query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
URL slug creation logic The steps are roughly as follows 1. If the record hasn't passed its validations, exit immediately 2. If the source_column is empty, exit immediately (no error is thrown this should be checked with your own validation) 3. If the slug is already set we have nothing to do, otherwise a. Strip out punctuation b. Replace unusable characters with dashes c. Clean up any doubled up dashes d. Check if the slug is unique and, if not, append a number until it is e. Save the URL slug
def create_slug return if self.errors.size > 0 return if self[source_column].blank? if self[slug_column].to_s.empty? proposed_slug = self[source_column].to_slug suffix = "" existing = true acts_as_slugable_class.transaction do while existing != nil # look for records with the same url slug and increment a counter until we find a unique slug existing = acts_as_slugable_class. where(slug_column => proposed_slug + suffix). where(slug_scope_condition).first if existing suffix = suffix.empty? ? "-0" : suffix.succ end end end # end of transaction self[slug_column] = proposed_slug + suffix end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_slug\n source = self[model.slug_options[:gen_from]] || \"\"\n slug = ActiveSupport::Inflector.transliterate(source) # remove accents\n .gsub(/&/,'and') # switch out &\n .gsub(/@/,'at') # switch out @\n .parameterize('-') # cleanup remaining odd characters and link with hyphens\n if slug.length > 0\n if s = unique_slug(slug)\n slug = s\n end\n else\n slug = random_slug\n end\n self.slug = slug\n end", "def before_save\n if !new? && (title = fields[title_field_name])\n set_slug_from_title(title)\n end\n fix_generated_slug_conflicts if changed_columns.include?(:slug)\n super\n end", "def build_slug\n if slug.blank? or title_changed?\n self.slug = self.title.blank? ? Time.now.strftime('%s') + id.to_s : ActiveSupport::Inflector.transliterate(title).downcase.gsub(/[^\\w]+/, '-')\n\n\n i = 0\n # Slug must be unique, so we try guess a good one\n loop do\n if Post.where(:slug => slug).count == 0\n break\n end\n i += 1\n if slug == 1\n slug = [slug, sprintf('%03d', i)].join('-')\n else\n orig_slug = slug.scan(/^(.+)-(\\d+)$/).flatten.first\n slug = [orig_slug, sprintf('%03d', i)].join('-')\n end\n end\n end\n end", "def create_slug\n return if self.title.blank?\n tail, int = \"\", 1\n initial = convert_to_slug(self.title)\n while Post.find_by_slug(initial + tail) do \n int += 1\n tail = \"-#{int}\"\n end\n self.slug = initial + tail\n end", "def slug_column; end", "def slug_column; end", "def generate_slug\n count = 0\n begin\n o = [('a'..'z'), ('A'..'Z'), ('0'..'9')].map { |i| i.to_a }.flatten\n string = (0...6).map { o[rand(o.length)] }.join\n self.slug = string\n self._slug = self.slug\n self._slug = self._slug.gsub('0', 'O')\n self._slug = self._slug.gsub('o', 'O')\n self._slug = self._slug.gsub('1', 'I')\n self._slug = self._slug.gsub('i', 'I')\n self._slug = self._slug.gsub('l', 'I')\n self._slug = self._slug.chars.sort.join\n self.save\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::StatementInvalid => err\n if (count += 1) < 50\n retry\n else\n raise\n end\n end\n end", "def make_slug\n self.permalink = (self.permalink.downcase.gsub(/[^a-zA-Z 0-9]/, \"\")).gsub(/\\s/,'-') if self.permalink\n end", "def fix_slug\n # If title is present and slug not set\n if title.present? && !slug.present?\n fixed_slug = Article.stripper(self.title)\n end\n if slug.present?\n # Make sure slug matches format\n fixed_slug = Article.stripper(self.slug)\n end\n self.slug = fixed_slug\n end", "def slug_column=(_arg0); end", "def slug_column=(_arg0); end", "def createSlug()\n # Strip leading and trailing spaces\n @slugString = @inputString.strip()\n\n # If custom mapping is given, first substitute these key, value pairs\n unless @customMap.nil?\n substituteCustom(@customMap)\n end\n\n # Substitute all the common characters present in the default map\n substituteChars($defaultMap)\n \n # Substitute all the characters present in the given language\n substituteChars($referenceTable[@language])\n \n # Process all non ASCII characters and convert them to nearest ASCII\n @slugString = Stringex::Unidecoder.decode(@slugString)\n\n # If required in lowercase, convert it. Always coverts to lowercase unless specified otherwise\n unless @toLower == false\n @slugString = @slugString.downcase\n end\n \n # Any character other than a-z A-Z 0-9 _ and - will be replaced with -\n @slugString = @slugString.gsub(/[^a-zA-Z0-9\\-\\_]/, '-')\n \n # Replace multiple '-'s with a single '-' and multiple '_'s with a single '_'\n @slugString = @slugString.gsub(/-+/, '-')\n @slugString = @slugString.gsub(/_+/, '_')\n\n # Remove any leading and trailing '-'s and '_'s\n @slugString = @slugString.delete_prefix('-')\n @slugString = @slugString.delete_prefix('_')\n @slugString = @slugString.delete_suffix('-')\n @slugString = @slugString.delete_suffix('_')\n \n # If the size of slug string is greater than the maxLength, trim it\n if @slugString.length > @maxLength\n @slugString = trimString(@slugString, @maxLength)\n end\n \n @slugString\n end", "def generate_slug\n if self.slug.blank? || self.slug.nil?\n unless self.name.blank?\n if Department.in_clinic(self).where(slug: name.parameterize).count != 0\n n = 1\n while Department.where(slug: \"#{name.parameterize}-#{n}\").count != 0\n n+= 1\n end\n self.slug = \"#{name.parameterize}-#{n}\"\n else\n self.slug = name.parameterize\n end\n else\n self.slug = 'no-name-entered'.parameterize\n end\n end\n end", "def slug\n @attributes[:slug] = @attributes[:name] && PublicEarth::Db::Collection.create_slug(@attributes[:name]) unless @attributes[:slug] \n @attributes[:slug]\n end", "def make_slugs_unique\n slugs.each do |column, (_, scope_column)|\n next unless changes.key?(column.to_s)\n\n current_slug = send(column)\n scope_value = scope_column ? send(scope_column) : nil\n while self.class.slug_taken?(column, current_slug, scope_column, scope_value)\n current_slug = Slug.increment(current_slug)\n send(\"#{column}=\", current_slug)\n end\n end\n end", "def build_slug\n return unless new_slug_needed?\n @slug = slugs.new(:name => slug_text, :scope => friendly_id_config.scope_for(self))\n raise FriendlyId::BlankError unless @slug.valid?\n @new_friendly_id = @slug.to_friendly_id\n @slug\n end", "def validate_slug_columns\n raise ArgumentError, \"Source column '#{self.slug_source}' does not exist!\" if !self.respond_to?(self.slug_source)\n raise ArgumentError, \"Slug column '#{self.slug_column}' does not exist!\" if !self.respond_to?(\"#{self.slug_column}=\")\n end", "def generate_slug\n self.slug=self.send(self.class.slug_column)\n self.slug=self.slug.tr(\" /=\",\"_\")\nend", "def generate_slug\n self.slug = self.title[0..47].parameterize\n end", "def generate_slug\n self.slug = self.title[0..47].parameterize\n end", "def generate_slug!\n\t\tself.slug = self.id.to_s(36)\n\t\tsave\n\tend", "def build_slug\n return unless new_slug_needed?\n self.slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self)\n end", "def generate_slug\n\t# Count the optimal slug length to start\n\tlinks_count = Link.count \n\tlength = 1\n\tcombinations = (1..49).inject(:*)/(1..49-length).inject(:*)\n\twhile combinations < links_count\n\t\tlength +=1\n\t\tcombinations = (1..49).inject(:*)/(1..49-length).inject(:*)\n\tend\n\n\t# Pick a random_id for slug \n\t# If slug is not unique: try 5 times to find another combination, after that - try a bigger length\n\tself.slug = random_id(length)\n\tuntil self.valid?\n\t\t5.times do \n\t\t\tself.slug = random_id(length)\n\t\t\tbreak if self.valid?\n\t\tend\n\t\tlength += 1 \n\tend\n\n\t#self.slug = \"D\"\n\tsave!\nend", "def generate_slug_from_title\n self.slug = self.title.downcase.gsub(' ','-')\n end", "def compute_slug\n \"#{normalize_slug_base_string}-#{self.id || sluggify}\"\n end", "def generate_slug\n self.slug = title.parameterize if title\n end", "def clean_slug!\n blank = \"\"\n separator = \"-\"\n self.slug = slug.downcase\n .gsub(/\\(|\\)|\\[|\\]\\./, blank)\n .gsub(/&amp;/, blank)\n .gsub(/\\W|_|\\s|-+/, separator)\n .gsub(/^-+/, blank)\n .gsub(/-+$/, blank)\n .gsub(/--*/, separator)\n end", "def get_unique_slug(field, val, crit = {})\n slug = val.to_slug.normalize.to_s.slice(0,200)\n !exists?(crit.merge!({field.to_s => slug})) ? slug :\n !exists?(crit.merge!({field.to_s => slug+\"-1\"})) ? slug+\"-1\" : \n !exists?(crit.merge!({field.to_s => slug+\"-2\"})) ? slug+\"-2\" : \n !exists?(crit.merge!({field.to_s => slug+\"-3\"})) ? slug+\"-3\" : \n !exists?(crit.merge!({field.to_s => slug+\"-4\"})) ? slug+\"-4\" : \n !exists?(crit.merge!({field.to_s => slug+\"-5\"})) ? slug+\"-5\" : \n !exists?(crit.merge!({field.to_s => slug+\"-6\"})) ? slug+\"-6\" : \n slug+\"-\"+rand(1000000).to_s\n end", "def slugando\n\t\tself.slug = summary.parameterize.to_s\n\tend", "def slug_text\n base = send friendly_id_options[:column]\n if self.friendly_id_options[:strip_diacritics]\n base = Slug::strip_diacritics(base)\n end\n if self.friendly_id_options[:strip_non_ascii]\n base = Slug::strip_non_ascii(base)\n end\n base = Slug::normalize(base)\n \n if base.length > friendly_id_options[:max_length]\n base = base[0...friendly_id_options[:max_length]]\n end\n if friendly_id_options[:reserved].include?(base)\n raise FriendlyId::SlugGenerationError.new(\"The slug text is a reserved value\")\n end\n return base\n end", "def set_slug\n self.slug = title.downcase.gsub(\" \", \"_\") if slug.blank?\n slug\n end", "def set_slug\n self.slug = title.downcase.tr(\" \", \"_\") if slug.blank?\n slug\n end", "def create_slug\n var_slug = [title.parameterize].join(\"-\")\n self.slug = BlogPost.generate_slug(var_slug)\n end", "def generate_slug\n self.slug = name.parameterize if name.present?\n end", "def set_slug\n self.slug = KeyGenerator.generate(8) if self.slug.blank?\n end", "def slug\n self.title.downcase.gsub(\" \", \"-\") unless self.title.nil?\n end", "def check_and_set_slug\n self.slug ||= self.host&.parameterize\n end", "def manage_slug\n \tself.slug = self.title.parameterize if self.slug.blank?\n end", "def set_slug\n \t \tself.slug = name.to_slug unless name.blank?\n\tend", "def make_slugged_title\n return true unless self.published?\n return true unless self.slug.to_s.blank?\n self.slug = self.title.to_slug\n end", "def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end", "def generate_slug\n self.slug = self.name.parameterize\n end", "def generate_and_add_slug\n if self.slug.nil? || self.slug.empty?\n self.slug = SecureRandom.hex 16\n end\n self\n end", "def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end", "def create_slug\n if new? \n \tlength = 16\n \t# Loop while slug is not unique\n \tbegin\n \t\tself.slug = (0..(length-1)).map{ rand(36).to_s(36) }.join \n \t\tobject = self.class.first(:slug => self.slug) \n \tend while(object != nil)\n end\nend", "def build_a_slug\n return unless new_slug_needed?\n @slug = slugs.build :name => slug_text.to_s, :scope => friendly_id_config.scope_for(self),\n :sluggable => self\n @new_friendly_id = @slug.to_friendly_id\n end", "def sanitize\n \tself.original_url.strip!\n \tself.sanitize_url = self.original_url.downcase.gsub(/(https?:\\/\\/)|(www\\.)/, \"\")\n \tself.sanitize_url = \"http://#{self.sanitize_url}\"\n\n \n start = 8\n final = self.sanitize_url.length\n\n while start <= final do\n sanitize_url[start] == ' ' ? sanitize_url[start] = '-' : sanitize_url[start] = sanitize_url[start] #change spaces for '-'\n break if sanitize_url[start] == '/' #break if '/' is found\n start +=1\n end\n\n self.sanitize_url = sanitize_url[0..start] #cut the string for creating the shortened_url\n self.short_url = sanitize_url + short_url #save the final shortened_url on the short_url's field\n end", "def generate_slug\n \tself.slug = title.parameterize\n end", "def slugify\n self.slug = self.name.downcase.strip.gsub(' ', '-').gsub(/[^\\w-]/, '')\n end", "def slug\n self.downcase.gsub(\" \", \"-\").gsub(/[^0-9a-z\\-]/, '')\nend", "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 set_slug\n if self.class.friendly_id_options[:use_slug] && new_slug_needed?\n @most_recent_slug = nil\n slug_attributes = {:name => slug_text}\n if friendly_id_options[:scope]\n scope = send(friendly_id_options[:scope])\n slug_attributes[:scope] = scope.respond_to?(:to_param) ? scope.to_param : scope.to_s\n end\n # If we're renaming back to a previously used friendly_id, delete the\n # slug so that we can recycle the name without having to use a sequence.\n slugs.find(:all, :conditions => {:name => slug_text, :scope => scope}).each { |s| s.destroy }\n slug = slugs.build slug_attributes\n slug\n end\n end", "def normalize_slug\n self.slug = normalize_friendly_id(slug)\n end", "def slugfy\n# self.slug = title.gsub(/\\W/, '-').downcase\n self.slug = title.parameterize.to_s\n end", "def slugify\n if !self.slug\n self.update(slug: \"#{self.business_name.gsub(/\\s+/, \"\").downcase}\")\n puts \"Slugified!\"\n end\n end", "def set_slug(normalized_slug = T.unsafe(nil)); end", "def slugify txt, max=2000\n # Perform transliteration to replace non-ascii characters with an ascii\n # character\n value = txt.gsub(/[^\\x00-\\x7F]/n, '').to_s\n # Remove single quotes from input\n value.gsub!(/[']+/, '')\n # Replace any non-word character (\\W) with a space\n value.gsub!(/\\W+/, ' ')\n # Remove any whitespace before and after the string\n value.strip!\n # All characters should be downcased\n value.downcase!\n # Replace spaces with dashes\n value.gsub!(' ', '-')\n # Return the resulting slug\n\n self.url_slug=value[0...max]\n if (self.slug_id == -1)\n self.slug_id = get_slug_id\n end\n end", "def set_slug\n if self.slug.blank?\n self.slug = self.name.parameterize.downcase unless self.name.nil?\n end\n end", "def slug=(s)\n if (new_slug = fit_slug_to_length(s, 64)) != slug\n super(new_slug)\n update_path\n end\n end", "def clean_url\n self.url = self.title.clone if self.url.blank?\n \n self.url.downcase!\n self.url = self.url.gsub(/[^[:alnum:]]/,'-').gsub(/-{2,}/,'-')\n self.url = self.url.gsub(/^[-]/,'').gsub(/[-]$/,'')\n self.url.strip!\n\n return true\n \tend", "def slug_builder\n _cur_slug = nil\n\n # if custom slug is defined use that\n if ! self._slug.empty?\n append_slug(self._slug)\n end\n\n # user defined slug\n if new_with_slugs? or persisted_with_slug_changes?\n _cur_slug = _slugs.last\n end\n\n # generate slug if the slug is no custom slug defined or does not exist\n _cur_slug || pre_slug_string\n end", "def add_slug\n loop do\n initials = user.first_name[0, 2].downcase <<\n user.last_name[0, 2].downcase\n year = Time.current.strftime(\"%y\")\n self.slug = \"#{initials}#{year}-#{rand(100..9999)}\"\n break unless self.class.exists?(slug: slug)\n end\n end", "def slug=(value)\n write_attribute(:slug, value) if value.present?\n end", "def slug=(value)\n write_attribute(:slug, value) if value.present?\n end", "def slug=(value)\n write_attribute(:slug, value) if value.present?\n end", "def generate_slug\n slug = name.to_s.gsub(/:id/, '').gsub(/[^a-zA-Z0-9]+/, '-').gsub(/^-|-$/, '')\n slug = 'home' if slug.blank?\n \n # If there is a duplicate slug then loop over existing slugs to \n # find the next highest numbered slug.\n if project.resources.where(:slug => slug).count > 0\n index = 0\n project.resources.where(\"slug LIKE ?\", \"#{slug}%\").each do |r|\n m, i = *r.slug.match(/#{Regexp.escape(slug)}-(\\d+)$/)\n index = [index, i.to_i].max if m\n end\n slug += \"-#{index+1}\"\n end\n\n self.slug = slug\n end", "def slug_unique_in_clinic\n errors.add(:slug, \"Slug: #{slug} already in use\") unless\n slug_unique_in_clinic?\n end", "def parameterize_slug\n self.slug = self.title if self.slug.empty?\n self.slug = self.slug.downcase.parameterize\n end", "def normalize_friendly_id(string)\n if slug.blank?\n super\n else\n super(slug)\n end\n end", "def make_slug(string)\n string.to_s.downcase.gsub(/[^a-z0-9]+/, '-').gsub(/-+$/, '').gsub(/^-+$/, '')\n end", "def set_slug\n self.slug = self.title.parameterize\n end", "def slug\n self.name.downcase.gsub(\" \", \"-\") unless self.name.nil?\n end", "def slug\n self.name.downcase.gsub(\" \", \"-\") unless self.name.nil?\n end", "def assign_slug_sequence\n return if self[self.slug_column].blank?\n assoc = self.class.base_class\n base_slug = self[self.slug_column]\n seq = 0\n\n while assoc.where(self.slug_column => self[self.slug_column]).exists? do\n seq += 1\n self[self.slug_column] = \"#{base_slug}-#{seq}\"\n end\n end", "def slug=(_arg0); end", "def generate_slug\n if self.id_changed? && !self.slug_changed?\n # this should not happen on regular DB setup, just a bit of insurance\n throw 'ID exceeded the storage limit' if self.id > TICKET_ID_LIMIT\n\n shifted_id = (Rails.application.secrets.ticket[:shift] + self.id) % TICKET_ID_LIMIT\n\n chunk1 = shifted_id / SLUG_FIRST_MULTIPLIER\n rest1 = shifted_id % SLUG_FIRST_MULTIPLIER\n\n chunk2 = rest1 / SLUG_SECOND_MULTIPLIER\n chunk3 = rest1 % SLUG_SECOND_MULTIPLIER\n\n slug = [\n rand(BASE62_LIMIT).b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n chunk1.to_s(16).upcase().rjust(2, '0'),\n chunk2.b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n chunk3.to_s(16).upcase().rjust(2, '0'),\n rand(BASE62_LIMIT).b(10).to_s(Radix::BASE::B62).rjust(3, '0'),\n ].join('-')\n\n self.update_attribute(:slug, slug)\n end\n end", "def set_slug\n self.slug = full_name.parameterize\n end", "def set_slug(normalized_slug = nil)\n if should_generate_new_friendly_id?\n candidates = FriendlyId::Candidates.new(self, normalized_slug || send(friendly_id_config.base))\n slug = slug_generator.generate(candidates) || resolve_friendly_id_conflict(candidates)\n send \"#{friendly_id_config.slug_column}=\", slug\n end\n end", "def generateSlug(text)\n text=text.to_s\n text=text.gsub(\"-\",\" \")\n text=text.split.join(\" \")\n return text.downcase.gsub(\" \", \"-\").to_s\nend", "def auto_generate_slug\n return true unless self.slug.nil?\n return true if self.respond_to?(:published?) && !self.published?\n self.slug = self.interpolate_slug\n end", "def transform_to_slug(title, extension)\r\n characters = /(\"|'|!|\\?|:|\\s\\z)/\r\n whitespace = /\\s/\r\n \"#{title.gsub(characters,\"\").gsub(whitespace,\"-\").downcase}.#{extension}\"\r\nend", "def slugify(item)\n slug = File.basename(item[:filename], File.extname(item[:filename]))\n slug.gsub(/\\s+/, '-')\n end", "def generate_custom_slug\n\t\t# \"#{convert_to_lowercase_to} #{convert_to_lowercase_from}\"\n\t\t\"#{self.id}\"\n\tend", "def set_slug\n self.slug = title.parameterize\n end", "def slug; end", "def slug; end", "def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end", "def slug\n self.title.downcase.gsub(/\\s+/, '-').gsub(/[^a-z0-9_-]/, '').squeeze('-')\n end", "def slug\n @input = self.username.gsub(/\\s|\\W/,'-').downcase\n end", "def slugify\n self.slug = name.parameterize \n end", "def before_save_field(field)\n set_slug_from_title(field) if (field.name == title_field_name)\n super\n end", "def slugify\n self.slug = name.parameterize\n end", "def save(target_url:, slug: nil)\n slug = slug.blank? ? next_slug : slug.parameterize\n\n unless save_target_url(slug, target_url)\n fail(Errors::SlugAlreadyTaken, slug)\n end\n\n to_url(slug, target_url)\n end", "def generate_slug(title)\n title = clean_title title\n # Strip the string\n ret = title.downcase.strip\n\n # Blow away apostrophes\n ret.gsub! /['`]/,\"\"\n\n # @ --> at, and & --> and\n ret.gsub! /\\s*@\\s*/, \" at \"\n ret.gsub! /\\s*&\\s*/, \" and \"\n\n # Replace all non alphanumeric, underscore or periods with underscore\n ret.gsub! /\\s*[^A-Za-z0-9\\.\\-]\\s*/, '_' \n\n # Convert double underscores to single\n ret.gsub! /_+/,\"_\"\n\n # Strip off leading/trailing underscore\n ret.gsub! /\\A[_\\.]+|[_\\.]+\\z/,\"\"\n\n ret\nend", "def slug\n title.downcase.gsub(\" \", \"_\")\n title.gsub(\".\",\"\")\n end", "def update_slug\n get_resource.slug = nil\n get_resource.save!\n end", "def skip_slug_validation?\n true\n end", "def create_shortened_url\n key = self.id - 1\n\n if key == 0\n shortened = ALPHABET[0]\n else\n shortened = ''\n baseLength = ALPHABET.length\n\n until key < 1\n place = key % baseLength\n shortened += ALPHABET[place]\n\n key /= baseLength\n end\n end\n self.shortened = shortened\n self.save\n end", "def set_slug\n write_attribute(:cached_slug, self.to_slug)\n end", "def slug\n\t\tunless name.nil?\n\t\t\tname.downcase.gsub(\" \", \"-\")\t\t\t\n\t\tend\n\tend" ]
[ "0.7065004", "0.6764861", "0.66352636", "0.65899235", "0.65244013", "0.65244013", "0.6512822", "0.6461349", "0.63912755", "0.6388084", "0.6388084", "0.6371469", "0.6365984", "0.6351019", "0.63445914", "0.6339431", "0.6322686", "0.63140494", "0.62559336", "0.62559336", "0.6248821", "0.6236675", "0.62093043", "0.61675316", "0.6135833", "0.61324084", "0.61132574", "0.6102853", "0.609344", "0.6091595", "0.6084802", "0.60820115", "0.6068687", "0.5995278", "0.5982967", "0.59788465", "0.5973485", "0.59645504", "0.59579855", "0.5947795", "0.59441006", "0.5939552", "0.59250855", "0.5912798", "0.58928394", "0.58850425", "0.5873582", "0.5871877", "0.5869964", "0.5855279", "0.5840933", "0.584024", "0.58323884", "0.5828159", "0.5813255", "0.58022434", "0.5802011", "0.57894397", "0.57886225", "0.57874405", "0.57874304", "0.578493", "0.5784401", "0.5784401", "0.5784401", "0.5773939", "0.5771068", "0.5765225", "0.5757444", "0.5757338", "0.57396996", "0.573031", "0.573031", "0.572999", "0.5729352", "0.5718759", "0.5713429", "0.5694177", "0.56890035", "0.5687745", "0.5686883", "0.5680582", "0.56786764", "0.5670047", "0.5666447", "0.5666447", "0.56532943", "0.56532943", "0.5648954", "0.56416637", "0.5616788", "0.56162775", "0.56002", "0.55948746", "0.55929667", "0.5591265", "0.55849606", "0.55824465", "0.558148", "0.5580343" ]
0.86341465
0
TODO Add account number validation.
def identifier num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_account_number\n @acct_num\n end", "def account_number\n return @account_number\n end", "def generate_account_number\n return if account_number.present?\n self.account_number = generate_account_number_token\n end", "def account_number\n @account_number ? @account_number.to_s.delete('-') : nil\n end", "def credit_card_number; end", "def account\n\n end", "def full_account_number\n if account_number_prefix && !account_number_prefix.empty? && account_number_prefix != '000000'\n \"#{account_number_prefix}-#{account_number}\"\n else\n \"#{account_number}\"\n end\n end", "def bank_account_number\n @account_number = 12345\n puts \"My bank account number is #{@account_number}.\"\n end", "def test_next_ax_account_number_begining\n assert_equal \"CU 0100001\", AxAccount.next_ax_account_number\n end", "def account_number\n return @account_number if @account_number\n\n begin\n my_arn = AWS::IAM.new(\n :access_key_id => @access_key_id,\n :secret_access_key => @secret_access_key).client.get_user()[:user][:arn]\n rescue AWS::IAM::Errors::AccessDenied => e\n my_arn = e.message.split[1]\n end\n\n @account_number = my_arn.split(':')[4]\n end", "def get_account_id\n num = rand(111111111..999999999)\n id = sprintf(\"%09d\", num)\n id.to_s\n end", "def acct_number\n hidden_length = @acct_number.length - 4\n @acct_number.sub(Regexp.new(\"^.{#{hidden_length}}\"), \"*\" * hidden_length)\n end", "def accounts\n end", "def new_account_number\n return rand(99999999)\n end", "def new_account_number\n return rand(99999999)\n end", "def random_account_number\r\n acct_num = rand(10**11).to_s.rjust(11, '1')\r\n return acct_num\r\n end", "def is_an_account_number?(string)\n /\\d{4}-\\d{3}-\\d{3}/ === string ? true :false\nend", "def account_from; Account.get(self.account_from_id); end", "def account_from; Account.get(self.account_from_id); end", "def accounts_with_usage; end", "def generate_account_number_token\n loop do\n token = SecureRandom.hex(3).upcase\n break token unless User.find_by(account_number: token)\n end\n end", "def generate_account\n toll_free = @client.available_phone_numbers('US').toll_free.list(limit: 1)\n\n toll_free.each do |record|\n \n incoming_phone_number = @client.incoming_phone_numbers.create(phone_number: record.phone_number)\n\n puts incoming_phone_number.sid\n end\n\n \n end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account_gid; account.gid end", "def random_account_number\n acct_num = rand(10**11).to_s.rjust(11, '1')\n return acct_num\n end", "def dyslexic_accounting(number)\n # code goes here\nend", "def get_AccountID()\n \t return @outputs[\"AccountID\"]\n \tend", "def initialize\n createAccountNumber\n @CheckingAccount = 500\n @SavingAccount = 50\n @interestRate = 0.05\n @@account_counter += 1\n end", "def my_account\n accounts.currency_code_is(\"flc\").first\n end", "def account_information\n puts \"Account Number: #%d\" % @account_number\n puts \"\\t- Checking Amount: $%d\" % @checking_amount \n puts \"\\t- Saving Amount: $%d\" % @saving_amount\n puts \"\\t- Total Amouunt: $%d\" % (@checking_amount + @saving_amount)\n puts \"\\t- interest Rate: %f%\" % @interest\n end", "def account_information\n puts \"Account Number: #%d\" % @account_number\n puts \"\\t- Checking Amount: $%d\" % @checking_amount \n puts \"\\t- Saving Amount: $%d\" % @saving_amount\n puts \"\\t- Total Amouunt: $%d\" % (@checking_amount + @saving_amount)\n puts \"\\t- interest Rate: %f%\" % @interest\n end", "def create_account_for_user\n # # if age.exists?\n # balance = age >= 18 ? 350 : 250\n # create_account(balance: balance)\n # # end\n create_account(balance: 250)\n end", "def to_s\n account_number.gsub(/(\\d{2})(\\d{2})(\\d{2})(\\d{3})/, '\\1.\\2.\\3.\\4')\n end", "def credit_account\n subclass_must_define\n end", "def account_src\n account_src_id\n end", "def display_number\n # \n ('X' * (account_number.to_s.length - last_digits.size)) + last_digits\n # account_number.to_s[0..last_digits.size].to_s.size + \n # last_digits.to_s\n end", "def create_account\n\n end", "def is_bank_account_number_valid?\n # check a regex to see if its a 11 digit number\n errors.add(:bank_account_number, \"Ugyldig kontonummer. Kan kun ha 11 siffer.\") if self.bank_account_number !~ /\\A[0-9]{11}\\z/\n # remove check_digit, calculate Mod11, and see if it still matches:\n errors.add(:bank_account_number, \"Ugyldig kontonummer.\") if ( Mod11.new( self.bank_account_number[0..-2] ).full_value != self.bank_account_number )\n end", "def validate\n super\n validates_presence :account\n validates_unique :account\n end", "def validate_account(order_detail)\n account = order_detail.account\n begin\n AccountValidator::ValidatorFactory.instance(account.account_number, order_detail.product.account).account_is_open!(order_detail.fulfilled_at)\n rescue AccountValidator::ValidatorError => e\n @errors << I18n.t(\n \"activerecord.errors.models.journal.invalid_account\",\n account_number: account.account_number_to_s,\n validation_error: e.message,\n )\n end\n end", "def valid?(account)\n\tdigits = account.to_s.reverse.chars.map(&:to_i)\n\t# digits = account.to_s.reverse.chars.map { |c| c.to_i }\n \tcheck_sum = 0\n\n\tdoubled_digits = digits.with_index { |num, index| index.odd? ? num * 2 : num }\n\n\tdigits.each_slice(2) do |odd, even|\n \tcheck_sum += odd\n \tnext unless even\n \teven *= 2\n \teven = even.divmod(10).inject(:+) if even > 9\n \tcheck_sum += even\n end\n\n # look to refactor\n check_sum % 10 == 0\n check_sum.modulo(10) == 0\n\nend", "def south_african_listed_company_registration_number; end", "def account=(value)\n @account = value\n end", "def account_authorized(account)\n session[:account_id] = account.public_send(BookingSyncEngine.bookingsync_id_key).to_s\n end", "def initialize\n # Call function to generate the account number\n account_number_gen\n # Initialize instance variables\n @checking_account_balance = 0\n @saving_account_balance = 0\n @@total_accounts += 1\n @interest_rate = 0.01\n end", "def set_account\n\n\taccount = Account.find_by_account_code(self.account_code)\n\t if account != nil \n\t\t self.account = account\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'account_code' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def check_account(account)\n return true if @accounting_plan.accounts.find_by_number(account)\n return false\n end", "def account\n @details ||= fetch_details\n @details[:account]\n end", "def account_return\n direct_login = []\n users = []\n ulist = Main.active.account_text.tr(\"\\n \",\",\").split(\",\")\n ulist.each do |n| \n n.strip!\n case n\n when /^.*@[0-9]{2,3}$/ \n direct_login << n.split(\"@\")\n when /^.{1,8}$/\n users << n\n end\n end\n #p Account.find_accounts(users).private.other_accounts.flatten\n accounts = users.empty? ? [] : Account.find_accounts_or_initialize(users)\n accounts.collect! { |account| account.all_accounts } if accounts\n accounts.flatten! if accounts\n if !accounts.empty?\n fill_accounts(accounts)\n else\n Main.active.status = [\"#{users}\", \"existiert nicht\", \"important\", -1]\n end\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 account_name\n return @account_name\n end", "def account_name\n return @account_name\n end", "def bank_account\n @bank_account\n end", "def listed_company_registration_number; end", "def account_number=(account_number)\n\n if !account_number.nil? && account_number.to_s.length > 100\n fail ArgumentError, \"invalid value for 'account_number', the character length must be smaller than or equal to 100.\"\n end\n\n @account_number = account_number\n end", "def valid_id_number; end", "def credit_card_number\n Faker::Business.credit_card_number\n end", "def create_account(account_number)\n begin\n #if account does not exist, a NotFound Error will be thrown\n accountNumber = account_number\n\n puts \"Creating new account with account number: #{accountNumber}\"\n\n account = Recurly::Account.create(\n :account_code => accountNumber,\n :email => 'verena@example.com',\n :first_name => 'Verena',\n :last_name => 'Example',\n :shipping_addresses => [\n {\n :nickname => 'Work',\n :first_name => 'Verena',\n :last_name => 'Example',\n :company => 'Recurly Inc',\n :phone => '555-222-1212',\n :email => 'verena@example.com',\n :address1 => '123 Main St.',\n :address2 => 'Suite 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n },\n {\n :nickname => 'Home',\n :first_name => 'Verena',\n :last_name => 'Example',\n :phone => '555-867-5309',\n :email => 'verena@example.com',\n :address1 => '123 Fourth St.',\n :address2 => 'Apt. 101',\n :city => 'San Francisco',\n :state => 'CA',\n :zip => '94105',\n :country => 'US'\n }\n ]\n )\n\n account = Recurly::Account.find(accountNumber)\n account.billing_info = {\n :first_name => 'Verena',\n :last_name => 'Example',\n :number => '4111-1111-1111-1111',\n :verification_value => '123',\n :month => 11,\n :year => 2019,\n :address1 => '1234 fake st',\n :city => 'Omaha',\n :state => 'NE',\n :zip => '68135',\n :country => 'US'\n\n }\n account.billing_info.save!\n\n #output account to make sure it saved with billing_info\n #account = Recurly::Account.find accountNumber\n #puts \"Account: #{account.inspect}\"\n\n rescue Recurly::Resource::NotFound => e\n puts e.message\n rescue Recurly::API::UnprocessableEntity => e\n puts e.message\n end\n\n end", "def create\n @bank_account = BankAccount.new(bank_account_params)\n if is_number?(params[:bank_account][:account_number]) && @bank_account.save \n render :json => @bank_account \n else\n render :json => @bank_account.errors, status: :unprocessable_entity \n end\n end", "def account_select\n Dialog::space\n @acct_list = bank.account_list(@man_name, @man_pin)\n @account_id_array = Display::account_info(@acct_list)\n account_num = Dialog::which_account\n if bank.account_exists?(account_num)\n @account = bank.load_account(account_num.to_i)\n else\n Dialog::wrong_entry\n account_select\n end\n end", "def find_account(string)\n true if string.match /\\d{4}-\\d{3}-\\d{3}/\nend", "def initialize\n @account_number = account_number # private method\n @checking_balance = 100\n @savings_balance = 100\n @rate = interest_rate # private method\n @@account_count += 1\n end", "def validate_patient_account_number\n error_message = \"\"\n error_message += \" Account# - Required Alphanumeric, hyphen and period only!!\" if $IS_PARTNER_BAC &&\n !account_number.blank? &&\n (account_number.match(/\\.{2}|\\-{2}|^[\\-\\.]+$/) ||\n !account_number.match(/^[A-Za-z0-9\\-\\.]*$/)) \n error_message += \" Account# - Required Alphanumeric, hyphen, period and forward slash only!!\" if !$IS_PARTNER_BAC &&\n !account_number.blank? &&\n (account_number.match(/\\.{2}|\\-{2}|\\/{2}|^[\\-\\.\\/]+$/) ||\n !account_number.match(/^[A-Za-z0-9\\-\\.\\/]*$/) ||\n account_number.gsub(/[a-zA-Z0-9\\.\\-]/, '').match(/\\/{4,}/))\n errors.add(:base, error_message) unless error_message == \"\"\n end", "def account_number=(account_number)\n if !account_number.nil? && account_number.to_s.length > 50\n fail ArgumentError, 'invalid value for \"account_number\", the character length must be smaller than or equal to 50.'\n end\n\n @account_number = account_number\n end", "def account\n AccountInfoParser.parse(post(\"balance\"))\n end", "def account=(str)\n @account = str.strip.gsub('acct:','').to_s.downcase\n end", "def getaccount(coinaddress)\n coind.getaccount coinaddress\n end", "def account_params_for_build\n super + [{ account_number_parts: NufsAccount.account_number_field_names }]\n end", "def find_account\n @account = Account.find(params[:account_id])\n end", "def find_account\n @account = Account.find(params[:account_id])\n end", "def account_name\n self.current_account.try :name\n end", "def print_account(account)\n puts \"Email: #{account.email}\"\n puts \"Username: #{account.username}\"\n puts \"First name: #{account.given_name}\"\n puts \"Last name: #{account.surname}\"\n puts \"Status: #{account.status}\"\nend", "def getaccountaddress(account)\n coind.getaccountaddress account\n end", "def initialize_account\n self.credits = 0\n end", "def account_information\n puts \"====================\"\n puts \"Account information:\"\n puts \"====================\"\n puts \"\\nAccount number: %d\" % [@account_number]\n puts \"\\nTotal money: %d\" % [total_balance]\n puts \"\\nChecking account balance: %d\" % [@checking_account_balance]\n puts \"\\nSaving account balance: %d\" % [@saving_account_balance]\n puts \"\\nInterest rate: %.2f\" % [@interest_rate]\n puts\n end", "def initialize\n @account_number = new_account_number\n @balance_total = 0\n @interest_rate = 0.0025 #per month or 3% per year.\n @balance_savings = 0\n @balance_checking = 0\n @@total_accounts += 1\n puts \"Your account has been created.\"\n end", "def generate_account\n self.account = Account.create(:name => self.email) unless account\n end", "def fetchAccountDetails(primaryMember)\n #,Unomy_Location_Country__c,Unomy_Location_State__c,Unomy_Location_City__c,Primary_Member__c,Interested_in_Number_of_Desks__c,BillingCountry,BillingState,BillingCity\n return checkRecordCreated(\"Account\", \"SELECT id,Allow_Merge__c,Name,Owner.Id,Owner.Name,RecordType.Name,Number_of_Full_Time_Employees__c,Interested_in_Number_of_Desks__c,Unomy_Location_Country__c,Unomy_Location_State__c,Unomy_Location_City__c,BillingCountry,BillingState,BillingCity FROM Account WHERE Primary_Member__c = '#{primaryMember}'\")\n end", "def initialize(account, api_key, domain: 'wufoo.com', account_prefix: nil)\n @account = account\n @api_key = api_key\n @domain = domain\n @account_prefix = account_prefix || @account\n @field_numbers = {}\n end", "def get_account_id\n if user\n return user.get_account_id\n end\n end", "def account_type_code\n self.class.account_types[account_type]\n end", "def get_account(account_id)\n @accounts[account_id]\n end", "def get_account(account_id)\n @accounts[account_id]\n end", "def account\n get('account')\n end", "def account_name\n last_four.present? ? name + ' ( ... ' + last_four.to_s + ')' : name\n end", "def polish_taxpayer_identification_number; end", "def account_to; Account.get(self.account_to_id); end", "def find_account\n @account = current_user.accounts.find(params[:account_id])\n end", "def card_number_secure\n @card.display_number\n end", "def id\n @account\n end", "def get_account(acct)\n\t\t$DB.where(account_name: acct).each do |t|\n\t\t\tputs \"#{t[:account_name]}: #{t[:balance]}\"\n\t\tend\n\tend", "def account\n AccountInfoParser.parse(post(\"money/info\"))\n end" ]
[ "0.73531663", "0.73414975", "0.7076806", "0.7033394", "0.67323345", "0.6714883", "0.6531907", "0.6504244", "0.64889216", "0.64050996", "0.6332469", "0.6317587", "0.6310256", "0.62917554", "0.62917554", "0.6289948", "0.6265814", "0.6264364", "0.6264364", "0.6264338", "0.6244607", "0.621971", "0.61966205", "0.61966205", "0.61966205", "0.61966205", "0.61966205", "0.61966205", "0.61966205", "0.61966205", "0.61966205", "0.61966205", "0.6153034", "0.61215407", "0.6068613", "0.6054958", "0.6018554", "0.599217", "0.59880286", "0.59880286", "0.5958439", "0.5953203", "0.593719", "0.59129846", "0.5906315", "0.5901992", "0.58867013", "0.5873189", "0.58511454", "0.584723", "0.58314574", "0.5830835", "0.58217984", "0.5821192", "0.581222", "0.58106", "0.5809794", "0.5809722", "0.58094496", "0.5800572", "0.5800572", "0.57898945", "0.5788739", "0.5783977", "0.57839", "0.5781479", "0.5776321", "0.5770352", "0.5764008", "0.57628113", "0.57586175", "0.5753925", "0.57533115", "0.5753125", "0.5748036", "0.57467276", "0.57441556", "0.57422364", "0.57422364", "0.57315063", "0.57289416", "0.5727371", "0.57242686", "0.57188255", "0.571814", "0.5712427", "0.5708482", "0.5703063", "0.57025063", "0.57012177", "0.5698323", "0.5698323", "0.5685604", "0.5684072", "0.56785446", "0.5676332", "0.56753033", "0.56734884", "0.56692594", "0.5664664", "0.56625396" ]
0.0
-1
This is the constructor for the Paper class. All dimension parameters to this method are in twips. ==== Parameters name:: The name for the paper object. width:: The width of the paper in portrait mode. height:: The height of the paper in portrait mode.
def initialize(name, width, height) @name = name @width = width @height = height end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n @paper = Paper::A4\n @left_margin = DEFAULT_LEFT_MARGIN\n @right_margin = DEFAULT_RIGHT_MARGIN\n @top_margin = DEFAULT_TOP_MARGIN\n @bottom_margin = DEFAULT_BOTTOM_MARGIN\n @gutter = nil\n @orientation = PORTRAIT\n end", "def initialize(width:, height:)\n @width = width\n @height = height\n end", "def initialize(n,h,w)\n\t\t@name=n\n\t\t@height=h\n\t\t@weight=w\n\tend", "def initialize(width, height)\r\n \t#variables de instancia\r\n @width = width\r\n @height = height\r\n end", "def initialize p_name, p_width, p_height\n\n # So at least we've got our dimensions and a name\n @path = p_name\n @source_x = 0\n @source_y = 0\n @source_w = p_width\n @source_h = p_height\n\n # Fill in some defaults for the rest\n @x = 0\n @y = 0\n @z = 0\n @w = @source_w\n @h = @source_h\n\n end", "def initialize(n, h, w)\n @name = n\n @height = h\n @weight = w\n end", "def initialize(n, h, w)\n @name = n\n @height = h\n @weight = w\n end", "def initialize(n, h, w)\n @name = n # The @ symbol beforehand defines an instance variable\n @height = h\n @weight = w\n end", "def initialize(n, h, w) #changed name to n; added h & w\n @name = n\n @height = h\n @weight = w\n end", "def initialize(n, h, w)\r\n @name = n #@ symbol is called an instance variable\r\n @height = h\r\n @weight = w\r\n end", "def initialize(width, height)\n @width = width\n @height = height\n @x = 0\n @y = 0\n end", "def initialize(n,h,w)\n @name = n #@name -- > Instance variable - scoped at the object level.\n #It is a variable that exists as long as the object instance exists\n @height = h\n @weight = w\n end", "def initialize(width, height)\n @width = width.to_i\n @height = height.to_i\n\n # use default value if not set properly or TOO small\n @width = DEFAULT_WIDTH if @width < DEFAULT_WIDTH\n @height = DEFAULT_WIDTH if @height < DEFAULT_HEIGHT\n end", "def initialize(n, h, w)\n @name = n\n @height = h\n @weight = w\n puts \"This object was initialized with the name #{@name}\"\n end", "def size(width, height)\n self.width = width\n self.height = height\n end", "def initialize(name, height, weight)\n self.name = name # here, self references the instance\n self.height = height\n self.weight = weight\n end", "def initialize(name)\n @points = 3\n @name = name\n end", "def initialize(name, size)\n @name = name\n @size = size\n end", "def initialize(picture_name, width_slide, width_plain)\n super('')\n @picture_name = picture_name\n @width_slide = width_slide\n @width_plain = width_plain\n end", "def initialize(paper=:A4, options={})\n \n @options=DEFAULT_OPTIONS.merge(options)\n @paper=paper \n end", "def initialize(width, height)\n\n\t\t# ensure heights and widths are odd\n\t\twidth += 1 if width.odd?\n\t\theight += 1 if height.odd?\n\t\t@width = width\n\t\t@height = height\n\n\t\t# Initilize cell array\n\t\tinitialise_cell_array()\n\n\t\t# Block the perimeter\n\t\tblock_perimeter()\n\n\t\t# Generate rooms\n generate_rooms()\n\n\t\t# Generate corridors\n\t\tgenerate_corridors()\n\n\t\t# Trim tree\n\t\ttrim_tree()\n\tend", "def initialize(height: nil, width: nil, figsize_unit: :cm)\n super(0, 0)\n @title = ''\n @nrows = 1\n @ncols = 1\n @width = (width || DEFAULT_CANVAS_DIM).to_f\n @height = (height || DEFAULT_CANVAS_DIM).to_f\n @top_spacing = 5\n @bottom_spacing = 5\n @left_spacing = 5\n @right_spacing = 5\n @subplots = nil\n @figsize_unit = figsize_unit\n set_rubyplot_artist_coords!\n setup_default_theme\n add_subplots! @nrows, @ncols\n end", "def initialize(this_name =\"default name\", height, )\n @name = this_name OR self.name = this name\n #can do this for all other attibutes\n self.height = new_height\n self.hair_color = hair_color\n\n end", "def initialize x, y, width, height\n @x = x\n @y = y\n @width = width\n @height = height\n end", "def initialize(width, height, output = $stdout)\n @board_width = width\n @board_height = height\n @output = output\n super()\n end", "def initialize(w,h)\n\t\t@width, @height = w, h #@ -> instance variables\n\t\t@@count += 1\n\tend", "def initialize(width, height)\n\n # ensure heights and widths are odd\n width += 1 if width.odd?\n height += 1 if height.odd?\n @width = width\n @height = height\n\n # Initilize cell array\n initialise_cell_array()\n\n # Block the perimeter\n block_perimeter()\n\n # Generate rooms\n generate_rooms()\n\n # Generate corridors\n generate_corridors()\n\n # Trim tree\n trim_tree()\n end", "def initialize(width, height)\n @width = width\n @height = height\n @impassable_cells = Set.new\n end", "def size(width, height)\n if !width.nil? && (width.to_i > 0) && !height.nil? && (height.to_i > 0)\n @width = width\n @height = height\n @chart_size = nil\n end\n self\n end", "def set_paper(paper_size = 0)\n @paper_size = paper_size\n end", "def initialize(width, height)\n @width, @height = width, height\n @chars = Array.new(height) { Array.new(width, \" \") }\n end", "def initialize(options = {})\n super()\n $app = App.current = self\n set_sketch_path unless online?\n make_accessible_to_the_browser\n options = {\n :width => 400, \n :height => 400, \n :title => \"\",\n :full_screen => false\n }.merge(options)\n @width, @height, @title = options[:width], options[:height], options[:title]\n @render_mode = P2D\n determine_how_to_display options\n end", "def initialize name, sex, height, weight, age\n\n\t\tself.name = name\n\t\tself.sex = sex\n\t\tself.height = height\n\t\tself.weight = weight\n\t\tself.age = age\n\tend", "def make_painting(title, width, height)\n # **QUIZ** What is self in this line?\n Painting.new(title, width, height, self)\n end", "def initialize(name)\n self.name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize\n @font = '10pt'\n @paper = 'letterpaper'\n @fleqn = false\n @leqno = false\n @titlepage = false\n @twocolunm = false\n @sided = 1\n @layout = 'portrait'\n @draft = false\n\n @packages = []\n @preamble = ''\n @document = []\n end", "def setSize(width, height)\n setWidth(width)\n setHeight(height)\n end", "def initialize(name)\n name(name)\n end", "def initialize(height, width)\n @visible = true\n # do we set height and width ?? XXX\n @window = Ncurses.newpad(height, width)\n @padheight = height\n @padwidth = width\n @height = height\n @width = width\n @sheight = height\n @swidth = width\n init_vars\n end", "def size=(width, height)\n end", "def initialize(name)\n @name = name\n end", "def initialize(width, height)\n @width = width\n @height = height\n @rows = [0] * height\n end", "def initialize(name)\n\t\t@name = name\n\t\t@life_points = 10\n\tend", "def initialize(name)\n self.name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n @name = name\n end", "def initialize(name)\n \n @name = name\n end", "def initialize name\n\t\t\t@name = name\n\t\tend", "def initialize(name)\n @name = name\n end", "def initialize(name)\n \t\t@name = name\n \tend", "def initialize(name)\n fail(ArgumentError, 'Outputter expects a name') if name.nil?\n @name = name\n end", "def initialize name\n @name = name\n end", "def initialize(x, y, w, h)\r\n @x = x\r\n @y = y\r\n @w = w\r\n @h = h\r\n end", "def new\n @paper = Paper.new\n end", "def initialize(name)\n super()\n\n @name = name\n build_document\n build_root\n end", "def initialize(name, age = 0, weight = rand(60..100), height = rand(150..200), eye_color = nil, hair_color = nil)\n\t\t@name = name\n\t\t@age = age\n\t\t@weight = weight\n\t\t@height = height\n\tend", "def initialize name\n @name = name\n end", "def initialize\n\t\t@height = 5\n\tend", "def initialize(name=nil, size=nil)\n @name = name || Font.default_name\n @size = size || Font.default_size\n @bold = Font.default_bold\n @italic = Font.default_italic\n @color = Font.default_color\n end", "def initialize(width, height)\n # default width and height are set to max to use the validations functions\n @width = MAX_WIDTH\n @height = MAX_HEIGHT\n validate_x_y_coords(width, height)\n @width = width\n @height = height\n clear\n end", "def initialize(name)\n @name = name\n end", "def initialize(x, y, w, h)\n @x = x; @y = y; @w = w; @h = h\n end", "def initialize(name = nil)\n\t\t@name = name\n\tend", "def initialize(name = nil)\n\t\t@name = name\n\tend", "def initialize(name, options = {})\n\t\t@name = name\n\t\t@age = options[:age] || 0\n\t\t@weight = options[:weight] || 60 + rand(41)\n\t\t@height = options[:height] || 150 + rand(50)\n\t\t@eye_color = options[:eye_color]\n\t\t@hair_color = options[:hair_color]\n\t\t@pets = options[:pets]\n\tend", "def initialize(name, attributes)\n @name = name\n @attributes = attributes\n end", "def initialize(name)\n @name = name\n \n end", "def initialize(name)\r\n\t\t@name = name\r\n\t\t@life_points = 100 #augmentation du nombre de PV\r\n\t\t@weapon_level = 1 #initialisation de la nouvelle variable\r\n\tend", "def setPageDimensions(width, height)\n setPageWidth(width)\n setPageHeight(height)\n self\n end", "def setPageDimensions(width, height)\n setPageWidth(width)\n setPageHeight(height)\n self\n end", "def paper_size=(size)\n RestrictionValidator.validate 'paper_size', (1..118), size\n @paper_size = size\n end", "def initialize(width, height)\n @width, @height = width, height\n\n @pixels = Array.new(@height) { Array.new(@width) { \"00\" } }\n end", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name)\n\t\t@name = name\n\tend", "def initialize(name = '')\n self.name = name\n end", "def initialize(title, options = {})\n @title = title\n @width = options[:width] || 250 # defaults to the small graphs\n @height = options[:height] || 200\n @data = GraphData.new\n end", "def initialize(name = nil)\n\t\t@name = name;\n \tend", "def initialize(width, height)\n @table = Table.new(width, height)\n @view = RobotView.new\n @robot = Robot.new(@table)\n end", "def initialize(name, arm_length)\n @name = name\n @arm_length = arm_length\n @color = 'red'\n @predator = true\n @timePeriod = 'jurassic'\n @favoriteFood = 'Teradactyl'\n end", "def initialize(target_width=800)\n if not Numeric === target_width\n geometric_width, geometric_height = target_width.split('x')\n @columns = geometric_width.to_f\n @rows = geometric_height.to_f\n else\n @columns = target_width.to_f\n @rows = target_width.to_f * 9/16\n end\n\n initialize_ivars\n\n reset_themes()\n theme_keynote()\n end", "def initialize(name)\r\n \t\t@name = name\r\n \tend", "def set_size(w,h)\n @width = w\n @height = h\n end", "def initialize(name='Toy Robot Simulator', size=5)\n @name = name\n @playground = ToyRobot::Playground.new(size)\n @robot = ToyRobot::Robot.new\n end" ]
[ "0.6314327", "0.6223362", "0.61128145", "0.6091368", "0.6081066", "0.600612", "0.600612", "0.5984649", "0.5946034", "0.5912513", "0.5911243", "0.59032494", "0.5886491", "0.58456147", "0.58222026", "0.57983303", "0.56411725", "0.5640577", "0.56243366", "0.562127", "0.560729", "0.5526994", "0.5510788", "0.54757756", "0.5474412", "0.54601985", "0.5455775", "0.5435696", "0.54339504", "0.54231304", "0.54087585", "0.5395027", "0.53769445", "0.5320934", "0.53164786", "0.5315115", "0.5315115", "0.5315115", "0.5315115", "0.5315115", "0.5315115", "0.5315115", "0.5315115", "0.5315115", "0.5315115", "0.53063804", "0.5305789", "0.5290613", "0.52862245", "0.5286045", "0.527295", "0.52720135", "0.5265383", "0.5251615", "0.5246573", "0.5246573", "0.5246573", "0.5246573", "0.5246573", "0.5241237", "0.5221841", "0.52204275", "0.52120876", "0.52043366", "0.52027833", "0.519837", "0.51947314", "0.5194192", "0.519034", "0.518745", "0.51827973", "0.5179714", "0.5176141", "0.5174602", "0.51726305", "0.5172212", "0.5172212", "0.51657915", "0.51634854", "0.5159411", "0.51592386", "0.51550883", "0.51544", "0.5153146", "0.5151332", "0.5150551", "0.5150551", "0.5150551", "0.5150551", "0.5150551", "0.5150551", "0.5150509", "0.5148867", "0.51472765", "0.5146228", "0.5145517", "0.51328003", "0.51153237", "0.5110829", "0.5108301" ]
0.7407958
0
Convenience method for zooming the screen. Places two fingers at the edges of the screen and brings them together.
def zoom(percentage = 200, auto_perform = true, driver = $driver) ::Appium::Core::MultiTouch.zoom percentage: percentage, auto_perform: auto_perform, driver: driver end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def zoom(percentage = 200, auto_perform = true)\n fail ArgumentError(\"Can't zoom to smaller then screen size.\") if percentage < 100\n\n p = 100 / Float(percentage)\n i = 1 - p\n\n top = TouchAction.new\n top.swipe start_x: i, start_y: i, end_x: 1, end_y: 1, duration: 1\n\n bottom = TouchAction.new\n bottom.swipe start_x: p, start_y: p, end_x: 1, end_y: 1, duration: 1\n\n zoom = MultiTouch.new\n zoom.add top\n zoom.add bottom\n return zoom unless auto_perform\n zoom.perform\n end", "def update_zoom\n @effectus_old_zoom_x = @picture.zoom_x\n @effectus_old_zoom_y = @picture.zoom_y\n self.zoom_x = @effectus_old_zoom_x / 100.0\n self.zoom_y = @effectus_old_zoom_y / 100.0\n end", "def zoom\n end", "def zoom_2\n return 1.0\n end", "def update_capture_rect\n @zoom = [100, @zoom].max\n tx, ty = @zoom_target_x, @zoom_target_y\n f = @zoom / 100.0\n w = (Graphics.width / f).to_i\n h = (Graphics.height / f).to_i\n x = (tx - w / 2.0).to_i.bound(0, Graphics.width - w)\n y = (ty - h / 2.0).to_i.bound(0, Graphics.height - h)\n @capture_rect.set(x, y, w, h)\n end", "def zoom=(val)\n self.zoom_x = val\n self.zoom_y = val\n end", "def zoom=(val)\n self.zoom_x = val\n self.zoom_y = val\n end", "def setScaleShiftByBoundaryBox(x0,y0,x1,y1)\n @device.setScaleShiftByBoundaryBox(x0,y0,x1,y1) ;\n end", "def zoom(x_factor, y_factor = x_factor)\n unary_transform(\"zoom\", x_factor.to_i, y_factor.to_i)\n end", "def zoom_1\n return 1.0\n end", "def snap_screen\n bmp = Graphics.snap_to_bitmap\n width = self.viewport ? viewport.rect.width : Graphics.width\n height = self.viewport ? viewport.rect.height : Graphics.height\n x = self.viewport ? viewport.rect.x : 0\n y = self.viewport ? viewport.rect.y : 0\n self.bitmap = Bitmap.new(width,height)\n self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height)); bmp.dispose\n end", "def zoom(factor = 5)\n upstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp < @start_cumulative_bp}.sort_by{|s| s.start_cumulative_bp}[-1]\n downstream_slice = self.class.sketch.slices.select{|s| s.start_cumulative_bp > @start_cumulative_bp}.sort_by{|s| s.start_cumulative_bp}[0]\n\n center_bp = (@start_cumulative_bp + @length_bp.to_f/2).round\n\n @length_bp = (@length_bp.to_f/factor).round\n @start_cumulative_bp = (center_bp - @length_bp.to_f/2).round\n @stop_cumulative_bp = (center_bp + @length_bp.to_f/2 - 1).round\n @resolution = @length_pixel.to_f/@length_bp\n self.fetch_sequence\n\n upstream_slice.stop_cumulative_bp = @start_cumulative_bp - 1\n downstream_slice.start_cumulative_bp = @stop_cumulative_bp + 1\n [upstream_slice, downstream_slice].each do |s|\n s.length_bp = s.stop_cumulative_bp - s.start_cumulative_bp + 1\n s.resolution = s.length_pixel.to_f/s.length_bp\n s.range_cumulative_bp = Range.new(s.start_cumulative_bp, s.stop_cumulative_bp)\n s.fetch_sequence\n end\n self.class.sketch.slices.each{|s| s.format_resolution}\n\n self.class.sketch.buffer_images[:zoomed] = self.class.sketch.draw_zoomed_buffer\n self.class.sketch.buffer_images[:information_panel] = self.class.sketch.draw_information_panel\n end", "def zoom(scale)\n execute_script(%(document.body.style.zoom = arguments[0];), scale)\n end", "def snapScreen\n bmp = Graphics.snap_to_bitmap\n width = self.viewport ? viewport.rect.width : Graphics.width\n height = self.viewport ? viewport.rect.height : Graphics.height\n x = self.viewport ? viewport.rect.x : 0\n y = self.viewport ? viewport.rect.y : 0\n self.bitmap = Bitmap.new(width,height)\n self.bitmap.blt(0,0,bmp,Rect.new(x,y,width,height)); bmp.dispose\n end", "def update_classic\n @equip_icon.zoom_x += 0.2 if @equip_icon.zoom_x < 2.0\n @equip_icon.zoom_y += 0.2 if @equip_icon.zoom_y < 2.0\n @scroll_icon.zoom_x += 0.2 if @scroll_icon.zoom_x < 2.0\n @scroll_icon.zoom_y += 0.2 if @scroll_icon.zoom_y < 2.0\n end", "def zoom(delay)\n self.scale += delay * ZOOM_SPEED\n end", "def change_zoom_on(toy, to: zoom)\n old_zoom = toy.old_zoom\n return if zoom == old_zoom\n undoManager.prepareWithInvocationTarget(self).change_zoom_on(toy, to: old_zoom)\n toy.change_zoom(zoom)\n unredo\n setNeedsDisplay\n end", "def zoom(percent)\n set RGhost::Scale.zoom(percent)\n end", "def set_zoom(scale = 100)\n # Confine the scale to Excel's range\n if scale < 10 or scale > 400\n # carp \"Zoom factor $scale outside range: 10 <= zoom <= 400\";\n scale = 100\n end\n\n @zoom = scale.to_i\n end", "def zoom(duration, value, force = false)\n return if @zoom && !force\n @zoom = true\n @zoom_duration = duration\n @zoom_total_duration = duration\n @zoom_valuex = (value-self.zoom_x)/(duration/2)\n @zoom_valuey = (value-self.zoom_y)/(duration/2)\n @zoom_ori_zvaluex = self.zoom_x\n @zoom_ori_zvaluey = self.zoom_y\n @zoom_x = self.x\n @zoom_y = self.y\n @zoom_phase = 0\n self.ox = self.width/2\n self.oy = self.height/2\n self.x += self.width/2\n self.y += self.height/2\n end", "def set_at(x, y)\n self.x = x\n self.x = 0 if x < 0\n self.y = y\n if x + self.width > 640\n self.x -= (x + self.width - 640)\n end\n if y + self.height > 480\n self.y -= (y + self.height - 480)\n end\n end", "def for_zoom_liveness\n for_liveness_type(Constants::ZOOM)\n end", "def zoom_unit\n [@native_screen_width, @native_screen_height]\n end", "def set_screen_factors(lat_min, lat_max, lon_min, lon_max)\n @x_factor = 0\n @y_factor = 0\n # TODO add a border\n x_range = lon_max.to_f - lon_min.to_f\n @x_factor = (x_range * MAP_SCALE) / (SCRATCH_MAX_X - SCRATCH_MIN_X)\n y_range = lat_max.to_f - lat_min.to_f\n @y_factor = (y_range * MAP_SCALE) / (SCRATCH_MAX_Y - SCRATCH_MIN_Y)\n # TODO don't skew the map, figure on one factor and use accordingly\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def on_zoom(menu)\n end", "def set_rect(width, height)\n @width, @height = width, height\n zoom_x, zoom_y = (@width.to_f/@image_w.to_f)*@scale[0], (@height.to_f/@image_h.to_f)*@scale[1]\n @background.zoom_x, @background.zoom_y = zoom_x, zoom_y\n if @frame then @frame.zoom_x, @frame.zoom_y = zoom_x, zoom_y end\n end", "def update_position\n self.x = @battler.screen_x\n self.y = @battler.screen_y - (oy * zoom_y)\n self.z = @battler.screen_z\n end", "def setviewport(*)\n super\n end", "def kiosk_mode_require_zoom=(value)\n @kiosk_mode_require_zoom = value\n end", "def set_rect\n if character\n x_rect, y_rect = self.x-self.ox*self.zoom_x, self.y-self.oy*self.zoom_y\n w_rect, h_rect = self.src_rect.width*self.zoom_x, self.src_rect.height*self.zoom_y\n character.rect.set(x_rect, y_rect, w_rect, h_rect)\n end\n end", "def scale( scale_x, scale_y = scale_x )\n dup.scale!(scale_x, scale_y)\n end", "def update_screen\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end", "def update_screen\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end", "def adjust_y_to_zoom(value)\n return (value * $game_temp.temp_zoom_value) + $game_temp.temp_zoom_adj_y - ($game_temp.center_adj_y / 2)\n end", "def inqviewport\n inquiry %i[double double double double] do |*pts|\n super(*pts)\n end\n end", "def zoom?\n false\n end", "def zoom_selected(recognizer)\n p \"zoom selected\"\n if @selected.is_a?(ToyInScene) # we don't rotate circles\n case recognizer.state\n when UIGestureRecognizerStateBegan\n @starting_zoom = @selected.zoom\n when UIGestureRecognizerStateChanged\n @selected.zoom = recognizer.scale * @starting_zoom\n if Time.now.usec % 5 == 0\n setNeedsDisplay\n end\n when UIGestureRecognizerStateEnded\n change_zoom_on(@selected, to: @selected.zoom)\n @starting_zoom = nil\n end\n end\n end", "def on_zoom &block\n %x{\n var mqString = \"(resolution: \" + #@native.devicePixelRatio + \"dppx)\";\n #@native.matchMedia(mqString).addListener(#{block.to_n});\n }\n end", "def viewport2=(vw)\n @graphic.viewport = vw\n end", "def zoom\n `#@native.devicePixelRatio`\n end", "def zoom_factor\n Zif.position_math(:fdiv, [@cur_w, @cur_h], zoom_unit)\n end", "def init_zoom\r\n self.zoom = 1 # $zoom_factor\r\n @zoom = PSDK_CONFIG.specific_zoom || ZoomDiv[1] # $zoom_factor.to_i]\r\n end", "def zoom\n options[:zoom] || Config.zoom\n end", "def pinch direction, magnification = 1, obj = nil, wait = 0.2\n move_mouse_to obj, wait: 0 if obj\n Mouse.pinch direction, magnification\n sleep wait\n end", "def create_picture_viewport\n @viewport2 = Viewport.new(0, 0, Graphics.width, Graphics.height)\n @viewport2.z = 99\n end", "def update_viewports\r\n # Set screen color tone and shake position\r\n @viewport1.tone = $game_screen.tone\r\n @viewport1.ox = $game_screen.shake\r\n # Set screen flash color\r\n @viewport4.color = $game_screen.flash_color\r\n # Update viewports\r\n @viewport1.update\r\n @viewport2.update\r\n @viewport4.update\r\n end", "def scale(factor_x, factor_y=factor_x, &rendering_code); end", "def zoom_center(x)\n idx = @grf.near_x x\n printf(\"zoom center start: %3d % 4d % 4d % 4d\\n\", x, @zoom_beg, idx, @zoom_end)\n range = @zoom_end - @zoom_beg\n cpidx = idx / range\n \n newl = (@zoom_beg + (range * 0.125)).to_i\n newr = (@zoom_end - (range * 0.125)).to_i\n @zoom_beg = newl\n @zoom_end = newr\n printf(\"zoom center end: %3d % 4d % 4d % 4d \\n\", x, @zoom_beg, idx, @zoom_end)\n @zooming = true;\n @grf.zoom @zoom_beg, @zoom_end\n end", "def zoom_to_level(new_level)\n zoom_to_scale ZOOM_SCALE[new_level]\n end", "def kiosk_mode_allow_zoom_settings=(value)\n @kiosk_mode_allow_zoom_settings = value\n end", "def update_scroll(last_real_x, last_real_y)\n return unless $game_system.camera_target == self\n ax1 = $game_map.adjust_x(last_real_x)\n ay1 = $game_map.adjust_y(last_real_y)\n ax2 = $game_map.adjust_x(@real_x)\n ay2 = $game_map.adjust_y(@real_y)\n $game_map.scroll_down (ay2 - ay1) if ay2 > ay1 && ay2 > center_y\n $game_map.scroll_left (ax1 - ax2) if ax2 < ax1 && ax2 < center_x\n $game_map.scroll_right(ax2 - ax1) if ax2 > ax1 && ax2 > center_x\n $game_map.scroll_up (ay1 - ay2) if ay2 < ay1 && ay2 < center_y\n end", "def set_animation_origin\n unless camera_reposition_case?\n super\n return\n end\n @anim_origin.x = @screen_point.x\n @anim_origin.y = @screen_point.y\n if @animation.position == 0\n @anim_origin.y -= height / 2\n elsif @animation.position == 2\n @anim_origin.y += height / 2\n end\n update_anim_origin_reference\n end", "def zoom=(zoom)\n @zoom = zoom\n\n if zoom == :best_fit\n Google::Scripts.end_of_map_script << \"#{self}.setZoom(#{self}.getBoundsZoomLevel(track_bounds));\"\n else\n self.set_zoom(self.zoom) \n end\n end", "def modify_image\n if @vertical\n @main_image = @main_image.zooming_v\n else\n @main_image = @main_image.zooming_h\n end\n end", "def tap(x, y)\n # Touches appear to be lost during the first frame after navigation.\n # This waits a frame before sending the tap.\n # @see https://crbug.com/613219\n @_client.command(\n Protocol::Runtime.evaluate(\n expression: 'new Promise(x => requestAnimationFrame(() => requestAnimationFrame(x)))',\n await_promise: true\n )\n ).wait!\n\n touch_points = [{ x: x.round, y: y.round }]\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchStart',\n touch_points: touch_points,\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n @_client.command(\n Protocol::Input.dispatch_touch_event(\n type: 'touchEnd',\n touch_points: [],\n modifiers: @_keyboard.modifiers\n )\n ).wait!\n end", "def update_screen\n unless self.disposed?\n self.x = screen_x \n self.y = screen_y\n self.z = self.y + 64 + (@is_moving ? 1 : 0)\n end\n end", "def set_position_center\n self.set_position(0.5*(@screen_width-@window_width), 0.5*(@screen_height-@window_height))\n return self\nend", "def update_location\n self.x = screen_x unless self.disposed?\n self.y = screen_y unless self.disposed?\n end", "def zoom_to_scale(new_scale)\n @map_state.merge!('Scale' => new_scale)\n update_session do |xml|\n set_map_state xml\n end\n \n TileCache.clear(@session_id)\n end", "def update_viewports\r\n # Set screen color tone and shake position\r\n @viewport1.tone = $game_screen.tone \r\n @viewport1.ox = $game_screen.shake\r\n # Set screen flash color\r\n @viewport3.color = $game_screen.flash_color \r\n # Update viewports\r\n @viewport1.update \r\n @viewport3.update\r\n end", "def init_viewport\r\n # Make viewports\r\n @viewport1 = Viewport.new(0, 0, 640, 320)\r\n @viewport2 = Viewport.new(0, 0, 640, 480)\r\n @viewport3 = Viewport.new(0, 0, 640, 480)\r\n @viewport4 = Viewport.new(0, 0, 640, 480)\r\n @viewport2.z = 101\r\n @viewport3.z = 200\r\n @viewport4.z = 5000\r\n end", "def setViewDistance _args\n \"setViewDistance _args;\" \n end", "def scale(factor_x, factor_y, around_x, around_y, &rendering_code); end", "def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n @zoom = args[:zoom] if args.key?(:zoom)\n end", "def update!(**args)\n @x = args[:x] if args.key?(:x)\n @y = args[:y] if args.key?(:y)\n @zoom = args[:zoom] if args.key?(:zoom)\n end", "def setscale(*)\n super\n end", "def inf_loop(fps, xzoom, f)\n s = Screen.new(W, H)\n for x in 1...WI do\n y = f.call(x/xzoom.to_f)\n s.set(x, y)\n s.print()\n #s.unset(x, y)\n sleep(1.0/fps)\n end\nend", "def vscale(factor)\n @height = @height * factor\n @top *= factor\n self\n end", "def snap_to_bitmap\n @viewport&.snap_to_bitmap || Bitmap.new(16, 16)\n end", "def setInitialZoom(zoom)\n if (!(Integer(zoom) > 0))\n raise Error.new(Pdfcrowd.create_invalid_value_message(zoom, \"setInitialZoom\", \"image-to-pdf\", \"Must be a positive integer number.\", \"set_initial_zoom\"), 470);\n end\n \n @fields['initial_zoom'] = zoom\n self\n end", "def set_camera(cam_x, cam_y)\n @cam.x = cam_x\n @cam.y = cam_y\n set_bounds\n end", "def double_click()\n double_click_at :center, :center\n end", "def set_screen_postion(start_pos, reset = false)\n position = reset ? [$game_player.x,$game_player.y] : start_pos \n pos = set_screen_move_postion(position)\n set_screen(pos[0], $game_map.display_x, true)\n set_screen(pos[1], $game_map.display_y, false)\n end", "def resize_to_local_point_locked_aspect!(grab_handle, point, minimum_dimension=1,limit_by:nil)\n\t\ttype, target_indicies = VEC_TO_TRANSFORM_DATA[grab_handle.to_a]\n\t\t\n\t\tnew_verts = self.verts\n\t\t\n\t\t\n\t\t# store original dimensions before any transforms\n\t\toriginal_width = self.width\n\t\toriginal_height = self.height\n\t\t\n\t\t\n\t\t# compute minimum dimensions\n\t\tlimit_by ||= :smaller\n\t\tlimits = [:smaller, :larger, :width, :height]\n\t\tunless limits.include? limit_by\n\t\t\traise \"Must declare kwarg 'limit by' with one of these values: #{limits.inspect}\"\n\t\tend\n\t\t\n\t\t\n\t\tminimum_x, minimum_y =\n\t\t\tminimum_dimensions(width, height, minimum_dimension, limit_by)\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\tcase type\n\t\t\twhen :edge\n\t\t\t\t# these two lines stolen from CP::Shape::Rect#resize_by_delta!\n\t\t\t\ta,b = target_indicies.collect{|i| new_verts[i] }\n\t\t\t\taxis = ( a.x == b.x ? :x : :y )\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t# TODO: consider possible problems of dividing delta by two. Should you use integer division? The underlying measurements are pixels, so what happens when you divide in half? Will you ever lose precision?\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t# -----\n\t\t\t\t# Compare these two ratios:\n\t\t\t\t# > minimum dimension calculation\n\t\t\t\t# > scale the secondary axis\n\t\t\t\t# \n\t\t\t\t# The two ratios are similarly calculated, but you can't reuse the same variable.\n\t\t\t\t# The top ratio is based on the which side is longer, \n\t\t\t\t# but the bottom ratio is based on which side is being directly manipulated.\n\t\t\t\t# -----\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t# Scale the edge along the axis shared by it's verts\n\t\t\t\t# Then, scale along the other axis\n\t\t\t\tif axis == :x\n\t\t\t\t\t# primary x\n\t\t\t\t\tself.resize_to_local_point!(grab_handle, point, minimum_x)\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t# secondary y\n\t\t\t\t\tratio = original_height / original_width\n\t\t\t\t\t\n\t\t\t\t\tnew_width = self.width\n\t\t\t\t\tnew_height = new_width * ratio\n\t\t\t\t\t\n\t\t\t\t\tdelta = new_height - original_height\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\ta = CP::Vec2.new(0, 1)\n\t\t\t\t\tb = CP::Vec2.new(0, -1)\n\t\t\t\t\tself.resize_by_delta!(a, a*delta/2, minimum_y)\n\t\t\t\t\tself.resize_by_delta!(b, b*delta/2, minimum_y)\n\t\t\t\telse # axis == :y\n\t\t\t\t\t# primary y\n\t\t\t\t\tself.resize_to_local_point!(grab_handle, point, minimum_y)\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t# secondary x\n\t\t\t\t\tratio = original_width / original_height\n\t\t\t\t\t\n\t\t\t\t\tnew_height = self.height\n\t\t\t\t\tnew_width = new_height * ratio\n\t\t\t\t\t\n\t\t\t\t\tdelta = new_width - original_width\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\ta = CP::Vec2.new( 1, 0)\n\t\t\t\t\tb = CP::Vec2.new(-1, 0)\n\t\t\t\t\tself.resize_by_delta!(a, a*delta/2, minimum_x)\n\t\t\t\t\tself.resize_by_delta!(b, b*delta/2, minimum_x)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\twhen :vert\n\t\t\t\t# should perform calculations completely within local space\n\t\t\t\t# (this allows for advanced coordinate space manipulations, ex: body rotation)\n\t\t\t\t\n\t\t\t\tcenter = self.center\n\t\t\t\tvert = new_verts[target_indicies.first]\n\t\t\t\tdiagonal = (vert - center).normalize\n\t\t\t\t\n\t\t\t\t\n\t\t\t\tpoint -= center\n\t\t\t\t\t# perform projection relative to center\n\t\t\t\t\t# ( this coordinate space can not be rotated or skewed\n\t\t\t\t\t# so you can get in / out via translation only )\n\t\t\t\t\tpoint = point.project(diagonal)\n\t\t\t\tpoint += center\n\t\t\t\t\n\t\t\t\t# all calculations in local space\n\t\t\t\t# some calculations local to center, rather than local origin\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t# scale each axis separately, so each can be clamped independently\n\t\t\t\tself.resize_to_local_point!(CP::Vec2.new(grab_handle.x,0), point, minimum_x)\n\t\t\t\tself.resize_to_local_point!(CP::Vec2.new(0,grab_handle.y), point, minimum_y)\n\t\t\t\t\n\t\t\t\t\n\t\t\twhen :center\n\t\t\t\t# nothing\n\t\tend\n\tend", "def center_zoom_init(center, zoom)\r\n if center.is_a?(GLatLng)\r\n @init_begin << set_center(center,zoom)\r\n else\r\n @init_begin << set_center(GLatLng.new(center),zoom)\r\n end\r\n end", "def touch\n @repaint_required = true\n end", "def _cell_zoom\r\n @x = params[:x]\r\n @y = params[:y]\r\n @otu = Otu.find(params[:otu_id])\r\n @chr = Chr.find(params[:chr_id])\r\n @confidences = @proj.confidences\r\n @mx = Mx.find(params[:mx_id])\r\n end", "def recalculate!(scale)\n neighbor = @coordinate.zoom_to(zoom - 1)\n parent = neighbor.container\n\n col_shift = 2 * (neighbor.column - parent.column)\n row_shift = 2 * (neighbor.row - parent.row)\n\n @offset.x -= scale * tile_width * col_shift\n @offset.y -= scale * tile_height * row_shift\n @coordinate = parent\n end", "def zoom_to_fit_annotations(args={})\n # Preserve backwards compatibility\n args = {animated: args} if args == true || args == false\n args = {animated: true, include_user: false}.merge(args)\n\n ann = args[:include_user] ? (annotations + [user_annotation]).compact : annotations\n\n #Don't attempt the rezoom of there are no pins\n return if ann.count == 0\n\n #Set some crazy boundaries\n topLeft = CLLocationCoordinate2D.new(-90, 180)\n bottomRight = CLLocationCoordinate2D.new(90, -180)\n\n #Find the bounds of the pins\n ann.each do |a|\n topLeft.longitude = [topLeft.longitude, a.coordinate.longitude].min\n topLeft.latitude = [topLeft.latitude, a.coordinate.latitude].max\n bottomRight.longitude = [bottomRight.longitude, a.coordinate.longitude].max\n bottomRight.latitude = [bottomRight.latitude, a.coordinate.latitude].min\n end\n\n #Find the bounds of all the pins and set the map_view\n coord = CLLocationCoordinate2D.new(\n topLeft.latitude - (topLeft.latitude - bottomRight.latitude) * 0.5,\n topLeft.longitude + (bottomRight.longitude - topLeft.longitude) * 0.5\n )\n\n # Add some padding to the edges\n span = MKCoordinateSpanMake(\n ((topLeft.latitude - bottomRight.latitude) * 1.075).abs,\n ((bottomRight.longitude - topLeft.longitude) * 1.075).abs\n )\n\n region = MKCoordinateRegionMake(coord, span)\n fits = self.view.regionThatFits(region)\n\n set_region(fits, animated: args[:animated])\n end", "def stretch_screen(file)\n bmp = pbBitmap(file)\n self.bitmap = Bitmap.new(self.viewport.width, self.viewport.height)\n self.bitmap.stretch_blt(self.bitmap.rect, bmp, bmp.rect)\n end", "def scale(f)\n @x *= f\n @y *= f\n self\n end", "def set_zoom_user\n @zoom_user = ZoomUser.find(params[:id])\n end", "def kiosk_mode_require_zoom\n return @kiosk_mode_require_zoom\n end", "def update_position\r\n set_position(@character.screen_x / @zoom, @character.screen_y / @zoom)\r\n self.z = @character.screen_z(@ch) + @add_z\r\n return true\r\n end", "def maximize_to_screen\n size = execute_script(%(\n return { width: window.screen.width, height: window.screen.height };\n ))\n\n move_window_to(0, 0)\n resize_window_to(size['width'], size['height'])\n end", "def create_main_viewport\n @viewport1 = Viewport.new(0, 0, Graphics.width, Graphics.height)\n @viewport1.z = 1\n end", "def initialize(**opts)\n defaults = {\n width: 1024,\n height: 768,\n method: :scale_by_bounds\n }\n super(opts, defaults)\n end", "def hscale(factor)\n @width *= factor\n @left *= factor\n self\n end", "def handle2FingerTap(gesture)\n layout = @layout_style + 1\n layout = 0 if layout >= LAYOUT_COUNT\n self.changeToLayout(layout, animated:true)\n end", "def move_camera(x, y)\n @cam.x += x\n @cam.y += y\n set_bounds\n end", "def bw_zoom(transition_sprite)\n 60.times do\n transition_sprite.zoom_x = (transition_sprite.zoom_y *= 1.005)\n Graphics.update\n end\n 30.times do\n transition_sprite.zoom_x = (transition_sprite.zoom_y *= 1.01)\n transition_sprite.opacity -= 9\n Graphics.update\n end\n transition_sprite.bitmap.dispose\n transition_sprite.dispose\n end" ]
[ "0.60257125", "0.59447056", "0.59120256", "0.58333623", "0.57661", "0.5733687", "0.5733687", "0.5653727", "0.564632", "0.5472498", "0.54480577", "0.54408664", "0.5410994", "0.5393193", "0.5371043", "0.5365548", "0.5279539", "0.52739227", "0.52502626", "0.5191827", "0.5104939", "0.5100981", "0.50883365", "0.50845754", "0.5053973", "0.5053973", "0.5053973", "0.5053973", "0.5053973", "0.5053973", "0.5053973", "0.5053973", "0.5053973", "0.5053973", "0.5037833", "0.50322473", "0.4971405", "0.49436793", "0.49379995", "0.49316984", "0.49078295", "0.49078295", "0.48997262", "0.48841092", "0.48532933", "0.4842228", "0.48363358", "0.48202062", "0.4790777", "0.4758241", "0.47536513", "0.4736462", "0.47253788", "0.47242555", "0.4688171", "0.46445894", "0.46245247", "0.46208215", "0.46109736", "0.4606124", "0.46046174", "0.46008968", "0.45957205", "0.45725274", "0.45531386", "0.45494395", "0.4536262", "0.4523614", "0.45098686", "0.44707704", "0.44684333", "0.44585037", "0.44519693", "0.44519693", "0.44519", "0.4437351", "0.44308567", "0.44190186", "0.44125617", "0.4395348", "0.43914413", "0.43870136", "0.43822002", "0.43513244", "0.43453184", "0.43445897", "0.43410605", "0.43409058", "0.43405315", "0.4335543", "0.43296307", "0.4329519", "0.43277827", "0.43230793", "0.431584", "0.43096638", "0.43094632", "0.43019816", "0.4300885", "0.42932433" ]
0.5557064
9
def create if params[:password] == Rails.application.secrets.secret_password find_by(password_digest: params[:password]) session[:valid_user] = true redirect_to '/secret' else
def show @user = User.find_by(id: session[:user_id]) @outfit = @user.outfits end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_password\n if params[:password] != params[:verify_pw]\n session[:message] = \"Passwords don't match. Please try again.\"\n redirect \"/register\"\n end\nend", "def verify_password\n # dev_puts current_user.login\n # dev_puts params[:login]\n if current_user && current_user.login.eql?(params[:login])\n redirect_to :action=>:account\n else\n if request.get?\n @user_session = UserSession.new \n elsif request.post?\n @user_session = UserSession.new(params[:user_session])\n if @user_session.save\n redirect_to :action=>:account\n else\n flash[:notice] = '<b>Incorrect password - Please try again</b>'\n end\n end\n #render :template=>'user_sessions/new'\n end\n end", "def create\n #from has_secure_password docs -- try to find by the passed-in params of user, try and authetnicate the password\n @user = User.find_by(name: params[:user][:name]).try(:authenticate, params[:user][:password]) \n #redirect them back to the controller unless the above returned a truthy value (e.g. it knows what @user is)\n return redirect_to controller: 'users', action: 'new' unless !!@user\n #set the session user id to the found @user.id\n session[:user_id] = @user.id\n #then redirect them to the users controller, welcome\n redirect_to(controller: 'users', action: 'welcome')\n end", "def create\n session[:password] = params[:password]\n flash[:notice] = \"You successfully logged in #{ \"as admin\" if admin? }\"\n redirect_to root_path\n end", "def create\n #Try to find the user in the database\n user = User.find_by(email: params[:session][:email].downcase)\n #If the password matches, log the user in and redirect them to the user profile page\n if user && user.authenticate(params[:session][:password])\n log_in(user) #store id in cache\n redirect_to user_url(user)\n #Display error message and refresh the page if password is invalid\n else\n flash.now[:danger] = \"Invalid username or password\"\n #refresh the page\n render 'new'\n end\n end", "def create \n if User.find_by(username: params[:user][:username]) != nil\n flash[:notice] = \"Sorry, that account already exists.\"\n redirect_to '/users/new'\n else\n if password_reqs?\n @user = User.create(params.require(:user).permit(:username, :password))\n session[:user_id] = @user.id \n redirect_to '/welcome'\n else\n redirect_to '/users/new'\n end\n end\n end", "def create\n user = User.find_by_email(params[:email])\n\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to \"/users/#{user.id}\"\n else\n flash[:errors] = [\"Invalid combination\"]\n redirect_to new_session_path\n end\n\n end", "def create\n # identifies user by provided email\n user = User.find_by_email(params[:email])\n\n # if the provided passord matches the user, session is established\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user, notice: 'You have successfully logged in!'\n else\n # if password doesnt match, session is not established\n redirect_to :root\n end\n end", "def user_verify\n user = User.find_by_email(params[\"email\"].downcase) \n\n if user.methods.include?(:password) \n if BCrypt::Password.new(user.password) == params[\"password\"].to_s\n session[:user_id] = user.id\n session[:email] = user.email\n session[:privilege] = user.privilege\n session[:user_name] = user.user_name\n session[:status] = user.status\n \n if session[:status] == \"inactive\"\n return redirect_to (\"/admin/inactive\")\n else\n return redirect_to (\"/admin/update_library\")\n end\n end\n \n else \n redirect_to (\"/login?error=We couldn't find you in the system; please try again.\") \n end\n\n end", "def auth_pass(password)\n BCrypt::Password.create(password) == self.hash_pass\n end", "def create\n @user = User.find_by_email(params[:email])\n #input_password = BCrypt::Password.create(params[:password])\n #if @user.password == input_password\n if (@user != nil) then\n session[:user_id] = @user.id\n redirect_to posts_path\n else\n redirect_to sessions_new_path\n end\n end", "def create\n if(params[:user][:password] != params[:user][:password_repeat])\n flash[:notice] = \"Passwords didn't match!\"\n redirect_to(:root)\n #redirect_to(:action => :register)\n elsif(params[:user][:password] == \"\")\n flash[:notice] = \"Password cannot be blank\"\n redirect_to(:root)\n else\n @user = User.new\n @user.username = params[:user][:username]\n @user.password=(params[:user][:password])\n @user.email = params[:user][:email]\n if(@user.valid?)\n @user.save\n session[:id] = @user.id\n redirect_to(@user, :id => @user.id)\n #flash[:notice] = \"You have successfully registered and can now log in.\"\n #redirect_to(:action => :login)\n else\n flash[:notice] = \"Username in use\"\n redirect_to(:root)\n end\n end\n end", "def create\n user = User.find_by(username: params[:username])\n\n if user && user.authenticate(params[:password])\n\n session[:user_id] = user.id\n redirect_to(\"/\")\n else\n @failed_auth = true\n render(:new)\n end\n end", "def create\n user = User.find_by :email => params[:email]\n if user.present? && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to dashboard_path\n else\n flash[:error] = \"Invalid email or password\"\n redirect_to login_path\n end\nend", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n\n # If the user exists and the password entered is valid\n if !user.blank? && user.authenticate(params[:session][:password])\n log_in user\n redirect_to root_path\n else\n flash[:error] = 'Your email or password is incorrect.'\n render 'new'\n end\n end", "def create\n user = User.find_by_username(params[:username])\n if user && user.authenticate(params[:password])\n if user.pgp_2fa\n session[:user_id_for_2fa] = user.id\n redirect_to sessions_pgp_2fa_path, notice: 'Username and password authentication was successful.'\n else\n # This will do redirect to root_path.\n auth_success(user)\n end\n else\n auth_failure(user)\n end\n end", "def create\n user = User.find_by_email(params[:email])\n if user && user.authenticate(params[:password]) && user.confirm\n session[:user_id] = user.id\n session[:expires_at] = Time.now + 120.minutes\n redirect_to main_url\n else\n flash[:error] = \"Invalid username or password\"\n render \"new\"\n end\n end", "def create\n @user = User.find_by_email(params[:session][:email])\n if @user && @user.authenticate(params[:session][:password])\n session[:user_id] = @user.id\n ensure_changed_password\n #redirect_to '/songs'\n else\n redirect_to '/login'\n flash[:error] = \"Oops, something went wrong! Ensure you type in the correct password.\n If you don't have an account, please contact the administrator.\"\n end\n end", "def create\n if user = User.authenticate_with_credentials(params[:email], params[:password])\n session[:user_id] = user.id\n redirect_to :root\n else\n @error_login='Invalid Username/password!'\n render :new, alert: @error_login\n end\n end", "def create\n # byebug\n user = User.find_by(email: user_params[:email])\n if user && user.authenticate(user_params[:password])\n # save the user's id into the session\n session[:user_id] = user.id\n #redirect to the show page\n redirect_to root_url\n else\n #there was an error logging the user in\n flash[:danger] = \"Invalid email/password combination\"\n render :new \n end\n end", "def create\n user = User.find_by_credentials(params[:user][:name], params[:user][:password])\n if user \n #rails creates session cookie for us, session is a hash\n #generate new session token and set our session to that token\n login!(user)\n redirect_to chirps_url\n else\n # flash used for collecting errors \n # flash - lasts for now and the next response cycle, usually for redirects\n # flash.now - only persist for this response, usually for render\n\n #we want errors to render once but not again on refresh\n flash[:errors] = [\"Invalid username/password\"]\n # render :new\n redirect_to new_session_url\n end\n end", "def create_from_bookshelf\n @user = User.find_by(email: params[:email]) # Find user by email\n\n if @user && @user.authenticate(params[:password]) # If user exists and is authenticated, log them in by adding their ID to the session hash\n session[:user_id] = @user.id\n redirect_to user_path(@user)\n elsif !@user # If user doesn't exists flash error on signin page\n flash[:alert] = \"We don't have an account associated with that email.\" \n redirect_to signin_path\n else # If password is incorrect flash error on signin page\n flash[:alert] = \"Your password is incorrect - please try again.\" \n redirect_to signin_path\n end\n\n end", "def create\n user = User.find_by(username: params[:session][:username])\n if (user && (!user.disabled? && user.authenticate(params[:session][:password]))) \n log_in user \n redirect_back_or active_jobs_path \n else \n flash.now[:danger] = \"Invalid Username/Password Combination\" \n render :new\n end\n end", "def create\n if params[:user][:password].blank?\n redirect_to :action => \"password\", :id => @user\n else\n super\n end\n end", "def authenticate!(psw)\n User.encrypt_token(psw, password_salt) == encrypted_password\n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n sign_in user\n redirect_back_or user\n else\n flash.now[:error] = 'Invalid email/password combination'\n render 'new'\n end\nend", "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\t\tuser = User.find_by(email: params[:email])\n\t\tif user && user.authenticate(params[:password])\n\t\t\tsession[:user_id] = user.id\n\t\t\tredirect_to \"/users/#{user.id}\"\n\t\telse\n\t\t\tflash[:errors] = [\"Invalid Email/Password Combination\"]\n\t\t\tredirect_to :back\n\t\tend\n\tend", "def authenticate password\n hash = BCrypt::Engine.hash_secret password, password_salt\n hash == password_hash\n end", "def create\n user = User.find_by_username(user_login_params[:username])\n if user and user.authenticate(user_login_params[:password])\n session[:current_user_key] = user.key\n redirect_to '/home'\n else\n redirect_to login_url, alert: \"Invalid user/password combination\" \n end\n end", "def create\n user = User.find_by_login(params[:session][:login])\n if user && user.authenticate(params[:session][:password])\n sign_in user\n redirect_back_or user_path(user.login)\n else\n flash.now[:error] = \"Ungültige Passwort / Login Kombination\"\n render 'new'\n end\n end", "def create\n user = User.find_by(name: params[:name])\n if user&.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to home_path\n else\n redirect_to login_path, alert: \"Invalid user/password combination\"\n end\n end", "def create\n user_params = params.require(:user).permit(:email, :password_digest)\n # confirm email & password combo is correct\n @user = User.confirm(user_params)\n if @user\n login(@user)\n flash[:notice] = \"You are now logged in.\"\n redirect_to @user\n #redirect_to user_path(@user.id)\n else\n flash[:error] = \"Incorrect email or password. Try again\"\n redirect_to login_path\n end\n end", "def create\n #this references the funciton we made in user.rb\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash[:login_error] = \"Couldn't find a user with those credentials\"\n redirect_to new_session_path\n else\n redirect_to user\n end\n end", "def create\n @user = User.find_by(email: params[:session][:email])\n #@user = User.find_by(password_digest: params[:session][:password_digest])\n @user && @user.authenticate(params[:session][:password])\n if @user\n log_in(@user)\n flash[:success] = 'Log in successful.'\n redirect_to @user #first problem identified#\n else\n flash.now[:danger] = 'The user id you entered does not exist.'\n render 'new'\n #render html:'<strong>HTML String</strong>'\n end\n end", "def create \n user = User.find_by(username: params[:user][:username])\n if user && user.authenticate(params[:user][:password])\n session[:user_id] = user.id \n redirect_to user_path(user)\n else\n redirect_to '/login'\n end\n end", "def create\n\n @user = User.new(params[:user])\n p \"hhhhhhhhhhhh\"\n a = params[:password]\n b = params[:user][:password]\n if a == b\n if @user.save\n redirect_to root_path\n flash[:notice] = 'User was successfully created.' \n else\n flash[:notice] = \"#{@user.errors.full_messages}\"\n redirect_to :back\n #render json: @user.errors, status: :unprocessable_entity\n end\n \n else\n flash[:notice] = \"password not matched\"\n redirect_to :back\n end\n\n end", "def create\n @user = User.where(username: params[:username]).first\n if @user.present? && @user.authenticate(params[:password]) #the user exists and the pw is correct\n session[:user_id] = @user.id # log the user in\n flash[:notice] = \"Howdy #{@user.username}!\"\n redirect_to admin_books_path\n else\n flash[:alert] = 'Oops! You entered in the wrong username or password.'\n render :new # something went horribly wrong\n end\n end", "def create\n user = User.find_by(:name => params[:name])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user_path(user)\n else\n render :new\n end\n end", "def register_with_password\n pu = params[:user]\n if user = User.find_by_email(pu[:email]) \n # Go ahead and sign the user in if he mistakenly used the signup form to login. But dont bother updating any attributes\n # that area different from the last time he used the sign up screen. \n if pu[:password] == user.password\n set_and_cookie_current_user user\n render :json => {:success => {:user => user}}\n else\n render :json => {:fail => {:email => user.email}}\n end\n else user = User.create!( pu.merge(:status => :active,:app_version => params[:v]) )\n set_and_cookie_current_user user\n render :json => {:success => {:user => user}}\n end \n end", "def create\n userEmail = User.where(email: params[:email]).count\n userPassword = User.where(password: params[:password]).count\n if userEmail != 0 && userPassword != 0\n user = User.find_by email: params[:email]\n session[:user_id] = user.id\n redirect_to '/cool'\n else\n @user = Olduser.new\n if @user.valid? == false \n @user.errors.messages\n flash[:error] = \"Please enter valid information\"\n redirect_to :back\n end\n end\n end", "def create\n user = User.find_by(username: params[:username])\n authenticated = user.try(:authenticate, params[:password])\n return head(:forbidden) unless authenticated\n @user = user\n session[:user_id] = @user.id\n end", "def authorized?\n session[:password] == SETTINGS[\"password\"]\n end", "def password_confirmed?\n params[:password] != params[:user][:password]\n end", "def authenticate(user, password)\n salt = user.password_salt \n\n hash = PBKDF2.new do |p|\n p.password = password.unpack(\"B*\").first\n p.salt = salt\n p.iterations = 10000\n end\n\n pass_hash = hash.hex_string\n \n pass_hash == user.password_hash \n end", "def create\n user = find_user\n if user.present? && user.authenticate(params[:user][:password])\n session[:user_id] = user.id\n flash[:success] = t('.successfully_logged_in')\n redirect_to polymorphic_path(user)\n else\n flash[:danger] = user.present? ? t('.incorrect_password') : t('.incorrect_email')\n render :new\n end\n end", "def create\n permitted_params = params.require(:user).permit :password, :otp_attempt\n User::current=current_user\n if current_user.activate_two_factor permitted_params\n redirect_to root_path, notice: \"You have enabled Two Factor Auth\"\n else\n render 'new'\n end\n end", "def create\n account = params[:email]\n user = User.locate(account)\n\n if user && user.valid_password?(params[:password])\n session[:user_id] = user.id\n redirect_to root_url, notice: \"Logged in!\"\n else\n flash.now[:alert] = \"Account or password is invalid\"\n render \"new\"\n end\n end", "def validate\n @user = User.authenticate(params[:user], params[:pass])\n if @user != nil\n session[:user] = @user.id\n session[:username] = @user.username\n redirect_to :controller => 'profile'\n else\n flash[:error] = \"Invalid user name or password.\"\n redirect_to :action => 'index'\n end\n end", "def create\n user = User.find_by(email: params[:email])\n\n p user\n p params[:email]\n p params\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to user_path(user)\n else\n redirect_to authentication_index_path\n end\n end", "def create\n user = User.find_by_email( params[:session][:email].downcase )\n\n if user and user.authenticate( params[:session][:password] )\n sign_in user \n redirect_to root_url\n else\n flash[:error] = \"invalid email/password\"\n render :action => 'new' \n end\n end", "def correct_password?(params)\n self.current_password = params[:user][:current_password]\n self.password == self.current_password\n end", "def create\n user = User.find_by(email: params[:email])\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_url, notice: 'Logged in!'\n else\n flash.now.alert = 'Email or password is invalid'\n render :new\n end\n end", "def create\n user = User.find_by_email(params[:email].downcase)\n return redirect_to sessions_path,\n flash: { danger: 'User does not exist' } if user.nil?\n\n return redirect_to sessions_path,\n flash: { warning: 'Please confirm your email' } unless user.email_confirmed\n\n return redirect_to sessions_path,\n flash: { danger: 'password is incorrect' } unless user&.\n authenticate(params[:password])\n\n session[:user_id] = user.id\n redirect_to :todos, flash: { success: 'Successfully Logged in' }\n end", "def create\n #binding.pry \n user = User.find_by(name: params[:user][:name])\n if user.try(:authenticate, params[:user][:password])\n session[:user_id] = user.id \n @user = user\n else \n redirect_to(controller: 'sessions', action: 'new')\n end\n end", "def admin? \n session[:password] == \"secret\" \n end", "def match_password(login_password=\"\")\n password == BCrypt::Engine.hash_secret(login_password, salt)\n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user&.authenticate(params[:session][:password])\n reset_session\n log_in user\n redirect_to user\n else\n flash.now[:danger] = 'Invalid email password combo'\n render 'new'\n end\n end", "def authenticate\n begin\n if !session[:user_guid]\n redirect_to(root_path)\n elsif session[:user_guid] != User.find_by(id: session[:user_id].to_i).guid\n redirect_to(logout_user_path)\n end\n rescue\n redirect_to(logout_user_path)\n end\n end", "def create\n @user = User.where(username: params[:session][:username]).first\n if @user.password == params[:session][:password]\n session[:user_id]=@user.id\n log_in @user\n puts \"my sess = #{session[:user_id]}\"\n redirect_to @user\n else\n flash[:alert] = \"Invalid Username/Password. Please try again\"\n redirect_to login_path\n end\n end", "def create\n \tuser = User.find_by(email: params[:session][:email].downcase)\n \tif user and user.authenticate(params[:session][:password])\n \t\tlog_in(user)\n # redirect_to \"/users/#{user.id}\"\n redirect_to '/'\n \telse\n \t\tflash.now[:danger] = \"Invalid email/password confirmation!\"\n \t\trender 'new'\n \tend\n end", "def create\n\t\tuser = User.find_by_name params[:name]\n\t\tif user and user.authenticate params[:password]\n\t\t\t# 'logging in' is performed by saving a user's id in the session variable\n\t\t\tsession[:user_id] = user.id\n\t\t\t\t\n\t\t\tredirect_to session[:return_to] || root_path\n\t\telse\n\t\t\tflash.now.alert = \"Invalid user/password\"\n\t\t\trender :new\n\t\tend\n\tend", "def create\n # Get submitted email and password\n address = params[:session][:email]\n password = params[:session][:password]\n\n # Pull the user from the db\n user = User.find_by(email: address.downcase)\n\n # User exists and password is correct\n if user && user.authenticate(password)\n # Login user\n create_session user\n\n # Show user profile page\n redirect_to user\n\n # There were invalid credentials\n else\n # Show an error message\n flash.now[:warning] = \"You cocked up. Try again.\"\n\n # Show login page again\n render 'new'\n end\n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n flash[:success] = 'Thank you for signing in!'\n sign_in(user)\n redirect_to root_path\n else\n flash.now[:error] = \"Invalid email/password combination\"\n render 'new'\n end\n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password])\n log_in user\n redirect_to home_path\n else\n flash.now[:danger] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def create\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash.now[:error] = \"invalid emails/password combination\"\n render 'new'\n else #user logs in, creates session\n session[:remember_token] = user.id\n @user = User.find_by_id(session[:remember_token]) \n if(@user.email==\"admin@dreamatic.org\") #redirect admin to her page\n redirect_to :controller => 'users', :action => 'index'\n elsif session[:url] == nil\n redirect_to :controller => :users, :action => :show, :id => user.id\n else\n redirect_to session[:url]\n session[:url] = nil\n end\n end \n end", "def create\n user = User.find_by(email: params[:session][:email].downcase)\n \n #if the user was found and the user.authenticate based on enetered password\n if user && user.authenticate(params[:session][:password])\n # we are saving user id into the session so the browsers cookies will handle this\n # this id will be used across sessions\n session[:user_id] = user.id\n \n # flash a success and redirect to the users page\n flash[:success] = \"You have successfully logged in\"\n redirect_to user_path(user)\n else\n # re render the login page, but since this is not a model backed form we wont have validation messages\n # add a message with flash\n flash.now[:danger] = \"Username or Password were incorrect\"\n render 'new'\n end\n end", "def create\n\t\tuser = User.find_by_username(params[:session][:username])\n\t\t\n if (user.nil?)\n \tflash[:warning] = \"Username or Password incorrect\"\n redirect_to new_session_path\n elsif (params[:session][:password] != user.password)\n \tflash[:warning] = \"Username or Password incorrect\"\n redirect_to new_session_path\n else\n \tsession[:current_user_id] = user.id\n \tsession[:current_user_username] = user.username\n \tredirect_to home_path\n\t end \n\tend", "def create\n session_params = params.permit(:email, :password)\n user = User.confirm(session_params)\n if user\n login(user)\n redirect_to current_user\n\n else\n flash.now[:error] = \"Something went wrong! Invalid email/password combination\"\n redirect_to signin_path \n end\n end", "def create \n user = User.find_by(:email => params[:session][:email]) #make sure that they are saved as a user. if not, returns nil. if yes, returns user.\n if user && user.authenticate(params[:session][:password]) #if both of these work, log user in\n login(user)\n redirect_to user\n else \n redirect_to :back\n end\n end", "def create\n user = User.authenticate(params[:email], params[:password])\n if user\n # token = (0...20).map { ('a'..'z').to_a[rand(26)] }.join\n #session[:token] = token\n session[:user_id] = user.id\n # user.update(session: token)\n redirect_to root_url, :notice => \"Logged in!\" \n else\n flash.now.alert = \"Invalid credentials.\"\n render \"new\"\n end\n end", "def is_valid_password?(password)\n\t\tself.password == BCrypt::Engine.hash_secret(password, self.password)\n\tend", "def needs_password?(_user, params)\n params[:password].present?\n end", "def create\n @user = User.find_by_credentials(params[:user][:email],params[:user][:password])\n\n if @user.nil?\n flash.now[:errors] = [\"incorrect email/password combination\"]\n render :log_in\n else\n @user.reset_session_token!\n session[:session_token] = @user.session_token\n # fail\n redirect_to user_url(@user)\n end\n end", "def passwords_match?\n context.user.password == context.password\n end", "def create\n @user = User.new(params[:user])\n @user.password = Digest::SHA1.hexdigest(@user.password)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to [:admin,@user], notice: t(\"helpers.notice.new\") }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def new_pwd\n user=User.where(:username => params[:username])[0]\n \n if user==nil || Integer(user[:hash])!=Integer(params[:hash])\n render :update do |page|\n page<< \"alert('Invalid Code');\"\n end\n else\n alphas=Array.new\n i=0\n (\"a\"..\"z\").to_a.each do |l|\n alphas[i]=l\n i+=1\n end\n (\"A\"..\"Z\").to_a.each do |l|\n alphas[i]=l\n i+=1\n end\n (\"0\"..\"9\").to_a.each do |l|\n alphas[i]=l\n i+=1\n end\n \n @new_pwd= Array.new\n i=0\n while i<15\n @new_pwd[i]=alphas[rand(62)]\n i+=1\n end\n @new_pwd*=''\n user.password=hash_pwd(@new_pwd)\n user.save\n session[:current_user]=user\n end\n end", "def create\n # Find the user by their name\n user = User.find_by(name: params[:session][:name].downcase)\n # If the user exists and the user credentials are correct\n if user && user.authenticate(params[:session][:password])\n # Log the user in\n login user\n # Take the user to their profile page\n redirect_to me_path\n else\n # Notify the user that their credentials are incorrect\n flash[:error] = 'Invalid email/password combination'\n # Redirect to the home page\n redirect_to root_path\n end\n end", "def login_action\n if params[:password]\n if Digest::SHA256.hexdigest(params[:password]) == APP_PASSWORD_HASH\n session[:login_time] = DateTime.now\n flash[:notice] = \"You are now logged in.\"\n return redirect_to \"/admin\"\n end\n end\n flash[:error] = \"The password was incorrect.\"\n return redirect_to \"/login\"\n end", "def create\n @guestaccount = Guestaccount.find_by_email(params[:session][:email])\n if @guestaccount && @guestaccount.authenticate(params[:session][:password])\n session[:guestaccount_id] = @guestaccount.id\n redirect_to '/guest?' \n else\n flash.now[:danger] = \"Invalid email/password combination\"# alert if wrong password/email combo entered\n render 'new'\n end \nend", "def login_post\n @contributor = Contributor.find_by({email: params[:email]})\n if @contributor\n\n if @contributor.authenticate(params[:password])\n #password is good\n session[:contributor_id] = @contributor.id\n redirect_to articles_path\n else\n #password is bad\n redirect_to '/login', {:flash => { :error => \"Insufficient rights!\" }}\n end\n else\n redirect_to '/login', {:flash => { :error => \"Insufficient rights!\" }}\n end\n\n end", "def create\n #this used to use params[:user] as the variable, but uses the more secure method\n #defined below in the private section (user_params)\n @user = User.new(user_params)\n if @user.save\n flash.now[:alert] = 'Welcome!'\n log_in(@user)\n redirect_to root_url\n else\n render 'new'\n end\n end", "def create\n # refactor this\n user = User.find_by(username: params[:session][:username_or_email].downcase) ||\n User.find_by(email: params[:session][:username_or_email].downcase)\n if authenticated_successfully?(user)\n login(user)\n redirect_to(session[:intended_url] || root_path)\n else\n flash.now[:danger] = \"Hmm... #{$SITE_TITLE} couldn't authenicate your account with those credentials.\"\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 # Find the user\n user = User.find_by(email: params[:session][:email].downcase)\n # Get the password from the parameters\n password = params[:session][:password]\n # Try to authenticate the user\n if user && user.authenticate(password)\n flash[:success] = \"Welcome back #{user.username}\"\n # Store the user id in the session\n session[:user_id] = user.id\n # Redirect the user to its page\n redirect_to user_path(user)\n else\n # Since we are using render, there won't be another request, so we need to use flash.now\n flash.now[:danger] = \"Wrong email or password. Please try again.\"\n render :new\n end\n end", "def create\n @user = User.new(user_params)\n if params[:user][:password] == params[:user][:password_confirmation]\n respond_to do |format|\n if @user.save\n flash[:success] = \"User was successfully created.\"\n format.html { redirect_to root_path }\n format.json { render :show, status: :created, location: @user }\n else\n flash.now[:notice] = \"unprocessable_entity\"\n format.html { render :new} \n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n else\n flash.now[:danger] = \"password & conform_password not match\"\n render :new \n end\n end", "def create\n\n user = current_instance.users.where(username: params[:username]).first\n if user && user.authenticate(params[:password])\n session[:user_id] = user.id\n redirect_to root_path, notice: 'You have been successfully logged in to Unify.'\n else\n flash[:error] = 'Invalid username and/or password.'\n render :new\n end\n\n end", "def create\n\n user = User.find_by(email: params[:session][:email].downcase)\n\n if(user && user.authenticate(params[:session][:password]))\n log_in(user)\n redirect_to(root_path)\n flash[:success] = \"Logado com sucesso!\"\n else\n flash.now[:danger] = 'Combinação inválida de e-mail/senha'\n render('new')\n end\n\n end", "def create\n \tuser = User.find_by :email => params[:email]\n \tif user.present? && user.authenticate(params[:password])\n \t\tsession[:user_id] = user.id\n \t\tredirect_to root_path\n \telse\n \t\tredirect_to login_path\n \tend\n end", "def create\n user = User.find_by_email(params[:session][:email].downcase)\n if user && user.authenticate(params[:session][:password]) && user.confirmed_user?\n if user.banned?\n sign_out_user\n flash[:error] = \"This account has been suspended for violating terms of conditions.\"\n redirect_to root_url\n else\n sign_in_user(user, params[:remember_me])\n redirect_back_or user\n end\n elsif user && user.authenticate(params[:session][:password])\n flash.now[:error] = 'Your account has not been activated yet, please check your email.'\n render 'new'\n else\n flash.now[:error] = 'Invalid email/password combination'\n render 'new'\n end\n end", "def create\n @user = User.find(session[:user_id])\n @secret = Secret.new(content:params[:content], user:@user)\n if !@secret.save\n flash[:notice] = @secret.errors.full_messages\n end\n redirect_to \"/users/#{@user.id}\"\n end", "def valid_password?(password); end", "def create\n user = User.authenticate(params[:username], params[:password])\n \n # valid account\n if user && user.enabled?\n self.current_user = user\n remember_user if params[:remember_me] == \"1\"\n flash[:notice] = \"Signed in successfully\"\n redirect_back_or_default user_url(current_user)\n\n # disabled user\n elsif user && !user.enabled\n flash.now[:error] = \"Your account has been disabled.\"\n render :action => \"new\"\n \n # invalid username/pass\n else\n flash.now[:error] = \"Username/Password was not found. If you have forgot your \" + \n \"password click <a href=\\\"#{url_for new_lost_password_path}\\\">here</a>\" \n render :action => \"new\"\n end\n end", "def valid_password?(password)\n return false if encrypted_password.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_password)\n # check with the pepper\n spicy_password = ::BCrypt::Engine.hash_secret(\"#{password}#{self.class.pepper}\", bcrypt.salt)\n if Devise.secure_compare(spicy_password, encrypted_password)\n return true\n end\n\n # check without the pepper\n mild_password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n if Devise.secure_compare(mild_password, encrypted_password)\n # save the spicy password\n self.update_attribute(:encrypted_password, spicy_password)\n return true\n end\n\n return false\n end", "def valid_password?(password)\n return false if encrypted_password.blank?\n bcrypt = ::BCrypt::Password.new(encrypted_password)\n # check with the pepper\n spicy_password = ::BCrypt::Engine.hash_secret(\"#{password}#{self.class.pepper}\", bcrypt.salt)\n if Devise.secure_compare(spicy_password, encrypted_password)\n return true\n end\n\n # check without the pepper\n mild_password = ::BCrypt::Engine.hash_secret(password, bcrypt.salt)\n if Devise.secure_compare(mild_password, encrypted_password)\n # save the spicy password\n update_attribute(:encrypted_password, spicy_password)\n return true\n end\n\n return false\n end", "def show\r\n @user = User.find_by_id(params[:id])\r\n params[:reset_token] ||= \"\"\r\n if @user\r\n if CGI.escape(Base64.strict_encode64(Digest::SHA256.new.digest(@user.password_digest))) != CGI.escape(params[:reset_token])\r\n redirect_to root_path\r\n end\r\n @pass = CGI.escape(Base64.strict_encode64(Digest::SHA256.new.digest(@user.password_digest)))\r\n else\r\n redirect_to root_path\r\n end\r\n end", "def create\n validate_params; return if performed?\n user = User.find_by(user_name: params[:session][:user_name])\n if user && user.authenticate(params[:session][:password])\n log_in user\n redirect_to root_path\n else\n flash.now[:error] = I18n.t('errors.log_in.create')\n render :new\n end\n end", "def verify\n return false unless expires_at >= Time.zone.now\n user.present? && user.password_digest == password_digest ? user : false\n end", "def create\n if user&.valid_password?(params[:password])\n if turbo_native_app?\n sign_in_user\n render json: {location: after_sign_in_path_for(user), token: token_by_name(ApiToken::APP_NAME)}\n else\n render json: {token: token_by_name(ApiToken::DEFAULT_NAME)}\n end\n else\n render json: {error: error_message}, status: :unauthorized\n end\n end", "def login()\n db = SQLite3::Database.new('db/db.db')\n result = db.execute(\"SELECT Password FROM users WHERE Username =(?)\", params[\"name\"])\n if result[0] == nil\n session[:loginfail] = true\n redirect('/')\n end\n not_password = result[0][0]\n if BCrypt::Password.new(not_password) == params[\"pass\"]\n session[:loggedin] = true\n session[:user] = params[\"name\"]\n redirect('/')\n else\n session[:loginfail] = true\n redirect('/')\n end\nend", "def correct_password?(params)\n current_password=params[:user][:current_password]\n password == current_password\n end" ]
[ "0.730715", "0.70501834", "0.70470154", "0.6925958", "0.6919008", "0.68930167", "0.6882618", "0.6860816", "0.6858191", "0.68566334", "0.6837599", "0.6823904", "0.6815354", "0.6805224", "0.67698723", "0.67693883", "0.67681164", "0.67454183", "0.67284405", "0.67134815", "0.6699261", "0.66967994", "0.6691797", "0.6689618", "0.667492", "0.6652386", "0.664901", "0.664837", "0.6637811", "0.6621483", "0.66199887", "0.6619491", "0.6613751", "0.6605005", "0.6598996", "0.65979093", "0.6597408", "0.6594143", "0.65931886", "0.65917045", "0.65877575", "0.6586162", "0.65799457", "0.6560808", "0.65501475", "0.6548198", "0.65469104", "0.6538982", "0.6525121", "0.652237", "0.650666", "0.65062225", "0.6504853", "0.6503677", "0.6500744", "0.6495048", "0.64822483", "0.6479726", "0.6477743", "0.64737767", "0.6470167", "0.64700943", "0.6466966", "0.64625764", "0.64623886", "0.64608026", "0.6452368", "0.64497", "0.64492106", "0.64458936", "0.6445826", "0.64351654", "0.6434708", "0.6432711", "0.6424488", "0.64217913", "0.6420326", "0.64164656", "0.6415972", "0.6415601", "0.641253", "0.6409908", "0.6406805", "0.6405871", "0.6405258", "0.6404034", "0.6400281", "0.6399924", "0.6396654", "0.63951147", "0.63950425", "0.6391073", "0.639088", "0.63857245", "0.6382778", "0.6381112", "0.6376297", "0.6376126", "0.63720244", "0.6370965", "0.6364129" ]
0.0
-1
assert("RustRegexpcasefold?", '15.2.15.7.6') do assert_false RustRegexp.new("(https?://[^/]+)[azAZ09./]+", RustRegexp::MULTILINE).casefold? assert_true RustRegexp.new("(https?://[^/]+)[azAZ09./]+", RustRegexp::IGNORECASE | RustRegexp::EXTENDED).casefold? assert_true RustRegexp.new("(https?://[^/]+)[azAZ09./]+", RustRegexp::MULTILINE | RustRegexp::IGNORECASE).casefold? assert_false RustRegexp.new("(https?://[^/]+)[azAZ09./]+").casefold? assert_true RustRegexp.new("(https?://[^/]+)[azAZ09./]+", true).casefold? end
def test_match reg = RustRegexp.new("(https?://[^/]+)[-a-zA-Z0-9./]+") assert_false reg.match("http://masamitsu-murase.12345/hoge.html").nil? assert_nil reg.match("http:///masamitsu-murase.12345/hoge.html") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_match_case_sensitive_binary_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string doesnt contains a match on: My\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"M|79|Mat|63 68|123\" #equals MyMatch123\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"case sensitive match on no match content.\")\r\n\tend", "def test_match_case_sensitive_no_match\r\n\t\t#content with case insensitive, but not case sensitive match\r\n\t\tcontent = \"first line.\\nthis string doesn not contain a case insensitive match on: mymatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect case sensitive match on content.\")\r\n\tend", "def test_match_case_sensitive\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content.\")\r\n\tend", "def casefold?() end", "def test_match_nocase\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(62, match,\"no case insensitive match on content.\")\r\n\tend", "def test_the_left_most_match_wins\n ## assert_equal __, \"abbccc az\"[/az*/]\n assert_equal \"a\", \"abbccc az\"[/az*/]\n\n # The regex matches starting from left to right\n end", "def case_sensitive?\n !@regexp.casefold?\n end", "def case_insensitive_match; end", "def test_match_case_sensitive_within_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"1234MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.within = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with within.\")\r\n\tend", "def test_exclusion_match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect case sensitive exclusion match on content.\")\r\n\tend", "def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string does not contain a case sensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"case sensitive exclusion match on content didnt fire.\")\t\r\n\tend", "def match_a_string(name)\n case name\n in \"ruby\"\n puts \"https://www.ruby-lang.org/en/\"\n in \"python\"\n puts \"https://www.python.org/\"\n in \"elixir\"\n puts \"https://elixir-lang.org/\"\n else\n puts \"no match\"\n end\nend", "def test_match_case_sensitive_depth_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.depth = 9\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with depth.\")\r\n\tend", "def case_sensitive?\n !@regexp.casefold?\n end", "def test_exclusion_match_nocase_no_match\r\n\t\tcontent = \"first line.\\nthis string does not contain a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"some other string\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(0, match,\"nocase exclusion match on content didnt fire.\")\t\r\n\tend", "def test_match_case_sensitive_depth\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.depth = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with depth.\")\r\n\tend", "def test_string_match\n s = \"a\"\n assert_equal(0, string_match(\"a\", s))\n assert_equal(0, string_match(/a/, s))\n assert_equal(0, string_match('\\(a\\|\\b\\)', s))\n assert_equal(0, string_match(/a|b/, s))\n assert_equal(0, string_match(/^a/, s))\n assert_equal(0, string_match(/a$/, s))\n assert_equal(0, string_match(/.*/, s))\n assert_equal(nil, string_match(/not-match/, s))\n \n end", "def test_exclusion_match_nocase\r\n\t\tcontent = \"first line.\\nthis string contains a case insensitive match on: MyMatch123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.not_modifier = true\r\n\t\tsnort_rule_content.unescaped_string = \"mymatch123\"\r\n\t\tsnort_rule_content.nocase = true\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect nocase exclusion match on content.\")\r\n\tend", "def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend", "def test_extended_patterns_no_flags\n [\n [ \".*\", \"abcd\\nefg\", \"abcd\" ],\n [ \"^a.\", \"abcd\\naefg\", \"ab\" ],\n [ \"^a.\", \"bacd\\naefg\", \"ae\" ],\n [ \".$\", \"bacd\\naefg\", \"d\" ]\n ].each do |reg, str, result|\n m = RustRegexp.new(reg).match(str)\n puts m.inspect\n unless m.nil?\n assert_equal result, m[0]\n end\n end\n end", "def test_match_case_sensitive_special_char\r\n\t\t#content with exact match\r\n\t\tcontent = \"first line.\\nthis string contains a case sensitive match on: My(Match123\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"My(Match123\" \r\n\t\tsnort_rule_content.nocase = false\r\n\t\t\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(60, match,\"no case sensitive match on content with special char.\")\r\n\tend", "def test_match_case_sensitive_within\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.within = 10\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,10)\r\n\t\tassert_equal(13, match,\"no match on content with within.\") #13 pos of second MyMatch\r\n\tend", "def test_lower4\n result = lower?(\"RYANSTANTZ\")\n refute(result, \"'RYANSTANTZ' should not be valid because it doesn't contain lower case letters\")\n end", "def test_match_case_sensitive_offset_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 4\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,0),\"incorrect match on content with offset.\")\r\n\tend", "def test_match_case_sensitive_offset\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch and some more\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.offset = 3\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,0)\r\n\t\tassert_equal(3, match,\"no match on content with offset.\")\r\n\tend", "def test_3_rejects_all_upper_case_passwords\n result = at_least_one_downcase?(\"1abjils&a\")\n assert(result, \"'1abjils&a' should be invalid because it contains no upcase\")\n #assert(result == false, \".same message as above\")\n end", "def regexp_anchored?(regexp)\n regexp.source =~ /\\A(\\\\A|\\^).*(\\\\Z|\\$)\\Z/m ? true : false\n end", "def case_insensitive_match=(_arg0); end", "def test_match_case_sensitive_distance_no_match\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 11\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tassert(!snort_rule_content.match(content,4),\"incorrect match on content with distance.\")\r\n\tend", "def test_the_left_most_match_wins\n assert_equal \"a\", \"abbccc az\"[/az*/]\n end", "def test_the_left_most_match_wins\n assert_equal \"a\", \"abbccc az\"[/az*/]\n end", "def fnmatch?(matcher); end", "def test_the_left_most_match_wins\n assert_equal 'a', \"abbccc az\"[/az*/]\n end", "def test_slash_b_anchors_to_a_word_boundary\n assert_equal 'vines', \"bovine vines\"[/\\bvine./]\n end", "def test_camel_case\n raise NotImplementedError, 'Undecided as to whether to check camel case or not'\n end", "def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end", "def check_url_match(string)\n $driver.current_url.should =~ Regexp.new(string, Regexp::MULTILINE)\n end", "def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contain lower case letters.\")\n end", "def string_behavior (strings)\n\n strings.each do |str|\n if not str =~ /[A-Z]/ and str.length > 4\n puts \"long and lowercase\"\n elsif not str =~ /[A-Z]/\n puts \"lowercase\"\n elsif str.length > 4\n puts \"long\"\n\n else\n puts str\n end\n end\n end", "def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end", "def test_regexp\n# (find-node \"(emacs-ja)Regexps\")\n \n conv = lambda{|from,to| assert_equal(to, el4r_conv_regexp(from)) }\n conv[ //, '' ]\n conv[ /a/, 'a' ]\n conv[ /a./, 'a.' ]\n conv[ /a*/, 'a*' ]\n conv[ /a+/, 'a+' ]\n conv[ /a?/, 'a?' ]\n conv[ /[ab]/, '[ab]' ]\n conv[ /[^ab]/, '[^ab]' ]\n conv[ /^ab/, '^ab' ]\n conv[ /ab$/, 'ab$' ]\n conv[ /a|b/, 'a\\|b' ]\n conv[ /(ab)/, '\\(ab\\)' ]\n conv[ /\\As/, '\\`s' ]\n conv[ /s\\Z/, %q[s\\'] ]\n # \\=\n conv[ /\\bball\\B/, '\\bball\\B']\n # \\<\n # \\>\n conv[ /\\w/, '[0-9A-Za-z_]']\n conv[ /\\W/, '[^0-9A-Za-z_]']\n # \\sC\n # \\SC\n # \\D (number)\n end", "def uppercase3?(string)\n #p string.scan(/[a-z]/i)\n !string.scan(/[A-Z]/).empty? && string.scan(/[A-Z]/) == string.scan(/[a-z]/i)\nend", "def check_page_source_match(string)\n $driver.page_source.should =~ Regexp.new(string, Regexp::MULTILINE)\n end", "def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end", "def test_lower3\n result = lower?(\"RYANSTANTz\")\n assert(result, \"'RYANSTANTz' should be valid because it contains a lower case letter\")\n end", "def test_match_case_sensitive_distance\r\n\t\t#content with exact match\r\n\t\tcontent = \"123MyMatch123MyMatch\"\r\n\t\tsnort_rule_content = SnortRuleContent.new\r\n\t\tsnort_rule_content.unescaped_string = \"MyMatch\"\r\n\t\tsnort_rule_content.distance = 1\r\n\t\tsnort_rule_content.nocase = false\r\n\t\tmatch = snort_rule_content.match(content,4)\r\n\t\tassert_equal(13, match,\"no match on content with distance.\") #13 position of second MyMatch\r\n\tend", "def website(input)\n\t(/((http|https)\\:\\/\\/)?(www)?(.+)(\\.[a-zA-Z]{2,3})+/i =~ input)? \"true\" : \"false\"\nend", "def assert_valid_url(string)\n assert string.to_s.match(/https?:\\/\\/[\\S]+/)\nend", "def test_strict_match_criteria\n entry = BigramEntry.new\n entry.parse_line(\"8\t工作\t18904\t6.89133239246\t213454\")\n cedict_entry = CEdictEntry.new\n cedict_entry.parse_line(\"工作 工作 [gong1 zuo4] /job/work/construction/task/CL:個|个[ge4],份[fen4],項|项[xiang4]/\")\n \n result = entry.default_match_criteria.call(cedict_entry,entry)\n assert(true,result)\n end", "def pre_match() end", "def test_downcase\n value = \"XYZ\"\n assert_equal \"xyz\", value.downcase\n end", "def test_contain_period\n %w( example.com del.icio.us ).each do |word|\n assert_equal word, word.titlecase\n end\n end", "def reduce_case_insensitive(_production, _range, _tokens, _children)\n Regexp::IGNORECASE\n end", "def test_downcase\n value = 'XyZ'\n assert_equal('xyz', value.downcase)\n end", "def test_downcase\n value = 'XyZ'\n assert_equal('xyz', value.downcase)\n end", "def test_downcase\n value = 'XyZ'\n assert_equal('xyz', value.downcase)\n end", "def test_character_class_vs_alternation\n assert_equal \"crab\", \"crab\"[/[catbatrat]+/]\n assert_equal nil, \"crab\"[/(cat|bat|rat)/]\n end", "def ABCheck(str)\n str.match?(/a.{3}b/) || str.match?(/b.{3}a/)\nend", "def const_regexp(camel_cased_word) #:nodoc:\n parts = camel_cased_word.split(\"::\")\n last = parts.pop\n\n parts.reverse.inject(last) do |acc, part|\n part.empty? ? acc : \"#{part}(::#{acc})?\"\n end\n end", "def step3(str)\n rv_pos = rv(str)\n rv_text = str[rv_pos..-1]\n\n if rv_text =~ /(os|[aoáíóÁÍÓ])$/ui\n str[%r{#$&$}]=''\n return true\n elsif idx = rv_text =~ /(u?[eéÉ])$/i\n if $&[0].downcase == 'u' and str[rv_pos+idx-1].downcase == 'g'\n str[%r{#$&$}]=''\n else\n str.chop!\n end\n return true\n end\n false\n end", "def staggered_case_decide(string, use_all_char=false)\n alt_cap = ''\n need_upper = true\n split_str = string.chars\n split_str.each do |char|\n if use_all_char\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n else\n if char =~ /[^A-z]/\n alt_cap << char\n else\n if need_upper\n alt_cap << char.upcase\n else\n alt_cap << char.downcase\n end\n need_upper = !need_upper\n end\n end\n end\n alt_cap\nend", "def test_other_than_first_character\n %w( iTunes TitleCase ).each do |word|\n assert_equal word, word.titlecase\n end\n end", "def regex\n {\n 'java' => /(\\/\\*+([^\\*]|\\*(?!\\/))*(\\*\\/))|(\\/{2}.*)/, # (\\/\\*([\\s\\S]*?)\\*\\/)|(\\/\\/(.*)$)\n 'aspx' => //,\n 'javascript' => //,\n 'js' => //,\n 'ruby' => //,\n 'python' => //,\n 'c' => /((?:\\/\\*(?:[^*]|(?:\\*+[^*\\/]))*\\*+\\/)|(?:\\/\\/.*))/,\n }\nend", "def lab_check(str)\n puts str if str =~ /(l|L)ab/\nend", "def ABCheck(str)\n\n return \"true\" if str=~(/a...b/) or str=~(/b...a/)\n return \"false\"\n \nend", "def has_lab(string)\n new_string = string.downcase\n if new_string =~ /lab/\n puts \"Match! #{string}\"\n else\n puts \"No Match\"\n end\nend", "def test_iban_country_code\n assert_match(/^[A-Z]{2}$/, @tester.iban_country_code)\n end", "def test_check_capital_false\r\n assert_equal true, @g.check_capital('abdc')\r\n end", "def starts_with_consonant?(s)\n # YOUR CODE HERE\n /^[b-df-hj-np-tv-z]/i.match(s) != nil\nend", "def test_upper6\n result = upper?(\"ryanstantz\")\n refute(result, \"'ryanstantz' should not be valid because it doesn't contain an upper case letter\")\n end", "def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end", "def test_is_uri\n assert(N::URI.is_uri?(\"http://foobar.org/\"))\n assert(N::URI.is_uri?(\"http://foobar.org/\"))\n assert(N::URI.is_uri?(\"baa:boo\"))\n assert(!N::URI.is_uri?(\"foo\"))\n end", "def fnmatch(matcher); end", "def match(regexp); end", "def test_ignoring_accent\n end", "def test_ignoring_accent\n end", "def string_to_regex(str)\n if str.length > 1 && str[0] == \"/\" && (str[-1] == \"/\" || str[-2..-1] == \"/i\")\n insensitive = str[-1] == \"i\"\n insensitive ? Regexp.new(str[1..-3], true) : Regexp.new(str[1..-2])\n end\n end", "def test_ABBA_interior_chars_must_be_diff_not_supports_TLS\n input = 'aaaa[qwer]tyui'\n ipv7 = Ipv7.new(input)\n actual_value = ipv7.supportsTls\n assert(! actual_value)\n end", "def check(word)\n if word.downcase =~ /lab/\n puts word\n end\nend", "def step1(str)\n r1,r2 = r12(str)\n r1_text = str[r1..-1]\n r2_text = str[r2..-1]\n\n case r2_text\n when /(anzas?|ic[oa]s?|ismos?|[ai]bles?|istas?|os[oa]s?|[ai]mientos?)$/i\n str[%r{#$&$}]=''\n return true\n when /(ic)?(ador([ae]s?)?|aci[óÓ]n|aciones|antes?|ancias?)$/ui\n str[%r{#$&$}]=''\n return true\n when /log[íÍ]as?/ui\n str[%r{#$&$}]='log'\n return true\n when /(uci([óÓ]n|ones))$/ui\n str[%r{#$&$}]='u'\n return true\n when /(encias?)$/i\n str[%r{#$&$}]='ente'\n return true\n end\n\n if r2_text =~ /(ativ|iv|os|ic|ad)amente$/i or r1_text =~ /amente$/i\n str[%r{#$&$}]=''\n return true\n end\n\n case r2_text\n when /((ante|[ai]ble)?mente)$/i, /((abil|i[cv])?idad(es)?)$/i, /((at)?iv[ao]s?)$/i\n str[%r{#$&$}]=''\n return true\n end\n false\n end", "def matching_lines(regex); end", "def has_lab?(string)\n if string.downcase =~ /lab/\n puts \"#{string} includes the word lab.\"\n else\n puts \"#{string} does not include the word lab\"\n end\nend", "def test_majordomoII\n validate_case\\\n [\"tibbs@uh.edu (Homey ( j (\\(\\() t ) Tibbs)\",\n [ { :name => 'Homey ( j ((() t ) Tibbs',\n :display_name => nil,\n :address => 'tibbs@uh.edu',\n :domain => 'uh.edu',\n :local => 'tibbs',\n :comments => [ 'Homey ( j ((() t ) Tibbs' ],\n :format => 'tibbs@uh.edu (Homey \\( j \\(\\(\\(\\) t \\) Tibbs)' } ] ]\n\n validate_case\\\n ['\"tibbs@home\"@hpc.uh.edu (JLT )',\n [ { :name => 'JLT ',\n :address => 'tibbs@home@hpc.uh.edu',\n :display_name => nil,\n :domain => 'hpc.uh.edu',\n :local => 'tibbs@home',\n :comments => [ 'JLT ' ],\n :format => '\"tibbs@home\"@hpc.uh.edu (JLT )' } ] ]\n\n validate_case\\\n ['tibbs@[129.7.3.5]',\n [ { :name => nil,\n :display_name => nil,\n :domain => '[129.7.3.5]',\n :local => 'tibbs',\n :comments => nil,\n :address => 'tibbs@[129.7.3.5]',\n :format => '<tibbs@[129.7.3.5]>' } ] ]\n\n validate_case\\\n ['A_Foriegner%across.the.pond@relay1.uu.net',\n [ { :name => nil,\n :display_name => nil,\n :domain => 'relay1.uu.net',\n :local => 'A_Foriegner%across.the.pond',\n :comments => nil,\n :address => 'A_Foriegner%across.the.pond@relay1.uu.net',\n :format => 'A_Foriegner%across.the.pond@relay1.uu.net' } ] ]\n\n validate_case\\\n ['\"Jason @ Tibbitts\" <tibbs@uh.edu>',\n [ { :name => 'Jason @ Tibbitts',\n :display_name => 'Jason @ Tibbitts',\n :domain => 'uh.edu',\n :local => 'tibbs',\n :comments => nil,\n :address => 'tibbs@uh.edu',\n :format => '\"Jason @ Tibbitts\" <tibbs@uh.edu>' } ] ]\n\n # Majordomo II parses all of these with an error. We have deleted\n # some of the tests when they are actually legal.\n validate_case ['tibbs@uh.edu Jason Tibbitts', [] ]\n validate_case ['@uh.edu', [] ] # Can't start with @\n validate_case ['J <tibbs>', [] ] # Not FQDN\n validate_case ['<tibbs Da Man', [] ] # Unbalanced\n validate_case ['Jason <tibbs>>', [] ] # Unbalanced\n validate_case ['tibbs, nobody', [] ] # Multiple addresses not allowed\n validate_case ['tibbs@.hpc', [] ] # Illegal @.\n validate_case ['<a@b>@c', [] ] # @ illegal in phrase\n validate_case ['<a@>', [] ]\t# No hostname\n validate_case ['<a@b>.abc', [] ] # >. illegal\n validate_case ['<a@b> blah <d@e>', [] ] # Two routes illegal\n validate_case ['<tibbs<tib@a>@hpc.uh.edu>', [] ] # Nested routes illegal\n validate_case ['[<tibbs@hpc.uh.edu>]', [] ]\t# Enclosed in []\n validate_case ['<a@b.cd> Me [blurfl] U', [] ] # Domain literals illegal in comment\n validate_case ['A B @ C <a@b.c>', [] ] # @ not legal in comment\n validate_case ['blah . tibbs@', [] ] # Unquoted . not legal in comment\n validate_case ['tibbs@hpc.uh.edu.', [] ] # Address ends with a dot\n validate_case ['sina.hpc.uh.edu', [] ] # No local-part@\n validate_case ['tibbs@@math.uh.edu', [] ] # Two @s next to each other\n validate_case ['tibbs@math@uh.edu', [] ] # Two @s, not next to each other\n end", "def check_html(str)\n str = str.downcase\n str.gsub! /\\s/, ''\n check_for = [ /<a/, /<p/, /http:/ ]\n\n check_for.inject(false) { |accum, cond| accum ||= (str =~ cond) }\nend", "def wc_equals(str, pat)\n return false if pat.size != str.size\n\n idx = 0\n pat.each_char do |ch|\n return false if (str[idx] != ch) && (ch != '.')\n\n idx += 1\n end\n true\nend", "def matches_specs(text)\n text = text.downcase\n matches = false\n\n # some of Terri's terms were redundant so I removed them\n matches = true if text =~ /\\bsid|pakistan[.]* rendition|apartheid|apart[.]* regime|apart[.]* state|palestin[.]*/\n matches = true if text =~ /israel/ and text =~ /human rights violations/\n\n matches\nend", "def match_with_eol_regex\n return match_regex if resource[:exact]\n return /^(?>#{match_regex})#{$/}/\n end", "def test_check_capital_contains\r\n assert_nil @g.check_capital('abDc')\r\n end", "def ignorable_nl!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 106 )\n\n \n # - - - - main rule block - - - -\n # at line 948:3: ( '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )? | '/*' ( . )* '*/' | ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\n' | '\\\\r' )+ )\n alt_50 = 3\n look_50_0 = @input.peek( 1 )\n\n if ( look_50_0 == 0x2f )\n look_50_1 = @input.peek( 2 )\n\n if ( look_50_1 == 0x2f )\n alt_50 = 1\n elsif ( look_50_1 == 0x2a )\n alt_50 = 2\n else\n raise NoViableAlternative( \"\", 50, 1 )\n end\n elsif ( look_50_0.between?( 0x9, 0xa ) || look_50_0.between?( 0xc, 0xd ) || look_50_0 == 0x20 || look_50_0 == 0xa0 )\n alt_50 = 3\n else\n raise NoViableAlternative( \"\", 50, 0 )\n end\n case alt_50\n when 1\n # at line 948:5: '//' (~ ( '\\\\n' | '\\\\r' ) )* ( ( '\\\\r' )? '\\\\n' )?\n match( \"//\" )\n # at line 948:10: (~ ( '\\\\n' | '\\\\r' ) )*\n while true # decision 45\n alt_45 = 2\n look_45_0 = @input.peek( 1 )\n\n if ( look_45_0.between?( 0x0, 0x9 ) || look_45_0.between?( 0xb, 0xc ) || look_45_0.between?( 0xe, 0xffff ) )\n alt_45 = 1\n\n end\n case alt_45\n when 1\n # at line 948:10: ~ ( '\\\\n' | '\\\\r' )\n if @input.peek( 1 ).between?( 0x0, 0x9 ) || @input.peek( 1 ).between?( 0xb, 0xc ) || @input.peek( 1 ).between?( 0xe, 0xff )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n break # out of loop for decision 45\n end\n end # loop for decision 45\n # at line 948:28: ( ( '\\\\r' )? '\\\\n' )?\n alt_47 = 2\n look_47_0 = @input.peek( 1 )\n\n if ( look_47_0 == 0xa || look_47_0 == 0xd )\n alt_47 = 1\n end\n case alt_47\n when 1\n # at line 948:30: ( '\\\\r' )? '\\\\n'\n # at line 948:30: ( '\\\\r' )?\n alt_46 = 2\n look_46_0 = @input.peek( 1 )\n\n if ( look_46_0 == 0xd )\n alt_46 = 1\n end\n case alt_46\n when 1\n # at line 948:30: '\\\\r'\n match( 0xd )\n\n end\n match( 0xa )\n\n end\n\n when 2\n # at line 949:5: '/*' ( . )* '*/'\n match( \"/*\" )\n # at line 949:10: ( . )*\n while true # decision 48\n alt_48 = 2\n look_48_0 = @input.peek( 1 )\n\n if ( look_48_0 == 0x2a )\n look_48_1 = @input.peek( 2 )\n\n if ( look_48_1 == 0x2f )\n alt_48 = 2\n elsif ( look_48_1.between?( 0x0, 0x2e ) || look_48_1.between?( 0x30, 0xffff ) )\n alt_48 = 1\n\n end\n elsif ( look_48_0.between?( 0x0, 0x29 ) || look_48_0.between?( 0x2b, 0xffff ) )\n alt_48 = 1\n\n end\n case alt_48\n when 1\n # at line 949:10: .\n match_any\n\n else\n break # out of loop for decision 48\n end\n end # loop for decision 48\n match( \"*/\" )\n\n when 3\n # at line 950:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\n' | '\\\\r' )+\n # at file 950:5: ( '\\\\t' | '\\\\f' | ' ' | '\\\\u00A0' | '\\\\n' | '\\\\r' )+\n match_count_49 = 0\n while true\n alt_49 = 2\n look_49_0 = @input.peek( 1 )\n\n if ( look_49_0.between?( 0x9, 0xa ) || look_49_0.between?( 0xc, 0xd ) || look_49_0 == 0x20 || look_49_0 == 0xa0 )\n alt_49 = 1\n\n end\n case alt_49\n when 1\n # at line \n if @input.peek( 1 ).between?( 0x9, 0xa ) || @input.peek( 1 ).between?( 0xc, 0xd ) || @input.peek(1) == 0x20 || @input.peek(1) == 0xa0\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_49 > 0 and break\n eee = EarlyExit(49)\n\n\n raise eee\n end\n match_count_49 += 1\n end\n\n\n end\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 106 )\n\n end", "def test_upper5\n result = upper?(\"RYANSTANTz\")\n assert(result, \"'RYANSTANTz' should be valid because it contains an upper case letter\")\n end", "def case_insensitive(input)\n return 1 unless input\n\n input.split(\"\").each do |i|\n return 0 if /[[:upper:]]/ =~ i\n end\n\n return 1\n end", "def test_match_string\n lisp = %q((progn\n (switch-to-buffer \"a\")\n\n (save-excursion\n (insert \"abcdefg\\n\")\n (goto-char 1)\n (re-search-forward \"^\\\\\\\\(.+\\\\\\\\)$\")\n )\n (match-string 1)))\n\n ruby = lambda{\n##### [with]\n with(:save_excursion) do\n goto_char 1\n re_search_forward('^\\\\(.+\\\\)$')\n end\n match_string 1\n##### [/with]\n }\n assert_equal(el4r_lisp_eval(lisp), ruby[])\n\n end", "def regex_matcher(string, type)\n return false if string.nil?\n case type\n when \"email\"\n string.match(/^\\w+@\\w+\\.com$/)\n when \"mobile\"\n string.match(/^\\d{10}$/)\n when \"ip\"\n valid_part_count = 0\n ip_array = string.split(\".\")\n ip_array.each do |part|\n if (part.match(/^\\d{1,3}$/) and part.to_i <= 255 and part.to_i >= 0)\n valid_part_count += 1\n end\n end\n if valid_part_count == 4\n return true\n else\n return false\n end\n when \"URL\"\n string.match(/[(http)(https)]:\\/\\/(www.)?\\w+\\.\\w+/)\n end\nend", "def checklab(string)\n b = string.downcase\n if /lab/.match(b)\n puts \"#{string} has 'lab' in it\"\n else\n puts \"#{string} does NOT have 'lab' in it\"\n end\nend", "def validates_format_of(content)\n /\\b(?:(?:(?:ai|ae|ao|a|à|ei|eo|e|ia|iai|ie|io|i|oai|oa|oe|oi|o|ò|-)?(?:(?:b|dr|d|f|g|h|j|k|l|mb|mp|m|ndr|ntr|nts|nd|nj|ng|nk|nt|n|p|r|s|tr|ts|t|v|z)(?:'?(?:ai|ae|ao|a|à|ei|eo|e|ia|iai|ie|io|i|oai|oa|oe|oi|o|ò)|-))*(?:b|dr|d|f|g|h|j|k|l|mb|mp|m|ndr|ntr|nts|nd|nj|ng|nk|nt|(?:\\w+)n'n|n|p|r|s|tr|ts|t|v|z)(?:ao|ae|a-|a|à|eo|e|i-|ia|ie|io|oay|oa|oe|o-|o|ò|oy|iay|ey|ay|y))|ah|an|ar|eh|e|i|oh|ô|ao|eo|e|ia|ie|io)\\b/i =~ content\n end", "def private_nets_regex; end", "def test_downcase_string\n test = 'MiXeD'\n down = test.downcase\n assert_equal down, 'mixed'\n end", "def uppercase_alt?(str)\n str == str.upcase\nend", "def test_less_than_3_equal_chars\n\t\tassert_equal(false,compare('1234','1325'))\n\tend", "def test_downcase\n assert_equal 'xyz', value.downcase\nend" ]
[ "0.6137553", "0.60912406", "0.60233766", "0.6018899", "0.5960956", "0.58500963", "0.5798894", "0.57920045", "0.5780985", "0.57408726", "0.5732851", "0.5724394", "0.5691623", "0.5656116", "0.56359", "0.557114", "0.5563196", "0.55368555", "0.5534483", "0.54810584", "0.5474184", "0.54734826", "0.5452804", "0.54518145", "0.5417722", "0.54032946", "0.53828496", "0.5371531", "0.53701776", "0.5366723", "0.5366723", "0.53647697", "0.5345499", "0.53245974", "0.5310923", "0.53104854", "0.52938336", "0.5290528", "0.5286854", "0.5281536", "0.52791315", "0.5273997", "0.52631605", "0.5257315", "0.52450395", "0.5240036", "0.5209365", "0.518293", "0.5176594", "0.51501155", "0.5144914", "0.5117719", "0.51142037", "0.5113064", "0.5113064", "0.5113064", "0.5086194", "0.50855803", "0.5080562", "0.5044085", "0.50384134", "0.5034383", "0.5032642", "0.50310725", "0.5018559", "0.5011487", "0.4997658", "0.4992111", "0.49811277", "0.49635148", "0.49588862", "0.4943773", "0.49414164", "0.49364373", "0.49250942", "0.49250942", "0.49250028", "0.49248776", "0.49157736", "0.49098495", "0.49044427", "0.49006918", "0.4892894", "0.4892665", "0.48852783", "0.4869677", "0.48685873", "0.48678023", "0.48651034", "0.4863369", "0.4861458", "0.4859757", "0.48566875", "0.48500258", "0.48478103", "0.48458406", "0.4833836", "0.4831622", "0.4809766", "0.48091075" ]
0.6180982
0
if RustRegexp.const_defined? :ASCII_RANGE assert('RustRegexpoptions (no options)') do assert_equal RustRegexp::ASCII_RANGE | RustRegexp::POSIX_BRACKET_ALL_RANGE | RustRegexp::WORD_BOUND_ALL_RANGE, OnigRegexp.new(".").options end assert('RustRegexpoptions (multiline)') do assert_equal RustRegexp::MULTILINE | RustRegexp::ASCII_RANGE | RustRegexp::POSIX_BRACKET_ALL_RANGE | OnigRegexp::WORD_BOUND_ALL_RANGE, OnigRegexp.new(".", OnigRegexp::MULTILINE).options end end
def test_extended_patterns_no_flags [ [ ".*", "abcd\nefg", "abcd" ], [ "^a.", "abcd\naefg", "ab" ], [ "^a.", "bacd\naefg", "ae" ], [ ".$", "bacd\naefg", "d" ] ].each do |reg, str, result| m = RustRegexp.new(reg).match(str) puts m.inspect unless m.nil? assert_equal result, m[0] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_regexp\n# (find-node \"(emacs-ja)Regexps\")\n \n conv = lambda{|from,to| assert_equal(to, el4r_conv_regexp(from)) }\n conv[ //, '' ]\n conv[ /a/, 'a' ]\n conv[ /a./, 'a.' ]\n conv[ /a*/, 'a*' ]\n conv[ /a+/, 'a+' ]\n conv[ /a?/, 'a?' ]\n conv[ /[ab]/, '[ab]' ]\n conv[ /[^ab]/, '[^ab]' ]\n conv[ /^ab/, '^ab' ]\n conv[ /ab$/, 'ab$' ]\n conv[ /a|b/, 'a\\|b' ]\n conv[ /(ab)/, '\\(ab\\)' ]\n conv[ /\\As/, '\\`s' ]\n conv[ /s\\Z/, %q[s\\'] ]\n # \\=\n conv[ /\\bball\\B/, '\\bball\\B']\n # \\<\n # \\>\n conv[ /\\w/, '[0-9A-Za-z_]']\n conv[ /\\W/, '[^0-9A-Za-z_]']\n # \\sC\n # \\SC\n # \\D (number)\n end", "def regexp; end", "def regexp; end", "def supports_regexp?\n true\n end", "def supports_regexp?\n true\n end", "def allow_matcher; end", "def each_match_range(range, regex); end", "def invalid_regexp_chars\n @invalid_regexp_chars ||= TwitterCldr::Utils::RangeSet.new(\n [2..7, 55296..57343]\n )\n end", "def regexps; end", "def character_range?( rule_spec )\n return false unless string_pattern?(rule_spec)\n return Grammar.node_has_type?(rule_spec.expression.string_pattern, \"character_set\")\n end", "def is_range?\n self =~ /\\A(([\\d]+)|(['\"][\\w]{1}['\"]))\\.\\.\\.?(([\\d]+)|(['\"][\\w]{1}['\"]))\\z/i\n end", "def spec\n string_match_operator\n string_element_reference_regexp\n string_byteslice\n string_scan\n string_unary_minus\n string_reverse\n string_tr\n\n true\nend", "def match_range(range, match); end", "def regexp=(_arg0); end", "def lex_en_regexp_modifiers; end", "def lex_en_regexp_modifiers; end", "def lex_en_regexp_modifiers; end", "def test_Range_InstanceMethods_include?\n\t\tr = 1..10\n\t\tassert_equal(true, r.include?(5))\n\t\tassert_equal(true, r.include?(5.5))\n\t\tassert_equal(true, r.include?(10))\n\n\t\tr = 1...10\n\t\tassert_equal(false, r.include?(10))\n\n\t\tr = 'a'..'z'\n\t\tassert_equal(true, r.include?('b'))\n\t\tassert_equal(false, r.include?('ruby'))\n\tend", "def range\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 28 )\n return_value = RangeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n c1 = nil\n c2 = nil\n __RANGE133__ = nil\n element_options134 = nil\n\n tree_for_c1 = nil\n tree_for_c2 = nil\n tree_for_RANGE133 = nil\n stream_RANGE = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token RANGE\" )\n stream_CHAR_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new( @adaptor, \"token CHAR_LITERAL\" )\n stream_element_options = ANTLR3::AST::RewriteRuleSubtreeStream.new( @adaptor, \"rule element_options\" )\n begin\n # at line 287:4: c1= CHAR_LITERAL RANGE c2= CHAR_LITERAL ( element_options )?\n c1 = match( CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2057 )\n if @state.backtracking == 0\n stream_CHAR_LITERAL.add( c1 )\n end\n __RANGE133__ = match( RANGE, TOKENS_FOLLOWING_RANGE_IN_range_2059 )\n if @state.backtracking == 0\n stream_RANGE.add( __RANGE133__ )\n end\n c2 = match( CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2063 )\n if @state.backtracking == 0\n stream_CHAR_LITERAL.add( c2 )\n end\n # at line 287:42: ( element_options )?\n alt_61 = 2\n look_61_0 = @input.peek( 1 )\n\n if ( look_61_0 == T__88 )\n alt_61 = 1\n end\n case alt_61\n when 1\n # at line 287:42: element_options\n @state.following.push( TOKENS_FOLLOWING_element_options_IN_range_2065 )\n element_options134 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add( element_options134.tree )\n end\n\n end\n # AST Rewrite\n # elements: c1, element_options, c2\n # token labels: c1, c2\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_c1 = token_stream( \"token c1\", c1 )\n stream_c2 = token_stream( \"token c2\", c2 )\n stream_return_value = return_value ? subtree_stream( \"rule return_value\", return_value.tree ) : subtree_stream( \"token return_value\" )\n\n root_0 = @adaptor.create_flat_list\n # 288:3: -> ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n # at line 288:6: ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n root_1 = @adaptor.create_flat_list\n root_1 = @adaptor.become_root( @adaptor.create( CHAR_RANGE, c1, \"..\" ), root_1 )\n\n @adaptor.add_child( root_1, stream_c1.next_node )\n @adaptor.add_child( root_1, stream_c2.next_node )\n # at line 288:37: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child( root_1, stream_element_options.next_tree )\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child( root_0, root_1 )\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look( -1 )\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing( root_0 )\n @adaptor.set_token_boundaries( return_value.tree, return_value.start, return_value.stop )\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node( @input, return_value.start, @input.look(-1), re )\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 28 )\n\n end\n \n return return_value\n end", "def range\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 28)\n return_value = RangeReturnValue.new\n\n # $rule.start = the first token seen before matching\n return_value.start = @input.look\n\n root_0 = nil\n c1 = nil\n c2 = nil\n __RANGE133__ = nil\n element_options134 = nil\n\n tree_for_c1 = nil\n tree_for_c2 = nil\n tree_for_RANGE133 = nil\n stream_RANGE = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token RANGE\")\n stream_CHAR_LITERAL = ANTLR3::AST::RewriteRuleTokenStream.new(@adaptor, \"token CHAR_LITERAL\")\n stream_element_options = ANTLR3::AST::RewriteRuleSubtreeStream.new(@adaptor, \"rule element_options\")\n begin\n # at line 296:4: c1= CHAR_LITERAL RANGE c2= CHAR_LITERAL ( element_options )?\n c1 = match(CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2062) \n if @state.backtracking == 0\n stream_CHAR_LITERAL.add(c1)\n end\n __RANGE133__ = match(RANGE, TOKENS_FOLLOWING_RANGE_IN_range_2064) \n if @state.backtracking == 0\n stream_RANGE.add(__RANGE133__)\n end\n c2 = match(CHAR_LITERAL, TOKENS_FOLLOWING_CHAR_LITERAL_IN_range_2068) \n if @state.backtracking == 0\n stream_CHAR_LITERAL.add(c2)\n end\n # at line 296:42: ( element_options )?\n alt_61 = 2\n look_61_0 = @input.peek(1)\n\n if (look_61_0 == T__88) \n alt_61 = 1\n end\n case alt_61\n when 1\n # at line 296:42: element_options\n @state.following.push(TOKENS_FOLLOWING_element_options_IN_range_2070)\n element_options134 = element_options\n @state.following.pop\n if @state.backtracking == 0\n stream_element_options.add(element_options134.tree)\n end\n\n end\n # AST Rewrite\n # elements: c2, element_options, c1\n # token labels: c1, c2\n # rule labels: return_value\n # token list labels: \n # rule list labels: \n # wildcard labels: \n if @state.backtracking == 0\n\n return_value.tree = root_0\n stream_c1 = token_stream(\"token c1\", c1)\n stream_c2 = token_stream(\"token c2\", c2)\n stream_return_value = return_value ? subtree_stream(\"rule return_value\", return_value.tree) : subtree_stream(\"token return_value\")\n\n root_0 = @adaptor.create_flat_list!\n # 297:3: -> ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n # at line 297:6: ^( CHAR_RANGE[$c1,\\\"..\\\"] $c1 $c2 ( element_options )? )\n root_1 = @adaptor.create_flat_list!\n root_1 = @adaptor.become_root(@adaptor.create!(CHAR_RANGE, c1, \"..\"), root_1)\n\n @adaptor.add_child(root_1, stream_c1.next_node)\n @adaptor.add_child(root_1, stream_c2.next_node)\n # at line 297:37: ( element_options )?\n if stream_element_options.has_next?\n @adaptor.add_child(root_1, stream_element_options.next_tree)\n\n end\n\n stream_element_options.reset();\n\n @adaptor.add_child(root_0, root_1)\n\n\n\n return_value.tree = root_0\n\n end# - - - - - - - rule clean up - - - - - - - -\n return_value.stop = @input.look(-1)\n\n if @state.backtracking == 0\n\n return_value.tree = @adaptor.rule_post_processing(root_0)\n @adaptor.set_token_boundaries(return_value.tree, return_value.start, return_value.stop)\n\n end\n rescue ANTLR3::Error::RecognitionError => re\n report_error(re)\n recover(re)\n return_value.tree = @adaptor.create_error_node!(@input, return_value.start, @input.look(-1), re)\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 28)\n\n end\n \n return return_value\n end", "def get_regex(pattern, encoding='ASCII', options=0)\n Regexp.new(pattern.encode(encoding),options)\nend", "def match(regexp); end", "def regexp\n @regexp ||= Regexp.compile(source.to_s, Regexp::IGNORECASE)\n end", "def test_Range_InstanceMethods_member?\n\t\tr = 1..10\n\t\tassert_equal(true, r.member?(5))\n\t\tassert_equal(true, r.member?(5.5))\n\t\tassert_equal(true, r.member?(10))\n\n\t\tr = 1...10\n\t\tassert_equal(false, r.member?(10))\n\n\t\tr = 'a'..'z'\n\t\tassert_equal(true, r.member?('b'))\n\t\tassert_equal(false, r.member?('ruby'))\n\tend", "def test_match_regexp\n pattern = /Hello,*/\n value = \"Hello, World\"\n check = Maze::Checks::AssertCheck.new\n check.match pattern, value\n end", "def regexp_literal\n # RegularExpressionLiteral::\n # \t/ RegularExpressionBody / RegularExpressionFlags\n pos0 = @pos\n return nil unless @codes[@pos] == 0x2f\n\n body = regexp_body\n flags = regexp_flags\n return ECMA262::ECMA262RegExp.new(body, flags)\n end", "def matches_options?(type, regexp)\n case type\n when :option_name then options.any? { |n, _| regexp =~ n }\n when :option_value then options.any? { |_, v| regexp =~ v }\n when :command_name then regexp =~ options[:command]\n end\n end", "def test_Range_InstanceMethods_compare\n\t\tassert_equal(true, (1..3) == Range.new(1,3))\n\t\tassert_equal(false, (1..3) == (2..4))\n\tend", "def consume_unicode_range; end", "def test_Range_InstanceMethods_excludes\n\t\tassert_equal(true, (1..10) === 5)\n\t\tassert_equal(false, (1..10) === 15)\n\t\tassert_equal(true, (1..10) === 3.14159)\n\t\tassert_equal(true, ('a'..'j') === 'c')\n\t\tassert_equal(false, ('a'..'j') === 'z')\n\tend", "def monocle(inputString)\n\toptic = Regexp.new(inputString)\n\treturn optic\nend", "def start_re; end", "def match_with_eol_regex\n return match_regex if resource[:exact]\n return /^(?>#{match_regex})#{$/}/\n end", "def test_a_regexp_can_search_a_string_for_matching_content\n assert_equal 'match', \"some matching content\"[/match/]\n end", "def define_regexp\n # Default pattern if there is no tags specified on command line\n if @options[:tags].nil?\n pattern = 'TODO|FIXME'\n else\n # Parse defined tags on command line\n pattern = ''\n tags_names = @options[:tags].split(',')\n tags_names.each do |tag_name|\n pattern << (pattern.empty?) ? \"#{tag_name}\" : \"|#{tag_name}\"\n end\n end\n pattern\n end", "def test_parser_handles_trailing_restricted_email_text\n valid_from_name = 'From Name'\n\n email_text_assert valid_from_name, \"#{valid_from_name},\"\n email_text_assert valid_from_name, \"#{valid_from_name} ,\"\n email_text_assert valid_from_name, \"#{valid_from_name} ,\"\n email_text_assert valid_from_name, \"#{valid_from_name} , ,\"\n email_text_assert valid_from_name, \"#{valid_from_name}<\"\n email_text_assert valid_from_name, \"#{valid_from_name} <\"\n email_text_assert valid_from_name, \"#{valid_from_name} <<\"\n email_text_assert valid_from_name, \"#{valid_from_name} < <\"\n email_text_assert valid_from_name, \"#{valid_from_name}>\"\n email_text_assert valid_from_name, \"#{valid_from_name} >\"\n email_text_assert valid_from_name, \"#{valid_from_name} >>\"\n email_text_assert valid_from_name, \"#{valid_from_name} > >\"\n email_text_assert valid_from_name, \"#{valid_from_name},<<>>,\"\n email_text_assert valid_from_name, \"#{valid_from_name} ,<<>>,\"\n end", "def test_parser_handles_leading_restricted_email_text\n valid_from_name = 'From Name'\n\n email_text_assert valid_from_name, \",#{valid_from_name}\"\n email_text_assert valid_from_name, \", #{valid_from_name}\"\n email_text_assert valid_from_name, \",, #{valid_from_name}\"\n email_text_assert valid_from_name, \", , #{valid_from_name}\"\n email_text_assert valid_from_name, \"<#{valid_from_name}\"\n email_text_assert valid_from_name, \"< #{valid_from_name}\"\n email_text_assert valid_from_name, \"<< #{valid_from_name}\"\n email_text_assert valid_from_name, \"< < #{valid_from_name}\"\n email_text_assert valid_from_name, \">#{valid_from_name}\"\n email_text_assert valid_from_name, \"> #{valid_from_name}\"\n email_text_assert valid_from_name, \">> #{valid_from_name}\"\n email_text_assert valid_from_name, \"> > #{valid_from_name}\"\n email_text_assert valid_from_name, \",<<>>,#{valid_from_name}\"\n email_text_assert valid_from_name, \",<<>>, #{valid_from_name}\"\n end", "def regex_end_prefix\n Regexp.new(\"endline#{VM_PREFIX}\")\nend", "def lex_en_regexp_modifiers=(_arg0); end", "def lex_en_regexp_modifiers=(_arg0); end", "def lex_en_regexp_modifiers=(_arg0); end", "def regex\n Regexp.new(@str)\n end", "def test_Range_InstanceMethods_eql?\n\t\tassert_equal(true , (1..10).eql?(Range.new(1,10)))\n\t\tassert_equal(false, (1..10).eql?([1..10]))\n\tend", "def regexp(r0, which)\n source, stop_index = r0.source, r0.stop_index\n return factor_result(source, stop_index, stop_index+$&.length) \\\n if source.index(@regexps[which],stop_index)==stop_index\n terminal_parse_failure(r0, which)\n end", "def matched_by_basic_range?(range)\n if range.kind_of?(Composition)\n s = range.composition\n elsif range.respond_to?(:to_str)\n s = range.to_str.downcase\n return true if s == WILDCARD\n else\n return false\n end\n\n composition == s ||\n composition.index(s + HYPHEN) == 0\n end", "def matching_lines(regex); end", "def test_parser_handles_surrounding_restricted_email_text\n valid_from_name = 'From Name'\n\n email_text_assert valid_from_name, \",#{valid_from_name},\"\n email_text_assert valid_from_name, \", #{valid_from_name} ,\"\n email_text_assert valid_from_name, \",, #{valid_from_name} ,,\"\n email_text_assert valid_from_name, \", , #{valid_from_name} , ,\"\n email_text_assert valid_from_name, \"<#{valid_from_name}<\"\n email_text_assert valid_from_name, \"< #{valid_from_name} <\"\n email_text_assert valid_from_name, \"<< #{valid_from_name} <<\"\n email_text_assert valid_from_name, \"< < #{valid_from_name} < <\"\n email_text_assert valid_from_name, \">#{valid_from_name}>\"\n email_text_assert valid_from_name, \"> #{valid_from_name} >\"\n email_text_assert valid_from_name, \">> #{valid_from_name} >>\"\n email_text_assert valid_from_name, \"> > #{valid_from_name} > >\"\n email_text_assert valid_from_name, \",<<>>,#{valid_from_name},<<>>,\"\n email_text_assert valid_from_name, \",<<>>, #{valid_from_name} ,<<>>,\"\n end", "def utf8_ranges( range )\n ranges = []\n UTF8_BOUNDARIES.each do |max|\n if range.begin <= max\n return ranges << range if range.end <= max\n\n ranges << range.begin .. max\n range = (max + 1) .. range.end\n end\n end\n ranges\nend", "def test_the_left_most_match_wins\n ## assert_equal __, \"abbccc az\"[/az*/]\n assert_equal \"a\", \"abbccc az\"[/az*/]\n\n # The regex matches starting from left to right\n end", "def test_ranges\r\n assert_equal(@range.begin.to_f, @p2.to_f)\r\n assert(@range.cover?(@p5))\r\n assert(@range.end == @p8)\r\n assert(@range2.exclude_end?)\r\n assert_false(@range.exclude_end?)\r\n assert(@range.include?(@p3))\r\n assert(@range.max == @p8)\r\n assert(@range2.max == @p7)\r\n assert(@range.last(3) == [@p6, @p7, @p8])\r\n assert(@range.size == nil)\r\n end", "def range_all\n [ range(:upper_alphas), \n range(:lower_alphas), \n range(:numerals), \n range(:symbols_1), \n range(:symbols_2), \n range(:symbols_3), \n range(:symbols_4), \n range(:symbols_5), \n range(:symbols_6),\n range(:single_quotes),\n range(:double_quotes),\n range(:backtick) ]\n end", "def regex(_obj)\n raise NotImplementedError\n end", "def underlying_matcher; end", "def underlying_matcher; end", "def string_matchers()\n []\n end", "def re; end", "def is_a_3_dot_range?(range)\n range.to_s.include?(\"...\")\nend", "def test_slash_a_anchors_to_the_start_of_the_string\n assert_equal \"start\", \"start end\"[/\\Astart/]\n assert_equal nil, \"start end\"[/\\Aend/]\n end", "def is_a_3_dot_range?(range)\n range.to_s.include?(\"...\")\nend", "def checkTypo(arg,regex)\r\n return !(arg=~regex)\r\nend", "def submatcher; end", "def submatcher; end", "def reserved_nets_regex; end", "def test_slash_a_anchors_to_the_start_of_the_string\n assert_equal 'start', \"start end\"[/\\Astart/]\n assert_equal nil, \"start end\"[/\\Aend/]\n end", "def regexp_anchored?(regexp)\n regexp.source =~ /\\A(\\\\A|\\^).*(\\\\Z|\\$)\\Z/m ? true : false\n end", "def test_two_artgs\n assert_true ArrayPatternMatcher.new(1, 2) === [1, 2]\n assert_true ArrayPatternMatcher.new(Integer, 2) === [1, 2]\n assert_true ArrayPatternMatcher.new(/\\s/, 'a') === [' ', 'a']\n assert_false ArrayPatternMatcher.new(/\\s/, 'b') === [' ', 'a']\n assert_false ArrayPatternMatcher.new(/\\s/) === [' ', 'a']\n end", "def build_regexp(term, opts = {})\n opts[:sensitive] ||= false\n if opts[:sensitive]\n Regexp.new(term, Regexp::EXTENDED)\n else\n Regexp.new(term, Regexp::EXTENDED | Regexp::IGNORECASE)\n end\n end", "def test_Range_InstanceMethods_end\n\t\tassert_equal(10, (1..10).end)\n\t\tassert_equal(10, (1...10).end)\n\tend", "def regex(pattern)\n Regexp.new pattern.regex\n end", "def matched_by_basic_range?(range)\n if range.kind_of?(self.class)\n s = range.recompose.tag\n elsif range.respond_to?(:to_str)\n return true if range.to_str == Const::WILDCARD\n s = self.class.parse(range).tag\n else\n return false\n end\n recompose\n @tag == s || @tag.index(s + Const::HYPHEN) == 0\n rescue\n false\n end", "def matcher; end", "def matcher; end", "def start_re=(_); end", "def to_regexp(text, exact: false, all_whitespace: false, options: nil)\n return text if text.is_a?(Regexp)\n\n escaped = Regexp.escape(text)\n escaped = escaped.gsub('\\\\ ', '[[:blank:]]') if all_whitespace\n escaped = \"\\\\A#{escaped}\\\\z\" if exact\n Regexp.new(escaped, options)\n end", "def test_ABBA_interior_chars_must_be_diff_not_supports_TLS\n input = 'aaaa[qwer]tyui'\n ipv7 = Ipv7.new(input)\n actual_value = ipv7.supportsTls\n assert(! actual_value)\n end", "def test_Range_InstanceMethods_begin\n\t\tassert_equal('a', ('a'..'b').begin)\n\t\tassert_equal('a', ('a'...'b').begin)\n\t\tassert_equal(1, (1..100).begin)\n\t\tassert_equal(1, (1...100).begin)\n\tend", "def test_string_match\n s = \"a\"\n assert_equal(0, string_match(\"a\", s))\n assert_equal(0, string_match(/a/, s))\n assert_equal(0, string_match('\\(a\\|\\b\\)', s))\n assert_equal(0, string_match(/a|b/, s))\n assert_equal(0, string_match(/^a/, s))\n assert_equal(0, string_match(/a$/, s))\n assert_equal(0, string_match(/.*/, s))\n assert_equal(nil, string_match(/not-match/, s))\n \n end", "def test_character_class_vs_alternation\n assert_equal \"crab\", \"crab\"[/[catbatrat]+/]\n assert_equal nil, \"crab\"[/(cat|bat|rat)/]\n end", "def consume_unicode_range\n value = @s.scan(RE_HEX) || ''\n\n while value.length < 6\n break unless @s.peek == '?'\n value << @s.consume\n end\n\n range = {}\n\n if value.include?('?')\n range[:start] = value.gsub('?', '0').hex\n range[:end] = value.gsub('?', 'F').hex\n return create_token(:unicode_range, range)\n end\n\n range[:start] = value.hex\n\n if @s.peek(2) =~ RE_UNICODE_RANGE_END\n @s.consume\n range[:end] = (@s.scan(RE_HEX) || '').hex\n else\n range[:end] = range[:start]\n end\n\n create_token(:unicode_range, range)\n end", "def span_parser_regexps(parsers = T.unsafe(nil)); end", "def test_unicode_9_0\n assert \"A\\u{17000}B\".match(/\\p{Tangut}/)\nend", "def test_Range_InstanceMethods_exclude_end?\n\t\t# TODO, need add some testcases.\n\tend", "def test_condition(i)\n case self.rc_query\n when (:contains || :is)\n #i =~ #self.rc_regex\n when :does_not_contain\n #i =~ #self.rc_regex\n when :is_greater_than\n i > self.rc_integer_value\n when :is_less_than\n i < self.rc_integer_value \n when :equals\n i == self.rc_integer_value\n else\n false \n end\n end", "def regexp_with_working_captures?(node); end", "def regexp?(value, option = nil)\n if option.is_a?(Regexp)\n options = {:regexp => option}\n else\n options = option\n end \n return true if value.nil? and not required(options) \n return false unless value.is_a?(String)\n raise TypeError.new(\"option :regexp is not Regexp.\") unless options[:regexp].is_a?(Regexp)\n return options[:regexp].match(value)\n end", "def consume_unicode_range\n value = @s.scan(RE_HEX) || String.new\n\n while value.length < 6\n break unless @s.peek == '?'\n value << @s.consume\n end\n\n range = {}\n\n if value.include?('?')\n range[:start] = value.gsub('?', '0').hex\n range[:end] = value.gsub('?', 'F').hex\n return create_token(:unicode_range, range)\n end\n\n range[:start] = value.hex\n\n if @s.peek(2) =~ RE_UNICODE_RANGE_END\n @s.consume\n range[:end] = (@s.scan(RE_HEX) || '').hex\n else\n range[:end] = range[:start]\n end\n\n create_token(:unicode_range, range)\n end", "def test_length_boundaries\n assert_length :min, rules(:active_or_rule), :rule_name, Rule::NAME_MIN_LENGTH\n assert_length :max, rules(:active_or_rule), :rule_name, Rule::NAME_MAX_LENGTH\n end", "def pattern2regex(pattern); end", "def valid?\n self =~ /[a-h][1-8]/\n end", "def code_regexp\n unless defined?(@code_regexp)\n @code_regexp = nil\n\n if reg_str = vocab_entry.format_regexp\n @code_regexp = Regexp.union(Regexp.new(reg_str, Regexp::IGNORECASE), /\\A\\*\\Z/)\n end\n end\n @code_regexp\n end", "def parse_range r\n if m = $IPA.match(r)\n a = digits_to_int m[1], 0, 0, 0\n b = digits_to_int m[1], 255, 255, 255\n elsif m = $IPB.match(r)\n a = digits_to_int m[1], m[2], 0, 0\n b = digits_to_int m[1], m[2], 255, 255\n elsif m = $IPC.match(r)\n a = digits_to_int m[1], m[2], m[3], 0\n b = digits_to_int m[1], m[2], m[3], 255\n elsif m = $IPD.match(r)\n a = digits_to_int m[1], m[2], m[3], m[4]\n b = a\n elsif m = $IPRANGE.match(r)\n a = digits_to_int m[1], m[2], m[3], m[4]\n b = digits_to_int m[5], m[6], m[7], m[8]\n elsif m = $CIDR.match(r)\n ip = digits_to_int m[1], m[2], m[3], m[4]\n bits = m[5].to_i\n lobits = (2 ** (32-bits)) - 1\n hibits = (0xffffffff) ^ lobits\n\n a = ip & hibits\n b = a | lobits\n else\n raise \"can't parse IP range #{r.inspect}\"\n end\n [a, b]\nend", "def begin_with(*args, exactly: nil, range: nil)\n raise Regexify::Error.new('#begin_with? called multiple times') unless @str.empty?\n @str += \"^#{parse(args, exactly: exactly, range: range)}\"\n self\n end", "def check_assignment_or_regexp(assignment, regexp)\n return @assigned_paragraph_type == assignment if @assigned_paragraph_type\n return @line =~ regexp\n end", "def valid_syntax? (value)\n value.extend(Rips::Utils::StringVariableExtension)\n value.register? && value.valid_range?(@range)\n end", "def arabic?\r\n self =~ ARABIC_REGEXP\r\n end", "def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end", "def valid_syntax? (value)\n value.extend(Rips::Utils::StringVariableExtension)\n value.inmediate? && value.valid_range?(@range)\n end", "def range(c_begin, c_end, alphabet = DEFAULT_ALPHABET)\n any((c_begin..c_end).to_a, alphabet)\n end", "def locales_contraint\n Regexp.new locales * '|'\n end", "def test_one_arg\n assert_true ArrayPatternMatcher.new(1) === [1]\n assert_true ArrayPatternMatcher.new(Integer) === [1]\n assert_true ArrayPatternMatcher.new(/\\s/) === [' ']\n assert_true ArrayPatternMatcher.new(String) === [' ']\n assert_false ArrayPatternMatcher.new(Integer) === []\n assert_false ArrayPatternMatcher.new(Integer) === [' ']\n assert_false ArrayPatternMatcher.new(String) === ' '\n assert_false ArrayPatternMatcher.new(Array) === ' '\n end" ]
[ "0.5964451", "0.5913886", "0.5913886", "0.5864126", "0.58640945", "0.5765381", "0.57223755", "0.57221174", "0.558431", "0.5540713", "0.5537782", "0.5499215", "0.5493492", "0.5485469", "0.5476689", "0.5476689", "0.5476689", "0.54644084", "0.541113", "0.54087114", "0.5389694", "0.53876173", "0.53121823", "0.5307897", "0.5300779", "0.5292232", "0.5290007", "0.5286744", "0.52734363", "0.52469426", "0.5231013", "0.5227595", "0.51874846", "0.5185077", "0.51791626", "0.5160958", "0.51361525", "0.5127423", "0.5126929", "0.5126929", "0.5126929", "0.5111352", "0.51074934", "0.5104592", "0.5102652", "0.51012087", "0.50991786", "0.50937414", "0.508365", "0.50688744", "0.5060052", "0.50582254", "0.50503135", "0.50503135", "0.5041468", "0.50348437", "0.50326496", "0.503172", "0.5029298", "0.50182205", "0.5010223", "0.5010223", "0.49955758", "0.4988315", "0.49775428", "0.49575227", "0.49532557", "0.49483672", "0.49363303", "0.49307734", "0.4927812", "0.4927812", "0.4913906", "0.49039462", "0.48960668", "0.48878843", "0.48864555", "0.48855373", "0.4883432", "0.48783782", "0.48730284", "0.4869767", "0.48640984", "0.48595282", "0.48549727", "0.4850928", "0.4850481", "0.4839749", "0.4833524", "0.4828862", "0.48182133", "0.48154432", "0.48079795", "0.4799759", "0.4796729", "0.479502", "0.4791809", "0.4789804", "0.4788222", "0.47826874" ]
0.60338444
0
global variables assert('$~') do
def test_dolla_squiggle m = match_data_example assert_equal m[0], $~[0] mismatch_data_example assert_nil $~ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __\n raise \"__ should be replaced with a value or expression to make the test pass.\"\nend", "def checkTypo(arg,regex)\r\n return !(arg=~regex)\r\nend", "def verify_iss=(_arg0); end", "def verify_iss=(_arg0); end", "def =~(p0) end", "def =~(p0) end", "def =~(p0) end", "def verify_not_before=(_arg0); end", "def verify_not_before=(_arg0); end", "def test_placeholder\n assert(true)\n end", "def test_check_capital_non_alpha\r\n assert_equal true, @g.check_capital('?!.(3')\r\n end", "def check ; true ; end", "def test_hack\n assert(true)\n end", "def precheck\n end", "def test_clean_at_sign\n #assert false # bogus assert -- remove or comment out\n assert(@concordance.clean(\"test@@one@two\").eql?(\"test one two\"),\"Clean function not working properly\")\n end", "def test_seqence_valid19\n result = engine(\"TrumppasswORd12%\")\n refute(result, \"'Trump1%' should not be valid because it contains password.\")\n end", "def test_elvar__oddname\n elvar[\"*an/odd+variable!*\"] = 10\n assert_equal(10, elvar[\"*an/odd+variable!*\"])\n end", "def check test\n test = test.gsub(/={1,2}(?!~)/,\"==\").gsub(/(\\[[^\\]]*\\])/,'\\1.to_v')\n (eval(test) ? true : false) rescue false\n end", "def _not_here_\n 'not here'\nend", "def strict_variables; end", "def verify_iss; end", "def verify_iss; end", "def test_seqence_valid16\n result = engine(\"trump12%\")\n refute(result, \"'trump12%' should not be valid because it does not contain upper case letters.\")\n end", "def global?; end", "def assert _args\n \"assert _args;\" \n end", "def pre_match() end", "def assertions=(_arg0); end", "def assertions=(_arg0); end", "def does_not_contain_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n false\n else\n true\n end\nend", "def does_not_contain_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n false\n else\n true\n end\nend", "def test_block_args\n assert('blah'.palindrome?{|x| 'abba'})\n assert(!'blah'.palindrome?{|x| 'boo'})\n end", "def test_no_branch_for_plus_equals_with_interpolated_string\n assert_alias '\"a\" + \"#{b}\" + \"c\"', <<-'INPUT'\n x = \"a\"\n x += \"#{b}\" if something\n x += \"c\" if something_else\n x\n INPUT\n end", "def strict_variables=(_arg0); end", "def checks=(_arg0); end", "def guard; end", "def test_no_branch_for_plus_equals_with_number\n assert_alias '6', <<-INPUT\n x = 1\n x += 2 if something\n x += 3 if something_else\n x\n INPUT\n end", "def test_seqence_valid17\n result = engine(\"TRUMP12%\")\n refute(result, \"'TRUMP12%' should not be valid because it does not contain lower case letters.\")\n end", "def contains_special?(string)\n if string.include?(\"!\") || string.include?(\"#\") || string.include?(\"$\")\n true\n else\n false\n end\nend", "def assertions; end", "def assertions; end", "def containsSpecial(password)\n if password.include?(\"!\") || password.include?(\"$\") || password.include?(\"#\")\n puts \"true\"\n else\n puts \"false\"\n end\nend", "def variable_checker(variable)\n $user_variables[variable.upcase.ord - 65]\n end", "def test_two_slashes\n\texpect_error(\"\\n\\n\\n</x/>\", # on two lines due to rubymode.el\n\t\t /slash appears at both beginning and end/, 4)\n end", "def environment_matchers=(_arg0); end", "def contains_special(string)\n if (string.include?('!') || string.include?('#') || string.include?('$'))\n true\n else\n false\n end\nend", "def =~(*args, &block)\n # only one-arg call supported. any other invocation\n # will have a bridge method interposed which would\n # require different args to __storeRubyVcGlobal\n raise ArgumentError, 'expected 1 arg'\n end", "def test_code = assert_equal('MX', @territory.code)", "def contains_special(str)\n if str.include? ('!') or str.include? ('#') or str.include? ('$')\n true\n else\n false\n end\nend", "def test_nonhero_is_vulnerable\n end", "def verify_sub=(_arg0); end", "def verify_sub=(_arg0); end", "def test_is_a_letter\n assert_equal true, RPN.letter?('c').zero?\n refute_equal true, RPN.letter?('$').zero?\n end", "def contains_special(password)\n if password.include?(\"!\") || password.include?(\"#\") || password.include?(\"$\")\n puts \"Acceptable\"\n else \n puts \"Password must contain at least one of the following: !, #, or $\"\n end\nend", "def enable_check_variables\n add option: \"-check-variables=true\"\n end", "def ignore_comment\n\traise 'Expected #' if gets[ 0 ] != '#'\nend", "def match(x)\n $look == x or expected(\"#{x}\")\n getChar\n skipWhite\nend", "def exact_glob?(glob)\n !glob.include?('*') && !glob.include?('?') && !glob.include?('[') && !glob.include?('{')\n end", "def is_valid_email(str)\n # check 1: include? 1 @\n # check 2: include? 1 .\n # check 3: split into an array to check(if) downcase, . after @\n\nend", "def test_shouting_with_no_exclamation_mark\n remark = 'I HATE YOU' # => \"I HATE YOU\"\n assert_equal 'Whoa, chill out!', bob.hey(remark), feedback(remark) # => true\n end", "def match=(_); end", "def test_contain_password11\n result = contains_password?(\"passwrd1*\")\n assert(result, \"'passwrd1*' should be valid because it doesn't contain 'password'\")\n end", "def does_not_contain_special str\n !(str.include?(\"#\") || str.include?(\"!\") || str.include?(\"$\"))\n end", "def test_12_accepts_doesnt_include_password\n result = not_including_username?(\"HatBox1992!\", \"gdavida\")\n assert(result, \"HatBox1992! does not include your username, should be valid\")\n end", "def test_arg_check_3string\n \t@args = ArgumentCheck.new\n \tassert_equal(false, @args.arg_check(['poop', 'poopy', 'poopypoop']))\n end", "def authorized? name\n\t$master_regex ||= /^#{$master.gsub('.','\\.')}(\\/.*)?$/\n\tname.to_s =~ $master_regex\nend", "def test_compound_branch_w_3_terms_t_t_assign\n assert interpret('var=0; true && true || var=99; :var').zero?\n end", "def test_10_accepts_doesnt_include_password\n result = doesnt_include_password?(\"Hat123!!\")\n assert(result, \"Hat123!! has non alphanumeric, should be valid\")\n end", "def corrector=(_); end", "def variable_regex\n /\n \\$ # start tag\n ([a-zA-Z_][\\w_]*) # our variables are starting with $ and are followed by\n # upcase letters or _. We want to match the \n # variable name\n /xm\n end", "def check_vars\n @to_load.each do |hash|\n assert_not_nil(instance_variable_get(hash[:name]))\n end\n end", "def test_match \n begin\n md = @regexp =~ @s\n puts \"\\n#{regexp} =~ #{@s} yields #{@regexp =~ @s} and $~=#{$~.inspect}\"\n\n rescue => e\n $stderr.print e.message \n $stderr.print e.backtrace.join(\"\\n\")\n raise #re-raise\n end \n end", "def pre_match\n end", "def global_variables() end", "def test_name_generator_with_valid_input\nresult = name_generator(\"SH&$3aw(,n\")\nassert_equal(\"xX_ShAwN_Xx\", result)\nend", "def test_check_capital_contains\r\n assert_nil @g.check_capital('abDc')\r\n end", "def assert_non_destructive\n assert_equal('/usr/local/bin', @abs_path)\n assert_equal('usr/local/bin', @rel_path)\n end", "def check_include\n runs = 100000\n string = '1;3@5~7]9>' * 50\n chars = [0x0A, # \\n\n 0x21, # !\n 0x23, # #\n 0x24, # $\n 0x25, # %\n 0x26, # &\n 0x2A, # *\n 0x2B, # +\n 0x2D, # -\n 0x3A, # :\n 0x3C, # <\n 0x3D, # =\n 0x3E, # >\n 0x40, # @\n 0x5B, # [\n 0x5C, # \\\n 0x5D, # ]\n 0x5E, # ^\n 0x5F, # _\n 0x60, # `\n 0x7B, # {\n 0x7D, # }\n 0x7E # ~\n ]\n measure \"\\n-> include @ #{runs} : \" do\n runs.times do\n 0.upto(string.length - 1) do |pos|\n chars.include?(string[pos].ord)\n end\n end\n end \nend", "def filter_out?(line)\n # \"./lib\" in project dir, or \"/usr/local/blahblah\" if installed\n assert_lib_path = File.expand_path(\"../..\", __FILE__)\n assert_macros_path = File.join(assert_lib_path, \"assert/macros\")\n assert_bin_regex = %r{bin/assert\\:}\n (line.rindex(assert_lib_path, 0) &&\n !line.rindex(assert_macros_path, 0)\n ) ||\n line =~ assert_bin_regex\n end", "def test_m_greater_1\n assert_not_nil \"troubles\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"private\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"oaten\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"orrery\" =~ PorterStemmer::Porter1::MGR1\n assert_not_nil \"crepuscular\" =~ PorterStemmer::Porter1::MGR1\n end", "def test_contains_four_eachface\n assert true == false\n end", "def variable!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n\n type = VARIABLE\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 38:5: '$' ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '-' | '_' )+\n match( 0x24 )\n # at file 38:9: ( 'a' .. 'z' | 'A' .. 'Z' | '0' .. '9' | '-' | '_' )+\n match_count_11 = 0\n while true\n alt_11 = 2\n look_11_0 = @input.peek( 1 )\n\n if ( look_11_0 == 0x2d || look_11_0.between?( 0x30, 0x39 ) || look_11_0.between?( 0x41, 0x5a ) || look_11_0 == 0x5f || look_11_0.between?( 0x61, 0x7a ) )\n alt_11 = 1\n\n end\n case alt_11\n when 1\n # at line \n if @input.peek(1) == 0x2d || @input.peek( 1 ).between?( 0x30, 0x39 ) || @input.peek( 1 ).between?( 0x41, 0x5a ) || @input.peek(1) == 0x5f || @input.peek( 1 ).between?( 0x61, 0x7a )\n @input.consume\n else\n mse = MismatchedSet( nil )\n recover mse\n raise mse\n end\n\n\n\n else\n match_count_11 > 0 and break\n eee = EarlyExit(11)\n\n\n raise eee\n end\n match_count_11 += 1\n end\n\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 6 )\n\n end", "def variable_name? word\n word.start_with?('@') or word.start_with?('$')\n end", "def test_sometimes_missing_parentheses_are_ambiguous\n # eval \"assert_equal 5, my_global_method 2, 3\" # ENABLE CHECK\n eval \"assert_equal(5, my_global_method(2, 3))\" # ENABLE CHECK\n #\n # Ruby doesn't know if you mean:\n #\n # assert_equal(5, my_global_method(2), 3)\n # or\n # assert_equal(5, my_global_method(2, 3))\n #\n # Rewrite the eval string to continue.\n #\n end", "def assert_non_destructive \n assert_equal(\"C:\\\\Program Files\\\\Windows NT\\\\Accessories\", @fpath)\n assert_equal(\"C:\\\\Program Files\\\\Windows NT\\\\Accessories\", @bpath)\n assert_equal(\"C:\\\\Program Files\\\\File[5].txt\", @dpath)\n assert_equal(\"C:\\\\PROGRA~1\\\\WINDOW~1\\\\ACCESS~1\", @spath)\n assert_equal(\"\\\\\\\\foo\\\\bar\\\\baz\", @upath)\n assert_equal(\"foo\\\\bar\\\\baz\", @npath)\n assert_equal(\"Z:\\\\\", @rpath)\n assert_equal(\"\\\\\\\\foo\\\\bar\", @xpath)\n assert_equal(\"\\\\\\\\foo\", @ypath)\n assert_equal(\"\\\\\\\\\", @zpath)\n assert_equal(\"\", @epath)\n assert_equal(\"C:\\\\foo\\\\bar\\\\\", @ppath)\n assert_equal(\"C:\\\\foo\\\\..\\\\bar\\\\.\\\\baz\", @cpath)\n end", "def t__87!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 32)\n\n type = T__87\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 38:9: '~'\n match(?~)\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out(__method__, 32)\n\n end", "def test_8_return_false_if_letter_not_in_word\r\n $word = \"test\"\r\n letter = \"d\"\r\n results = letter_test(letter)\r\n assert_equal(false, results)\r\n end", "def test_1\n\t\tputs check_custom nil\n\t\tputs check_custom \"hi\"\n\t\tputs check_custom 'hi(there)'\n\tend", "def test_not_let\n RPN rpn = RPN.new(2)\n let = 'foo'\n refute_equal let, 'let'\n refute rpn.check_let(let)\n end", "def verify_not_before; end", "def verify_not_before; end", "def invariable?\n false\n end", "def global_variables_exist(text)\n\ttext.each_line do |line|\n\n\t\t# Only want the global variables, function lines come later.\n\t\tif lineHasGlobalVariable(line) and not lineIsFunctionStart(line)\n\n\t\t\t# puts line\n\t\t\treturn true\n\t\tend\n\tend\n\treturn false\nend", "def test_check_let\n RPN rpn = RPN.new(1)\n let = 'let'\n assert_equal let, 'let'\n assert rpn.check_let(let)\n end", "def handy_method()\n ENV[@sentinel_var] = \"foo\"\n new_env = { @sentinel_var => \"bar\" }\n\n Facter::Util::Resolution.with_env new_env do\n ENV[@sentinel_var].should == \"bar\"\n return\n end\n end", "def handy_method()\n ENV[@sentinel_var] = \"foo\"\n new_env = { @sentinel_var => \"bar\" }\n\n Facter::Util::Resolution.with_env new_env do\n ENV[@sentinel_var].should == \"bar\"\n return\n end\n end", "def test_special_characters\n v = Verify.new\n return_code = v.verify_second_pipeset('2.s3', '2.s3')\n assert_equal 1, return_code\n end", "def global?; true end", "def test_01_precondition_for_sanity()\n\t\t\n\t\tputs \"---------------------- START OF SANITY PRE-CONDITION ----------------------\"\n\t\tcreateRazooAccount(\"Normal\", \"User\", \"normaluser@aol.com\", \"123456\")\n\t\tlogout()\t\n\t\tcreateRazooAccount(\"OrgAdmin\", \"User\", \"orgadmin@aol.com\", \"123456\")\n\t\tlogout()\n\t\tlogin(\"srajkumar.here@gmail.com\", \"razoo1\")\n\t\tgrantOrgAdminRights(\"/admin\", \"orgadmin@aol.com\", \"410832480\")\n\t\tlogout()\n\t\tputs \"---------------------- END OF SANITY PRE-CONDITION ----------------------\"\n\tend", "def should_log?(path)\n /\\./ !~ path\n end", "def scm_symbol?; SCM_FALSE; end", "def test_refute\r\n a = false\r\n refute a\r\n end" ]
[ "0.58193773", "0.5751243", "0.57143074", "0.57143074", "0.566705", "0.566705", "0.566705", "0.5551559", "0.5551559", "0.5546082", "0.55127764", "0.5485446", "0.5458042", "0.54202974", "0.5415629", "0.53506213", "0.5317055", "0.5305252", "0.52981436", "0.5257", "0.52562773", "0.52562773", "0.5241294", "0.5237978", "0.52220243", "0.521551", "0.52149904", "0.52149904", "0.5211284", "0.52083063", "0.5207684", "0.5203224", "0.520181", "0.51805973", "0.51792705", "0.51768553", "0.51755583", "0.5175341", "0.51699996", "0.51699996", "0.5165332", "0.516343", "0.51611495", "0.51523155", "0.5140822", "0.51264685", "0.51259005", "0.5125766", "0.5125234", "0.51242816", "0.51242816", "0.51175904", "0.5117471", "0.51155376", "0.5103572", "0.5102545", "0.50783515", "0.5076815", "0.5067669", "0.5066274", "0.5066268", "0.5065078", "0.5062648", "0.50529265", "0.5050112", "0.50357187", "0.50304043", "0.50260997", "0.5026092", "0.50255686", "0.50244486", "0.50191534", "0.5018019", "0.5016227", "0.50034", "0.5002872", "0.5001836", "0.49988207", "0.4992597", "0.49895576", "0.49894005", "0.4984073", "0.49820584", "0.49811122", "0.49809146", "0.49791396", "0.49700466", "0.49670345", "0.49667788", "0.49667788", "0.4966618", "0.49636355", "0.4954752", "0.4952147", "0.4952147", "0.49366218", "0.4933188", "0.49267602", "0.49253097", "0.49238244", "0.4920103" ]
0.0
-1
GET /requests GET /requests.json
def index @requests = Request.all respond_to do |format| format.html # index.html.erb format.json { render json: @requests } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @requests = Request.all\n\n render json: @requests\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def friend_requests\n get(\"users/requests\").requests\n end", "def index\n @requests = Request.paginate(:page => params[:page], :per_page => 8).order(\"created_at DESC\").find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def get_requests\n @requests\n end", "def requests\n @requests_obj.list\n end", "def list_requests\n # stub\n end", "def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end", "def show\n @request = Request.find(params[:id])\n\n render json: @request\n end", "def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def requests\n\t\tRequest.find(:all)\n\tend", "def requests\n REQUESTS\n end", "def request_data(request_url)\n\n uri = URI.parse(request_url)\n response = Net::HTTP.get_response(uri)\n data = JSON.parse(response.body)\n return data\n\nend", "def index\n @requests = Request.authorize_requests_for current_user.id\n respond_to do |format|\n format.html { }\n format.json { render :json => @requests}\n format.xml { render :xml => @requests.to_xml}\n end\n end", "def index\n @requests = Request.all\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get(path, query={})\n request_json :get, path, query\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def request_json(url)\n JSON.parse(@access_token.get(\"#{SITE}#{url}\").body)\n end", "def index\n requests = Request.where(status: 0)\n if requests\n render json: requests, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n }\n },\n status: :ok\n else\n render status: :unprocessable_entity\n end\n end", "def my_request\n request = Request.where(user_id: @current_user.id)\n if request\n render json: {\n status: 'success',\n message: 'Requests found',\n data: request,\n },\n status: :ok\n else \n render json: {\n status: 'no-content',\n message: 'Requests not found',\n },\n status: :no_content\n end\n end", "def json_get(path, params={})\n json_request(:get, path, params)\n end", "def request(url, expires_in)\n return [] unless enabled?\n\n response = http.cache(expires_in).get(url)\n return [] if response.status != 200\n JSON.parse(response.to_s.force_encoding(\"utf-8\"))\n end", "def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end", "def index\n if current_user.has_role? :admin\n @requests = Request.ordered\n else\n @requests = current_user.requests.ordered\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def get endpoint\n do_request :get, endpoint\n end", "def request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def requests_get\n @attributes[:requests_get]\n end", "def show\n\t\t@request = Request.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @request }\n\t\tend\n\tend", "def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end", "def get()\n return @http.request(@req)\n end", "def index\n @http_requests = HttpRequest.order(\"created_at DESC\").page(params[:page]).per(10)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get(request)\n _request(request) { |client, options| client.get options }\n end", "def userrequests\n @requests = Request.where(user_id: params[:user_id])\n render json: { total: @requests.size, requests: @requests.as_json(:methods => [:is_republishable] ) }, status: 200\n end", "def show \n\t @request = Request.find(params[:id])\n\t respond_to do |format|\n\t format.html # show.html.erb\n\t format.json { render json: @request }\n\t end \n \tend", "def rest_get(url)\n JSON.parse(RestClient.get(url))\n end", "def index\n render json: RequestItem.all\n end", "def index\n if params[:filter]\n case params[:filter]\n when \"by_me\"\n requests = Request.where(:user_id => current_user.id)\n when \"recent\"\n requests = Request.limit_5\n when \"for_me\"\n requests = []\n current_user.followers.each do |f|\n f.parent.requests.each do |r|\n requests << r\n end\n end\n requests = Request.in(:user_id => current_user.following.map {|f| f.user_id})\n end\n else\n #TODO: change this to paginate\n requests = Request.limit_5\n end\n\n render json: requests\n end", "def get(url, opts = {})\n response = RestClient::Request.new(\n method: :get,\n url: \"#{ENDPOINT_URL}/#{url}\",\n verify_ssl: false,\n headers: {\n 'Content-Type' => 'application/json',\n 'Authorization' => \"Basic #{authorization_hash}\",\n 'client-id' => client_id,\n 'access-token' => access_token\n },\n payload: opts\n ).execute\n\n JSON.parse(response)\n end", "def index\n @request_calls = RequestCall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_calls }\n end\n end", "def get\n JSON.parse(self.class.get(url).response.body)\n end", "def index\n @http_requests = HttpRequest.all\n end", "def index\n if current_client\n @current_client_requests = current_client.requests\n else\n end\n end", "def get\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n if response.code.to_i == 404\n # Handle HTML 404 responses on malformed record ID, emulating API's\n # JSON response.\n raise Errors::RequestError, \"Invalid record identifier: #{@id}\"\n else\n raise Errors::ResponseError\n end\n end", "def index\n if not params[:user].blank?\n if params[:accept].blank?\n @requests = Request.where(statement_id: Statement.where(user: params[:user]) )\n else\n @requests = Request.where(\n statement_id: Statement.where(user: params[:user]),\n accept: params[:accept]\n )\n end\n else\n @requests = Request.all\n end\n \n json_response(@requests)\n end", "def run_json_http_request\n uri = URI.parse @json_url\n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n \n # set up request\n request = Net::HTTP::Get.new uri.request_uri\n \n # get response, convert to hash\n response = http.request request\n response_hash = JSON.parse response.body\n end", "def get_response\n parse_response(parse_JSON(get_request))\n end", "def get url, params={}, headers={}\n uri = URI.parse(url)\n path = uri.path + \"?\" + query_string(default_params.merge(params))\n response = http(uri.host, uri.port).get(path, default_headers.merge(headers))\n JSON.parse(response.body)\n end", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def get_json\n response = @api.request(:get, @location)\n response.body if response.status == 200\n end", "def index\n @travel_requests = TravelRequest.where user_id: current_user.id\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @travel_requests }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end", "def requests\n @requests = @startup.requests.startup_related_requests(current_user.brand_id)\n .order(created_at: :desc)\n end", "def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend", "def request_json\n @request.headers[\"Content-Type\"] = 'application/json'\n @request.headers[\"Accept\"] = 'application/json'\n end", "def retrieve(request = nil)\n request = request ? camelized_hash(HTTP_REQUEST => Request.new(symbolize_keys(request))) : {}\n\n logger.debug('Retrieving request list from mockserver')\n logger.debug(\"URL: #{RETRIEVE_ENDPOINT}. Payload: #{request.to_hash}\")\n\n response = @base[RETRIEVE_ENDPOINT].put(request.to_json)\n logger.debug(\"Got retrieve response: #{response.code}\")\n requests = Requests.new([])\n parse_string_to_json(response.body).map { |result| requests << request_from_json(result) } unless response.empty?\n requests.code = response.code\n requests\n end", "def request(endpoint, params = nil)\n response = connection.get(endpoint, params)\n JSON.parse(response.body)\n end", "def show\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @requests\n end", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def request(endpoint, params = {})\n url = @@url + endpoint\n response = RestClient::Request.execute(method: 'get', url: url, headers: {token: @@token, params: params})\n JSON.parse(response.body)\n end", "def request\n @rest_response.request\n end", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def get(request_opts = {})\n store_result(http(request_opts).get(resolved_path))\n end", "def signrequests_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SignrequestsApi.signrequests_list ...'\n end\n # resource path\n local_var_path = '/signrequests/'\n\n # query parameters\n query_params = {}\n query_params[:'who'] = opts[:'who'] if !opts[:'who'].nil?\n query_params[:'from_email'] = opts[:'from_email'] if !opts[:'from_email'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['Token']\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 => 'InlineResponse2005')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: SignrequestsApi#signrequests_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_data\n uri = URI(\"#{@url_base}/#{@url_path}\")\n uri.query = @params\n use_ssl = { use_ssl: uri.scheme == 'https', verify_mode: OpenSSL::SSL::VERIFY_NONE }\n response = {}\n\n Net::HTTP.start(uri.host, uri.port, use_ssl) do |http|\n request = Net::HTTP::Get.new(uri)\n response = http.request(request)\n end\n\n raise JSON.parse(response.body)['error'] if !JSON.parse(response.body)['error'].nil?\n\n raise \"page_arg_must_be_integer\" if !@page_number.empty? && @page_number.scan(/\\d/).join('').to_i == 0\n\n raise \"no_response\" if JSON.parse(response.body).nil?\n\n raise \"no_orders_found\" if JSON.parse(response.body)['orders'].nil?\n\n { res: JSON.parse(response.body), status: get_response_status(response) }\n end", "def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end", "def index\n unless current_user.is_admin\n raise \"401\"\n end\n gon.requests = Request.all\n end", "def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend" ]
[ "0.71195513", "0.6854284", "0.6853197", "0.67639446", "0.67531043", "0.6720251", "0.6658772", "0.6585643", "0.6530313", "0.64756197", "0.6440112", "0.64036715", "0.6360889", "0.63438714", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6312427", "0.6310229", "0.63059115", "0.6280614", "0.6280291", "0.62471926", "0.6223575", "0.6197743", "0.6197743", "0.6172123", "0.6167977", "0.6148039", "0.6138531", "0.6135714", "0.6129415", "0.6126209", "0.611424", "0.611424", "0.611424", "0.611424", "0.611032", "0.6106889", "0.610525", "0.6098993", "0.6092368", "0.6069484", "0.6057848", "0.6042704", "0.6041803", "0.6022464", "0.6019557", "0.6015836", "0.6015836", "0.60069", "0.59940696", "0.5993591", "0.5992571", "0.5984578", "0.5980173", "0.5975348", "0.5970403", "0.59416234", "0.5929286", "0.59282863", "0.5922181", "0.5919491", "0.5915769", "0.591258", "0.5908662", "0.59064364", "0.5886651", "0.5879608", "0.586918", "0.5865376", "0.5865376", "0.5854756", "0.58531225", "0.5851665", "0.58295953", "0.58289456", "0.58266807", "0.5818414", "0.5806476", "0.58026016", "0.5796335", "0.5790245", "0.57892257", "0.5786809", "0.5786809", "0.57696587", "0.57675874", "0.57661694", "0.576356", "0.57604665", "0.5753543" ]
0.6835143
4
GET /requests/1 GET /requests/1.json
def show respond_to do |format| format.html # show.html.erb format.json { render json: @request } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @requests = Request.all\n\n render json: @requests\n end", "def show\n @request = Request.find(params[:id])\n\n render json: @request\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.where(status: -1)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def show\n @request = Request.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def index\n temp = current_user.id\n # Auf Methode warten, nur noch offene, in der Zukunft liegende Requests \n @requests = Request.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def index\n @requests = Request.paginate(:page => params[:page], :per_page => 8).order(\"created_at DESC\").find_all_by_user_id(current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def show \n\t @request = Request.find(params[:id])\n\t respond_to do |format|\n\t format.html # show.html.erb\n\t format.json { render json: @request }\n\t end \n \tend", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def index\n @requests = Request.all\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def show\n\t\t@request = Request.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @request }\n\t\tend\n\tend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def friend_requests\n get(\"users/requests\").requests\n end", "def get_requests\n @requests\n end", "def requests\n @requests_obj.list\n end", "def list_requests\n # stub\n end", "def index\n @requests = Request.all\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def requests\n\t@title = \"Gate Requests\"\n\t@user = User.find(params[:id])\n\t@requests = Relationship.where(:accessed_id => params[:id], :accepted => false)\n\t\n\trender 'requests'\n end", "def request(args = {})\n response = @client.get(args[:url],\n argument_hash(args[:args] || {},\n args[:symbols] || []))\n JSON.parse(response.body)\n end", "def request (url_requested, api_key)\n url_builded = url_requested + \"&api_key=\" + api_key\n\n url = URI(url_builded)\n\n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = true\n\n request = Net::HTTP::Get.new(url)\n\n response = https.request(request)\n\n JSON.parse(response.read_body)\nend", "def show\n @request_status = RequestStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request_status }\n end\n end", "def index\n requests = Request.where(status: 0)\n if requests\n render json: requests, :include => {\n :user => {\n :only => [:id, :firstname, :lastname]\n }\n },\n status: :ok\n else\n render status: :unprocessable_entity\n end\n end", "def requests\n REQUESTS\n end", "def get(path, query={})\n request_json :get, path, query\n end", "def get\n uri = request_uri\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n retries = Europeana.max_retries\n \n begin\n response = http.request(request)\n rescue Timeout::Error, Errno::ECONNREFUSED, EOFError\n retries -= 1\n raise unless retries > 0\n sleep Europeana.retry_delay\n retry\n end\n \n json = JSON.parse(response.body)\n raise Errors::RequestError, json['error'] unless json['success']\n json\n rescue JSON::ParserError\n if response.code.to_i == 404\n # Handle HTML 404 responses on malformed record ID, emulating API's\n # JSON response.\n raise Errors::RequestError, \"Invalid record identifier: #{@id}\"\n else\n raise Errors::ResponseError\n end\n end", "def show\n @request = current_user.requests.find(params[:id])\n end", "def simple_request(method, url)\n uri = URI.parse(url)\n request = Net::HTTP::Get.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request[\"App-Id\"] = ENV[\"salt_edge_app_id\"]\n request[\"Secret\"] = ENV[\"salt_edge_secret\"]\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n } \n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n #puts response.body\n return JSON.parse(response.body)\n end", "def requests\n\t\tRequest.find(:all)\n\tend", "def request_data(request_url)\n\n uri = URI.parse(request_url)\n response = Net::HTTP.get_response(uri)\n data = JSON.parse(response.body)\n return data\n\nend", "def get endpoint\n do_request :get, endpoint\n end", "def json_get(path, params={})\n json_request(:get, path, params)\n end", "def index\n render json: RequestItem.all\n end", "def my_request\n request = Request.where(user_id: @current_user.id)\n if request\n render json: {\n status: 'success',\n message: 'Requests found',\n data: request,\n },\n status: :ok\n else \n render json: {\n status: 'no-content',\n message: 'Requests not found',\n },\n status: :no_content\n end\n end", "def show\n @request_call = RequestCall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request_call }\n end\n end", "def show\n @request = Request.find(params[:id])\n respond_with(@request)\n end", "def index\n if current_client\n @current_client_requests = current_client.requests\n else\n end\n end", "def requests_get\n @attributes[:requests_get]\n end", "def index\n @http_requests = HttpRequest.order(\"created_at DESC\").page(params[:page]).per(10)\n end", "def index\n @requests = Request.authorize_requests_for current_user.id\n respond_to do |format|\n format.html { }\n format.json { render :json => @requests}\n format.xml { render :xml => @requests.to_xml}\n end\n end", "def get(path)\n request = Net::HTTP::Get.new @uri.path+'/'+path\n request.basic_auth @api_key, ''\n request['User-Agent'] = USER_AGENT\n response = @https.request request\n JSON.parse response.body\n end", "def get(request)\n do_request(request) { |client| client.http_get }\n end", "def index\n @http_requests = HttpRequest.all\n end", "def retrieve(request = nil)\n request = request ? camelized_hash(HTTP_REQUEST => Request.new(symbolize_keys(request))) : {}\n\n logger.debug('Retrieving request list from mockserver')\n logger.debug(\"URL: #{RETRIEVE_ENDPOINT}. Payload: #{request.to_hash}\")\n\n response = @base[RETRIEVE_ENDPOINT].put(request.to_json)\n logger.debug(\"Got retrieve response: #{response.code}\")\n requests = Requests.new([])\n parse_string_to_json(response.body).map { |result| requests << request_from_json(result) } unless response.empty?\n requests.code = response.code\n requests\n end", "def api_get url_suffix\n url = URI::encode \"#{@@oauth_info[:api_url]}/gems/#{url_suffix}\"\n data = {:client_id => @@oauth_info[:client_id]}\n headers = {:Authorization => \"Bearer #{@access_token}\"}\n\n conn = get_conn url\n #Try request 3 times\n for i in 1..3\n res = conn.get(url, data, headers)\n if res.status == 200 then return JSON.parse(res.body) end\n sleep 1\n end\n raise OAuthSessionError, \"GET Failed. Status: #{res.status}. Body: #{res.body}\"\n end", "def index\n @request_calls = RequestCall.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_calls }\n end\n end", "def show\n @crawl_request = CrawlRequest.find(params[:id])\n\n render json: @crawl_request\n end", "def request(url, expires_in)\n return [] unless enabled?\n\n response = http.cache(expires_in).get(url)\n return [] if response.status != 200\n JSON.parse(response.to_s.force_encoding(\"utf-8\"))\n end", "def index\n @contact = current_user.contacts.find(params[:contact_id])\n @requests = @contact.requests\n\n respond_with @requests\n end", "def get_request( id )\n url = \"#{self.url}/#{id}?auth=#{self.authtoken}\"\n status, response = rest_get( url )\n return status, response['details'] if ok?( status ) && response['details']\n return status, ''\n end", "def request_api(url)\n begin\n response = RestClient.get(url)\n print(\"response: \", response)\n JSON.parse(response)\n rescue\n return nil\n end\n \n \n end", "def show\n @gig_request = GigRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gig_request }\n end\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def request_json(url)\n JSON.parse(@access_token.get(\"#{SITE}#{url}\").body)\n end", "def index\n if current_user.has_role? :admin\n @requests = Request.ordered\n else\n @requests = current_user.requests.ordered\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end", "def show\n @request = Request.find(params[:id])\n end", "def show\n \n @all_listing_requsts = Request.where(listing_id: params[:id])\n render json: @all_listing_requsts\n end", "def show\n render json: @request_item\n end", "def getJson(url)\r\n request_uri = url\r\n request_query = ''\r\n url = \"#{request_uri}#{request_query}\"\r\n result = getJsonFromUrl(url)\r\n return result\r\nend", "def get(path)\n request 'GET', path\n end", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def invoke_request(url)\n site = RestClient::Resource.new(url, \"dHgVM1emGoTyr8zHmVNH\")\n return JSON.parse(site.get(:accept=>\"application/json\"))\nend", "def index\n unless params[:requests] && params[:requests].is_a?(Array)\n render :json => {:error => \"Must pass an array of requests\"}, :status => :bad_request and return\n end\n\n if params[:requests].size > MAX_REQUESTS\n render :json => {:error => \"This batch API accepts a maximum of #{MAX_REQUESTS} requests\"}, :status => :bad_request and return\n end\n\n fetcher = Batchy::Fetcher.new(app: Rails.application, requests: params[:requests]).run\n render :json => {:succeeded => fetcher.succeeded, :failed => fetcher.failed, :responses => fetcher.responses}, :status => :ok\n end", "def show\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n\n respond_with @requests\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def index\n if params[:filter]\n case params[:filter]\n when \"by_me\"\n requests = Request.where(:user_id => current_user.id)\n when \"recent\"\n requests = Request.limit_5\n when \"for_me\"\n requests = []\n current_user.followers.each do |f|\n f.parent.requests.each do |r|\n requests << r\n end\n end\n requests = Request.in(:user_id => current_user.following.map {|f| f.user_id})\n end\n else\n #TODO: change this to paginate\n requests = Request.limit_5\n end\n\n render json: requests\n end", "def get()\n return @http.request(@req)\n end", "def get(request)\n _request(request) { |client, options| client.get options }\n end", "def index\n if not params[:user].blank?\n if params[:accept].blank?\n @requests = Request.where(statement_id: Statement.where(user: params[:user]) )\n else\n @requests = Request.where(\n statement_id: Statement.where(user: params[:user]),\n accept: params[:accept]\n )\n end\n else\n @requests = Request.all\n end\n \n json_response(@requests)\n end", "def make_request(url)\n response = RestClient.get(url)\n parsed_response = JSON(response)[\"items\"]\nend", "def get(url, headers = {})\n http :get, \"#{url}.json\", headers\n end", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n\n result\nend", "def get(path)\n request(:get, path, {})\n end", "def fetch_experiment(id)\n url = @base + \"experiments/#{id}.json?token=#{@token}\"\n puts url\n response = JSON.parse(RestClient.get(url))\nend", "def index\n @travel_requests = TravelRequest.where user_id: current_user.id\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @travel_requests }\n end\n end", "def show\n @borrow_request = BorrowRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrow_request }\n end\n end", "def json_get(url)\n get url, :parse=>true\n end", "def get(request_opts = {})\n store_result(http(request_opts).get(resolved_path))\n end", "def request_info\n @requests = Request.ordered\n end", "def show\n @request = Request.find(params[:id])\n #@sorted_trips = @request.get_sorted_trips\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @request }\n end\n end", "def index\n @request_statuses = RequestStatus.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @request_statuses }\n end\n end" ]
[ "0.6923948", "0.6775905", "0.6691131", "0.6687603", "0.6687603", "0.6601547", "0.6509265", "0.64060545", "0.64060545", "0.64060545", "0.64060545", "0.6389414", "0.6377212", "0.62783706", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6263007", "0.6221878", "0.61859804", "0.61859804", "0.61842704", "0.61725116", "0.6150768", "0.61396736", "0.6123454", "0.60687506", "0.60664636", "0.6060908", "0.605296", "0.6039844", "0.6013379", "0.60102993", "0.5955823", "0.5935936", "0.5921716", "0.5921613", "0.5921347", "0.5920556", "0.59187806", "0.59163547", "0.5913627", "0.59101963", "0.5893194", "0.5877485", "0.58433694", "0.5830459", "0.58236897", "0.581346", "0.5811869", "0.5792206", "0.5791074", "0.57859856", "0.5775907", "0.5774756", "0.5771156", "0.5765633", "0.5760124", "0.57511836", "0.5750292", "0.5744925", "0.5726633", "0.5724793", "0.5724793", "0.5718419", "0.5710421", "0.57058626", "0.57034785", "0.5703064", "0.5698831", "0.5696723", "0.5690821", "0.5690821", "0.5675701", "0.5675465", "0.566802", "0.5661356", "0.56521076", "0.56462353", "0.561795", "0.5599461", "0.5597629", "0.5597255", "0.5582033", "0.5580595", "0.557904", "0.55772287", "0.5575208", "0.5573249", "0.5570232", "0.55695575", "0.5569429" ]
0.5719245
71
DELETE /requests/1 DELETE /requests/1.json
def destroy @request.destroy respond_to do |format| format.html { redirect_to requests_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_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 @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { message('You have successfully deleted this request') }\n format.json { head :ok }\n end\n end", "def deleteRequest\n\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n scope = Request.where(:user_id => current_user.id)\n\n @request = scope.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :ok }\n end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n request(:delete)\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n head :no_content\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to admin_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete!\n request! :delete\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request = @skill.requests.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to myrequests_path }\n format.json { head :no_content }\n end\n end", "def delete(*args)\n Request.delete(*args)\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 delete\n client.delete(\"/#{id}\")\n end", "def delete_requests\n self.requests.each {|request| request.destroy}\n end", "def destroy\n @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @http_request.destroy\n respond_to do |format|\n format.html { redirect_to http_requests_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n request(:delete, path)\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n respond_with()\n end", "def destroy\n @req.destroy\n respond_to do |format|\n flash[:notice] = \"Req was successfully destroyed.\"\n format.html { redirect_to reqs_url }\n format.json { head :no_content }\n end\n end", "def delete(request)\n do_request(request) { |client| client.http_delete }\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n respond_with(@request)\n end", "def delete(path)\n request 'DELETE', path\n end", "def destroy\n @request_status = RequestStatus.find(params[:id])\n @request_status.destroy\n\n respond_to do |format|\n format.html { redirect_to request_statuses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request_items = @request.request_items\n @request_items.each do |ri|\n ri.destroy\n end\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to(requests_url) }\n format.xml { head :ok }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\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 destroy\n @sa_request.destroy\n respond_to do |format|\n format.html { redirect_to sa_requests_url, notice: 'Sa request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\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 @status_request.destroy\n respond_to do |format|\n format.html { redirect_to status_requests_url, notice: 'Status request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n #@service_request = ServiceRequest.find(params[:id])\n @service_request.destroy\n\n respond_to do |format|\n format.html { redirect_to service_requests_url }\n format.json { head :no_content }\n end\n end", "def 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 @request_datum.destroy\n respond_to do |format|\n format.html { redirect_to request_data_url }\n format.json { head :no_content }\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def delete(request)\n _request(request) { |client, options| client.delete options }\n end", "def destroy\n @visit_request.destroy\n respond_to do |format|\n format.html { redirect_to visit_requests_url, notice: 'Visit request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end", "def delete(request_opts = {})\n store_result(http(request_opts).delete(resolved_path))\n end", "def destroy\n @request_call = RequestCall.find(params[:id])\n @request_call.destroy\n\n respond_to do |format|\n format.html { redirect_to request_calls_url }\n format.json { head :no_content }\n end\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete(path, params = {}, request_options = {})\n request(:delete, path, params)\n end", "def delete(path)\n request(:delete, path)\n end", "def delete(request)\n @connection.delete request.path do |req|\n req.body = request.params\n end\n end", "def destroy\n @request.image = nil\n @request.destroy\n respond_to do |format|\n format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(url)\n do_request(\"delete\", url)\n end", "def destroy\r\n @project_request = ProjectRequest.find(params[:id])\r\n @project_request.delete\r\n \r\n respond_to do |format|\r\n format.html { redirect_to my_requests_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "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 @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def deleted_request\n r = {}\n render json: r,\n root: :data,\n status: :no_content\n end", "def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_request.destroy\n respond_to do |format|\n format.html { redirect_to service_requests_url, notice: 'Service request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(path, params={}, options={})\n request(:delete, api_path(path), params, options)\n end", "def delete(path, params)\n request(:delete, path, {})\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete(path)\n\t\trequest(path, :delete)\n\tend", "def delete(*args)\n request(:delete, *args)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end", "def delete(path, params={})\n request(:delete, path, params)\n end" ]
[ "0.7699295", "0.76810163", "0.76810163", "0.76810163", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7389192", "0.73615795", "0.7333734", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7314506", "0.7310947", "0.7300432", "0.728424", "0.726732", "0.72599304", "0.72479475", "0.7220423", "0.7218483", "0.7188839", "0.7188839", "0.7188839", "0.71806914", "0.715783", "0.7157514", "0.7157514", "0.71274656", "0.7125597", "0.7125121", "0.7125121", "0.7085405", "0.70474625", "0.70405936", "0.70394516", "0.7035986", "0.70342696", "0.7030118", "0.7023059", "0.70073473", "0.69814795", "0.69814426", "0.6977825", "0.69530195", "0.69530195", "0.69530195", "0.69530195", "0.6951421", "0.69492424", "0.69489604", "0.69437677", "0.69437677", "0.69373155", "0.69356054", "0.6908822", "0.69082", "0.6890525", "0.6882026", "0.68688077", "0.68599784", "0.6852538", "0.6851396", "0.68437684", "0.6836594", "0.682858", "0.6826015", "0.6824945", "0.68124986", "0.67947996", "0.67824805", "0.6776917", "0.6776917", "0.6776917", "0.6761701", "0.6755976", "0.67498726", "0.6749689", "0.6746758", "0.6729394", "0.6729394" ]
0.7705958
0
DELETE /crops/1 DELETE /crops/1.json
def destroy Image.find(params[:id]).destroy redirect_to :action => 'index' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @crop.destroy\n respond_to do |format|\n format.html { redirect_to crops_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @clip = Clip.find(params[:id])\n @clip.destroy\n\n respond_to do |format|\n format.html { redirect_to clips_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 @clip.destroy\n respond_to do |format|\n format.html { redirect_to trip_path(@clip.trip.parent), change: 'list' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @couch.destroy\n respond_to do |format|\n format.html { redirect_to couches_url, notice: 'Couch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cocktail = Cocktail.find(params[:id])\n @cocktail.destroy\n\n respond_to do |format|\n format.html { redirect_to cocktails_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 @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def delete!\n Recliner.delete(uri)\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 @dataclip.destroy\n respond_to do |format|\n format.html { redirect_to dataclips_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scribble = Scribble.find(params[:id])\n @scribble.destroy\n\n respond_to do |format|\n format.html { redirect_to scribbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rep.destroy\n respond_to do |format|\n format.html { redirect_to reps_url }\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repa = Repa.find(params[:id])\n @repa.destroy\n\n respond_to do |format|\n format.html { redirect_to repas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crust = Crust.find(params[:id])\n @crust.destroy\n\n respond_to do |format|\n format.html { redirect_to crusts_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete(*rest) end", "def destroy\n @miccropost = Miccropost.find(params[:id])\n @miccropost.destroy\n\n respond_to do |format|\n format.html { redirect_to miccroposts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crop = Crop.find(params[:id])\n @crop.destroy\n\n respond_to do |format|\n format.html { redirect_to([@image, :crops]) }\n format.xml { head :ok }\n end\n end", "def destroy\n @octopus.destroy\n respond_to do |format|\n format.html { redirect_to octopi_url, notice: 'Octopus was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @coche.destroy\n respond_to do |format|\n format.html { redirect_to coches_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end", "def 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 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(options={})\n connection.delete(\"/\", @name)\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crate = Crate.find(params[:id])\n @crate.destroy\n\n respond_to do |format|\n format.html { redirect_to crates_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @coff = Coff.find(params[:id])\n @coff.destroy\n\n respond_to do |format|\n format.html { redirect_to coffs_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 @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @crag.destroy\n respond_to do |format|\n format.html { redirect_to crags_url, notice: 'Crag 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", "def destroy\n @catebg = Catebg.find(params[:id])\n @catebg.destroy\n\n respond_to do |format|\n format.html { redirect_to catebgs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crop_mix.destroy\n respond_to do |format|\n format.html { redirect_to crop_mixes_url, notice: 'Crop mix was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb_datum = ClimbDatum.find(params[:id])\n @climb_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to climb_data_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 delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\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 \n end", "def destroy\n @cake = Cake.find(params[:id])\n @cake.destroy\n\n respond_to do |format|\n format.html { redirect_to cakes_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @cict.destroy\n respond_to do |format|\n format.html { redirect_to cicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @recipy = Recipy.find(params[:id])\n @recipy.destroy\n\n respond_to do |format|\n format.html { redirect_to recipies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climate = Climate.find(params[:id])\n @climate.destroy\n\n respond_to do |format|\n format.html { redirect_to climates_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 @cropland.destroy\n respond_to do |format|\n format.html { redirect_to croplands_url, notice: 'Cropland was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @scrobble = Scrobble.find(params[:id])\n @scrobble.destroy\n\n respond_to do |format|\n format.html { redirect_to scrobbles_url }\n format.json { head :no_content }\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 @sculpture.destroy\n respond_to do |format|\n format.html { redirect_to sculptures_url }\n format.json { head :no_content }\n end\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end", "def destroy\n @coffeeshop.destroy\n respond_to do |format|\n format.html { redirect_to coffeeshops_url, notice: 'Coffeeshop was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @photo1 = Photo1.find(params[:id])\n @photo1.destroy\n\n respond_to do |format|\n format.html { redirect_to photo1s_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n @clip.destroy\n respond_to do |format|\n format.html { redirect_to clips_url, notice: \"Clip was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @chronicle.destroy\n respond_to do |format|\n format.html { redirect_to chronicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @troop = Troop.find(params[:id])\n @troop.destroy\n\n respond_to do |format|\n format.html { redirect_to troops_url }\n format.json { head :ok }\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 @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_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 destroy\n @grocery = Grocery.find(params[:id])\n @grocery.destroy\n\n head :no_content\n end", "def destroy\n @crowd = Crowd.find(params[:id])\n @crowd.destroy\n\n respond_to do |format|\n format.html { redirect_to crowds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clip.destroy\n respond_to do |format|\n format.xml { head :no_content }\n format.json { head :no_content }\n end\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\n end", "def destroy\n self.class.mongo_client.database.fs.find(:_id=>BSON::ObjectId.from_string(@id)).delete_one\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 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\n api(\"Delete\")\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def delete\n\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\n end", "def destroy\n @cof.destroy\n respond_to do |format|\n format.html { redirect_to cofs_url }\n format.json { head :no_content }\n end\n end", "def delete!\n connection.delete(\n path: resource_path,\n status: 204\n ).data\n end", "def destroy\n @photoid = Photoid.find(params[:id])\n @photoid.destroy\n\n respond_to do |format|\n format.html { redirect_to photoids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @coffee1.destroy\n respond_to do |format|\n format.html { redirect_to coffee1s_url, notice: 'Coffee1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.6835698", "0.67774457", "0.66544914", "0.6623697", "0.65907073", "0.6563973", "0.6503464", "0.64857924", "0.64815444", "0.64815444", "0.6477888", "0.6457768", "0.645574", "0.64427245", "0.64319974", "0.6416719", "0.6390896", "0.6388758", "0.6388758", "0.6388758", "0.6386186", "0.63718164", "0.6361111", "0.6361111", "0.6355021", "0.63531184", "0.6347158", "0.6339797", "0.63199633", "0.6313762", "0.63112044", "0.63086843", "0.63071835", "0.63069636", "0.63063234", "0.6299965", "0.62929374", "0.6270573", "0.626922", "0.62641007", "0.62635446", "0.6261333", "0.62591887", "0.62542814", "0.62534636", "0.62517315", "0.6245792", "0.6244763", "0.6244034", "0.62398523", "0.623971", "0.6233606", "0.62315845", "0.6229441", "0.6220856", "0.62186587", "0.62186587", "0.62186587", "0.62186587", "0.62155294", "0.6212144", "0.6209559", "0.62044615", "0.620276", "0.6202597", "0.62019175", "0.62019175", "0.620038", "0.6196919", "0.6196919", "0.61941946", "0.61919653", "0.61913913", "0.6190287", "0.61898476", "0.61887205", "0.6187797", "0.6187197", "0.6187197", "0.6185404", "0.6184792", "0.6184786", "0.61834717", "0.6176289", "0.617607", "0.61682534", "0.61666656", "0.61666656", "0.6162118", "0.61608744", "0.61582977", "0.6146065", "0.61449814", "0.6143406", "0.6143239", "0.61421776", "0.6140803", "0.6136134", "0.6135771", "0.61357033", "0.6135004" ]
0.0
-1
Return current user instance, used for authorization. This method can be redefined in ApplicationController if you want to use application's auth system. ex: class ApplicationController < ActionController::Base def current_puffer_user current_user end end In this case returner user model instance should respond to has_role? method, or you should properly redefine +has_puffer_access?+ See +has_puffer_access?+ source and docs.
def current_puffer_user @current_puffer_user ||= begin super rescue NoMethodError ::Admin::SessionsController.model.to_adapter.get(session[:puffer_user_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n \treturn @current_user if defined? @current_user\n \t@current_user = User.first\n end", "def current_user\n if @current_user.nil?\n if ( ! session[ApplicationController::KEY_CURRENT_USER_ID].blank? )\n user_class = session[ApplicationController::KEY_CURRENT_USER_CLASS];\n return nil if user_class.blank?\n @current_user = user_class.instance_eval( \"#{user_class}.find(#{session[ApplicationController::KEY_CURRENT_USER_ID]})\" );\n end\n end\n return @current_user;\n end", "def current_user\n self.class.current_user\n end", "def current_user\n @current_user ||= get(User)\n end", "def current_user\n self.class.current_user\n end", "def current_user\n core_id = Origen::Users::User.current_user_id\n user = app_users.find { |user| user.core_id == core_id }\n user || User.new(core_id)\n end", "def current_user\n ActiveRecord::Base.current_user_proc.call if ActiveRecord::Base.current_user_proc\n end", "def get_user\n @current_user = current_user\n end", "def current_user\n return @current_user\n end", "def current_user\n appctrl_set_user()\n return @current_user\n end", "def current_user\n # has to be public with @ so accessible everywhere\n # checks if current user is already defined before using database\n #using find_by_id instead of find to avoid errors\n @current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]\n end", "def current_user\n return unless session[:user_id]\n User.find(session[:user_id])\n end", "def current_user\n get_from_options_or_controller(:current_user)\n end", "def current_user\n User.find(current_user_id)\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n\t\tif session[:user_id].present?\n\t\t\tUser.find(session[:user_id])\n\t\tend\n\tend", "def current_user\n @current_user ||= ::Billfold::user_class.find_by_id(session[:user_id])\n end", "def current_user\n @current_user if logged_in?\n end", "def current_user\n @current_user if logged_in?\n end", "def get_current_user\n if @current_user\n return @current_user\n else\n @current_user = User.find_by(id: session[:user_id])\n end\n end", "def current_user\n if valid_session?\n User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n end\n end", "def current_user\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n # ||= is used for memoization of @current_user variable\n end", "def current_user\n @current_user ||= fetch_user_from_request\n end", "def current_user\n User.get_user(session[:user_id]) if session[:user_id]\n end", "def current_user() # :doc:\n @current_user ||= begin\n if api_request?\n UserSession.find.full?(&:user) ||\n authenticate_by_api_key_in_params || \n authenticate_by_api_key_in_http_auth\n else\n UserSession.find.full?(&:user)\n end\n end\n end", "def current_user\n if !@current_user.nil?\n @current_user\n elsif !session[:current_user_id].nil?\n begin\n @current_user = User.find(session[:current_user_id])\n rescue ActiveRecord::RecordNotFound\n @current_user = nil\n end\n end\n end", "def current_user\n @current_user ||= current_user_session.record unless current_user_session.nil?\n end", "def current_user\n ActiveRecord::Base.current_user_proc.call if ActiveRecord::Base.current_user_proc\n end", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n\t\t\tUser.find(session[:user_id])\n\t\tend", "def current_user\n User.first\n end", "def current_user\n User.first\n end", "def current_user\n User.first\n end", "def current_user\n \t# If the session contains the user_id with non-nil, we have ID of some user\n \t# Return the user object for ID\n \t\n \t# Using instance variable helps limit calls\n \t# \"Or equals\" means \n \t\t# if nil, set it -- if not, return it\n \tif session[:user_id]\n \t@current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n @current_user ||= auth_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def get_user\n @current_user = current_user\n end", "def current_user\n @current_user ||=\n if session[:userid]\n User.find_by_userid(session[:userid])\n end\n end", "def current_user\n\t\t# checks to see if session exists, if so, loads user\n\t\t# and saves into @user instance variable\n\t\t@current_user ||= User.find(session[:user_id]) if session[:user_id]\n\tend", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end", "def current_user\n # User.find would throw an error if we cannot find the user\n User.find_by({ id: session[:user_id] })\n end", "def current_user\n return unless session[:user_id]\n @current_user ||= User.first(:id => session[:user_id])\n end", "def current_user\n # retrieve from database on every request instead of\n # storing it as global variable when current_user=\n # is called to prevent user information becoming stale.\n @current_user ||= (session[:uid] && User.find_by_id(session[:uid])) || nil\n end", "def current_user\n if session[:user_id]\n user = User.find(session[:user_id])\n else\n nil\n end\n end", "def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end", "def current_user\n User.all(public_key: security.public_key).first\n end", "def current_user\n return @current_user if @current_user.present?\n\n session_user_id = session[:user_id]\n @current_user = if session_user_id.present?\n User.find_by(id: session_user_id) || AdminUser.find_by(id: session_user_id)\n end\n end", "def current_user\n # retrieve from database on every request instead of \n # storing it as global variable when current_user= \n # is called to prevent user information becoming stale.\n @current_user ||= (session[:uid] && User.find_by_id(session[:uid])) || nil\n end", "def current_user\n # authorization initialization if not run yet\n # (in the case of paper_trial it might not have run)\n authorization_init\n @logged_in_user\n end", "def current_user\n if session[:user_id]\n User.find_by(id: session[:user_id])\n end\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = User.find_by_id(session[:user_id])\n end", "def current_user\n if session[:user_id]\n return User.find(session[:id])\n else\n return nil\n end\n end", "def current_user\n @current_user ||= Manybots::User.new(self.verify_credentials)\n end", "def current_user\n @current_user ||= find_logged_in_user\n end", "def current_user\n @current_user ||= User.find_by(uid: session[:user_uid])\n end", "def current_user\n @current_user ||= User.find_by(uid: session[:user_uid])\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.record\n end", "def current_user\n @current_user || = User.find(session[:user_id]) if session[:user_id]\n end", "def current_user\n if session[:admin]\n @current_user ||= Admin.find(session[:user_id]) if session[:user_id]\n else\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n end\n end", "def current_user\n return @current_user if @current_user.present?\n\n if session[:uid]\n @current_user = User.from_session(session)\n end\n\n @current_user\n end", "def current_user\n @user ||= User.find(session[:user_id])\n end", "def current_user\n\t\tif session[:user_id]\n\t\t\t@current_user = User.find(session[:user_id])\n\t\telse\n\t\t\tapi_key = ApiKey.where(access_token: token_and_options(request)).first\n\t\t\t@current_user = User.find(api_key.user_id) if api_key\n\t\tend\n\tend", "def current_user\n @current_user\n end", "def current_user\n User::TYPES.each do |mapping|\n user = self.send(\"current_#{mapping.to_s.downcase}\")\n return user unless user.nil?\n end\n end", "def current_user\n if session[:current_user_id]\n @current_user ||= User.find(session[:current_user_id])\n end\n end", "def get_user\n @current_user = current_admin || current_user\n end", "def current_user\n load_session\n @current_user\n end", "def current_user\n @user ||= @factory.current_user\n end", "def get_current_user\n @user = User.find(params[:user_id])\n # @user = current_user\n end", "def current_user\n @current_user ||= begin\n # Check for session[:uid] here? That would mean that for token auth the\n # user always needs to be logged out (e.g. in UserController#create).\n # Looks a bit more robust this way:\n try_login\n find_current_user if session && session[:uid]\n end\n end", "def current_user\n @_current ||= User.find_by(id: session[:user_id])\n end", "def current_user\n if session[:user_id]\n @current_user = User.find(session[:user_id])\n end\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n User.find_by(id: session[:user_id])\n end", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n\tif(session[:user_id])\n\t\t@u ||= User.first(id: session[:user_id])\n\t\treturn @u\n\telse\n\t\treturn nil\n\tend\nend", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @current_user ||= User.find(session[:user_id])\n end\n end", "def current_user\n return @current_user ||= User.find(session[:user_id]) unless session[:user_id].nil?\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def current_user\n if session[:user_id]\n @user = User.find(session[:user_id])\n end\n end", "def current_alchemy_user\n raise NoCurrentUserFoundError if !defined?(current_user)\n current_user\n end", "def current_user\n return @current_user if defined?(@current_user)\n @current_user = current_user_session && current_user_session.user\n end", "def current_user\n cu = super\n return cu unless cu.blank?\n return nil unless doorkeeper_token && doorkeeper_token.accessible?\n @current_user ||= User.find_by_id(doorkeeper_token.resource_owner_id)\n end", "def current_user\n if @current_user.nil?\n @current_user = User.find_by(id: session[:user_id])\n else\n @current_user\n end\n end", "def current_user\n @current_user || User.find(session[:user_id]) if session[:user_id]\n \tend", "def current_user\n @current_user = current_user_session && current_user_session.record\n end" ]
[ "0.7571162", "0.7537186", "0.75358003", "0.7500328", "0.749589", "0.74914634", "0.74897945", "0.7485818", "0.74837977", "0.7482105", "0.74799097", "0.7463718", "0.7463391", "0.745315", "0.74430585", "0.74367815", "0.74355406", "0.74205005", "0.74205005", "0.74155694", "0.74148273", "0.7414704", "0.7413731", "0.74093527", "0.74052685", "0.74021786", "0.7397151", "0.73930573", "0.7389213", "0.73875", "0.73875", "0.73858386", "0.73858386", "0.73858386", "0.73800665", "0.7378083", "0.7378003", "0.7378003", "0.7378003", "0.7378003", "0.7378003", "0.7378003", "0.7378003", "0.7378003", "0.7377532", "0.73742706", "0.7365172", "0.7365172", "0.7363837", "0.7363218", "0.7360994", "0.7360978", "0.73606986", "0.7358706", "0.73511374", "0.7349196", "0.7348307", "0.73454523", "0.7337157", "0.73337567", "0.7326638", "0.732593", "0.7324693", "0.7324693", "0.73206455", "0.7318116", "0.7314484", "0.731377", "0.7311859", "0.7311714", "0.73112303", "0.7310101", "0.73098844", "0.73093295", "0.73082924", "0.7307859", "0.7307248", "0.7306335", "0.73061603", "0.73009133", "0.7298848", "0.7298848", "0.7298848", "0.7293461", "0.7293461", "0.7285948", "0.7285948", "0.7285948", "0.7285948", "0.72834", "0.72834", "0.7282259", "0.7281848", "0.7281848", "0.72781533", "0.7276", "0.7275923", "0.7270985", "0.72684306", "0.7268304" ]
0.7935158
0
Used in before_filter to prevent unauthorized access
def require_puffer_user unless has_puffer_access?(puffer_namespace) redirect_to puffer.new_admin_session_url(:return_to => request.fullpath) return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restrict_access\n head :unauthorized and return false unless current_user\n end", "def skip_authorization; end", "def access_denied\n end", "def unauthorized\n end", "def access_denied\n\n end", "def restrict_access\t\n\t\tif current_user.owner == false\n\t\t\tredirect_to user_path(current_user), notice: \"You can't view this page, contact your box owner\"\n\t\tend\t\n\tend", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def rescue_unauthorized\n render nothing: true, status: 403\n end", "def require_login\n authorize_request || render_unathorized(\"Access denied\")\n end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def authorize_access\n # byebug\n redirect_to root_path, alert: \"Access Denied\" unless can? :modify, Post\n end", "def access_control\n \n end", "def restrict_anonymous_access\n return unless current_user.nil?\n\n handle_http_401(t('application.errors.restricted_access'))\n end", "def permission_required \n render_403 unless admin? || @user == current_user\n end", "def prevent_authenticated_user!\n if signed_in?\n head :forbidden\n end\n end", "def require_login\n\t\tauthorize_request || render_unauthorized(\"Access Denied\")\n\tend", "def authorize_unauthenticated_user\n target_action = params[:controller] + '#' + params[:action]\n unless User::DEFAULT_PERMISSIONS.include?(target_action)\n head :unauthorized and return\n end\n end", "def restrict_access\n render :\"/home/http_404\" unless @pet && @pet.user == current_user\n end", "def unauthorized\n\n render_error( :unauthorized )\n\n end", "def allow_access\n !@current_user.nil?\n end", "def unauthorized\n render_json error: 'Access Not Authorized', status: :forbidden\n end", "def user_not_authorized\n redirect_to((request.referrer || root_path) ,notice: \"Authorization error.\")\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def not_authorized\n flash[:error] = I18n.t :forbidden\n response.headers['Status-Code'] = '403'\n redirect_to root_path\n end", "def restrict_access\n render :\"/home/http_404\" unless @profile && @profile.user == current_user\n end", "def authorize\n if session[:user_id] != 3\n raise AccessDenied\n #render \"public/404\", status: :not_found, layout: false\n end\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def authorise_action\n if !logged_in? or (@annotation.source != current_user)\n # TODO: return either a 401 or 403 depending on authentication\n respond_to do |format|\n flash[:error] = 'You are not allowed to perform this action.'\n format.html { redirect_to :back }\n format.xml { head :forbidden }\n end\n return false\n end\n return true\n end", "def redirect_403\n return hit_error(403) unless current_user\n end", "def not_allowed! redirect = root_url\n raise Exceptional::Unauthorized.new(\"Sorry, I was could not perform the action you requested!\")\n end", "def block_unauthenticated_user!\n unless current_user\n return render_unauthorized\n end\n end", "def show\n skip_authorization\n end", "def skip_authorization\n @_authorization_performed = true\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def restrict_access\n unless logged_in?\n flash[:error] = \"You have to login to access this page.\"\n redirect_to login_url\n end\n end", "def access_denied\n render status: 401, text: \"nice try\"\n end", "def authenticate\n CASClient::Frameworks::Rails::Filter.before(self)\n update_current_user(User.eager_load(*eager_loads).find_by(cas_directory_id: session[:cas_user]))\n\n return unless session[:cas_user] && !allow_access\n render(file: File.join(Rails.root, 'public/403.html'), status: :forbidden, layout: false)\n end", "def user_not_authorized\n \tflash[:alert] = \"You are not authorized to perform this action.\"\n \tredirect_to(request.referrer || root_path)\n end", "def filter_object\n # redirect_to(root_url, :notice => \"Do not have permission\") and return\n end", "def restrict_access\n redirect_to root_path if is_superuser_or_admin? == false\n end", "def authorize_user\n if !user_signed_in? || !current_user.admin?\n raise ActionController::RoutingError.new(\"Not Found\")\n end\n end", "def ignore_request_unless_permitted\n return if permitted?\n flash_notice(:permission_denied.t)\n redirect_to(action: \"index_article\") and return\n end", "def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:status => 'failure'}, :status => 403\n }\n end\n end\n end", "def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end", "def access_denied\n if logged_in?\n flash[:notice] = I18n.t('application.not_authorized')\n respond_to do |f|\n f.html do\n unless request.xhr?\n redirect_to current_user.has_any_role? ? admin_nodes_path : root_path\n else\n render text: flash[:notice], status: :forbidden # Render HTML\n end\n end\n f.js do\n render :update do |page|\n page.redirect_to '/admin' # Redirect through JS\n end\n end\n f.json do\n render json: { error: flash[:notice] }.to_json, status: :forbidden\n end\n end\n else\n super\n end\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def user_not_authorized\n flash[:warning] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end", "def deny_access\n if not current_user\n authenticate_user!\n elsif current_user.member?\n redirect_to root_path, :alert => \"Access denied.\"\n end\n end", "def login_required\n authorized? || throw(:halt, :access_denied)\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def not_authorised\n flash[:notice] = 'You are not authorized to perform this action!'\n redirect_back(fallback_location: root_path)\n end", "def unauthorized_user!\n if @user != current_user\n redirect_to root_path, status: :unauthorized, alert: 'You can only perform this action on your own user!'\n end\n end", "def access_denied!\n render partial: 'errors/401', status: 401 && return\n end", "def unauthorized\n head :unauthorized\n end", "def user_not_authorized\n flash[:danger] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end", "def authorized\n redirect_to \"/login\" unless logged_in? \n end", "def check_is_login_required\n authorized_denied unless logged_in?\n end", "def access_forbidden\n if !@authenticated.nil?\n send_response_document :forbidden\n else\n flash.keep\n authentication_needed!\n end\n end", "def unauthenticated\n end", "def require_authorization!\n unless current_user == @event.user\n render json: {}, status: :forbidden\n end\n end", "def ensure_user\n current_user? || deny_access('You must be logged in to perform this action.')\n end", "def unauthorized_access\n flash[:notice] = \"Unauthorized access\"\n redirect_to \"/\"\n return false\n end", "def content_protected\r\n redirect to '/restricted'\r\n end", "def authorize_only_for_admin\n unless authorized?(Admin)\n render :file => \"#{RAILS_ROOT}/public/404.html\", \n :status => 404\n end\n end", "def authorize_user\n # simple authorization: kick out anonymous users from backend actions\n=begin\n if !current_user\n redirect_back_or_default(home_page) and return if action_name =~ /index|edit|update|destroy/\n \n # skip checking permission if user is an admin\n elsif !current_user.has_role?('Admin')\n unless current_user.has_permission?(controller_name, action_name, params)\n flash[:warning] = 'Access Denied'\n redirect_back_or_default(home_page) and return\n end\n end\n=end\n end", "def ensure_permit_access_authorized!\n unless @_bsm_rails_api_authorized\n raise NotSecure, \"This action failed because permit_access filters were not run. Add permit_access to secure this endpoint.\"\n end\n end", "def access_denied\n redirect_to main_app.root_url, alert: \"Not authorized\"\n end", "def login_required\n raise Forbidden unless @current_member #ログイン状態でないとForbiddenを発生させる\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def authorized\n\t unless admin?\n\t redirect_to root_path\n\t end\n end", "def logged_in_authorize\n unless logged_in?\n unauthorized_access\n end\n end", "def require_login\n return head(:forbidden) unless current_user\n end", "def authorized?\n render nothing: true, status: :forbidden if !current_account\n end", "def index\n prevent_non_admin\n end", "def deny_access\n\t\t# store location for forwarding users after log in to their intended location\n\t\tstore_location\n \tredirect_to signin_path, :notice => \"Please sign in to access this page.\"\n \tend", "def user_not_authorized\n flash[:alert] = \"Access denied.\"\n redirect_to (request.referrer || root_path)\n end", "def user_not_authorized\n flash[:alert] = \"You are not authorized to perform this action.\"\n redirect_to(request.referrer || root_path)\n end", "def ensure_authenticated_user\r\n head :unauthorized unless current_user\r\n end", "def user_not_authorized\n flash[:alert] = \"You are not authorized to perform that action.\"\n redirect_to(request.referrer || root_path)\n end", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def login_required\n authorized? || access_denied\n end", "def unauthorized\n render :text => \"You are not authorized to perform this action\", :status => 401\n end", "def authorize\n redirect_to login_url, alert: \"Not authorized\" if !current_user\n end", "def require_authorization( message=\"You are not authorized to access this resource.\" )\n\t\tfinish_with( HTTP::FORBIDDEN, message )\n\tend", "def login_required\n not_authorized unless current_user\n end", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def deny_access\n\t\tstore_location\n\t\tredirect_to signin_path, :notice => \"Please sign in to access this page.\"\n\tend", "def without_access_control\n previous_state = Authorization.ignore_access_control\n Authorization.ignore_access_control(true)\n result = yield\n ensure\n Authorization.ignore_access_control(previous_state)\n result\n end", "def access_denied\n if @current_user\n render_401\n else\n redirect_to \"#{FUSESOURCE_URL}/login?return_to=#{external_url_to(request.request_uri)}\"\n end\n end", "def permission_denied\n\t\tif current_user\n\t\t\tflash[:warning] = \"Sorry, your account is not allowed to do that. Try another?\"\n\t\telse\n\t\t\tflash[:notice] = \"To do that, I need to know who you are.\"\n\t\tend\n\t\tif request.request_method == :get\n\t\t\tsession[:next] = request.request_uri\n\t\telse\n\t\t\tsession.delete(:next)\n\t\tend\n\t\tlogin_page = url_for :controller => :user_sessions, :action => :new, :secure => true, :host => request.host\n\t\trespond_to do |format|\n\t\t\tformat.html { return redirect_to login_page }\n\t\t\tformat.js { render(:update) {|p| p.redirect_to login_page }}\n\t\t\tformat.all { render :file => \"#{RAILS_ROOT}/public/403.html\", :status => '403 Forbidden' }\n\t\tend\n\t\tno_cache\n\tend" ]
[ "0.8207742", "0.7865589", "0.76097804", "0.7578242", "0.75616854", "0.75197655", "0.7509085", "0.7509085", "0.7482987", "0.7467636", "0.74079233", "0.73983616", "0.73949957", "0.73886526", "0.7366004", "0.7363671", "0.73410517", "0.7332605", "0.7325293", "0.7313738", "0.7308983", "0.7293652", "0.72877634", "0.7270951", "0.72403306", "0.7230972", "0.7229529", "0.7229529", "0.72275716", "0.72197974", "0.7208499", "0.7205217", "0.7204614", "0.7203289", "0.7203289", "0.7203289", "0.72023463", "0.71899307", "0.7182861", "0.7182248", "0.71821326", "0.71820766", "0.7166296", "0.7159527", "0.71584433", "0.71412516", "0.71361697", "0.71361285", "0.7135447", "0.71346277", "0.7133552", "0.71319", "0.71310973", "0.71310973", "0.71310973", "0.71310973", "0.71310973", "0.71310973", "0.71310973", "0.71310973", "0.7122512", "0.7121882", "0.71198213", "0.7117604", "0.7110029", "0.71096754", "0.7099947", "0.7094684", "0.7091643", "0.7089559", "0.70778525", "0.70765036", "0.7061366", "0.70499396", "0.7041521", "0.7027939", "0.7026703", "0.70200324", "0.70037264", "0.7002686", "0.7002433", "0.70003635", "0.69976985", "0.69933313", "0.69929904", "0.6988193", "0.6983763", "0.6979454", "0.69777834", "0.6977307", "0.6977307", "0.6977307", "0.69695115", "0.69685495", "0.69647235", "0.6962914", "0.6959613", "0.6956669", "0.6955133", "0.6943738", "0.6939" ]
0.0
-1
create method for iterating through consonants
def consonant(letter) alphabet = "bcdfghjklmnpqrstvwxyz" alphabet2 = alphabet.chars.rotate.join('') each_id = alphabet.index(letter.downcase) next_consonant = alphabet2[each_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_consonants\n \n @@sentence.map { |word|\n if word.start_with?('a','e','i','o','u','A','E','I','O','U') \n \"\" \n else \n consonant_blend = word.split /([aeiou].*)/\n consonant_blend[0]\n\n end\n }\n end", "def consonants_adv(str)\r\n str = vowel_adv(str)\r\n consonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n str = str.downcase\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if consonants.include?(char)\r\n consonants.rotate(1)[consonants.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend", "def next_consonants(vowel_name)\r\n\tconsonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n\tvowel_name = vowel_name.split('')\r\n\tconsonant_name = vowel_name.map do |consonant|\r\n\t if consonants.include?(consonant)\r\n\t consonants.rotate(1)[consonants.index(consonant)]\r\n\t else\r\n\t consonant\r\n\t end\r\n \tend\r\n consonant_name.join\r\nend", "def consonant_checker(array)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n array.map! do |name|\n name_split = name.split('')\n name_split.map! do |char|\n index = 0\n while index < consonant_guide.length\n if char == consonant_guide[index]\n char = consonant_guide[index += 1]\n index += 1\n elsif char == \"z\"\n char = \"b\"\n index += 1\n else\n char\n index += 1\n end\n char\n end\n char\n end\n name_split\n name_join = name_split.join('').capitalize!\n name_join\n end\n p array\nend", "def double_consonants(string)\n result = []\n string.each_char do |char|\n result << char_value(char)\n end\n p result.join\nend", "def double_consonants(str)\n repeater_chars = str.chars.map do |char| \n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n char * 2\n else\n char\n end\n end\n repeater_chars.join\nend", "def double_consonants(str)\n\n new_string = []\n\n str.chars.each do |char|\n if ('aeiouAEIOU').include?(char) == false\n new_string << char*2 \n else \n new_string << char\n end\n end\n\n new_string.join\nend", "def consonant_rep(array_of_char)\n array_of_char.map! do | char |\n consonants = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\n if consonants.include? char\n consonant_index = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z', 'b']\n i = consonant_index.index(char) + 1\n char = consonant_index[i] \n else char = char\n end\n end\n array_of_char\nend", "def consonant_converter(string)\r\n name_array = string\r\n consonant = ['b', 'c', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'm', 'n', 'p', 'q', 'r', 's', 't', 'v', 'w', 'x', 'y', 'z']\r\n counter = 0\r\n consonant_counter = 0\r\n# Outer loop that loops through entire name (first and last)\r\n while counter < name_array.length\r\n# Inner loop that loops through list of consonants, compares them with name, and changes consonants in name\r\n \twhile consonant_counter < consonant.length\r\n \t\tif name_array[counter] == consonant[consonant_counter]\r\n if name_array[counter] == 'z'\r\n \tname_array[counter] = 'b'\r\n break\r\n else\t\r\n \t\t name_array[counter] = consonant[consonant_counter + 1]\r\n \t\t break\r\n \t\t end\r\n \t end\r\n consonant_counter += 1\r\n end\r\n counter += 1\r\n consonant_counter = 0\r\n end \r\n new_name = name_array.join('')\r\n new_name = new_name.split(' ')\r\n new_name.map! { |word| word.capitalize! }\r\n new_name = new_name.join(' ')\r\n return new_name\r\nend", "def double_consonants(string)\n string.chars.inject('') do |str, char|\n char.downcase.count(\"a-z\", \"^aeiou\") > 0 ? str + char * 2 : str + char\n end\nend", "def consonant_cancel(sentence)\n result = []\n arr = sentence.split(\" \")\n\n arr.each do |i|\n cancelled = []\n i.each_char.with_index do |ch, idx|\n if ch == 'a' || ch == \"e\" || ch == \"i\" || ch == \"o\" || ch == \"u\"\n cancelled << i[idx..-1]\n break\n end\n end\n result << cancelled.join\n end\n\n return result.join(\" \")\n\nend", "def double_consonants(string)\n doubled_string = ''\n string.chars.each do |char|\n doubled_string << char\n doubled_string << char if consonant?(char.downcase)\n end\n\n doubled_string\nend", "def double_consonants(str)\n results = \"\"\n str.each_char do |char| \n if char.downcase =~ /[a-z&&[^aeiou]]/\n results << char * 2 \n else\n results << char\n end\n end\n results\nend", "def consonant(letter)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n alphabet2 = alphabet.chars.rotate.join('')\n each_id = alphabet.index(letter.downcase)\n next_consonant = alphabet2[each_id]\n end", "def double_consonants(str)\n str.split(//).map { |chr| chr.match?(/[^aeiou\\d\\W]/i) ? chr + chr : chr }.join\nend", "def next_consonant (last_first)\n last_first.map! do |word|\n word.gsub(/[zdhntbcfgjklmpqrsvwxy]/, 'z' => 'b', 'd' => 'f', 'h' => 'j', 'n' => 'p', 't' => 'v', 'b' => 'c', 'c' => 'd', 'f' => 'g', 'g' => 'h', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'p' => 'q', 'q' => 'r', 'r' => 's', 's' => 't', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z')\n end\nend", "def double_consonants(string)\n final = string.chars.map do |el|\n if %w[a e i o u].include?(el)\n el\n elsif ('a'..'z').include?(el.downcase)\n el * 2\n else\n el\n end\n end\n final.join\nend", "def count_consonants(str)\n str.chars.map do |letter|\n if consonant? letter\n letter = 1\n else\n letter = 0\n end\n end.reduce(0, :+)\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |char, new_str|\n if char =~ /[^aeiou]/ && char =~ /[A-z]/\n new_str << char * 2\n else\n new_str << char\n end\n end\nend", "def consonants # :nodoc:\n /^(y|[bcdfghjklmnprstvwxz]+|qu)/\n end", "def double_consonants(string)\n result = ''\n string.chars.each do |char|\n result += char\n result += char if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n end\n result\nend", "def consonant_cancel(sentence)\r\n newSentence = []\r\n sentence.split(\" \").each do |word|\r\n newWord = word\r\n while !('aeiou'.include?(newWord[0]))\r\n newWord = newWord[1..-1]\r\n end\r\n newSentence << newWord\r\n end\r\n return newSentence.join(\" \")\r\nend", "def consonants(text)\n percent = text.consonants.length / text.length.to_f\n percent * @emphasis[:consonants]\n end", "def double_consonants(string)\n doubled_chars = string.chars.map do |char|\n if char =~ /[A-Za-z]/ && !VOWELS.include?(char)\n char + char\n else\n char\n end\n end\n doubled_chars.join\nend", "def vowel_consonant_adv(str)\r\n \t\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n \t\tstr = str.split('')\r\n \t\tstr_new = str.map do |letter|\r\n if vowels.include?(letter)\r\n \tvowels.rotate(1)[vowels.index(letter)]\r\n else\r\n \tletter.next\r\n end\r\n \tend\r\n \t\tstr_new.join\r\n\tend", "def translate_two_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def consonant_cancel(sentence)\n vowel = \"aeiou\"\n new_arr = []\n sentence.split(\" \").each do |word|\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n new_word = word[i..-1]\n new_arr << new_word\n break\n end\n end\n end\n new_arr.join(\" \")\nend", "def double_consonants(string)\n chars_array = string.chars.map do |x|\n if x =~ /[^AEIOUaeiou0-9\\W]/\n x*2\n else\n x\n end\n end\n \n chars_array.join\nend", "def next_consonant(string)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\t#set index of string \n\tindex = 0\n\t#set index of vowels\n\ti = 0\n\t#create an empty string\n\tconverted_string = \"\"\n\t#for each index of the string, checks if equal to corresponding consonant and if so goes to the next consonant by adding one to the index\n\twhile index < string.length\n\t\t#start with if string has \"z\", converts to \"b\"\n\t\tif string[index] == consonants[20]\n\t\t\tconverted_string += \"b\"\n\t\t#if the string has any consonant besides \"z\"\n\t\telsif string[index] == consonants[i]\n\t\t\tconverted_string += consonants[i+1]\n\t\t#if string has vowels doesnt change character\n\t\telse \n\t\t\tconverted_string += string[index]\n\t\tend\n\t\t#go to next index in string\n\t\tindex += 1\n\t\t#reset vowel index to zero\n\t\ti += 1\n\tend\n\tconverted_string\nend", "def double_consonants(str)\nnew_str = \"\"\n\nstr.each_char do |char|\n\tif /[aeiou\\W\\d\\s]/ =~ char \n\t\tnew_str << char\n\telse\n\t\tnew_str << char << char\n\tend\nend\nnew_str\nend", "def double_consonants(string)\n new_string = ''\n string.each_char do |char|\n if char =~ /[a-z]/i && char =~ /[^aeiou]/i\n new_string << char << char\n else\n new_string << char\n end\n end\n new_string\nend", "def double_consonants(string)\n double_con_string = []\n string.chars.each do |char|\n if char.match?(/[aeiouAEIOU]/)\n double_con_string << char\n elsif char.match?(/[a-zA-Z]/)\n double_con_string << char << char\n else\n double_con_string << char\n end\n end\n double_con_string.join\nend", "def consonant_changer(name)\n consonant_guide = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n name.map! do |chars|\n counter = 0\n while counter < consonant_guide.length\n if chars == consonant_guide[counter]\n chars = consonant_guide[counter += 1]\n counter += 1\n elsif chars == \"z\"\n chars = \"b\"\n counter += 1\n else\n chars\n counter += 1\n end\n end\n chars\n end\n name\n name.join('').capitalize!\nend", "def next_vowel_consonant(str) \r\n #create an array with only vowels or consonants\r\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\",\"a\"]\r\n\tconsonants = (\"a\"..\"z\").to_a\r\n consonants.reject! { |letter| vowels.include?(letter)}\r\n consonants << \"b\" #for looping back to b when z is the letter\r\n\t\r\n\t#convert input into an array of each letter\r\n\tname_array = str.split(\"\")\r\n\t\r\n\t#iterate through each letter\r\n\tname_array.each_with_index do |letter,index|\r\n\t \r\n\t #if it is a vowel, find and replace with next\r\n\t if vowels.include?(letter)\r\n\t vowel_index = vowels.index(letter) + 1\r\n\t str[index] = vowels[vowel_index]\r\n\t \r\n \t #if it is a consonant, find and replace with next\r\n\t elsif consonants.include?(letter)\r\n\t \tc_index = consonants.index(letter) + 1\r\n\t str[index] = consonants[c_index]\r\n\t end\r\n\tend\r\n\tstr\r\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |letter|\n (letter =~ /[b-df-hj-np-tv-z]/i) == 0 ? result_string << letter << letter : result_string << letter\n end\n result_string\nend", "def double_consonants(string)\n doubled_string = ''\n string.each_char do |char|\n char.match(/[a-z&&[^aeiou]]/i) ? doubled_string << char << char : doubled_string << char\n end\n doubled_string\nend", "def consonants(consonants_letter)\r\n consonants = \"bcdefghjklmnpqrstvwxyz\"\r\n current_location = consonants.index(consonants_letter)\r\n new_consonants = current_location + 1\r\n if consonants.index(consonants_letter) == 21\r\n results = \"b\"\r\n else\r\n results = consonants[new_consonants]\r\n end\r\n results\r\nend", "def double_consonants(string)\n output = \"\"\n single_chars = string.chars\n single_chars.each do |char|\n if char.match(/[[a-z]&&[^aeiou]]/i)\n output << char * 2\n else\n output << char \n end\n end\n output\nend", "def double_consonants(string)\n results = []\n\n string.chars.each do |char|\n if char =~ /[\"AEIOUaeiou\"]/ || \n char =~ /\\W/ ||\n char =~ /\\d/\n results << char\n else\n results << char << char\n end\n end\n\n results.join\nend", "def double_consonants(str)\n result = \"\"\n str.chars.each do |ch|\n result << if ch.downcase.match?(/[a-z&&[^aeiou]]/)\n ch * 2\n else\n ch\n end\n end\n result\nend", "def double_consonants(str)\n new_str = ''\n str.each_char do |char|\n if char =~ /[-!aeiou0-9' ']/i\n new_str << char\n else\n new_str << char.concat(char)\n end\n end\n new_str\nend", "def double_consonants(string)\n result_string = ''\n string.each_char do |char|\n if char =~ /[a-z&&[^aeiou]]/i\n result_string << char << char\n else\n result_string << char\n end\n end\n result_string\nend", "def consonant_cancel(sentence)\n\tarry = sentence.split(\" \")\n \tfinal = []\n \tvowel = \"aeiou\"\n \tarry.each do |word|\n len = word.length\n word.each_char.with_index do |char, i|\n if vowel.include?(char)\n final << word[i..-1]\n break\n end\n end\n end\n return final.join(\" \")\nend", "def double_consonants(string)\n consonants = %(bcdfghjklmnpqrstvwxyz)\n string.chars.map{ |char| consonants.include?(char.downcase)? char * 2 : char}.join\nend", "def consonant_changer(name)\n consonant_string = \"bcdfghjklmnpqrstvwxyz\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"z\"\n character = \"b\"\n new_name << character\n elsif consonant_string.include? character\n character = consonant_string[consonant_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n p new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "def next_consonant(name)\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \n\t\t\"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\n\tindex = 0\n\tname = name.split('') # string to array\n\tname_change2 = name.map do |letter| \n\t\tif consonants.include? letter \n\t\t\tconsonants.rotate(1)[consonants.index(letter)]\n\t\telse\n\t\t\tletter\n\t\tend\n\tend\n\tname_change2.join\t# new array convert back to string\nend", "def next_consonant(name)\n name = name.downcase\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n i = 0\n consonants_changed = \"\"\n\n until i == name.length\n consonants_index = consonants.index(name[i])\n if consonants_index == nil\n consonants_changed += name[i]\n elsif consonants_index == 20\n consonants_changed += \"b\"\n else\n consonants_changed += consonants[consonants_index+1]\n end\n i = i + 1\n end\n return consonants_changed\n end", "def caesar(tevertalen, nummer)\n alfabet = ('a'..'z').to_a\n vertaalde_string = \"\"\n\nfor i in 0..tevertalen.length-1\n if alfabet.include? tevertalen[i].downcase\n vertaalde_string += nieuwe_letter(tevertalen[i], nummer)\n else\n vertaalde_string += tevertalen[i]\n end\n end\n vertaalde_string\nend", "def get_next_consonant(consonant,vowels)\n next_consonant = consonant\n loop do\n next_consonant = next_consonant.next\n break if !vowels.include?(next_consonant[-1])\n end\n next_consonant[-1]\nend", "def double_consonants(str)\n str.chars.each_with_object('') do |c, double_str|\n if c =~ /[^(aeiouAEIOU)|\\W|\\d]/\n double_str << c * 2\n else\n double_str << c\n end\n end\nend", "def c\n return $consonants.choice\nend", "def double_consonants(string)\n result = string.split(//).map do |char|\n char =~ /[b-df-hj-np-tv-z]/i ? char * 2 : char\n end\n result.join\nend", "def conjugations\n if block_given?\n yield Conjugations.instance\n else\n Conjugations.instance\n end\n end", "def double_consonants(string)\n string.chars.map { |chr| chr.match(/[bcdfghj-np-tvwxyz]/i) ? chr * 2 : chr }.join\nend", "def consonant_advance(letter)\r\nconsonant = \"abcdefghijklmnopqrstuvwxyz\".delete(\"aeiou\")\r\n if letter == \"z\"\r\n letter = \"b\"\r\n else\r\n letter = consonant[consonant.index(letter) +1]\r\n end \r\nend", "def count_consonants\n text.scan(/[bcdfghjklmnpqrstvwxyz]/).length\n end", "def next_consonant(letter)\n\tc_alphabet = \"bcdfghjklmnpqrstvqwxyzb\"\n \tx = c_alphabet.index(letter)\n \tx += 1\n\t c_alphabet[x]\n\nend", "def double_consonants(str)\n str.gsub(/([a-z&&[^aeiou]])/i,'\\1\\1')\nend", "def consonant_changer(letter)\r\n\tif letter == \"z\"\r\n\t\tnew_letter = \"b\"\r\n\telsif letter == \" \"\r\n\t \tnew_letter = \" \"\r\n\telse\r\n\t\tconsonant_index = \"bcdfghjklmnpqrstvwxyz\".index(letter)\r\n \tnew_letter =\"bcdfghjklmnpqrstvwxyz\"[consonant_index.next]\r\n\tend\r\nend", "def translate_one_consonant( s )\n\n\t\t# store the letters in an array\n\t\tch_array = s.chars\n\n\t\t# then grab the first letter from the array\n\t\tfirst_letter = ch_array.shift\n\n\t\t# put that letter at the back with push and add 'ay'\n\t\tch_array << first_letter + \"ay\"\n\n\t\t# bring it back together\n\t\tch_array.join\n\n\tend", "def next_consonant(name)\n\tconsonants = %w( b c d f g h j k l m n p q r s t v x y z)\n\t\tname = name.downcase.split('')\n\t\tnew_name = name.map do |con|\n\t\tif consonants.include?(con)\n\t\t\tconsonants.rotate(1)[consonants.index(con)]\n\t\telsif consonants == 'z'\n\t\t\tconsonants.replace('b')\n\t\telse\n\t\t\tcon\n\t\tend\n\tend\n\tnew_name.join.capitalize\nend", "def next_consonant(product)\n spot = 0 \n consonants = \"bcdfghjklmnpqrstvwxyz\"\n while spot < product.length\n if product[spot] == \"z\"\n product[spot] = \"b\"\n elsif consonants.split('').include?(product[spot])\n next_spot = consonants.index(product[spot]) + 1 \n product[spot] = consonants[next_spot]\n end\n spot += 1 \n end\n product\nend", "def consonant_cancel(sentence)\n \tnewSentence = \"\"\n\tsentence.split.each do |word|\n \t# puts word\n \tnewSentence = newSentence + \" \" + find_vowel(word)\n end\n \treturn newSentence\nend", "def translate_three_consonants( s )\n\n\t\t\t\t# store the letters in an array\n\t\t\t\tch_array = s.chars\n\n\t\t\t\t# then grab the first letter from the array\n\t\t\t\tfirst_letter = ch_array.shift\n\n\t\t\t\t# then grab the second letter from the array\n\t\t\t\tsecond_letter = ch_array.shift\n\n\t\t\t\t# then grab the third letter from the array\n\t\t\t\tthird_letter = ch_array.shift\n\n\t\t\t\t# put both letters at the back with push and add 'ay'\n\t\t\t\tch_array << first_letter + second_letter + third_letter + \"ay\"\n\n\t\t\t\t# bring it back together\n\t\t\t ch_array.join\n\n\tend", "def get_consonants\r\n\r\n list = Array.new #Define an array in which to store the consonants\r\n\r\n #Give the player an idea of what is coming\r\n puts \"Before you try to guess the secret word, you must specify \" +\r\n \"5 consonants.\\n\\n\"\r\n print \"Press Enter to continue.\"\r\n\r\n Console_Screen.pause #Pause the game\r\n\r\n 5.times do #Iterate 5 times\r\n\r\n Console_Screen.cls #Clear the display area\r\n\r\n #Prompt the player to enter a consonant\r\n print \"\\nPlease enter a consonant and press Enter. \"\r\n\r\n input = STDIN.gets #Collect the player's input\r\n input.chop! #Remove the end of line marker\r\n\r\n #Only accept consonant characters\r\n if input !~ /[bcdfghjklmnpqrstvwxyz]/i then\r\n Console_Screen.cls #Clear the display area\r\n print \"Error: \" + input + \" is not a consonant. Press Enter to \" +\r\n \"continue.\"\r\n Console_Screen.pause #Pause the game\r\n redo #Repeat the current iteration of the loop\r\n end\r\n\r\n #Only accept one character of input per guess\r\n if input.length > 1 then\r\n Console_Screen.cls #Clear the display area\r\n print \"Error: You may only enter one character at a time. Press \" +\r\n \"Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n redo #Repeat the current iteration of the loop\r\n end\r\n\r\n #Do not allow the player to submit the same guess twice\r\n if list.include?(input.upcase) == true then\r\n Console_Screen.cls #Clear the display area\r\n puts list.inspect.gsub(/\"/, \"\") #display letters the user has entered\r\n print \"Error: You have already guessed \" + input + \". Press \" +\r\n \"Enter to continue.\"\r\n Console_Screen.pause #Pause the game\r\n redo #Repeat the current iteration of the loop\r\n else\r\n list.push(input.upcase) #Convert the consonant to uppercase and\r\n end #add it to the list of consonants\r\n\r\n end\r\n\r\n return list #Return the list of consonants to the calling statement\r\n\r\n end", "def double_consonants(string)\n string.gsub(/([b-df-hj-np-tv-z])/i, '\\1\\1')\nend", "def consonant?\n self != 'ㅇ' && kor.chosung?(self)\n 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 get_consonants\n\n\tlist = Array.new #define an array in which to store the consonants\n\n\t#give the player an idea of what is coming\n\tputs \"Before you try to guess the secret word, you must specify 5 \" +\n\t\"consonants. \\n\\n\"\n\tprint \"Press Enter to continue.\"\n\n\tConsole_Screen.pause #pause the game\n\n\t5.times do #iterate 5 times\n\n\t\tConsole_Screen.cls #clear the display area\n\n\t\t#prompt the player to enter a consonant\n\t\tprint \"\\nPlease enter a consonant and press Enter. \"\n\n\t\tinput = STDIN.gets #collect the player's input\n\t\tinput.chop! #remove the end of line marker\n\n\t\t#only accept consonant characters\n\t\tif input !~/[bcdfghjklmnpqrstvwxyz]/i then \n\t\t\tConsole_Screen.cls #clear display area\n\t\t\tprint \"Error: \" + input + \" is not a consonant.\" +\n\t\t\t\"Press Enter to continue\"\n\t\t\tConsole_Screen.pause #pause the game\n\t\t\tredo #repeat the current iteration of the loop\n\t\tend\n\n\t\t#only accept one character of input per guess\n\t\tif input.length > 1 then\n\t\t\tConsole_Screen.cls\n\t\t\tprint \"Error: You may only enter one character at a time\" +\n\t\t\t\"Press Enter to continue.\"\n\t\t\tConsole_Screen.pause #pause the game\n\t\t\tredo #repeat the current iteration of the loop\n\n\t\tend\n \n #do not allow the player to submit the same guess twice\n if list.include?(input.upcase) == true then\n \tConsole_Screen.cls #clear the display area\n \tprint \"Error: You have already guessed\" + input + \n \t\"Press Enter to continue\"\n \tConsole_Screen.pause #pause the game\n \tredo #repeat the current iteration of the loop\n\n else\n \tlist.push(input.upcase) #convert the consonant to uppercase and add\n \t #it to the list of consonants\n end\nend\n return list #return the list of consonants to the calling statement\n\nend", "def isConsonant letter\n\tvowels = ['a', 'e', 'i', 'o', 'u']\n\treturn !(vowels.include?(letter))\nend", "def const_adv(str)\n consonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n str = str.split('')\n str_new = str.map do |char|\n if consonants.include?(char)\n consonants.rotate(1)[consonants.index(char)]\n else\n char\n end\n end\n str_new.join\nend", "def next_consonant(letter)\n\tconsonants = \"bcdfghjklmnpqrstvwxyz\"\n\tif letter == \"z\"\n\t\tnext_consonant = \"b\"\n\telse\n\tnext_consonant = consonants[consonants.index(letter) + 1]\nend\nend", "def next_consonant(letter)\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\ncurrent_index = consonant.index(letter)\nconsonant[current_index + 1]\n\tif letter == \"z\"\n\t\tprint \"b\"\n\telse letter == \" \"\n\t\tprint \" \"\n\tend\nend", "def swapping_consonents(consonant_char)\n consonents = { 'b' => 'c', 'c' => 'd', 'd' => 'f', 'f' => 'g', 'g' => 'h', 'h' => 'j', 'j' => 'k', 'k' => 'l', 'l' => 'm', 'm' => 'n', 'n' => 'p', 'p' => 'q', 'q' => 's', 's' => 't', 't' => 'v', 'v' => 'w', 'w' => 'x', 'x' => 'y', 'y' => 'z', 'z' => 'b' }\n\n consonant_char.map! do |letter|\n if consonents.include?(letter)\n consonents[letter]\n elsif consonents.include?(letter.downcase)\n consonents[letter.downcase].upcase\n else\n letter\n end\n end\nend", "def next_consonant (consonant)\n consonant_downcase = consonant.downcase\n index = CONSONANTS.index(consonant_downcase)\n\n # handle edge case for letter 'z'\n if consonant_downcase == \"z\"\n next_consonant = CONSONANTS[0]\n else\n next_consonant = CONSONANTS[index + 1]\n end\n #Capitalize next letter if the original letter is upper case\n next_consonant = capitalize(consonant, next_consonant)\nend", "def double_consonants(str)\n str.gsub(/([bcdfghjklmnpqrstvwxyz])/i, '\\1\\1')\nend", "def next_letter (name)\n vowels = \"aeiou\".split('')\nalphabet = ('a'..'z').to_a\nconsonants = alphabet - vowels\nname_array = name.split('')\nname_array.map! { |letter|\n if letter == \"u\"\n \"a\"\n elsif letter == \"z\"\n \"b\"\n elsif consonants.include? letter\n consonants[consonants.index(letter) + 1]\n elsif vowels.include? letter\n vowels[vowels.index(letter) + 1]\n else\n letter\n end\n}\nname_array.join('')\nend", "def translate(word)\r\n vowels = \"aeio\".split('').to_a\r\n consonant = \"bcdfghjklmnpqrstuvwxyz\".split('').to_a \r\n answer = []\r\n \r\n while word.split(' ').length == 1 \r\n words = word.split('')\r\n until vowels.include?(words[0])\r\n words = words.rotate(1)\r\n end\r\n words << \"ay\"\r\n return words.join('')\r\n end # one word ^^\r\n \r\n if word.split(' ').length > 1 \r\n words = word.split(' ')\r\n end \r\n words.each do |i|\r\n if vowels.include?(i[0])\r\n i << \"ay\"\r\n answer << i\r\n #return answer\r\n end\r\n end\r\n \r\n words.each do |j|\r\n if consonant.include?(j[0])\r\n j = j.split('').rotate(1).join('') until vowels.include?(j[0])\r\n j = j + \"ay\"\r\n #return j\r\n #j << j #correct format for 1 consonant but it doesnt add to array\r\n answer << j\r\n end\r\n end\r\n \r\n return answer.join(' ')\r\n end", "def determine_if_consonant(some_guess, some_points, session_points)\n\t@player_guess = some_guess\t\t# guess is the players guess coming from the main\n @player_points = some_points\t\t# set up instance for the players current points\n\t@points_for_round = session_points\t# instance variable for whatever points the player spun for on the wheel\n\n # The if statement is used because only consonants are useful data here\n \n\t# if the player_guess is not equal to a vowel the following code will execute\n\tif @player_guess !~ /A|E|I|O|U/\n counter = 0 # a counter is initialized for use in the .each loop\n @masterWordArray.each do |letter| # this is where the .each loop begins. it uses the @masterWordArray as its object\n # # and this array is used in the .each loop to process the data and sort out which \n # # letters can be matched with the master word and which ones wont\n \n if letter == @player_guess then # This if statement is used to compare the current item being processed in the loop\n @randomWordArray[counter] = @player_guess # and the players guess\n @player_points = @player_points.to_i + @points_for_round.to_i\t\t# add the points the player spun for to the current total\n print @player_points\n\n end # end if statement # If the if statement is true than the players guess is assigned to the\n # # @randomWordArray which is masked and replaces the _ that cooressponds to the master word\n \n counter +=1 # increments the counter\n end # ends the each loop\n \n\telse\n\t\tprint \"Please try again you did not enter a consonant. Press Enter to continue.\"\n\t\tConsole_Screen.pause_program\n\tend\t# end if statement\n\n\tConsole_Screen.cls\n #print @masterWordArray\n #print(\"\\n\\n\")\n #print @randomWordArray\n \n return @player_points\t\t# returns the players new amount of points to the calling statement\n \n end", "def consonant_cancel(sentence)\n\n arr = sentence.split(\" \").map do |word|\n removeConsonant(word)\n end\n return arr.join(\" \")\nend", "def cypher(name)\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n\tnew_name = split_reverse(name).map! { |name| \n\t\tname.chars.map! { |char| \n\t\t\tif consonants.include?(char)\n\t\t\t \tconsonant(char)\n\t\t\telsif vowels.include?(char) \n\t\t\t\tvowel(char)\n\t\t\telsif consonants.upcase.include?(char) || vowels.upcase.include?(char) \n\t\t\t\tupcase(char)\n\t\t\telse\n\t\t\t\tspecial_char(char)\n\t\t\tend\n\t\t}\n\t}\n\tjoin(new_name)\nend", "def single_terminal_consonant(infinitive)\n @single_terminal_consonants << infinitive\n end", "def consonant_cancel(sentence)\n words = sentence.split(' ')\n new_words = words.map { |word| del_before_vowel(word) }\n return new_words.join(' ')\nend", "def consonant_swap (secret_name)\n\t\n\tsecret_name.map do |letters|\n\t\t\n\t\tif letters == \" \"\n\t\t\tletters\n\t\telsif letters == \"z\"\n\t\t\tletters.gsub!(/[z]/, \"a\")\n\t\telsif letters =~ /[aeiou]/\n\t\t\tletters\n\t\telse \n\t\t\tletters.next!\n\t\t\tif letters =~ /[aeiou]/\n\t\t\t\tletters.next!\n\t\t\tend\n\t\tend\n\n\tend\n\tsecret_name\nend", "def next_consonant(char)\n char = char.downcase\n compare = \"bcdfghjklmnpqrstvwxyz\"\n\n # not a consonant, i.e., no instance of the variable\n if compare.count(char) == 0\n # puts \"Not a consonant\"\n return nil\n end\n\n consonant_index = compare.index(char)\n\n if consonant_index == compare.length - 1 # end edge case\n return 'b'\n else\n return compare[consonant_index + 1]\n end\nend", "def next_consonant(consonant)\n # handle 'z' edge case\n if consonant == 'z'\n consonant = 'b'\n # if the next letter is a vowel\n elsif 'aeiou'.include?(consonant.next)\n # return the letter after that\n consonant.next.next\n # otherwise, return the next letter\n else\n consonant.next\n end\nend", "def starts_with_consonant?(s)\n # if s.empty?\n \n \n # psj :: !! it's easier to evaluate an array of vowels using #includes? than understand your regular expression\n # vh: agreed but was not passing test on special characters ex. /&%$# \n # this expression works too (s =~ /^(?=[^aeiou])(?=a-z)/i )==0\n # you had it something like this: , so we can add\n # BP : What I noticed on this is that the original way it was written,\n # any tests with numbers or special characters were returning true. ..and emptys and ints threw errors.\n # the other option could be to just test the consonants instead of vowels.. but that isn't very elegent \n vowels = %w(a e i o u)\n consonant =(\"a\"..\"z\").find_all { |letter| !vowels.include? letter}\n #consonant = (\"a\"..\"z\").collect { |letter| !vowels.include? letter}\n if s.is_a?(String) && !s.empty?\n return consonant.include? s[0].downcase\n\n else\n return false\n end\n \n \nend", "def solve_cipher(input)\n\n\tputs \"\\n\\nCAESAR'S CYPHER -- ITERATION 1\\n\"\n\t \n\t#Char -> convert string to characters \n\t#map() -> convert all the items \n\t#ord -> Return the Integer ordinal of a one-character string\n\n\tinput_ascii = input.chars.map(&:ord)\n\toutput_ascii = []\n\t\n\tinput_ascii.each do |item|\n\n\t\tif (item >= 97 and item <= 122)\n\t\t\tlowercase = item - 97\n\t\t\toutput_ascii << 97 + (lowercase - 1) % 26\n\n\t\telsif (item >= 65 and item <= 90)\n\t\t\tuppercase = item - 65\n\t\t\toutput_ascii << 65 + (uppercase - 1) % 26\n\t \tend\n\tend\n\n\tcypher = output_ascii.map(&:chr)\n\tresult = cypher.join\n\n\treturn result\nend", "def pig_latin_name(word)\n \n letters = word.split(\"\")\n \n final_array = letters.clone\n letters.each do |letter| #[p, l, u, m]\n \n \n if is_consonants?(letter)\n final_array.rotate! \n # #puts \".........#{removed_consonant}\"\n # #letters.push(removed_consonant)\n # puts \".........#{final_array}..#{letters}\"\n else \n # puts \"*****#{final_array}.... #{letters}\"\n final_array.push(\"ay\")\n return final_array.join\n end\n end\nend", "def vowel_changer(name)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n name.each do |names|\n name = names.split('')\n name\n name.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n\n end\n char\n end\n name\n end\n name\nend", "def caesar_cipher(str, num)\n\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n alphabet.each_char.with_index do |char, idx|\n puts char\n puts idx\n puts \"---\"\n end \n\nend", "def vowels_with_if_elsif(letter)\n if vowels.include? letter\n return true\n elsif consonants.include? letter \n # one way to list consonants otherwise would be to take the alphabet (create that array first) and remove the contents of the vowels array\n return false\n else\n return false\n end\nend", "def get_next_consonant (consonant)\n\treturn 'b' if consonant == 'z'\n\tconsonants = 'bcdfghjklmnpqrstvwxyz'.chars\n\tconsonants[ consonants.index(consonant) + 1 ]\nend", "def get_next_consonant (consonant)\n\treturn 'b' if consonant == 'z'\n\tconsonants = 'bcdfghjklmnpqrstvwxyz'.chars\n\tconsonants[consonants.index(consonant) + 1]\nend", "def letter_changer(x)\n vowels = ['a','e','i','o','u']\n consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n if vowels.include? x\n if x == 'u'\n x = 'a'\n else\n index_x = vowels.index(x)\n next_vowel = vowels[index_x + 1]\n end\n elsif consonants.include? x\n if x == 'z'\n x = 'b'\n else\n index_x = consonants.index(x)\n next_consonant = consonants[index_x + 1]\n end\n end\nend", "def make_up_name(name)\nchanged_name = [] #empty array to push letters from name into when it goes through iteration\nvowels = \"aeiou\"\n\nconsonant = \"bcdfghjklmnpqrstvwxyz\"\n\n\n#if the index of the name provided is a consonant then change it to the next letter.\n\nindex = 0 #start at 0\n \n while index < name.length\n \t\tletter = name[index] #takes every index of every letter in name and stores it in a variable\n \t\tif vowels.include?(letter) #deals with edge case\n \t\t\tif letter == \"u\"\n \t\t\t\tchanged_name.push(\"a\")\n \t\t\telse #need to make it so every other vowel changes to next vowel letter.next\n \t\t\tend\n \t\telsif consonant.inlcude?(letter)\n \t\t\tif letter == \"z\" #deals with edge case\n \t\t\t\tchanged_name.push(\"b\")\n \t\t\telse #everything else will need to be next letter using letter.next \t\t \t\t\n \t\t\tend\n \t\telsif letter == \" \"\n \t\t\t\tchanged_name.push(\" \")\n \t\t\tend\n \t\t \t index += 1\n \tend\nnew_name_array = changed_name.join('') #takes all the letters in the array above and puts it in a new array\nnew_name_array.each {|name| p name.capitalize}\nend", "def count_nucleotides( input )\n\n bases = {\n \"A\" => 0,\n \"C\" => 0,\n \"G\" => 0,\n \"T\" => 0,\n }\n\n dna = [ ]\n\n input.upcase.chars.each do | letter |\n if bases.key? letter\n bases[ letter ] +=1 # if letter matches than start the counter\n else\n dna.push \"#{ letter } is not a nucleotide.\" # if letter is not a match then saves letter and states that in output\n end\n\n\n end #input.chars\n\n bases.each do | key, value |\n dna.push \"#{ key }, #{ value }\"\n end\n\n puts dna\n # puts bases\n end", "def name_muddler (array)\nvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\nconsonants = \"bcdfghjklmnpqrstvwxyz\"\nconsonant_array = consonants.chars \nnew_name = []\nindex = 0\nwhile index < array.length\n if array[index] == \"u\"\n new_name[index] = \"a\"\n elsif vowels.include?(array[index])\n new_name[index] = vowels[vowels.index(array[index]).next]\n elsif array[index] == \"z\"\n new_name[index] = \"b\"\n else new_name[index] = consonant_array[consonant_array.index(array[index]).next]\n end\n index += 1\nend \nreturn new_name\nend", "def abbreviate_sentence(sent)\n # Write your code here\n empty_array = []\n sent.chars.each do |element|\n if element.length > 4\n element.each do |letters|\n letters.gsub(/[aeiou]/i, \" \" )\n letters << empty_array\n end\n end\n end\n p empty_array.join(\"\")\nend" ]
[ "0.69036484", "0.6854533", "0.6818968", "0.6733501", "0.6683276", "0.66182685", "0.6504335", "0.6504113", "0.64830077", "0.64376146", "0.6421656", "0.64196306", "0.64174145", "0.640674", "0.6406254", "0.6393598", "0.63852936", "0.6383894", "0.6364434", "0.636204", "0.6352603", "0.6352021", "0.6347807", "0.63218623", "0.6321182", "0.63186944", "0.63163716", "0.6300296", "0.6279289", "0.62612635", "0.6256754", "0.6241569", "0.62415206", "0.62305725", "0.6228627", "0.6224374", "0.622022", "0.62135243", "0.6193996", "0.61751", "0.6162813", "0.6155413", "0.61540467", "0.61247367", "0.6108067", "0.6101298", "0.6087536", "0.60817194", "0.60677445", "0.6066886", "0.60468733", "0.60449153", "0.6036985", "0.6036686", "0.6017556", "0.6015983", "0.59764814", "0.59650457", "0.5962509", "0.5937232", "0.5926508", "0.59182036", "0.58800596", "0.58764845", "0.58751136", "0.58570606", "0.58406377", "0.5836146", "0.58104724", "0.58041793", "0.57799757", "0.57730633", "0.5764342", "0.57605654", "0.57320404", "0.5708414", "0.56959474", "0.56922626", "0.5639179", "0.5631739", "0.56266284", "0.5614131", "0.558121", "0.55803114", "0.55726284", "0.55249596", "0.54763097", "0.54668134", "0.546113", "0.5433991", "0.5433352", "0.54071057", "0.54048383", "0.5394008", "0.5372257", "0.5365596", "0.5360952", "0.53565717", "0.5340593" ]
0.6229567
35
define method that implements previous methods define alphabet and vowels set new_string to value of empty string
def aliass(full_name) alphabet = "bcdfghjklmnpqrstvwxyz" vowels = "aeiou" new_string = "" #break input word into array and iterate through each letter #if the letter is a vowel, take it and change it to next_vowel #if the letter is a consonant, take it and change it to consonant #else just add with no modification full_name.split('').each do |letter| if vowels.include?(letter) new_string += vowel(letter) elsif alphabet.include?(letter) new_string += consonant(letter) else new_string += letter end end #transform this new string into an array new_word = new_string.split(' ') #swap first and second word in array new_word.reverse! #turn new word into string new_word.map {|names| names.capitalize!} new_string = new_word.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowel_change(current_v)\n if current_v == \"u\"\n current_v = \"a\"\n elsif current_v == \"U\"\n current_v = \"A\" \n else \n v_location = $vowels.index(current_v)\n current_v = $vowels[v_location+2]\n end\n current_v\nend", "def vowel string\n # string = string.split(\"\")\n # string = string.downcase\n string = string.delete 'AaEeIiOoUu'\n # string = string.capitalize\n\nend", "def vowel_changer(letter)\r\n\tif letter == \"u\"\r\n\t\tnew_letter = \"a\"\r\n\telse\r\n\t\tvowel_index = \"aeiou\".index(letter)\r\n \t\tnew_letter =\"aeiou\"[vowel_index.next]\r\n\tend\r\nend", "def letter_changes(string_input)\n character_array = string_input.each_char\n output_string = ''\n character_array.each do |character|\n tempt_string = get_next_character(character)\n output_string += upcase_vowels(tempt_string)\n end\n output_string\nend", "def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=> \"o\",\n \"o\" => \"u\",\n \"u\"=> \"a\"\n }\n\n vowels= \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else \n char \n end \n end \n return new_arr.join(\"\")\nend", "def vowel_adv(str)\r\n str = secret_name(str)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n str = str.split('')\r\n str_new = str.map do |char|\r\n if vowels.include?(char)\r\n vowels.rotate(1)[vowels.index(char)]\r\n else\r\n char\r\n end\r\n end\r\n str_new.join\r\nend", "def make_vowel_change(first)\n\tnew_first = first.split(\"\") \n\ti = 0\n\tfake_firstname = \"\"\n\tlengthfirst = first.length\n\twhile i < lengthfirst\n\tif new_first[i] == \"a\"\n\t\tfake_firstname += \"e\"\n\telsif new_first[i] == \"e\"\n\t\tfake_firstname += \"i\"\n\telsif new_first[i] == \"i\"\n\t\tfake_firstname += \"o\"\n\telsif new_first[i] == \"o\"\n\t\tfake_firstname += \"u\"\n\telsif new_first[i] == \"u\"\n\t\tfake_firstname == \"a\"\n\telsif (new_first[i] != \"a\" || new_first[i] !=\"e\" || new_first[i] != \"i\" || new_first[i] != \"o\" || new_first[i] != \"u\")\n\t\tfake_firstname += new_first[i]\n\tend\n\ti+=1 \n\tend \n\tfake_firstname\nend", "def vowel_cipher(string)\n change = {\n \"a\"=>\"e\",\n \"e\"=>\"i\",\n \"i\"=>\"o\",\n \"o\"=>\"u\",\n \"u\"=>\"a\"\n }\n vowels = \"aeiou\"\n\n new_arr = string.split(\"\").map do |char|\n if vowels.include?(char)\n change[char]\n else\n char\n end\n end\n\n return new_arr.join(\"\")\nend", "def letter_change\n consonant = \"bcdfghjklmnpqrstvwxyz\"\n vowel = \"aeiou\"\n new_name = \"\"\n letter_new = \"\"\n\n split_flip_name.each do |letter|\n if consonant.index(letter) != nil\n letter_new = consonant[consonant.index(letter) + 1]\n elsif vowel.index(letter) != nil\n #addresses last vowel edge case\n if letter == \"u\"\n letter_new = \"a\"\n elsif\n letter_new = vowel[vowel.index(letter) + 1]\n end\n elsif letter == \" \"\n letter_new = letter\n end\n #.to_s addresses a nil edge case\n new_name += letter_new.to_s\n end\n p new_name\n\nend", "def no_vowels(string)\n string.delete\"aeiouAEIOU\"\n# use the .delete accessor and include uppercase and lower case characters to be deleted\nend", "def aliass(full_name)\n alphabet = \"bcdfghjklmnpqrstvwxyz\"\n vowels = \"aeiou\"\n new_string = \"\"\n \n #break input word into array and iterate through each letter\n #if the letter is a vowel, take it and change it to next_vowel\n #if the letter is a consonant, take it and change it to consonant\n #else just add with no modification\n full_name.split('').each do |letter|\n if vowels.include?(letter)\n new_string += vowel(letter)\n elsif alphabet.include?(letter)\n new_string += consonant(letter)\n else\n new_string += letter\n end\n end\n #transform this new string into an array\n new_word = new_string.split(' ')\n #swap first and second word in array\n new_word.reverse!\n #turn new word into string\n new_word.map {|names| names.capitalize!}\n new_string = new_word.join(\" \")\n end", "def disemvowel string\n\tstring.delete \"aeiouAEIOU\"\nend", "def elim_vowels(string)\r\n string.downcase.delete(\"aeiou\")\r\nend", "def vowel_cipher(string)\n \n vowels = \"aeiou\"\n new = \"\"\n\n string.each_char do |char|\n if vowels.include?(char)\n #mode = vowels.index(char)\n new << vowels[vowels.index(char) - 4]\n else \n new << char\n end \n end \n\n return new \nend", "def vowel_removed string\n string.delete! \"aeiouAEIOU\"\n p string\nend", "def vowels (string)\n # Your code here\nend", "def disemvowel(string)\n\nend", "def vowel_delete string\n string.downcase.delete('aeiou')\nend", "def disemvowel str\n\n\tstr.gsub(/[aeiou]/,'')\n\nend", "def make_vowel_change_2(last)\n\tnew_last = last.split(\"\") \n\ti = 0\n\tfake_lastname = \"\"\n\tlengthlast = last.length\n\twhile i < lengthlast\n\tif new_last[i] == \"a\"\n\t\tfake_lastname += \"e\"\n\telsif new_last[i] == \"e\"\n\t\tfake_lastname += \"i\"\n\telsif new_last[i] == \"i\"\n\t\tfake_lastname += \"o\"\n\telsif new_last[i] == \"o\"\n\t\tfake_lastname += \"u\"\n\telsif new_last[i] == \"u\"\n\t\tfake_lastname == \"a\"\n\telsif (new_last[i] != \"a\" || new_last[i] !=\"e\" || new_last[i] != \"i\" || new_last[i] != \"o\" || new_last[i] != \"u\")\n\t\tfake_lastname += new_last[i]\n\tend\n\ti+=1 \n\tend \n\tfake_lastname\nend", "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 vowel_cipher(string)\n vowels = \"aeiou\"\n new_string = \"\"\n\n # string.each_char do |ch|\n # if vowels.include?(ch)\n # old_idx = vowels.index(ch)\n # new_idx = (old_idx + 1) % 5\n # new_vowel = vowels[new_idx]\n # new_string << new_vowel\n # else\n # new_string << ch\n # end\n # end\n\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = old_idx + 1\n vowels[new_idx % vowels.length]\n else\n char\n end\n end\n new_string = new_chars.join(\"\")\n\n return new_string\nend", "def theBeatles string\n string.downcase.delete \"aeiou\"\nend", "def vowel_censor(string)\n vowels=[\"a\",\"e\",\"i\",\"o\",\"u\"]\n new_string=\"\"\n string.each_char do |char|\n if vowels.include? char\n new_string << \"X\"\n else\n new_string << char\n end\n\n # while i<=string.length\n # if char==string[i]\n # new_string+=\"X\"\n # added = true\n # else\n # new_string+=char\n # end\n # i+=1\n # end\n end\n puts new_string\n return new_string\nend", "def vowel_hide(name)\r\n name = name.chars\r\n name_length = name.length\r\n name_length.times do |index|\r\n if name[index] == \"a\" || name[index] == \"e\" ||name[index] == \"i\"|| name[index] == \"o\" || name[index] == \"u\"\r\n name[index] = \"#\"\r\n end\r\n end\r\n name = name.join(\"\")\r\nend", "def no_vowels str\n p str.delete \"aeiouAEIOU\"\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n new_string = \"\"\n\n string.each_char do |char|\n if char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\"\n new_char = vowels.index(char)\n new_string += vowels[(new_char + 1) % 5]\n else\n new_string += char\n end\n end\n\n return new_string\nend", "def vowel_cipher(string)\r\n vowels = 'aeiou'\r\n newString = ''\r\n string.each_char do |char|\r\n if vowels.include?(char)\r\n newString += vowels[(vowels.index(char) + 1) % 5]\r\n else\r\n newString += char\r\n end\r\n end\r\nreturn newString\r\nend", "def disemvowel\nend", "def vwl_rmv string\n # .downcase changes to lowercase, .delete! removes vowels\n string.downcase.delete!('aeiou')\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \n return new_chars.join(\"\")\nend", "def disemvowel(string)\n \n i = 0\n while i < string.length\n if string[i] == \"a\" || string[i] == \"e\" || (string[i] == \"i\") || (string[i] == \"o\") || (string[i] == \"u\")\n string[i] = \"\"\n else \n i += 1\n end\n \n end \n \n return string\nend", "def vowel_remover string\n string.delete \"aeiouAEIOU\"\nend", "def disemvowel string\n return string.delete \"aeiouAEIOU\"\nend", "def devowel(str)\n # your code goes here\n no_vowel_str = ''\n vowels = 'aeiou'\n str.downcase.each_char do |ch|\n if !vowels.include?(ch)\n no_vowel_str << ch\n end\n end\n no_vowel_str\nend", "def swapping_vowels(vowel_char)\n vowels = { 'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a' }\n\n# We take our arguement and run the iteration and create our if/els/els statement.\n# we use .map to store the next change of our letter and if the vowels are included printer the letter of the vowels otherwise print them downcase and switch them to uppercase.\n vowel_char.map! do |letter|\n if vowels.include?(letter)\n vowels[letter]\n elsif vowels.include?(letter.downcase)\n vowels[letter.downcase].upcase\n else\n letter\n end\n end\nend", "def vowel_cipher(string)\n \n vowels = \"aeiou\"\n\n new = \"\"\n\n string.each_char do |char|\n if vowels.include?(char)\n # print vowels.index(char)\n mode = vowels.index(char)\n new << vowels[mode - 4]\n else \n new << char\n end \n \n end \n\n return new \nend", "def vowel_swap (secret_name)\n\t#first separate string into an array of characters\n\t#the loop through looking for vowels\n\t#use each do loop to then go through each character\n\t#check to see if it is a vowel using gsub and replace with the next vowel\n\t#have to replace with an uppercase vowel, so when a becomes 'e' and then I check for 'e's, those 'a's don't become 'i's and etc\n\tsecret_name = secret_name.split('')\n\tsecret_name.each do |letters|\n\t\tletters.gsub!(/[a]/, \"E\")\n\t\tletters.gsub!(/[e]/, \"I\")\n\t\tletters.gsub!(/[i]/, \"O\")\n\t\tletters.gsub!(/[o]/, \"U\")\n\t\tletters.gsub!(/[u]/, \"A\")\n\tend\n\t#then downcase eveything\n\tsecret_name.map!{|letter| letter.downcase}\n\t\nend", "def devowel(str)\n # your code goes here\n return str.delete(\"aeiou\")\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \n print new_chars\nend", "def letter_change(letter)\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"a\"]\n\tconsonants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\",\"b\"]\n\n\tif vowels.include? letter\n\t\tvowels[vowels.index(letter)+1]\n\t\telsif consonants.include? letter\n\t\t\tconsonants[consonants.index(letter)+1]\n\t\telsif letter == \" \"\n\t\t\t\" \"\n\t\telse\n\tend\nend", "def disemvowel(str)\n new_str = str.gsub(/[aeiouAEIOU]/, '') \n new_str\nend", "def vowel_adv(str)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n str = str.split('')\n str_new = str.map do |char|\n if vowels.include?(char)\n vowels.rotate(1)[vowels.index(char)]\n else\n char\n end\n end\n str_new.join\nend", "def next_vowel(name)\n name = name.split('')\n name.each do |indivLetter| \n if indivLetter == \"a\"\n indivLetter.replace(\"e\")\n elsif indivLetter == \"e\"\n indivLetter.replace(\"i\")\n elsif indivLetter == \"i\"\n indivLetter.replace(\"o\")\n elsif indivLetter == \"o\"\n indivLetter.replace(\"u\")\n elsif indivLetter == \"u\"\n indivLetter.replace(\"a\")\n end\n end\nend", "def remove_vowels string \n string.delete \"aeiouAEIOU\"\nend", "def disemvowel(str)\n str.delete(\"aAeEiIoOuU\")\nend", "def asterisked(word)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n new_word = \"\"\n word.each_char do |c|\n if vowels.include?(c)\n new_word << \"*\"\n else\n new_word << c\n end\n end\n new_word\nend", "def fake_name(letters)\r\n\tvowel_arr = ['a', 'e', 'i', 'o', 'u']\r\n\tletters.map! do |letter|\r\n\t\tif vowel_arr.include?(letter.downcase)\r\n\t\t\tif letter.upcase! == nil\r\n\t\t\t\t\tif letter.downcase == vowel_arr[4]\r\n\t\t\t\t\t\tletter = vowel_arr[0].upcase\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number].upcase\r\n\t\t\t\t\tend\r\n\t\t\telse\r\n\t\t\t\tnumber = vowel_arr.index(letter.downcase)\r\n\t\t\t\t\tif number == 4\r\n\t\t\t\t\t\tletter = vowel_arr[0]\r\n\t\t\t\t\telse\r\n\t\t\t\t\t\tnumber = number + 1\r\n\t\t\t\t\t\tletter = vowel_arr[number]\r\n\t\t\t\t\tend\r\n\t\t\tend\r\n\t\telsif \"abcdefghijklmnopqrstuvwxyz\".include?(letter.downcase) == false\r\n\t\t\tletter = letter\r\n\t\telse \r\n\t\t\t\tif letter.downcase == 'z'\r\n\t\t\t\t\tletter = (letter.chr.ord - 24). chr\r\n\t\t\t\telsif vowel_arr.include?(letter.next.downcase) == false\r\n\t\t\t\t\tletter = letter.next\r\n\t\t\t\telse\r\n\t\t\t\t\tletter = letter.next.next\r\n\t\t\t\tend\r\n\t\tend\r\n\tend\r\nletters.join(\"\")\r\nend", "def name_change(normal_name)\nvowels = \"aeiouAEIOU\".split(\"\")\nconsonants = \"bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ\".split(\"\")\n\nchanged_name = normal_name.split(\" \")\nchanged_name[0], changed_name[1] = changed_name[1], changed_name[0]\n split_name = changed_name.join(\" \")\nname = split_name.split(\"\")\n\nnew_name = \"\"\nname.each_with_index do |letter, letter_index|\n if vowels.include?(letter)\n vowels.each_with_index do |vowel, vowel_index|\n if letter === vowel\n if letter === \"u\"\n new_name << \"a\"\n elsif letter === \"U\"\n new_name << \"A\"\n else\n new_name << vowels[vowel_index+1]\n end\n end\n end\nend\n if consonants.include?(letter)\n consonants.each_with_index do |consonant, consonant_index|\n if letter === consonant\n if letter === \"z\"\n new_name << \"b\"\n elsif letter === \"Z\"\n new_name << \"B\"\n else\n new_name << consonants[consonant_index+1]\n end\n end\n end\nend\n if letter === \" \"\n new_name << \" \"\n end\n end\n new_name\nend", "def fake_name (full_name)\n words_array = full_name.split (\" \")\n swap_name_array = words_array.reverse\n swap_name = swap_name_array.join(\" \")\n letters = swap_name.chars\n fake_letters = []\n letters.each do |letter|\n vowel = %w[a A e E i I o O u U]\n if vowel.include?(letter)\n fake_letters << next_vowel(letter)\n elsif letter == \" \"\n fake_letters << \" \"\n else\n fake_letters << next_unvowel(letter)\n end\nend\n return fake_letters.join (\"\")\nend", "def remove_vowels string\n string.delete 'aeiouAEIOU'\nend", "def remove_vowels string\n string.delete 'aeiouAEIOU'\nend", "def change_char(char)\r\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\r\n constanants = [\"b\", \"c\", \"d\", \"f\", \"g\", \"h\", \"j\", \"k\", \"l\", \"m\", \"n\", \"p\", \"q\", \"r\", \"s\", \"t\", \"v\", \"w\", \"x\", \"y\", \"z\"]\r\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\r\n \r\n index_of_char = alphabet.index(char) # check for any non-alphabet characters\r\n is_vowel = vowels.index(char) # check any vowels\r\n is_constanant = constanants.index(char) # check for any constanants\r\n \r\n if index_of_char == nil \r\n char\r\n # letter is not in alphabet, returns same character \r\n elsif is_vowel \r\n vowels.rotate(1)[vowels.index(char)]\r\n # if letter is a vowel, returns next vowel \r\n elsif is_constanant \r\n constanants.rotate(1)[constanants.index(char)] \r\n # if letter is a constanant, returns next constanant\r\n else\r\n char\r\n end\r\nend", "def delete_vowels(string)\n #Can't forget capitals!\n puts string.delete(\"a\").delete(\"e\").delete(\"i\").delete(\"o\").delete(\"u\").delete(\"A\").delete(\"E\").delete(\"I\").delete(\"O\").delete(\"U\")\nend", "def letter_changes(str)\n str.each_char.with_index do |char, idx|\n if char =~ /[A-Za-z]/\n if char =~ /[Zz]/\n str[idx] = 'a'\n else\n str[idx] = (char.ord + 1).chr\n end\n end\n end\n str.each_char.with_index do |char, idx|\n str[idx] = char.upcase if char =~ /[aeiou]/\n end\n str\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n \n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = old_idx + 1\n vowels[new_idx % vowels.length]\n else\n char\n end\n end\n \n return new_chars.join(\"\")\nend", "def disemvowel(str)\n str = str.delete 'AEIOUaeiou'\nend", "def remove_vowels str\n str.delete \"aeiouAEIOU\"\nend", "def vowel_changer(name)\n vowel_guide = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n name.each do |names|\n name = names.split('')\n name\n name.map! do |char|\n index = 0\n while index < vowel_guide.length\n if char == vowel_guide[index]\n char = vowel_guide[index += 1]\n index += 1\n elsif char == \"u\"\n char = \"a\"\n index += 1\n else\n char\n index += 1\n end\n\n end\n char\n end\n name\n end\n name\nend", "def create_alias(word)\n vowels_lower = ['a','e','i','o','u']\n vowels_upper = vowels_lower.map(&:upcase)\n consonants_lower = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z']\n consonants_upper = consonants_lower.map(&:upcase)\n \nupdated_vowels = word.map do |char|\n case\n when vowels_lower.include?(char)\n vowels_lower.rotate(1)[vowels_lower.index(char)]\n when vowels_upper.include?(char)\n vowels_upper.rotate(1)[vowels_upper.index(char)]\n when consonants_lower.include?(char)\n consonants_lower.rotate(1)[consonants_lower.index(char)]\n when consonants_upper.include?(char)\n consonants_upper.rotate(1)[consonants_upper.index(char)]\n else (char)\nend\nend\nend", "def vowel_cipher(str)\n new_str = ''\n vowel = 'aeiou'\n\n str.each_char do |char|\n if vowel.include?(char)\n old_idx = vowel.index(char)\n new_idx = (old_idx + 1) % vowel.length\n new_str += vowel[new_idx]\n else\n new_str += char\n end\n end\n\n return new_str\nend", "def rubyify(sentence)\n\n letters = \"abcdefghijklmnopqrstuvwxyz\"\n\n new_sentence = sentence.downcase\n\n new_sentence.each_char do |char|\n if char == \" \"\n new_sentence[char] = \"_\"\n end\n end\n\n puts new_sentence\n new_sentence = new_sentence.delete(\".\")\n new_sentence = new_sentence.delete(\"?\")\n puts new_sentence\n new_sentence\n\nend", "def increment_vowels(char)\r\n\tcase char\r\n\twhen \"A\" \r\n\t\treturn \"E\"\r\n\twhen \"E\" \r\n\t\treturn \"I\"\r\n\twhen \"I\" \r\n\t\treturn \"O\"\r\n\twhen \"O\" \r\n\t\treturn \"U\"\r\n\twhen \"U\" \r\n\t\treturn \"A\"\r\n\twhen \"a\" \r\n\t\treturn \"e\"\r\n\twhen \"e\" \r\n\t\treturn \"i\"\r\n\twhen \"i\" \r\n\t\treturn \"o\"\r\n\twhen \"o\" \r\n\t\treturn \"u\"\r\n\twhen \"u\" \r\n\t\treturn \"e\"\r\n\telse \r\n\t\treturn char\r\n\tend\r\nend", "def disemvowel(string)\n string.delete \"aeiouAEIOU\"\nend", "def devowel(str)\n new_str = \"\"\n vowels = \"aeiou\"\n\n str.downcase.each_char do |char|\n if !vowels.include?(char)\n new_str += char\n end\n end\n return new_str\nend", "def vowel_cipher(string)\n\tvowels = \"aeiou\"\n\n new_vowel = string.split(\"\").map do |char|\n if vowels.include?(char)\n prev_idx = vowels.index(char)\n new_idx = (prev_idx + 1) % vowels.length\n vowels[new_idx]\n else\n char\n end\n end\n return new_char.join(\"\")\nend", "def vowels (string)\r\n if string.class == String\r\n vowels(string.split(\"\").concat([ [] ]))\r\n else \r\n if string[0].class == String \r\n case string[0]\r\n when \"A\",\"a\",\"E\",\"e\",\"I\",\"i\",\"O\",\"o\",\"U\",\"u\"\r\n vowels(string.slice(1..-2).concat( [string[-1].concat([string[0]])] ))\r\n else\r\n vowels(string.drop(1)) \r\n end \r\n else\r\n return string[0]\r\n end\r\n end\r\nend", "def remove_vowels string\n string.delete \"aeiouAEIOU\"\nend", "def remove_vowels str\n reggie = /[aAeEiIoOuU]/\n holder_arr = str.split('')\n holder_arr.map! { |letter|\n if reggie.match letter\n letter = ''\n else \n letter\n end\n }\n holder_arr.join('')\nend", "def disemvowel(string)\n no_vowel_string = string.gsub(/[aeiou]/, \"\")\n return no_vowel_string\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n\n new_chars = string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = old_idx + 1\n vowels[new_idx % vowels.length]\n else\n char\n end\n end\n\n return new_chars.join(\"\")\nend", "def alteration\n (0...length).flat_map { |i|\n LETTERS.map { |letter|\n string.dup.tap { |w| w[i] = letter }\n }\n }.uniq\n end", "def vwl_rmv string\n string.delete!('aeiou')\nend", "def vwl_rmv string\n string.delete!('aeiou')\nend", "def devowel(str)\n str.delete(VOWELS)\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n new_arr = []\n string.each_char do |char|\n if vowels.include?(char)\n old_index = vowels.index(char)\n new_index = (old_index + 1)%5\n new_arr << vowels[new_index]\n else\n new_arr << char\n end\n \n end\n new_arr.join(\"\")\nend", "def LetterChanges(str)\r\n str = str.split(\"\")\r\n str.each do |x|\r\n x.next! if x =~ /[a-z]/\r\n x.upcase! if x =~ /[aeiou]/\r\n end\r\n return str.join(\"\")\r\nend", "def remove_vowels(s)\n s.downcase.delete('aeiou')\nend", "def letter=(input) \n super(input.try(:downcase))\n end", "def non_unique_letters(string)\nend", "def vowels(string)\r\n new_string = []\r\n string.split(\"\").each do |letter|\r\n if letter == \"a\" || letter == \"e\" || letter == \"i\" || letter == \"o\" || letter == \"u\" ||letter == \"A\" || letter == \"E\" || letter == \"I\" || letter == \"O\" || letter == \"U\"\r\n new_string.push(letter)\r\n end\r\n end\r\n return new_string\r\nend", "def vowel_changer(name)\n vowel_string = \"aeiou\"\n name_array = name.downcase.chars\n new_name = []\n name_array.each do |character|\n if character == \"u\"\n character = \"a\"\n new_name << character\n elsif vowel_string.include? character\n character = vowel_string[vowel_string.index(character) +1]\n new_name << character\n else\n new_name << character\n end\n end\n new_name.join(\"\").split(\" \").each {|word| word.capitalize!}.join(\" \")\nend", "def no_vowels str\n # delete the vowels in the str if str has vowels a, e, i, o, u\n str.delete 'aeiouAEIOU'\nend", "def replace_vowels_with_question_mark(word)\nend", "def next_vowel(letter)\n\tif letter == (\"a\")\n\t\tletter = \"e\"\n\telsif letter == (\"e\")\n\t\tletter = \"i\"\n\telsif letter == (\"i\")\n\t\tletter = \"o\"\n\telsif letter == (\"o\")\n\t\tletter = \"u\"\n\telse\n\t\tletter = \"a\"\n\tend\nend", "def vowel_censor(string)\n\n string.gsub(/[aeiou]/, 'X') \n p string \n \nend", "def vowel_cipher(string)\n vowels = 'aeiou'\n cipher = ''\n\n string.chars do |char|\n if vowels.include?(char)\n index = vowels.index(char)\n new_vowel = vowels[(index + 1) % 5]\n cipher += new_vowel\n else\n cipher += char\n end\n end\n return cipher\nend", "def more_vowels(string1, string2)\nend", "def disemvowel word\n word.delete('aeiou')\nend", "def noVowels string\n # # Create a string that contains all the vowels\n # vowels = 'aeiou'\n # # Split the string into an array\n # strArray = string.split('')\n # # Use 'select' to only keep the characters that are not vowels\n # consonantArray = strArray.select { |value| !vowels.include?(value.downcase) }\n # # Join the array into a string\n # consonantsOnly = consonantArray.join('')\n\n #Use the delete method that checks lowercase vowels and uppercase vowels\n string.delete \"aeiouAEIOU\"\n # Implicity return a string with all the vowels removed with the line above\nend", "def LetterChanges(str)\n\n str=str.tr('a-y','b-z')\n str=str.tr('aeiou','AEIOU')\n return str \n \nend", "def vowel_switch\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\", \"A\", \"E\", \"I\", \"O\", \"U\"]\n @split_name.map! do |char|\n if vowels.include?(char)\n char = vowels[vowels.index(char)+1]\n else\n char = char.next\n end\nend\np @split_name\nend", "def next_vowel(str)\n\t# Need to identify the vowels in the English alphabet in a new variable\n\tvowels = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n\t# Need to also identify the consonants in the English alphabet in a new variable\n\tconsonants = [\"b\",\"c\",\"d\",\"f\",\"g\",\"h\",\"j\",\"k\",\"l\",\"m\",\"n\",\"p\",\"q\",\"r\",\n\t\t\"s\",\"t\",\"v\",\"w\",\"x\",\"y\",\"z\"]\n\twords = str.split # Splitting the name into words based on space (' ')\n\t\n\t## Loop into each name\n\ti = 0 # Setting an index to zero\n\tnew_word = [] # Setting up an empty array for our new scrambled word\n\tmod_word = [] # Setting up an empty array to hold the capitalized scrambled word\n\n\twhile i < words.length # Looping into each word\n\t\tchars = words[i].split('') # Split each word into characters\n\t\tnew_chars = chars.map{|char| # Mapping into each character\n\t\t\tif vowels.include?(char) # If the character is included in the vowels variable\n\t\t\t\tvowels.rotate(1)[vowels.index(char)] # Reassign it to the next vowel\n\t\t\telsif consonants.include?(char) # If the character is included in the consonants variable\n\t\t\t\tconsonants.rotate(1)[consonants.index(char)] # Reassign it to the next consonet\n\t\t\telse\n\t\t\t\tchar # Otherwise don't do anything (In case there are odd characters)\n\t\t\tend\n\t\t}\n\t\tnew_word.push(new_chars.join) # rejoin the word\n\t\t# This bit of code capitalizes the first character of the name\n\t\tmod_word.push(new_word[i].slice(0,1).capitalize + new_word[i].slice(1..-1))\n\t\ti += 1 # increment counter\n\tend\n\treturn mod_word.join(' ') # return the rejoined words\nend", "def vowel_delete(str)\n str.delete(\"aeiouAEIOU\")\nend", "def vowel_cipher(string)\n vowels = \"aeiou\"\n string.split(\"\").map do |char|\n if vowels.include?(char)\n old_idx = vowels.index(char)\n new_idx = (old_idx + 1) % vowels.length # 5\n vowels[new_idx] # 2nd example! u -> a ! \n else \n char \n end \n end \nend", "def fix(value)\n value.concat('!')\n value = value.upcase\n value << 'xyz'\nend", "def vowel_removed(string)\n string.delete('aeiouAEIOU')\nend", "def LetterChanges(str)\n str = str.split(\"\")\n \n str.each do |c|\n c.next! if c =~ /[a-z]/\n c.upcase! if c =~ /[aeiou]/\n end\n \n return str.join\nend", "def encrypt(str)\n\tletters = \"aeioubcdfghjklmnpqrstvwxyzAEIOBCDFGHJKLMNPQRSTVWXYZ\"\n\tnew_name = \"\"\n\tstr.length.times do |index|\n\t\tif str[index] == \"u\"\n\t\t\tnew_name << \"a\"\n\t\telsif str[index] == \"U\"\n\t\t\tnew_name << \"A\"\n\t\telsif str[index] == \"z\"\n\t\t\tnew_name << \"b\"\n\t\telsif str[index] == \"Z\"\n\t\t\tnew_name << \"B\"\n\t\telsif str[index] == \" \"\n\t\t\tnew_name << \" \"\n\t\telse\n\t\t\tnext_letter = letters[letters.index(str[index]) + 1]\n\t\t\tnew_name << next_letter\n\t\tend\n\tend \n p new_name\nend", "def vowel_converter(swapped_name)\r\n\t# Forces all letters to be lower case in order for code to work properly\r\n\tcode_name = swapped_name.downcase.chars\r\n\tvowels = %w{a e i o u}\r\n\tcode_name.map! do |letter|\r\n\t\t# Edge case fix to make code work as intended\r\n\t\tif letter == \"u\"\r\n\t\t\tletter = \"a\"\r\n\t\telsif vowels.include?(letter)\r\n\t\t\tvowels[vowels.index(letter) + 1]\r\n\t\telse\r\n\t\t\tletter\r\n\t\tend\r\n\tend\r\n\t# This re-capitalizes the first letter of each part of the name\r\n\tcode_name.join('').split.map(&:capitalize).join(' ')\r\nend" ]
[ "0.66397953", "0.653145", "0.6477933", "0.64709556", "0.64006555", "0.63861024", "0.6377128", "0.63668257", "0.6337688", "0.63353044", "0.6332802", "0.62827474", "0.6281222", "0.6233197", "0.62321454", "0.62200516", "0.62124026", "0.62085694", "0.61926854", "0.6182257", "0.6158889", "0.6142042", "0.6133904", "0.6129302", "0.6125066", "0.61250645", "0.612127", "0.6119197", "0.6110236", "0.61000985", "0.6099076", "0.6079776", "0.60523003", "0.60465866", "0.6033107", "0.6025884", "0.6016423", "0.6010046", "0.6009967", "0.600757", "0.6001244", "0.5974789", "0.5967736", "0.5953945", "0.5947072", "0.5945979", "0.5940795", "0.5938367", "0.5935072", "0.5930701", "0.59283376", "0.59283376", "0.5925298", "0.5918718", "0.59051734", "0.59005874", "0.58988357", "0.5896339", "0.58942634", "0.588762", "0.58826154", "0.58795375", "0.5874308", "0.58725226", "0.5872255", "0.58720756", "0.5866212", "0.58608", "0.58585083", "0.5847951", "0.58396536", "0.58254474", "0.5822389", "0.5822389", "0.5818508", "0.5818008", "0.58172625", "0.5816881", "0.5814195", "0.5811379", "0.5809833", "0.5809356", "0.58089817", "0.58024085", "0.5800257", "0.5799618", "0.57980406", "0.5793152", "0.5788959", "0.57851005", "0.5781684", "0.5781232", "0.57723296", "0.5770923", "0.5764513", "0.5761561", "0.5761473", "0.57605255", "0.57570773", "0.57555664" ]
0.60119313
37
This method is used for retrive the original password. WTF?! def password_clean crypted_password.decrypt(password_salt) end
def active? active end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def password_clean\n crypted_password.decrypt(salt)\n end", "def password_clean\n crypted_password.decrypt(salt)\n end", "def password\n raw_password = read_attribute(:password)\n raw_password.blank? ? nil : crypt.decrypt(raw_password)\n end", "def decrpyt_password(encrypt_pass)\n if !(self.unencrypted?)\n self.unencrypted_password = EzCrypto::Key.decrypt_with_password(encrypt_pass, self.salt, Base64.decode64( self.password))\n @unencrypted = true\n self.password_confirmation=\"\"\n end\n end", "def crypt_password\n # EmailNotify.send_user_create_notification self\n self[:password] =\n password_hash(password(true))\n @password = nil\n end", "def password\n 'password'.gsub('', '')\n end", "def encrypted_password\n nil\n end", "def prepare_password\n unless password.blank?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = encrypt_password(password)\n end\n end", "def old_password\n nil\n end", "def password\n @crypted_password\n \n end", "def crypt_password\n write_attribute \"password\", self.class.sha1(self.class.generate_salt, password)\n @password = nil\n end", "def clean_up_passwords\n self.password = nil\n end", "def clean_up_passwords\n self.password = nil\n end", "def clean_up_passwords\n self.password = nil\n end", "def reset_password(plain)\n self.password = hash_crypt(plain)\n end", "def authenticatable_salt\n encrypted_password[0,29] if encrypted_password\n end", "def scramble_password\n if self.password_changed?\n self.password = Digest::MD5.hexdigest(self.password)\n end\n end", "def decrypt_password(pwd)\r\n ret = ''\r\n\r\n unless pwd.blank?\r\n # see secret_token.rb\r\n iv = Rails.configuration.iv\r\n key = Rails.configuration.key\r\n salt = Rails.configuration.salt\r\n ret = Encryptor.decrypt(value: Base64.decode64(pwd.encode('ascii-8bit')), key: key, iv: iv, salt: salt)\r\n end\r\n\r\n ret\r\n end", "def password\n password = Base64.decode64(@config.fetch(:password, nil))\n if password\n cipher.decrypt_string(password).gsub(\"\\0\", \"\")\n else\n password\n end\n end", "def decrypt(password = nil, salt = nil)\n Hoodie::Crypto.decrypt(self, password, salt)\n end", "def password_check\n return self.encrypted_password==BCrypt::Engine.hash_secret(self.password_verify, self.salt)\n end", "def old_password\n @old_password\n end", "def hash_password\n \t\tself.salt = BCrypt::Engine.generate_salt\n \t\tself.password_digest = BCrypt::Engine.hash_secret(self.password, self.salt)\n \t\tself.password = nil\n \tend", "def crypt_unless_empty\n if password(true).empty?\n user = self.class.find(id)\n self[:password] = user.password\n else\n crypt_password\n end\n\n if verify_password(true).empty?\n user = self.class.find(id)\n self[:verify_password] = user.verify_password\n else\n crypt_verify_password\n end\n\n end", "def mutate_bcrypt_password(_)\n '400$8$2d$f6ed5a490c441958$67f59aa61bc617849a3280b5e80f78607e53b5aa5807a44ddbc53e804e2e2a99'\n end", "def decrypt_login_salt\n r = Aws::Kms.new('login', 'user').decrypt(@user.login_salt)\n return r unless r.success?\n\n @login_salt_d = r.data[:plaintext]\n\n success\n end", "def monitor_password_with(secret,salt)\n secret_key = Digest::MD5.digest(secret)\n iv = Digest::MD5.digest(salt)\n begin\n Encryptor.decrypt(Base64.decode64(read_attribute(:monitor_password)), :key => secret_key,:iv=>iv)\n rescue\n return read_attribute(:monitor_password)\n end\n end", "def clear_password\n self.password = nil\n self.password_verify = nil\n end", "def secure_password_digest\n if password_digest.blank?\n self.password = SecureRandom.urlsafe_base64(16)\n end\n end", "def clean_up_passwords; end", "def decrypt_password(crypted=false, key=encryption_key, encryption_mehtod=self.auth_method)\n self.class.decrypt(crypted||self.send(props[:crypted_password]), key, encryption_mehtod)\n end", "def remove_salt(possibly_salted)\n possibly_salted.include?(\"::::\") ? possibly_salted.split(\"::::\")[1] : possibly_salted\n end", "def password\n if password_digest\n @password ||= BCrypt::Password.new(password_digest)\n else\n nil\n end\n end", "def standard_password_digest\n password_digest( standard_password )\n end", "def password\n @password ||= BCrypt::Password.new(hashed_password) # hangs on to the plain text password and compares it against the entered plain text password for authentication\n end", "def decrypt_login_salt\n login_salt_e = @admin_secret.login_salt\n return incorrect_login_error('am_l_cp_5') unless login_salt_e.present?\n\n r = Aws::Kms.new('login', 'admin').decrypt(login_salt_e)\n return incorrect_login_error('am_l_cp_6') unless r.success?\n\n @login_salt_d = r.data[:plaintext]\n\n success\n\n end", "def clean_up_passwords\n self.password = self.password_confirmation = nil\n end", "def clean_up_passwords\n self.password = self.password_confirmation = nil\n end", "def clear_password! \n self.password = nil \n end", "def password\n @password = Password.new(password_hash) unless password_hash.blank?\n end", "def password_digest\n BCrypt::Password.new(super)\n end", "def crypt_password\n \t\twrite_attribute \"password\", self.class.sha1(password) unless self.password.empty?\n end", "def reset_password!(*args)\n self.legacy_password_hash = nil\n super\n end", "def decrypt_login_salt\n login_salt_e = @admin_secret.login_salt\n return incorrect_login_error('am_l_pa_3') unless login_salt_e.present?\n\n r = Aws::Kms.new('login', 'admin').decrypt(login_salt_e)\n return incorrect_login_error('am_l_pa_4') unless r.success?\n\n @login_salt_d = r.data[:plaintext]\n\n success\n\n end", "def encrypted(password)\n\t\tDigest::SHA2.hexdigest(\"#{self.salt} -- #{pass}\")\n\tend", "def encrypt(password)\n e = self.class.encrypt(password, salt)\n\n # Clear password virtual attribute to prevent it from being shown in forms after update\n self.password = nil\n self.password_confirmation = nil #if self.respond_to?(password_confirmation)\n return e\n end", "def password=(new_password); end", "def password_digest(password); end", "def get_password(password)\n password\n end", "def clear_password!\n self.password = nil\n end", "def crypt_unless_empty\n if self.password.empty?\n user = self.class.find(self.id)\n self.password = user.password\n else\n write_attribute \"password\", self.class.sha1(self.class.generate_salt, password)\n end\n end", "def unset_auto_managed_password\n password = params[:user][:entered_password].strip\n if params[:user][:entered_password_confirmation].blank? && !password.blank? && User.hash_password(password) == User.find(current_user.id).hashed_password\n params[:user][:entered_password] = ''\n end\n end", "def check_password(password_provided)\n BCrypt::Engine.hash_secret(password_provided, self.password_salt) == self.password\n end", "def clear_password\n \t\tself.password = nil\n \tend", "def standard_password\n \"!@Cd5678\"\n end", "def crypt_password\n self.crypted_pass = BCrypt::Password.create(password) if password\n end", "def clear_password\n self.password = nil\n end", "def check_password_changed\n self.temp_password = nil if ( changed.include?('encrypted_password') && !(changed.include?('temp_password')))\n end", "def encrypted_password\n read_attribute(:password)\n end", "def password\n @password ||= Password.new(self.hashed_password)\n end", "def password_encrypt\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "def normalized_password\n URI.encode(CGI.unescape(password), ENCODE_PASSWORD).force_encoding(Encoding::UTF_8) if password\n end", "def authentication_password\n BCrypt::Password.new(hashed_password)\n end", "def authenticatable_salt; end", "def clean_up_passwords\n self.password = self.password_confirmation = nil\n end", "def password\n @password ||= BCrypt::Password.new(hashed_password)\n end", "def password=(unencrypted_password)\n unless unencrypted_password.empty?\n \t\t @password = unencrypted_password\n \t\t self.password_digest = BCrypt::Password.create(unencrypted_password)\n end\n end", "def salt_password(clear_password)\n self.salt = User.generate_salt\n self.hashed_password = User.hash_password(\"#{salt}#{User.hash_password clear_password}\")\n\n p \"hashed password==\", self.hashed_password\n end", "def crypt_password\r\n write_attribute \"password\", self.class.sha1(password)\r\n end", "def salt_password(clear_password)\n self.salt = User.generate_salt\n self.hashed_password = User.hash_password(\"#{salt}#{User.hash_password clear_password}\")\n end", "def cryptpass\n !self.password.nil? && self.password = self.password.crypt((rand*100).to_s)\n self.active = true\n end", "def password\n begin\n password = ::BCrypt::Password.new(self.encrypted_password)\n rescue\n password = nil\n end\n password\n end", "def password\n @password ||= ::BCrypt::Password.new(password_digest)\n end", "def crypt_unless_empty\n if password.empty? \n user = self.class.find(self.id)\n self.password = user.password_confirmation\n else\n write_attribute \"password\", self.class.sha1(password)\n end \n end", "def clear_password!\n unless (self.password.nil?)\n self.password = nil\n end\n \n unless (self.password_confirmation.nil?)\n self.password_confirmation = nil\n end \n \n unless (self.current_password.nil?)\n self.current_password = nil\n end \n end", "def password(id)\n profile_element = profile(id)\n if profile_element\n enc_passwd = profile_element['password']\n return decrypt(enc_passwd) if enc_passwd\n end\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def password\n @password ||= Password.new(password_hash)\n end", "def clear_plaintext\n @password = @password_confirmation = nil\n end", "def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end", "def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n else\n return false\n end\n end", "def authenticatable_salt\n return if encrypted_password_digest.blank?\n Encryption::PasswordVerifier::PasswordDigest.parse_from_string(\n encrypted_password_digest,\n ).password_salt\n end", "def valid_password?(password)\n if encrypted_password.present?\n super\n else\n \n old_password == Digest::SHA1.hexdigest(LAGACY_SALT + password)\n end\n end", "def authenticatable_salt\n self.encrypted_password[0,29] if self.encrypted_password\n end", "def password\n return nil unless @password\n @password.password\n end", "def password=(password)\n@password = password\nif password.present?\ngenerate_salt\nself.hashed_password = self.class.encrypt_password(password, salt)\nend\nend", "def password=(password)\n@password = password\nif password.present?\ngenerate_salt\nself.hashed_password = self.class.encrypt_password(password, salt)\nend\nend", "def password\n @password ||= Password.new(password_digest)\n end", "def password=(pass)\n @password = pass = password_confirmation\n self.password_hash = Digest::SHA256.hexdigest(pass)\n #Salt!\n #self.salt = User.random_string(10) if !self.salt?\n #self.password_hash = User.encrypt(@password, self.salt)\nend", "def password\n @password ||= BCrypt::Password.new(h_password)\n end" ]
[ "0.9375924", "0.93410146", "0.72074896", "0.6896532", "0.6842127", "0.67906916", "0.67060715", "0.6704768", "0.6683602", "0.66495824", "0.66283005", "0.6597421", "0.6597421", "0.6597421", "0.65815824", "0.6580408", "0.6564844", "0.6506535", "0.649459", "0.649048", "0.6487642", "0.64387894", "0.6422817", "0.6416256", "0.64091957", "0.6407098", "0.63915986", "0.6374258", "0.63416654", "0.6339161", "0.63329184", "0.6332886", "0.6313049", "0.62956595", "0.6272566", "0.62721646", "0.62694746", "0.62694746", "0.62683874", "0.6260621", "0.62419826", "0.6236336", "0.623424", "0.6226862", "0.62246186", "0.62188774", "0.6218372", "0.6216161", "0.62146837", "0.62006", "0.61967295", "0.6195825", "0.6191356", "0.61887693", "0.6187707", "0.6182681", "0.61683524", "0.616525", "0.6164793", "0.6161399", "0.6157853", "0.61507446", "0.6150362", "0.61492544", "0.6147262", "0.61448056", "0.614387", "0.61399233", "0.6139048", "0.6136395", "0.6129751", "0.61186504", "0.6111953", "0.6105616", "0.60942805", "0.6094098", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60884506", "0.60879576", "0.6087874", "0.6087874", "0.60870826", "0.6086117", "0.60826224", "0.60774606", "0.6071789", "0.6071789", "0.60701144", "0.60664856", "0.60647607" ]
0.0
-1
Calcula el porcentaje de carbohidratos del plato Devuelve:: Porcentaje de carbohidratos
def calc_perc_carbohydrates alimentos = @food.collect { |x| x.carbohydrates } gramos = @quantities.collect { |x| x/100.0 } result = 0.0 for i in 0...alimentos.size result += (gramos[i] * alimentos[i]) * 4 end result /= @vct end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def por_carbo\n\t\t\t(@carbohidratos/suma_gramos)*100\n\t\tend", "def valorpolialcoholesp\n\t\tvag=(polialcoholes * 70) / 100\n vag.round(2)\n\tend", "def porc_grasa\n\t\t(1.2 * self.indice_masa_corporal + 0.23 * edad - 10.8 * sexo - 5.4).round(1)\n\tend", "def porcentaje_carbohidratos\n recorrido = lista_alimentos.head\n acumulador = 0\n porcentaje = 0\n\n while recorrido != nil\n acumulador = acumulador + recorrido.value.proteinas + recorrido.value.carbohidratos + recorrido.value.lipidos\n porcentaje = porcentaje + recorrido.value.carbohidratos\n\n recorrido = recorrido.next\n end\n\n ((porcentaje * 100)/acumulador).round(2)\n end", "def por_carbohidratos\n \taux_carbohidratos = 0.0\n\t\ti = 1\n\t \twhile i < @lista_alimentos.size do\n\t\t\taux_carbohidratos += @lista_alimentos[i].carbohidratos * @lista_cantidades[i]\n\t\t\ti+=1\n\t\tend\n\t\treturn ((aux_carbohidratos/total_nutrientes)*100.0).round(2)\n\tend", "def porcentajegrasa\n\t\t1.2 * imc + 0.23 * @edad - 10.8 * @sexo - 5.4\n\tend", "def calculo_valor_energetico\n\t\t\t(@carbohidratos*4) + (@lipidos*9) + (@proteinas*4)\n\t\tend", "def calculo \n self.minutos_reales = 5 * 480 #cantidad de OPERARIOS * Jornada de Trabajo(Turnos)\n self.costo_minuto = 89 #Costo Real por minuto\n self.otros_costos = 540 * 89 #Tiempo Total(Minutos) * Costo Real por Minutos\n self.costo_mano_obra = 420 * 5 * 89 # Jornada Minutos * Cantidad Operarios * Costo Real por minutos \n self.manoObraPlaneada = 650.000 * 5 # Salario Total * Cantidad de operarios \n end", "def compute_fullcnpswage\n ( full_caissebase + full_process_bonuses ).ceil\n end", "def kcalglucidos\n\t\t\t@carbohidratos * 4\n\t\tend", "def porcentaje_graso\n (1.2*calcular_imc)+(0.23*@edad)-(10.8*@sexo)-5.4\n end", "def valorazucaresp\n\t\tvag=(azucares * 70) / 100\n vag.round(2)\n\tend", "def irhidratos\n vag=(hcarbono * 100) / 260\n vag.round(2)\n end", "def carbohidratos\n\t\treturn @carbohidratos*@cantidad\n\tend", "def vCalorico\n\t\tcalc = Calculadora.new\n\t\tvalCal = 0\t\t\n\t\t@platos.each do |alimento|\n\t\t\tvalCal += calc.valorKiloCalorico(alimento)\n\t\tend\n\t\treturn valCal.round(2)\n\tend", "def getPrecioVenta\n precio = (cantidadCasasHoteles) *(@precioCompra +@precioEdificar) *@factorRevalorizacion \n return precio\n end", "def pourcentage\n @pourcentage ||= (nombre.to_f / analyse.all_mots.count).pourcentage\n end", "def irpolialcoholesp\n vag=(valorpolialcoholesp * 100) / 90\n vag.round(2)\n end", "def valor_energetico\n @proteinas * 4.0 + @carbohidratos * 4.0 + @lipidos * 9.0\n end", "def costo_por_km\n\t\tcase tipo_servicio.downcase\n\t\t\twhen \"distrital\"\n\t\t\t\tif nro_pasajeros <= 3\n\t\t\t\t\treturn 0.5\n\t\t\t\telse\n\t\t\t\t\treturn 0.7\n\t\t\t\tend\n\t\t\twhen \"interprovincial\"\n\t\t\t\tif nro_pasajeros <= 3\n\t\t\t\t\treturn 0.8\n\t\t\t\telse\n\t\t\t\t\treturn 0.9\n\t\t\t\tend\n\t\t\t\t\n\t\t\twhen \"interdepartamental\"\n\t\t\t\tif nro_pasajeros <= 3\n\t\t\t\t\treturn 1.25\n\t\t\t\telse\n\t\t\t\t\treturn 1.5\n\t\t\t\tend\n\t\t\telse\n\t\t\t\treturn 0\t\t\t\t\n\t\tend\n\tend", "def valorproteinasp\n\t\tvag=(proteinas * 70) / 100\n vag.round(2)\n\tend", "def pHidratos\n\t\thidr = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\ttotal += alimento.proteinas + alimento.lipidos + alimento.carbohidratos\n\t\t\thidr += alimento.carbohidratos\n\t\tend\n\t\treturn ((hidr/total)*100).round\n\n\t\n\tend", "def pProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\ttotal += (alimento.proteinas + alimento.lipidos + alimento.carbohidratos)\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn ((prot/total)*100).round\t\n\tend", "def totalHidratos\n\t\thidr = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\thidr += alimento.carbohidratos\n\t\tend\n\t\treturn hidr.round(2)\n\tend", "def valorhidratosp\n\t\tvag=(hcarbono * 70) / 100\n vag.round(2)\n\tend", "def car\n\t\tsuma = 0\n\t\tx = 0\n\t\tcantidad = 0\n\n\t\t@alimentos.each do |i|\n\t\t\tcantidad = @gramos[x].valor / (i.proteinas + i.lipidos + i.carbohidratos)\n\t\t\tsuma += i.carbohidratos * cantidad\n\t\t\tx += 1\n\t\tend\t\n\n\t\treturn ((suma * 100) / gramos_total).round(2)\n\tend", "def valormonograsasp\n\t\tvag=(grasasmono * 70) / 100\n vag.round(2)\n\tend", "def irpoliinsaturadas\n vag=(grasaspoli * 100) / 70\n vag.round(2)\n end", "def precio\n\t\t@precio\n\tend", "def irvitaminas\n vag=(vitymin * 100) / 50\n vag.round(2)\n end", "def posti_disponibili\n self.vehicle.posti - self.n_passeggeri\n end", "def get_valor_energetico\n \n return ((@proteinas + @glucidos) * 4 + @lipidos * 9).round(1)\n \n \n end", "def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend", "def valorenergeticoKcal\n veKJ=(cgrasas * 9) + (cgrasassa * 9) + (grasasmono * 9) + (grasaspoli * 9) + (hcarbono * 4) + (polialcoholes * 2.4) + (almidon * 4) + (fibra * 2) + (proteinas * 4) + (sal * 6)\n veKJ.round(2)\n end", "def irmonograsas\n vag=(grasasmono * 100) / 70\n vag.round(2)\n end", "def valorizacao\n \t\tif self.tipo_de_operacao.compra?\n ((self.atual - self.entrada) / self.entrada) * 100.0\n else\n ((self.entrada - self.atual) / self.atual ) * 100.0\n end\n \tend", "def atribuirValor\n\t\t@@compras.each do |produto|\n\t\t\ti = @@compras.index(produto)\n\t\t\tcase produto\n\t\t\t\twhen \"par de meias\"\n\t\t\t\t\t@@compras[i] = 11.99\n\t\t\t\twhen \"camiseta\"\n\t\t\t\t\t@@compras[i] = 29.99\n\t\t\t\twhen \"chinelo\"\n\t\t\t\t\t@@compras[i] = 24.99\n\t\t\t\telse\n\t\t\t\t\tthrow \"Produto não consta.\"\n\t\t\tend\n\t\tend\n\tend", "def irhidratosp\n vag=(valorhidratosp * 100) / 260\n vag.round(2)\n end", "def vct\n\t\tsuma = 0\n\t\t\n\t\tsuma += prot * gramos_total * 4 / 100\n\t\tsuma += car * gramos_total * 4 / 100\n\t\tsuma += lip * gramos_total * 9 / 100\n\t\t\n\t\treturn suma.round(2)\n\tend", "def valorvityminp\n\t\tvag=(vitymin * 70) / 100\n vag.round(2)\n end", "def irgrasassaturadas\n vag=(cgrasassa * 100) / 70\n vag.round(2)\n end", "def get_valor_energetico\n\n return ((@proteinas + @glucidos) * 4 + @lipidos * 9).round(1)\n\n end", "def cobroViaje(tipoViaje, numPersonas, distancia)\n cobro = 0.0\n if (tipoViaje == \"Distrital\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 0.60 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 0.60 * distancia/10 + 0.60\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 0.75 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 0.75 * distancia/10 + 0.75\n end\n elsif (tipoViaje == \"Provincial\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 0.95 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 0.95 * distancia/10 + 0.95\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 1.25 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 1.25 * distancia/10 + 1.25\n end\n elsif (tipoViaje == \"Departamental\")\n if (numPersonas >= 1 && numPersonas <= 5 && distancia%10 == 0)\n cobro = 1.95 * distancia/10\n elsif (numPersonas >= 1 && numPersonas <= 5 && distancia%10 != 0)\n cobro = 1.95 * distancia/10 + 1.95\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 == 0)\n cobro = 2.25 * distancia/10\n elsif (numPersonas >= 6 && numPersonas <= 10 && distancia%10 != 0)\n cobro = 2.25 * distancia/10 + 2.25\n end \n end\n return cobro\nend", "def calcula_imc\n \n if @peso/@altura*@altura < 18\n puts \"vc esta magro\"\n elsif @peso/@altura*@altura <= 25\n puts \"vc esta no peso ideal\"\n elsif @peso/@altura*@altura > 25\n puts \"vc esta acima do peso\"\n end\n \n end", "def valorenergeticoKcalp\n\t\tvag=(valorenergeticoKcal * 70) / 100\n\t\tvag.round(2)\n\tend", "def totalProteina \n\t\tprot = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\tprot += alimento.proteinas\n\t\tend\n\t\treturn prot.round(2)\n\tend", "def irazucaresp\n vag=(valorazucaresp * 100) / 90\n vag.round(2)\n end", "def irvitaminasp\n vag=(valorvityminp * 100) / 50\n vag.round(2)\n end", "def por_prote\n\t\t\t(@proteinas/suma_gramos)*100\n\t\tend", "def irproteinasp\n vag=(valorproteinasp * 100) / 50\n vag.round(2)\n end", "def get_usoterreno\n aux = 0.0\n @contenido.each do |alimento|\n aux += alimento.ground\n end\n @usoterreno = aux\n end", "def precio_total_comprar\n precio_compra = @coste + ((@num_casas + @num_hoteles) * @titulo.precio_edificar).to_i\n \n return precio_compra\n end", "def por_lip\n\t\t\t(@lipidos/suma_gramos)*100\n\t\tend", "def irgrasas\n vag=(cgrasas * 100) / 70\n vag.round(2)\n end", "def precio_total_compras\n compras.sum(:precio_total)\n #p = 0\n #compras.each do |compra|\n #p += (compra.precio_total || 0)\n #end\n #return p\n end", "def get_monoin\n @_100=((@monoin*100)/@peso)\n @ir_100=(@_100/25)*100\n @porcion=((@monoin*@gramos_porciones)/@peso)\n @ir_porcion=(@porcion/25)*100\n [ @monoin , @_100 , @ir_100.round(1) , @porcion , @ir_porcion.round(1) ]\n end", "def valorgrasassatup\n\t\tvag=(cgrasassa * 70) / 100\n vag.round(2)\n\tend", "def vitaminasIR\n\t\t((valorEnergeticoKJ.to_f*260)/8400).round(2)\n\tend", "def valorgrasaspolip\n\t\tvag=(grasaspoli * 70) / 100\n vag.round(2)\n\tend", "def calcular_imc\n (@peso)/(@altura*@altura)\n end", "def calcular_ganancia\n dolar = Option.instance.dolar_libre.to_f\n dinero_acumulado = self.movements.inject(0) do |total,m|\n total + m.monto_neto\n end\n precio_en_dolares = (dinero_acumulado / dolar)\n return (precio_en_dolares - self.copia.precio_compra.to_f)\n end", "def ir_hidratos \n\t\t@hidratos_ir = hidratos\n\t\t@ir_hidratos = (@hidratos_ir/260.to_f)*100\n\t\t@ir_hidratos.round(1)\n\tend", "def aplicarDesconto\n\t\tif @@blackfriday\n\t\t\t@@compras.map! { |p| (p*0.8).round(2) }\n\t\tend\n\tend", "def indice_masa_corporal\n\t\t(peso / (talla * talla) * 10000).round(1)\n\tend", "def totalLipidos\n\t\tlip = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\tlip += alimento.lipidos\n\t\tend\n\t\treturn lip.round(2)\n\t\n\tend", "def huellaAmbiental\r\n indiceCarbono = 0.0\r\n if @geiTotal < 800.0\r\n indiceCarbono = 1.0\r\n elsif @geiTotal <= 1200.0\r\n indiceCarbono = 2.0\r\n else\r\n indiceCarbono = 3.0\r\n end\r\n\r\n indiceEnergia = 0.0\r\n if kcalPlato < 670.0\r\n calorias = 1.00\r\n elsif kcalPlato <= 830.0\r\n calorias = 2.0\r\n else\r\n calorias = 3.0\r\n end\r\n\r\n return (indiceCarbono + indiceEnergia)/2\r\n end", "def irazucares\n vag=(azucares * 100) / 90\n vag.round(2)\n end", "def irpoliinsaturadasp\n vag=(valorgrasaspolip * 100) / 70\n vag.round(2)\n end", "def vrat_celkovy_soucet_vah\n soucet = 0\n @pole_vah.each do |prvek| \n soucet += prvek.to_i\n end\n return soucet\n end", "def porcentajeGlucidos\r\n total_glucidos = 0.0\r\n la = @listaAlimentos.head\r\n lg = @listaGramos.head\r\n while la != nil do\r\n total_glucidos += (la.value.carbohidratos * lg.value) / 100\r\n la = la.next\r\n lg = lg.next\r\n end\r\n total_gramos = listaGramos.reduce(:+)\r\n porcentajeGlucidos = ((total_glucidos / total_gramos)*100).round(2)\r\n end", "def precio_mercado\n @serie.valor_primer_dia('precio')\n end", "def valor_energetico\n (@proteinas * 4) + (@glucidos * 4) + (@grasas * 9)\n end", "def pLipidos\n\t\tlip = 0\n\t\ttotal = 0\n\t\t@platos.each do |alimento|\n\t\t\ttotal += alimento.proteinas + alimento.lipidos + alimento.carbohidratos\n\t\t\tlip += alimento.lipidos\n\t\tend\n\t\treturn ((lip/total)*100).round\n\t\n\tend", "def valorgrasasp\n\t\tvag=(cgrasas * 70) / 100\n\t\tvag.round(2)\n\tend", "def valoralmidonp\n\t\tvag=(almidon * 70) / 100\n vag.round(2)\n\tend", "def promedios\n promedio = (@nota1.to_f + @nota2.to_f + @nota3.to_f) / 3\n promedio\n end", "def por_lipidos\n\t\taux_lipidos = 0.0\n\t\ti = 1\n\t\twhile i < @lista_alimentos.size do\n\t\t\taux_lipidos += @lista_alimentos[i].lipidos * @lista_cantidades[i]\n\t\t\ti+=1\n\t\tend\n\t\treturn ((aux_lipidos/total_nutrientes)*100.0).round(2)\n\tend", "def massaCorporalGorda(percentualDeGordura, peso)\n resultado = (peso*percentualDeGordura)/100\nend", "def ir_proteina\n @ir_proteina = (@proteinas/50.to_f)*100\n @ir_proteina.round(1)\n end", "def travel_ratio\n travel_ratio = actual_travel * 100 / budget_flight\n end", "def prop_c\n bases_c / length.to_f\n end", "def irproteinas\n vag=(proteinas * 100) / 50\n vag.round(2)\n end", "def defineSueldoVendedor(monto)\n sueldoBase = 1500\n comision = 0.0\n if(monto >= 0 && monto <=1999)\n comision = 0.00*monto\n elsif(monto >= 2000 && monto <=10000)\n comision = (0.03*monto).round(2)\n elsif(monto >= 10001 && monto <=20000)\n comision = (0.06*monto).round(2)\n elsif(monto >= 20001)\n comision = (0.1*monto).round(2)\n end\n return (sueldoBase + comision).round(2)\nend", "def hidratosIR\n\t\t((valorEnergeticoKJ.to_f*260)/8400).round(2)\n\tend", "def terrenoTotal\n\t\t@terrenoSuma = 0\n\t\t@platos.each do |alimento|\n\t\t\t@terrenoSuma += alimento.terreno\n\t\tend\n\t\treturn @terrenoSuma.round(2)\n\tend", "def calc_potential_cars_fueled(val1= calc_upg_ch4, val2= 1035)\n\t\t(val1 / val2).round 1\n\tend", "def carbo \n grtotal = 0\n sum = 0\n\t\t#itera en las dos listas a la vez para poder calcular las \n #cabrohidratos dependiendo de la cantidad y tambien suma\n #todas las cantidades para poder calcular el porcentaje\n #despues\n @lista.zip(@listagr).each do |normal, gr|\n grtotal += gr\n cant = gr/1000.0\n sum += normal.carbo*cant\n end\n (sum*100)/grtotal\n end", "def valorenergeticoKJp\n\t\tvag=(valorenergeticoKJ * 70) / 100\n\t\tvag.round(2)\n\tend", "def kcallipidos\n\t\t\t@lipidos * 9\n\t\tend", "def calculate_kcal\n\t\tkcal = 0.0\n\t\tkcal += (@lipids * 9) + (@carbohydrates * 4) + (@proteins * 4)\n\t\tkcal.ceil(2)\n\tend", "def huella_nutricional\n (valor_calorico() + huella_carbono()) / 2\n end", "def valorsalp\n\t\tvag=(sal * 70) / 100\n vag.round(2)\n\tend", "def carbsPercent()\n\t\t\t\tplato = @alimentsList.head\n\t\t\t\tgrams = @gramsList.head\n\t\t\t\ttotalEnergy = 0.0\n\t\t\t\ttotalCarbsEnergy = 0.0\n\n\t\t\t\twhile plato != nil\n\t\t\t\t\ttotalEnergy += (plato.value.get_energia * grams.value) / 100\n\t\t\t\t\ttotalCarbsEnergy += (plato.value.get_energia_carbs * grams.value) / 100\n\n\t\t\t\t\tplato = plato.next\n\t\t\t\t\tgrams = grams.next\n\t\t\t\tend\n\n\t\t\t\treturn (totalCarbsEnergy * 100) / totalEnergy\n\t\t\tend", "def irmonograsaslp\n vag=(valormonograsasp * 100) / 70\n vag.round(2)\n end", "def ir_grasa_saturada \n\t\t@ir_grasa_saturada = (@saturadas/20.to_f)*100\n\t\t@ir_grasa_saturada.round(1)\n\tend", "def get_individual_bono_percentage\n @goles / (@nivel.goles_mes.to_f / 100)\n end", "def valorenergeticoKJ\n\t\tveKJ=(cgrasas * 37) + (cgrasassa * 37) + (grasasmono * 37) + (grasaspoli * 37) + (hcarbono * 17) + (polialcoholes * 10) + (almidon * 17) + (fibra * 8) + (proteinas * 17) + (sal * 25)\n\t\tveKJ.round(2)\n\tend", "def valor_administracion\n\t\tarea * 2300\n\tend", "def calories_per_liter\n 672\n end", "def cintura\n\t\t(@cintura[0] + @cintura[1])/2\n\tend", "def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 and num < 39.9\n\t\t\tnum #- Obesidad grado 2\"\n\t\telsif num > 40\n\t\t\tnum #- Obesidad grado 2\"\n\t\tend\t\t\t\n\tend" ]
[ "0.71335584", "0.70614773", "0.69884187", "0.69729626", "0.6963495", "0.69417924", "0.69015986", "0.68918085", "0.6874473", "0.6755125", "0.67229366", "0.67117506", "0.67044514", "0.6671719", "0.6671009", "0.6664855", "0.6602347", "0.6581777", "0.6575524", "0.6566262", "0.65438676", "0.65355617", "0.65270215", "0.6521806", "0.6517663", "0.65039116", "0.6500824", "0.6478416", "0.64642555", "0.64428514", "0.6441511", "0.6438854", "0.64271915", "0.6391064", "0.6373522", "0.63701123", "0.6364198", "0.63529354", "0.6350487", "0.63391066", "0.633336", "0.63210875", "0.63158625", "0.6290093", "0.62874717", "0.6285106", "0.6253011", "0.62412006", "0.62391293", "0.6237175", "0.62265736", "0.62239677", "0.62187105", "0.6215677", "0.6207334", "0.61912066", "0.6187288", "0.6176522", "0.6165569", "0.61606896", "0.61509776", "0.6134583", "0.6131992", "0.6131744", "0.6129266", "0.61240786", "0.611215", "0.6110393", "0.61085534", "0.61065984", "0.6105374", "0.6104802", "0.60991246", "0.6085689", "0.6075374", "0.6069166", "0.60599905", "0.6058327", "0.60448545", "0.603614", "0.6034539", "0.6031481", "0.60240227", "0.6019582", "0.6013389", "0.60071003", "0.5991519", "0.59833854", "0.5976651", "0.5971211", "0.5969085", "0.5938747", "0.59283525", "0.5926326", "0.5923059", "0.591777", "0.5898457", "0.58981425", "0.58867115", "0.5884023", "0.58806777" ]
0.0
-1
storage :fog Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_dir\n 'file_uploads'\n end", "def store_dir\n \"uploads\"\n end", "def store_dir\n 'uploads'\n end", "def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # This works for the file storage as well as Amazon S3 and Rackspace Cloud Files.\n # Define store_dir as nil if you'd like to store files at the root level.\n nil\n end", "def store_dir\n base_dir = ENV.fetch('FILE_STORE_DIR', \"uploads\")\n if base_dir != \"uploads\"\n public_uploads = File.join(Rails.root, \"public\", \"uploads\")\n FileUtils.symlink(base_dir, public_uploads) unless File.symlink?(public_uploads)\n base_dir = public_uploads\n end\n \"#{base_dir}/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end", "def store_dir\n \"uploads/\"\n end", "def store_dir\n \"uploads/\"\n end", "def store_dir\n \"uploads/\"\n end", "def store_dir\n path = \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n if Rails.env.staging? or Rails.env.production?\n \"#{APP_CONFIG['deploy_path']}#{APP_CONFIG['seed_storage']}/#{path}\"\n else\n path\n end\n end", "def store_dir\n \"#{Rails.root}/tmp/upload/\"\n end", "def store_dir\n \"uploads/photos\"\n end", "def store_dir\n \"uploads/imports/\"\n end", "def store_dir\n \"#{Rails.root}/app/files/uploads/#{ENV['PROJECT_ID']}/\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/\"\n end", "def store_dir\n \"#{Rails.root}/public/uploads/\"\n end", "def store_dir\n \"uploads/#{Rails.env}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.uid}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n # \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # OK!\n #{}\"/home/bjarzab/www/pola2019_storage/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n # OK!\n # \"/mnt/cloud_test/files/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n \"#{Rails.application.secrets[:carrierwave_store_dir]}/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n\t\t\"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n\tend", "def store_dir\n configured_upload_path + \"#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\" \n end", "def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"system/uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{partition_dir(model.id)}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}\"\n end", "def storage_dir\n File.join(thirdpartydir,\"storage\")\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{model.attachable_type}/#{model.attachable_id}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end", "def store_dir\r\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\r\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}_#{mounted_as.to_s.pluralize}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end", "def store_dir\n \"uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}\"\n end" ]
[ "0.7506321", "0.736592", "0.7332265", "0.73319936", "0.73027855", "0.72984564", "0.72778606", "0.72778606", "0.72778606", "0.7269079", "0.7244876", "0.7229235", "0.7225781", "0.7201635", "0.71862006", "0.71782804", "0.7164274", "0.7149744", "0.7149744", "0.7149744", "0.7149744", "0.7149744", "0.7136877", "0.71333116", "0.7131406", "0.71278656", "0.7115834", "0.7115834", "0.7115827", "0.71145344", "0.7107058", "0.7101222", "0.71005857", "0.71005857", "0.7072522", "0.7071485", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131", "0.7071131" ]
0.7110686
30
Creates a new JobScheduler
def initialize(classes, result_aggregator, options, job_type: Job) @classes = classes @result_aggregator = result_aggregator @options = options @job_type = job_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @job_scheduler = JobScheduler.new(job_scheduler_params)\n\n respond_to do |format|\n if @job_scheduler.save\n flash[:success] = \"Success! JobScheduler created.\"\n format.html { redirect_to job_scheduler_url(@job_scheduler) }\n format.json { render :show, status: :created, location: job_scheduler_url(@job_scheduler) }\n else\n flash[:danger] = \"Error! There was a problem creating the Scheduler.\"\n @job_scheduler.destroy\n format.html { render :new }\n format.json { render json: @job_scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_job_scheduler\n @job_scheduler = JobScheduler.find(params[:id])\n end", "def scheduler\n raise NoSchedulerError, \"Scheduler isn't initialized. Call Secondhand.start before scheduling jobs.\" unless @scheduler \n @scheduler\n end", "def create\n @scheduler = Scheduler.new(scheduler_params)\n @scheduler.job_id = @job.id\n if @scheduler.scheduler_event_type_id == 5\n @scheduler.check_manager(@job)\n end\n\n respond_to do |format|\n if @scheduler.save\n @job.track 'Scheduler Created', current_user, @scheduler\n format.html { redirect_to job_path(@job), notice: 'Scheduler was successfully created.' }\n format.json { render :show, status: :created, location: @scheduler }\n else\n format.html { redirect_to job_path(@job), errors: @scheduler.errors }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scheduler = Scheduler.new(params[:scheduler])\n\n respond_to do |format|\n if @scheduler.save\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully created.' }\n format.json { render json: @scheduler, status: :created, location: @scheduler }\n else\n format.html { render action: \"new\" }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def start_scheduler\n @rufus = Rufus::Scheduler.new\n schedule_shutdown_job if !self.timeout.blank?\n schedule_job_specs(JobSpec.where(enabled: true))\n end", "def create_job(params = {})\n Bitmovin::Job.create(params)\n end", "def create\n @scheduler = Scheduler.new(scheduler_params)\n\n respond_to do |format|\n if @scheduler.save\n format.html { redirect_to @scheduler, notice: 'Scheduler was successfully created.' }\n format.json { render :show, status: :created, location: @scheduler }\n else\n format.html { render :new }\n format.json { render json: @scheduler.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(attributes={})\n super\n\n @id = 1\n\n Rails.logger.warn \"JobScheduler instance already exists!\" if @@job_scheduler_instance\n @@job_scheduler_instance ||= self\n\n @@job_scheduler_instance.timeout = attributes[:timeout]\n end", "def scheduler\n @scheduler || Rufus::Scheduler.new\n end", "def initialize(scheduler)\n @scheduler = scheduler\n @scheduler.post_initialize(self)\n end", "def initialize(job_id = nil, status = 'pending', scheduled_at = Time.now)\n if job_id\n @worker_record = WorkerJob.find_by(job_id: job_id)\n @errors = []\n else\n init_vars(status, scheduled_at)\n @worker_record = WorkerJob.create(status: @status, scheduled_at: @scheduled_at, class_name: @class_name, job_id: @job_id)\n end\n end", "def create\n\n # Get schedule json object from parameters\n schedule_params = params[:schedule] ||= {}\n\n # Find if schedule has been created already\n # find by name and group\n @schedule = Schedule.find_by_name_and_group(schedule_params[:name], schedule_params[:group])\n\n if @schedule\n\n # Check to see if the schedule is registered with Quartz (after restart or removal, etc)\n key = JobKey.new(@schedule.name, @schedule.group)\n unless RemoteJobScheduler.instance.scheduler.check_exists(key)\n RemoteJobScheduler.instance.build_schedule(@schedule)\n end\n\n render :json => {:schedule_id => @schedule.id, :msg => 'schedule already exists'}\n else\n begin\n @schedule = Schedule.new(schedule_params)\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n return\n end\n\n if @schedule.save\n begin\n RemoteJobScheduler.instance.build_schedule(@schedule)\n render :json => {:schedule_id => @schedule.id}\n rescue => e\n Rails.logger.error \"Could not create schedule : #{e.message}\"\n render :json => {:error => e.message}\n end\n\n else\n # TODO : We need error codes for this\n render :json => {:error => \"Error : #{@schedule.errors.first[0]} #{@schedule.errors.first[1]}\",\n :content_type => 'text/plain',\n :status => :unprocessable_entity}\n\n end # end (if @schedule.save)\n\n end # end (if @schedule)\n\n end", "def scheduler(params = {})\n scheduler_id = params.delete :uuid\n\n response =\n default_scope.get(\"schedule/schedulers/#{scheduler_id}\") do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end", "def set_scheduler\n @scheduler = Scheduler.find(params[:id])\n end", "def set_scheduler\n @scheduler = Scheduler.find(params[:id])\n end", "def set_scheduler\n @scheduler = Scheduler.find(params[:id])\n end", "def add(*args)\n new_item = args.first\n new_item = (TimeSchedulerItem.new *args) \\\n unless new_item.is_a? TimeSchedulerItem\n \n new_item.schedulers << self\n schedule_update new_item\n new_item\n end", "def new\n @job = Job.new\n end", "def initialize\n @id = SecureRandom.uuid\n @schedule = Rufus::Scheduler.new\n end", "def build_job(start_time, end_time)\n Job.create(\n :start_time => start_time, \n :end_time => end_time, \n :running_time => (end_time-start_time), \n :name => action_name\n )\n end", "def scheduled_job_presenter\n @scheduled_job_presenter ||= V1::ScheduledJobPresenter.new(@scheduled_job, @template)\n end", "def create_job(options = {})\n Job.create({:title => \"Another Dummy Job\", :description => \"This is just another dummy job\"}.merge(options))\n end", "def scheduled_jobs_presenter\n @scheduled_jobs_presenter ||= V1::ScheduledJobsPresenter.new(@scheduled_jobs, @template)\n end", "def job_creator(project_dxid)\n @job_creator ||= JobCreator.new(\n api: DNAnexusAPI.new(@context.token),\n context: @context,\n user: @context.user,\n project: project_dxid,\n )\n end", "def schedule(scheduler)\n case self.interval\n when :startup, :shutdown\n # ignore it\n else\n self.thread = Thread.new do\n loop do\n sleep self.interval\n scheduler.run_queue << self\n end\n end\n self.thread.abort_on_exception = true\n end\n end", "def create\n @db_scheduled_job = DbScheduledJob.new(db_scheduled_job_params)\n authorize! :create, @db_scheduled_job\n \n respond_to do |format|\n if @db_scheduled_job.save\n format.html { redirect_to @db_scheduled_job, notice: 'Database scheduled job was successfully created.' }\n format.json { render :show, status: :created, location: @db_scheduled_job }\n else\n format.html { render :new }\n format.json { render json: @db_scheduled_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @scheduled_job = ScheduledJob.new(scheduled_job_params)\n\n respond_to do |format|\n if @scheduled_job.save\n format.html { redirect_to @scheduled_job, notice: \"Scheduled job was successfully created.\" }\n format.json { render :show, status: :created, location: @scheduled_job }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @scheduled_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_job(job_name, template, pipeline: '', **parameters)\n xml = Autoproj::Jenkins.render_template(template, **parameters)\n xml = update_pipeline_in_config(xml, pipeline)\n jobs.create(job_name, xml)\n end", "def add_cron_job(job)\n client.create_cron_job(Kubeclient::Resource.new(job.cron_job_manifest))\n end", "def add_to_scheduler\n name = \"for_survey_#{@schedulable.company_survey.id}\"\n config = {}\n config[:every] = [\"#{@schedulable.repeat_every}#{@schedulable.repeat_mode}\",\n { first_at: calculate_next_delivery }]\n config[:class] = 'SendEmailsJob'\n config[:queue] = 'send_emails'\n config[:persist] = true\n config[:args] = @schedulable.company_survey.id\n Resque.set_schedule(name, config)\n end", "def new\n @job = Job.new\n end", "def create\n @admin_cron_request = Admin::CronRequest.new(admin_cron_request_params)\n\n respond_to do |format|\n if @admin_cron_request.save\n format.html { redirect_to @admin_cron_request, notice: I18n.t('admin.cron_requests.create.message.success') }\n format.json { render :show, status: :created, location: @admin_cron_request }\n else\n format.html { render :new }\n format.json { render json: @admin_cron_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def reschedule (scheduler)\n\n @scheduler_job_id = \"#{@fei.wfid}__#{@scheduler_job_id}\"\n\n method, arg0 = if @tab\n [ :schedule, @tab ]\n else\n [ :schedule_every, @every ]\n end\n\n get_scheduler.send(\n method,\n arg0,\n {\n :schedulable => self,\n :job_id => @scheduler_job_id,\n :tags => @scheduler_tags })\n\n #ldebug { \"reschedule() name is '#{@name}'\" }\n ldebug { \"reschedule() job id is '#{@scheduler_job_id}'\" }\n end", "def create\n ensure_authenticated!\n\n job = Grid5000::Job.new(job_params)\n Rails.logger.info \"Received job = #{job.inspect}\"\n raise BadRequest, \"The job you are trying to submit is not valid: #{job.errors.join('; ')}\" unless job.valid?\n\n job_to_send = job.to_hash(destination: 'oar-2.4-submission')\n Rails.logger.info \"Submitting #{job_to_send.inspect}\"\n\n result = @oarapi.create_job(job_to_send)\n\n job_uid = JSON.parse(result)['id']\n location_uri = uri_to(\n resource_path(job_uid),\n :in, :absolute\n )\n\n job = OAR::Job.expanded.includes(:job_types, :job_events, :gantt).find(job_uid)\n job.links = links_for_item(job)\n\n render_opts = {\n methods: %i[resources_by_type assigned_nodes],\n location: location_uri,\n status: 201\n }\n render_result(job, render_opts)\n end", "def generate_schedule\n \tschedule = Array.new\n \tqueue = Array.new\n \tcurrent_job = nil\n \tcurrent_job_execution_time = 0\n\n \tfor time in 0...hyper_period\n \t\t# add released tasks to queue\n \t\tqueue += get_released_jobs time\n\n \t\t# give the current job credit for execution in last step\n \t\tcurrent_job_execution_time += 1 unless current_job.nil?\n\n \t\t#check if current task is finished\n \t\tif !!current_job and current_job[:task].worst_case_execution_time == current_job_execution_time\n \t\t\t#task is finished\n \t\t\tcurrent_job = nil\n \t\t\tcurrent_job_execution_time = 0\n \t\tend\n\n \t\t#find a task to execute\n \t\tif current_job.nil?\n \t\t\tcurrent_job = get_highest_priorty_task(queue)\n \t\t\tqueue.delete(current_job)\n \t\tend\n\n \t\t# if we are missing a deadline task set is not schedulable\n \t\tif !!current_job and time >= current_job[:deadline]\n \t\t\treturn nil\n \t\tend\n\n \t\t# add current job to schedule\n \t\tschedule.push(current_job.nil? ? 0 : current_job[:task].id)\n\n \t\t#log whats executing in this slot\n \t\t#puts \"Slot #{time + 1} \" + (current_job.nil? ? \"Idle\" : current_job[:task].name)\n \tend\n\n \t# if queue isn't empty, then return nil\n \treturn nil unless queue.empty?\n\n \t#return schedule\n \tschedule\n end", "def initialize\n klass = self.class\n create_hourly_cronjob(klass.hourly_method) if klass.hourly_method\n create_daily_cronjob(klass.daily_method, klass.daily_trigger_time) if klass.daily_method\n create_weekly_cronjob(klass.weekly_method, klass.weekly_trigger_time) if klass.weekly_method\n end", "def initialize(args={})\n @schedule = args[:schedule] || Schedule.new\n # ...\n end", "def create\n \n params.permit!\n @quartz = Quartz.new(params[:quartz])\n\n respond_to do |format|\n if @quartz.save\n format.html { redirect_to(@quartz, :notice => 'Quartz was successfully created.') }\n format.xml { render :xml => @quartz, :status => :created, :location => @quartz }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @quartz.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_schedule request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_create_schedule_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def create_cron\n cron_edit = CronEdit.new\n command = cron_edit.add_command create_cron_command, Environment.ruby\n puts \"--> added command to cron\"\n puts \" #{command}\"\n end", "def new_job\n j = self.class.new\n j.save\n end", "def initialize(args = {})\n @schedule = args[:schedule] || Schedule.new\n # ...\n end", "def create\n @scheduler_type = SchedulerType.new(scheduler_type_params)\n\n respond_to do |format|\n if @scheduler_type.save\n format.html { redirect_to @scheduler_type, notice: 'Scheduler type was successfully created.' }\n format.json { render :show, status: :created, location: @scheduler_type }\n else\n format.html { render :new }\n format.json { render json: @scheduler_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def on_new_resource(resource)\n debug \"Created: #{resource}\"\n OMF::JobService.scheduler.on_new_job(resource)\n end", "def save!\n start_scheduler\n end", "def createJobWithDefaults\n\t\t@job = @user.jobs.new\n\t\t@job.sender = \"Average Joe <average.joe@gmx.net>\"\n\t\t@job.destinations = \"recipient@gmx.net\"\n\t\t@job.subject = \"A Simple Subject\"\n\t\t@job.content = \"This is a simple test content!\\n\\n#{Time.now.localtime}\"\n\t\t@job.repetition = 2\n\t\t@job.delay = 10\n\tend", "def start_with(*args)\n scheduler = CurrentThreadScheduler.instance\n if args.size > 0 && Scheduler === args[0]\n scheduler = args.shift\n end\n Observable.from_array(args, scheduler).concat(self)\n end", "def create\n @job = params[:construction_job]\n \n @construction_job = nil\n queue = nil\n \n Construction::Job.transaction do\n @construction_job = Construction::Job.new(@job)\n queue = @construction_job.queue\n queue.lock!\n raise ForbiddenError.new('not owner of settlement') unless @construction_job.slot.settlement.owner == current_character\n raise ForbiddenError.new('wrong requirements') unless @construction_job.queueable?\n @construction_job.position = queue.max_position + 1\n @construction_job.save\n end\n \n queue.reload\n queue.check_for_new_jobs\n \n slot = @construction_job.slot\n slot.job_created(@construction_job)\n \n respond_to do |format|\n if @construction_job.save\n format.html { redirect_to @construction_job, notice: 'Job was successfully created.' }\n format.json { render json: @construction_job, status: :created, location: @construction_job }\n else\n format.html { render action: \"new\" }\n format.json { render json: @construction_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(cron_def, &block)\n @cron_def = cron_def\n @block = block\n @next_run = cron_parser && cron_parser.next(Time.now)\n PeriodicTask.tasks << self\n end", "def schedule_recurring_task_creation(task)\n recurring_scheduler = Scheduler.new\n @recurring_schedulers << recurring_scheduler\n\n recurring_scheduler.schedule.every \"#{Helpers.convert_frequency_to_seconds(task.frequency).to_s}s\" do\n new_task = Task.new\n new_task.description = task.description\n new_task.frequency = task.frequency\n new_task.creation_date = Time.now.getlocal\n new_task.target_date = Helpers.calculate_task_target_date(\n new_task.creation_date,\n new_task.frequency\n )\n new_task.recurring_scheduler_id = recurring_scheduler.id\n\n new_task.create_reminder_notification\n new_task.create_failed_notification\n\n add_task(new_task)\n end\n end", "def mkcron(name, addargs = true)\n cron = nil\n command = \"date > #{tmpdir()}/crontest#{name}\"\n args = nil\n if addargs\n args = {\n :command => command,\n :name => name,\n :user => @me,\n :minute => rand(59),\n :month => \"1\",\n :monthday => \"1\",\n :hour => \"1\"\n }\n else\n args = {:command => command, :name => name}\n end\n assert_nothing_raised {\n cron = @crontype.new(args)\n }\n\n cron\n end", "def initialize(testing_frequency = \"60m\")\n # Set up the tasks\n @job_ids_by_task = {}\n @tasks_by_job_ids = {}\n # Start the scheduler\n @scheduler = Rufus::Scheduler.start_new\n # Create a logger\n @logger = Logger.new( 'scheduler.log', 'monthly' )\n @task_test_results_logger = Logger.new( 'task_test_results.log', 'monthly' )\n puts \"Schedule tests\"\n # Add the test runninng scheduler method\n @scheduler.every(testing_frequency) do\n test_results = execute_task_tests()\n test_results.each {|test_result|\n # the test is not nil then we have an error (print this error to the log)\n if(!test_result.nil?)\n @task_test_results_logger.error(test_result.inspect)\n end\n }\n end\n end", "def rocket_job_restart_new_instance\n return if expired?\n attrs = attributes.dup\n rocket_job_restart_excludes.each { |attr| attrs.delete(attr) }\n\n # Copy across run_at for future dated jobs\n attrs['run_at'] = run_at if run_at && (run_at > Time.now)\n\n rocket_job_restart_create(attrs)\n end", "def enqueue_at(_job, _timestamp)\n raise NotImplementedError, 'This queueing backend does not support scheduling jobs.'\n end", "def create_job(job:, params: {})\n response = HTTParty.post(\"#{@host}/api/jobs\", body: {job: job, api_key: @api_key}.merge(params))\n \n return response\n end", "def schedule(*args, &block)\n @jobs << [block, args]\n end", "def schedule(*args, &block)\n @jobs << [block, args]\n end", "def job_scheduler_params\n params.require(:job_scheduler).permit(:id, :timeout)\n end", "def set_scheduled_job\n @scheduled_job = ScheduledJob.find(params[:id])\n end", "def start\n @schedule_thread = Thread.new do\n begin\n # Continuously loop through the heap for the next scheduled job\n job = nil\n loop do\n unless @heap.empty?\n @mutex.synchronize do\n job = @heap.pop\n @job_set.delete(Digest::SHA1.hexdigest(job.json))\n execute_n_reschedule(job) unless job.nil?\n end\n end\n sleep 0.1\n end\n rescue Exception => e\n STDERR.puts e.message\n STDERR.puts e.backtrace\n end\n end\n end", "def job\n job_name.constantize.new({\n :context => self\n })\n end", "def schedule(*args, &block)\n @jobs << [block, args]\n end", "def initialize(name, last_run_timestamp, auto_retry)\n # name is a string\n # last_run_timestamp can either be a Time object, or a string denoting a time\n # In the case of queued jobs, last_run_timestamp > between the scheduled_timestamp (passed into get_task_objects) and\n # less than the current timestamp. Scheduled_timestamp pluss .1 second should work well\n raise ScheduledTaskException, \"initialize not overridden in #{self.class}\"\n end", "def schedule(*args, &block)\n @jobs << [block, args]\n end", "def schedule (cron_line, params={}, &block)\n\n params = prepare_params(params)\n\n #\n # is a job with the same id already scheduled ?\n\n cron_id = params[:cron_id] || params[:job_id]\n\n #@unschedule_queue << cron_id\n\n #\n # schedule\n\n b = to_block(params, &block)\n job = CronJob.new(self, cron_id, cron_line, params, &b)\n\n @schedule_queue << job\n\n job.job_id\n end", "def load_schedule_from_args\n @my_schedule = worker_options[:schedule]\n new_load_schedule if @my_schedule\n end", "def get_report_scheduler_service(endpoint_url = nil)\n driver = JasperServer::ReportSchedulerService::ReportSchedulerInterface.new(endpoint_url) \n driver.options[\"protocol.http.basic_auth\"] << [endpoint_url, @username, @password]\n driver.wiredump_dev = @xml_logger\n return driver\n end", "def rocket_job_restart_new_instance\n return unless cron_schedule\n\n super\n end", "def create_schedule(body, opts = {})\n data, _status_code, _headers = create_schedule_with_http_info(body, opts)\n return data\n end", "def create_job(json_payload)\n conn = @client.post do |req|\n req.url '/api/v2/job/create'\n req.headers[\"Authorization\"] = @token\n req.body = json_payload\n end\n conn.body\n end", "def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end", "def rocket_job_restart_new_instance\n return unless cron_schedule\n super\n end", "def create_new_schedule()\n wait_until_schedules_page_new_schedule_button_visible\n schedules_page_new_schedule_button.click\n self.wait_for_no_spinner\n wait_until_schedules_page_new_schedule_button_visible\n wait_until_schedules_page_active_schedule_title_visible\n self.wait_for_no_spinner\n MIST::AsyncHelper.wait_until{(schedules_page_active_schedule_title.text =~ /Schedule\\s*\\d+/i) == 0}\n end", "def schedule\n @schedule || Schedule.new\n end", "def schedule_scheduler_agent(agent)\n job = scheduler_agent_job(agent)\n\n if agent.unavailable?\n if job\n puts \"Unscheduling SchedulerAgent##{agent.id} (disabled)\"\n job.unschedule\n end\n nil\n else\n if job\n return job if agent.memory['scheduled_at'] == job.scheduled_at.to_i\n puts \"Rescheduling SchedulerAgent##{agent.id}\"\n job.unschedule\n else\n puts \"Scheduling SchedulerAgent##{agent.id}\"\n end\n\n agent_id = agent.id\n\n job = schedule_cron agent.options['schedule'], tag: SCHEDULER_AGENT_TAG do |job|\n job.scheduler_agent_id = agent_id\n\n if scheduler_agent = job.scheduler_agent\n scheduler_agent.control!\n else\n puts \"Unscheduling SchedulerAgent##{job.scheduler_agent_id} (disabled or deleted)\"\n job.unschedule\n end\n end\n # Make sure the job is associated with a SchedulerAgent before\n # it is triggered.\n job.scheduler_agent_id = agent_id\n\n agent.memory['scheduled_at'] = job.scheduled_at.to_i\n agent.save\n\n job\n end\n end", "def schedule_jobs(jobs)\n scheduler = Rufus::Scheduler.start_new\n \n jobs.each do |job|\n Mongolicious.logger.info(\"Scheduled new job for #{job['db'].split('/').last} with interval #{job['interval']}\")\n scheduler.every job['interval'] do\n backup(job)\n end\n end \n \n scheduler.join\n end", "def create_schedule(authorization, \n create_schedule_body = nil)\n\n # prepare query url\n _query_builder = Configuration.get_base_uri()\n _query_builder << '/schedules/new'\n _query_url = APIHelper.clean_url _query_builder\n\n # prepare headers\n _headers = {\n 'accept' => 'application/json',\n 'content-type' => 'application/json; charset=utf-8',\n 'Authorization' => Configuration.authorization,\n 'Authorization' => authorization\n }\n\n # prepare and execute HttpRequest\n _request = @http_client.post _query_url, headers: _headers, parameters: create_schedule_body.to_json\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 == 422\n raise EntitiesErrorErrorException.new 'Unprocessable Entity', _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 CreateScheduleResponse.from_hash(decoded)\n end", "def initialize_job\n launched_job_initializers\n \n job_template_initializers\n end", "def create\n http = Net::HTTP.new(\"#{@server_instance}.salesforce.com\", 443)\n http.use_ssl = true\n\n job_request = generate_create_request.lstrip\n logger.debug job_request\n response = http.post('/services/async/21.0/job',\n job_request,\n {\"Content-Type\" => \"application/xml;charset=UTF-8\", \"X-SFDC-Session\" => @session_id})\n\n return response.body if response.class != Net::HTTPCreated\n\n job_response = JobResponse.fromXML(response.body)\n @sf_job_id = job_response.job_id\n job_response\n end", "def create_task name, url, cron, enabled = nil, timeout = nil, mail_when_success = false, mail_when_failure = false, timezone = nil\n connection.create_task(id, name, url, cron, enabled, timeout, mail_when_success, mail_when_failure, timezone)\n end", "def new\n @encoding_job = EncodingJob.new\n end", "def create(id, klass, *args)\n plan = [klass.to_s, args]\n with_redis { |redis| redis.set(id, MultiJson.encode(plan)) }\n # Return the job\n job = new(id, klass, *args)\n job.clear\n job\n end", "def load_schedule!\n @schedule ||= load_default_schedule\n\n fail 'You should setup a schedule or place it in config/schedule.yml' unless schedule\n\n schedule.each do |name, config|\n # If rails_env is set in the config, enforce ENV['RAILS_ENV'] as\n # required for the jobs to be scheduled. If rails_env is missing, the\n # job should be scheduled regardless of what ENV['RAILS_ENV'] is set\n # to.\n if config['rails_env'].nil? || rails_env_matches?(config)\n setup_job_schedule(name, config)\n end\n end\n end", "def index\n @job_schedulers = JobScheduler.all\n end", "def createschedule(uid,rname,scparams,stparams)\r\n scrbslog(\"======Begin to create a new schedule======\")\r\n @user = User.find(uid)\r\n scrbslog(\"Author:\" + @user.name)\r\n @room = Room.find_by_room_name(rname) \r\n @schedule = Schedule.create(scparams)\r\n @user.schedules << @schedule\r\n @room.schedules << @schedule\r\n stparams[\"scheduleid\"]=@schedule.id\r\n @status = Status.create(stparams)\r\n scrbslog(scparams)\r\n scrbslog(\"======End to create a new schedule======\")\r\n end", "def create\n @launched_job = LaunchedJob.new(launched_job_params)\n\n respond_to do |format|\n if @launched_job.save\n format.html { redirect_to @launched_job, notice: 'Launched job was successfully created.' }\n format.json { render json: @launched_job, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @launched_job.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_for_job(job, batch)\n jr = JobRun.new(self)\n jr.created_at = Time.now\n jr.job_id = job.id\n jr.status = :new\n jr.batch = batch.to_json\n insert_sql = \"INSERT INTO #{@schema_name}.job_runs(created_at, updated_at, job_id, batch, status) VALUES ('#{Time.now}','#{Time.at(0)}', '#{job.id}', '#{batch.to_json}', 'new') RETURNING id\";\n r = exec_sql(insert_sql).values\n if r.length == 0\n return nil\n end\n jr.id = r.first[0].to_i\n jr\n end", "def initialize(name, job)\n @name = name\n @job = job\n end", "def job(id)\n Job.new(id, self)\n end", "def schedule(time_at: nil)\n # Generate task payload\n task = task_payload.merge(schedule_time: time_at).compact\n\n # Create and return remote task\n CloudTask.create(task)\n end", "def create_job_id\n application_job_overrides_method!(__method__)\n\n # default implementation for framework jobs\n Generators.generate_uuid(self)\n end", "def create_scheduled_push\n Push::ScheduledPush.new(self)\n end", "def scheduler_agent\n agent_id = scheduler_agent_id or return nil\n\n Agent.of_type(Agents::SchedulerAgent).active.find_by(id: agent_id)\n end", "def initialize(scheduler)\n super\n opts = scheduler.options\n @subauthorities = opts[:central_broker][:subauthorities]\n @@sfa_namespaces = {}\n @@sfa_namespaces[:omf] = 'http://schema.mytestbed.net/sfa/rspec/1'\n @@sfa_namespaces[:ol] = 'http://nitlab.inf.uth.gr/schema/sfa/rspec/1'\n @@sfa_namespaces[:flex] = 'http://nitlab.inf.uth.gr/schema/sfa/rspec/lte/1'\n end", "def scheduler_params\n params.fetch(:scheduler, {})\n end", "def new_worker(opts={})\n @mutex.synchronize {\n job_key = opts[:job_key] || gen_key\n unless self[job_key]\n if opts[:singleton] == true\n worker = get_worker_by_class(opts[:class])\n return worker if worker\n end\n self[job_key] = instantiate_worker(opts[:class]).new(job_key, opts[:args])\n self[job_key].start_process\n @timestamps[job_key][:expire_type] = opts[:expire_type] || :created\n @timestamps[job_key][:ttl] = opts[:ttl] || :immortal\n return job_key\n else\n raise ::BackgrounDRbDuplicateKeyError\n end\n }\n end", "def create_scheduling_object(principal_uri, object_uri, object_data)\n end", "def scheduler_params\n params.require(:scheduler).permit(:event_date, :start_time, :end_time, :assigned_to_user_id, :job_id, :scheduler_event_type_id, :notes, :title)\n end", "def new\n @scheduler = Scheduler.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @scheduler }\n end\n end", "def create name, options = {}\n \n scheduled_action = ScheduledAction.new(name, \n :auto_scaling_group_name => auto_scaling_group_name_opt(options),\n :config => config)\n\n scheduled_action.update(options)\n scheduled_action\n\n end" ]
[ "0.6695572", "0.6507251", "0.6492816", "0.64896166", "0.6323488", "0.6312585", "0.6305333", "0.6295468", "0.62597036", "0.5966181", "0.594305", "0.58616054", "0.58603346", "0.5834377", "0.5832244", "0.5832244", "0.5832244", "0.57532024", "0.57215494", "0.5717579", "0.5679437", "0.56717193", "0.56209564", "0.56066465", "0.55678976", "0.5557044", "0.5555319", "0.55131185", "0.5500792", "0.54999495", "0.54712605", "0.5470814", "0.5464783", "0.54549325", "0.5446466", "0.54434353", "0.54403883", "0.5419706", "0.5401419", "0.539861", "0.53870696", "0.5386214", "0.53804326", "0.53746706", "0.5328639", "0.5327", "0.53072447", "0.5299166", "0.5293527", "0.52865297", "0.5284994", "0.5270587", "0.52640754", "0.52454853", "0.52367085", "0.5196259", "0.5194902", "0.5194902", "0.5192492", "0.5184276", "0.517836", "0.51756066", "0.51714104", "0.5171273", "0.5168548", "0.51636404", "0.5160169", "0.5135453", "0.51353705", "0.51352596", "0.51293004", "0.5121691", "0.5121691", "0.5107003", "0.5106434", "0.51024693", "0.50985384", "0.5096062", "0.5091156", "0.50893354", "0.5085836", "0.50801194", "0.50773543", "0.5070245", "0.5060537", "0.50581986", "0.505716", "0.5036496", "0.5031869", "0.5029348", "0.5023011", "0.5022438", "0.50129855", "0.5011698", "0.50050074", "0.5000897", "0.5000802", "0.4994464", "0.49944398", "0.49877003", "0.49858502" ]
0.0
-1
def send_blowio(message, number) blowerio = RestClient::Resource.new(ENV['BLOWERIO_URL']) blowerio['/messages'].post :to => number, :message => message end
def send_sms(number, subject, carrier, message) SMSMailer.sms_mailer(number, subject, carrier, message).deliver_now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_message\n response = RestClient::Request.new(\n :method => :post,\n :url => \"https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_ACCOUNT_SID']}/Messages.json\",\n :user => ENV['TWILIO_ACCOUNT_SID'],\n :password => ENV['TWILIO_AUTH_TOKEN'],\n :payload => { :Body => body,\n :To => Contact.find(self.contact_id).number,\n :From => ENV['USER_NUMBER'] }\n ).execute\n end", "def send_joke\r\n client = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token\r\n message = client.messages.create from: '347-933-6917', to: params[:phone_number], body: Joke.pick_joke\r\n redirect_to :back\r\n end", "def send(message)\n\t\turl_arg = @params\n\t\turl_arg[\"input\"] = message\n\t\turl_arg_str = URI.encode_www_form(url_arg)\n\n\t\theaders = {\n\t\t\t'User-Agent' => 'cleverbotrb https://github.com/d0p1s4m4/cleverbotrb',\n\t\t}\n\n\t\treq = Net::HTTP.new(HOST, 80)\n\t\tresp = req.get(@endpoint + url_arg_str, headers)\n\t\tif resp.code != \"200\"\n\t\t\treturn nil\n\t\tend\n\t\tresponse = JSON.parse(resp.body)\n\t\t@params['cs'] = response['cs']\n\t\treturn response['output']\n\tend", "def send_message(message); end", "def send_message(message); end", "def send(message)\n headers = { 'Content-Type' => 'application/json' }\n payload = { text: message }.to_json\n HTTParty.post(@webhook_url, body: payload, headers: headers)\n end", "def send_message(arg1, arg2)\n account_sid = 'AC5XXXXXXXXXXXXXXXXXXX' # place twilio sid here\n auth_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' # place twilio auth token here\n client = Twilio::REST::Client.new(account_sid, auth_token)\n \n from = '' # Your Twilio number\n to = arg1 # Your mobile phone number\n \n client.messages.create(\n from: from,\n to: to,\n body: arg2\n )\n\n end", "def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end", "def send_message(user_id, message_content)\n\t\tfull_route = self.endpoint_route.gsub(USER_ID_KEY, user_id)\n\n\t\tdata = message_content.clone\n\t\tdata[\"token\"] = self.webhook_token\n\t\tquery = self.get_query(data)\n\n\t\turl = \"#{ full_route }?#{ query }\"\n\n\t\tresponse = HTTParty.get(url, body: data.to_json, headers: JSON_HEADERS)\n\t\tif response.code < 200 || response.code >= 300\n\t\t\traise \"Error\\nWebook HTTP Status: #{ response['code'] }. #{ response['message'] }\"\n\t\tend\n\tend", "def say(message)\n http = Net::HTTP.new(@uri.host, @uri.port)\n http.use_ssl = true\n req = Net::HTTP::Post.new(@uri.request_uri, @header)\n req.body = message.to_json\n http.request(req).code\n end", "def send_message\n twilio_service = TwilioService.new \n twilio = twilio_service.client\n if @user.first_name.downcase == 'brooks' && @user.last_name.downcase =='swinnerton'\n \n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: 'http://media-cache-ec0.pinimg.com/avatars/bswinnerton-57_140.jpg'\n )\n else\n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: @reddit.first_picture\n )\n end\n end", "def send_sms phone, message\n message = URI.escape message\n response = RestClient.get \"#{sender_base_url}/?from=#{@from}&to=#{phone}&text=#{message}&pass=#{@application_pass}\"\n @response = Response.new response\n end", "def add_bounce\n begin\n RestClient.post $cnf['mailgun']['apikey'] + $cnf['mailgun']['bounnces'],\n :address => 'bkotu6717@gmail.com'\n rescue Exception => e\n puts \"Exception raised add_bounce:\" + e.class.to_s\n puts e.message\n end\n end", "def send_simple_message\n user_email = params[ :from ]\n subject = params[ :subject ]\n text = params[ :text ]\n\n mailgun_api = Rails.application.secrets.secret_mailgun_api\n RestClient.post 'https://api:' + \"#{mailgun_api}\" +\n '@api.mailgun.net/v3/aondebrasil.com/messages',\n from: user_email,\n to: 'contato@aondebrasil.com',\n subject: subject,\n text: text\n\n respond_to do |format|\n format.json { render json: \"enviado\".to_json }\n end\n end", "def send_basic_message(message)\n\n resp = validate_message(message)\n if resp.result != SendResult.enum[\"Success\"]\n resp\n end\n\n req_factory = InjectionRequestFactory.new(@server_id, @api_key)\n request = req_factory.generate_request(message)\n\n # debug\n request_hash = request.to_hash\n debug_json = request_hash.to_json\n @request_json = debug_json\n\n http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })\n response = http_request.send_request(request)\n @response_json = response.to_json\n\n end", "def message\n account_sid = ENV['TWILIO_ACCOUNT_SID'] \n auth_token = ENV['TWILIO_AUTH_TOKEN'] \n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n from = ENV['TWILIO_PHONE_NUMBER']\n to = '+15145037764' # Your mobile phone number\n\n client.messages.create(\n from: from,\n to: to,\n body: \"The Elevator '#{self.id}', Serial Number '#{self.serial_number}' needs an intervention\" \n )\n end", "def send_message(number_arr,message)\n # put your own credentials here\n #number_arr, my_message\n\n account_sid = ENV[\"twilio_account_sid\"]\n auth_token = ENV[\"twilio_auth_token\"]\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n\n number_arr.each do |number|\n begin\n @client.api.account.messages.create(\n from: '+12892761834',\n to: number,\n body: message\n )\n rescue => err\n puts \"********************send msg error********************\"\n puts err.message\n puts \"********************send msg error********************\"\n end\n\n end\n\n end", "def send_request(from, to, title, message)\n RestClient.post API_URL+\"/messages\",\n :from => from.email,\n :to => to.email,\n :subject => \"UROP Application for \"+title+\" from \"+from.first_name+\" \"+from.last_name,\n :text => message\n end", "def send_text(number, message)\n @client.api.account.messages.create(\n to: number,\n from: 'add phone number',\n body: message\n )\n end", "def twilio\n account_sid = ENV[\"TWILIO_SID\"]\n auth_token = ENV['TWILIO_TOKEN']\n client = Twilio::REST::Client.new account_sid, auth_token\n\n from = \"8452633595\"\n\n client.account.messages.create(\n :from => from,\n :to => self.phone,\n :body => \"#{self.title} - #{self.full_desc} ($#{self.price})\"\n )\n puts \"Sent message\"\n end", "def send_raw(to, msg, dlr_url='')\n raise \"To should not be a user in send_raw\" if to.instance_of?(User)\n\n log_an_event(\"send_raw\",\"#{to} #{msg} #{dlr_url}\")\n\n gateway_status = nil\n gateway_string = nil\n\n # could limit message here\n # msg = msg[0..MSG_MAX_LEN]\n\n # todo: ensure the page has valid characters\n # todo: ensure the to is only numbers\n url = \"http://#{@server}:#{@port}/cgi-bin/sendsms?\"+\n \"username=#{@username}&password=#{@password}\"\n wait_for_response = false\n if (@dlr_mask && @dlr_mask.to_i>0 && @dlr_url && dlr_url)\n url = url + \"&dlr-mask=#{@dlr_mask}&dlr-url=#{URI::escape(dlr_url)}\"\n wait_for_response = true\n end\n url = url + \"&to=#{URI::escape(to)}&text=#{URI::escape(msg)}\"\n log_an_event \"send_raw url\", url\n open(url) do |f|\n # status will give us a message\n # read the status as well\n\n # it could fail here\n # but it cannot succeed immediately since this is just queued\n # from Kannel user guide, return codes are:\n #200: 0: Accepted for delivery\n #202: 0: Accepted for delivery\n #The message has been accepted and is delivered onward to a SMSC driver.\n #Note that this status does not ensure that the intended recipient receives the message.\n #202\t3: Queued for later delivery\n #4xx\t(varies)\n #503\tTemporal failure, try again later.\n # it returns an array [\"202\",\"Accepted\"]\n f_status_code = f.status\n f_status_code = f.status[0] if f.status.is_a?(Array)\n if not [\"200\", \"202\"].member?(f.status[0])\n gateway_status = STATUS_FAILED\n gateway_string = f.status.to_s\n log_an_error(\"send_raw\", \"FAILED to send #{url}\\n#{f.status.inspect}\")\n else\n gateway_string = f.read\n\n # 2 modes for the kannel server\n # either we wait for a delivery receipt, or we just send it to the server and assume this has been sent\n if wait_for_response\n gateway_status = STATUS_PENDING\n else\n gateway_status = STATUS_DELIVERED\n end\n log_an_event(\"send_page\", \"SUCCESS #{url} #{gateway_string}\")\n end\n end\n [wait_for_response, gateway_status, gateway_string]\n end", "def send_text_message(body)\n if self.mobile.present?\n begin\n TWILIO_CLIENT.messages.create(from: ENV['TWILIO_PHONE_NUMBER'], to: self.mobile, body: body)\n rescue Twilio::REST::RequestError => e\n puts \"Twilio Error: #{e.message}\"\n end\n end\n end", "def create\n @message = Message.new(params[:message])\n @message.sender = \"cmu3071\" #THIS NEEDS TO BE CHANGED WHEN OAF RECEIVES THEIR OWN SHORTCODE\n @message.time = Time.now\n \n body = @message.body\n phones = Message.split_numbers(@message.recipient)\n\n phones.each do |ph|\n phone = Message.reformat_phone(ph)\n puts \"PHONE: #{phone}\"\n url = Message.text_to(phone,body)\n puts \"URL: #{url}\"\n newUrl = URI.parse(URI.encode(url.strip))\n http = Net::HTTP.new(newUrl.host,443)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n @data = http.get(newUrl.request_uri)\n puts \"STATUS: #{@data.code}\"\n puts \"BODY: #{@data.body}\"\n puts \"RESPONSE: #{@data}\"\n end\n \n respond_to do |format|\n if @message.save\n format.html { redirect_to @message, notice: 'Message was successfully created.' }\n format.json { render json: @message, status: :created, location: @message }\n else\n format.html { render action: \"new\" }\n format.json { render json: @message.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end", "def smsFail1 \n response = HTTParty.post($uris, :body => {message: App.message})\nend", "def send(message)\n message\n end", "def send_message(message)\n @networking.send_message(message)\n end", "def wechat_api api_name, wat, data\n apiURLs={\n :sendTemplateMessage => \"cgi-bin/message/template/send?access_token=#{wat}\",\n :sendTextMessage => \"cgi-bin/message/custom/send?access_token=#{wat}\"\n }\n base = 'https://api.weixin.qq.com/'\n url = base + apiURLs[api_name]\n\n res = RestClient.post url, data.to_json\n return JSON.parse res.body\nend", "def send_message(message)\n body = message.is_a?(String) ? options.merge(text: message) : options.merge(message.as_json)\n\n conn = Faraday.new(url: @base_uri)\n\n response = conn.post('', payload: body.to_json)\n\n response\n end", "def send_moola!\n # @todo\n end", "def send_message(message)\n message = JSON.generate(message)\n @log.debug(\"Sending #{message}\")\n @ws.send(message)\n end", "def send\n begin\n response = RestClient.post \"https://api:#{ENV['MG_API_KEY']}\"\\\n \"@api.mailgun.net/v3/#{ENV['MG_DOMAIN']}/messages\",\n from: \"#{@params['from_name']} <#{@params['from']}>\",\n to: \"#{@params['to_name']}, #{@params['to']}\",\n subject: \"#{@params['subject']}\",\n html: \"#{ActionController::Base.helpers.sanitize(@params[\"body\"])}\"\n rescue RestClient::ExceptionWithResponse => e\n @errors = e.response\n end\n end", "def send_text(message, site_id)\n s1 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_account_sid\").first\n account_sid = s1 ? s1.value : nil\n s2 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_auth_token\").first\n auth_token = s2 ? s2.value : nil\n s3 = Caboose::Setting.where(:site_id => site_id, :name => \"twilio_from_number\").first\n twilio_number = s3 ? s3.value : nil\n send_to = self.cell_phone.blank? ? (self.direct_work_phone.blank? ? self.other_phone : self.direct_work_phone) : self.cell_phone\n send_to = '205-657-0937' if Rails.env.development? # Billy's cell\n if account_sid && auth_token && twilio_number && !send_to.blank? && !message.blank?\n @client = Twilio::REST::Client.new account_sid, auth_token\n begin\n message = @client.messages.create(\n body: message,\n to: \"+1#{send_to.gsub(/[(\\- )]/, '')}\",\n from: \"#{twilio_number}\"\n )\n rescue\n Caboose.log(\"invalid phone number\")\n end\n end\n end", "def send_my_message\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n @client.account.messages.create(\n :from => @from,\n :to => @to,\n :body => @body\n )\n end", "def bounce_with(message); end", "def bounce_with(message); end", "def deliver(message)\n Net::HTTP.start(EVENT_BUS_SERVER_URL.host, EVENT_BUS_SERVER_URL.port) do |http|\n request = Net::HTTP::Post.new EVENT_BUS_SERVER_URL\n request.body = message\n request.content_type = \"application/json\"\n request[\"Authorization\"] = authorization\n response = http.request request # Net::HTTPResponse object\n puts response.inspect\n\n # TODO: If the response is not 200 then there needs to be retry logic\n end\nend", "def reply # acts as endpoint\n \tmessage_body = params[\"Body\"] # grab params from Twilio's request\n \tfrom_number = params[\"From\"]\n \tboot_twilio\n \tsms = @client.messages.create( # send to inbound number made by end user\n from: Rails.application.secrets.twilio_from_number,\n to: from_number,\n body: \"Hello there, thanks for texting me. Your number is #{from_number}.\"\n \t)\n end", "def b_rdt_send message\n puts 'B Sending Data Unreliably...'\n packet = Packet.new\n packet.payload = message.data\n b_udt_send packet\nend", "def create\n to = params[:to]\n\n unless to\n raise IOError, \"Incorrect params for sending text message\" \n end\n\n @client = Twilio::REST::Client.new(\n CONFIG[:twilio_account_sid],\n CONFIG[:twilio_auth_token])\n\n @account = @client.account\n @message = @account.sms.messages.create({\n :from => CONFIG[:twilio_phone_number],\n :to => to,\n :body => \"Happy Mining! #{CONFIG[:ios_app_link]}\"}) \n\n rescue => ex\n handle_exception(ex)\n ensure\n respond_to do |format|\n format.json\n end\n end", "def main()\n puts(\"\\n\\nStarting up...\")\n\n #-------------------------\n # SET UP INFO\n #-------------------------\n # set up twilio info\n account_sid, auth_token, twilio_number = get_account_info()\n wordHash = HuffmanEncoder.getHash() # list of words to encode with\n\n \n get '/message' do\n\n #----------------------------\n # PREPARE TEXT RESPONSE\n #----------------------------\n puts(\"\\n\\n\\n\\nrecieved\\n\")\n \n # 1) Collect information from user text\n user_number = params['From']\n sms = params['Body'] # store incoming sms text\n declaration, bot_key, bot_case, packageSlot, content_request =\n get_request_info(sms)\n \n # 2) Run Bot\n # Gets bot name, and then runs bot from command line\n bot = %x{ruby BotFinder.rb #{bot_key}}.chomp\n result = %x{ruby bots/#{bot} #{content_request}}.downcase \n \n # 3) prepare result for sms\n encoded = Encoder.encode(result, wordHash) # encode it\n output = SeparateIntoTexts.separate(encoded, 150) # split it\n \n # print to terminal\n print_string(result)\n printf(\"packages size: %d\\npackageSlot: %d\\n\", output.length, packageSlot)\n print_string(output)\n # print packages expected: \n \n #----------------------------\n # SEND TEXT TO USER\n #----------------------------\n size = output.length\n \n if(declaration)\n # Send Declaration Text\n # { + bot_key + request + packageSlot + size \n size = output.length\n sms_message = \"{\" + bot_key + bot_case +\n packageSlot + int_to_key(size) + content_request\n \n send_text(account_sid, auth_token, sms_message,\n user_number, twilio_number)\n else\n # Send Content Texts\n # packageSlot + index + content\n index = 0\n while(index<size)\n sms_message = packageSlot + int_to_key(index) + output[index] \n \n send_text(account_sid, auth_token, sms_message,\n user_number, twilio_number)\n index+=1\n end\n end\n \n end\nend", "def send_text\n @number_list.each do |number|\n # clock = Alarm.new(2014, 07, 17, 11, 38, 40)\n puts Time.now\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n # until Time.now > clock.time\n # puts \"It's not time!\"\n # sleep (5)\n # end\n @client.account.messages.create(\n :from => '+18152642023',\n :to => number,\n :body => @body\n )\n end\n end", "def post_haiku(line_1,line_2,line_3)\n url = ENV[\"SLACK_URL\"]\n payload = {username: \"haiku-bot\", icon_url: \"christmas-haiku.jpg\", text: line_1+\"\\n\"+line_2+\"\\n\"+line_3, channel: \"#random\"}\n RestClient.post(url, payload.to_json, accept: :json)\n end", "def http_transport(message)\n headers = {\n 'Content-Type' => 'application/json',\n 'M-Api-Token' => @config[:token]\n }\n\n @pool.post do\n begin\n response = @http.send_request('PUT', '/tel/v2.0/metrics', message, headers)\n\n if response.code != '201'\n @logger.debug(\"Failed to flush message via http with: #{response.code} - #{response.msg}\") unless @logger.nil?\n end\n rescue StandardError => ex\n @logger.debug(\"Statful: #{ex} on #{@config[:host]}:#{@config[:port]}\") unless @logger.nil?\n false\n end\n end\n end", "def send_messages(event)\n begin\n scheme = request.scheme\n host = request.host\n rescue NameError\n scheme = 'http'\n host = 'testing'\n end\n message = <<EOL\nPlease attend this blood drive event and help save lives.\n#{scheme}://#{host}/events/#{event.id}\nEOL\n Donor.where(zipcode: event.zipcode).map(&:phone).each do |ph|\n @client.messages.create(:from => twilio_number, :to => ph , :body =>message)\n end\n end", "def cGetGas(userid, bot)\n bot.api.send_message(chat_id: userid, text: \"Fast transaction price: #{getApi('fast')} GWEI\\nSafe Low: #{getApi('safeLow')} GWEI\")\nend", "def get_message_body(url)\n response = RestClient::Request.execute method: :get,\n url: url,\n user: USERNAME,\n password: PASSWORD,\n :content_type => :json,\n :accept => :json\n\n if response.headers[:x_ratelimit_remaining].to_i < 3\n reset_time = Time.at(response.headers[:x_ratelimit_reset].to_i)\n delay = (reset_time - Time.now) + 5\n puts 'SLEEPING FOR: '+ delay.to_s\n sleep delay\n end\n\n JSON(response)['text']\n end", "def send_message(msg); end", "def write_berp(obj)\n socket.write(Client.create_berp(obj))\n end", "def send_request(message)\n message.requires_response!\n\n Pantry.logger.debug(\"[#{identity}] Sending request #{message.inspect}\")\n\n @networking.send_request(message)\n end", "def send_message(message)\n send_queue_message(\n address, (valid_json?(message) ? message : message.to_json), sqs\n )\n end", "def call\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n @client.account.messages.create(\n :from => '+18152642023',\n :to => @number,\n :body => 'hahahayolo'\n )\n end", "def send_message(to:, body:)\n twilio_client.api.account.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: \"+1#{to}\",\n body: body\n )\n end", "def send(phone, message)\n url = get_url\n url.query = get_data(phone, message)\n \n https = Net::HTTP.new(url.host, url.port)\n https.use_ssl = (url.scheme == 'https')\n \n res = https.get(url.request_uri)\n \n if res.code.to_i != 200\n raise Exception.new(\"Server responded with HTTP \" + res.code)\n end\n \n if res.body != OK\n raise Exception.new(get_error_message(res.body))\n end\n end", "def send(clients=1, bytesize=50)\n $log.info \"Send message bytesize: #{bytesize}\"\n\n message = Message.new(bytesize).to_s\n\n start = Time.now.to_f\n \n @client_class.send(@url, message, clients, @clients.first)\n \n $log.info \"msg to #{clients} clients. #{(Time.now.to_f - start).to_msec} ms\"\n end", "def send_content(subscriber, message_array)\n unless Rails.env.test?\n puts \"*******\"\n puts message_array\n end\n json_data = create_final_json(subscriber, message_array).to_json\n\n request = Typhoeus::Request.new(\n \"https://api.manychat.com/fb/sending/sendContent\",\n method: :post,\n body: json_data,\n headers: { \"Content-type\" => \"application/json\", \"Authorization\" => self.token },\n )\n request.run\n response = request.response\n return response\n end", "def create\n @message = Message.new(message_params)\n\n if @message.save\n SharpenAPI.send_sms(@message.message, @message.recipient_numbers)\n redirect_to admin_bat_signal_path, notice: 'Message was successfully sent'\n else\n format.html { render :new }\n format.json do\n render json: @message.errors, status: :unprocessable_entity\n end\n end\n end", "def add_bitch_message(bitch_message_text, &block)\n Logger.d(\"Adding bitch message for user on server : #{bitch_message_text}\")\n \n return if bitch_message_text.length == 0 or bitch_message_text.nil?\n\n json = {\n :message => {\n :abuse => bitch_message_text\n },\n :auth_token => get(:auth_token)\n }.to_json\n\n network_post(CONFIG.get(:add_bitch_message), nil, json, @on_api_call_failed) do |user_object|\n if is_valid_network_user_object?(user_object)\n @data = user_object\n Logger.d(\"Success in @user.add_bitch_message => \" + user_object.to_s)\n serialiaze() # Write the object to persistent storage\n block.call(@data) \n end\n end \n end", "def send_message\n self.get_message\n self.conn.get.status\n end", "def enqueue_message(message); end", "def message(twitt)\n @client.update(twitt)\n end", "def send_message(body, \r\n ticket_id)\r\n\r\n # Validate required parameters\r\n if body == nil\r\n raise ArgumentError.new \"Required parameter 'body' cannot be nil.\"\r\n elsif ticket_id == nil\r\n raise ArgumentError.new \"Required parameter 'ticket_id' cannot be nil.\"\r\n end\r\n\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets/{ticket_id}/message'\r\n\r\n # process optional query parameters\r\n _query_builder = APIHelper.append_url_with_template_parameters _query_builder, {\r\n 'ticket_id' => ticket_id\r\n }\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # prepare parameters\r\n _parameters = {\r\n 'body' => body\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.post _query_url, headers: _headers, parameters: _parameters\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n\r\n # Return appropriate type\r\n _response.body\r\n end", "def _send_message data\n response << data\n end", "def post(content)\n post_to(\"/api/v1/messages/\", {:body => content})\n end", "def send_text(call_job)\n from = '+18015131966'\n\n req_params = {\n from: from,\n to: call_job.phone,\n status_callback: \"#{ENV['CALL_SERVICE_URL']}twilio/provider_text_status_callback.xml\",\n body: call_job.body\n }\n\n if Rails.env == \"development\"\n url = \"http://127.0.0.1:4567/send_text\"\n RestClient.post url, req_params\n else\n client = Twilio::REST::Client.new(ENV[\"TWILIO_SID\"], ENV[\"TWILIO_TOKEN\"])\n\n account = client.account\n message = account.sms.messages.create(req_params)\n end\n end", "def post(message)\n puts message\n end", "def send_sms(content, tonumber)\n tonumber = format(tonumber);\n \tbegin\n @client.messages.create({\n \t :from => @from_number,\n \t :to => tonumber,\n \t :body => content,\n })\n rescue Twilio::REST::RequestError => e\n message = I18n.t(\"errors.sms_not_sent\")\n rescue NoMethodError => e\n message = I18n.t(\"errors.sms_not_sent\")\n else\n message = I18n.t(\"notice.success\")\n end\n\n return message\n\n end", "def send phone_number\n account = CLIENT.account \n message = account.sms.messages.create({from: TAKEAWAY_NUMBER , to: phone_number, body: \"Thanks for your order! It shall arrive no later than #{@delivery_time.strftime(\"%H\")}:#{@delivery_time.strftime(\"%M\")}.\"})\n message.body\n end", "def send_message(params)\n uri = URI.parse(@uri)\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n parameters = \"\"\n params.each do |k,v|\n if parameters.empty?\n parameters = \"#{k}=#{v}\"\n else\n parameters += \"&#{k}=#{v}\"\n end\n end\n sig = generate_signature(params)\n parameters += \"&signature=#{sig}\"\n puts parameters \n response = http.post(\"/api/2/apps/#{@key}/messages.json\", \"#{URI.escape(parameters)}\")\n puts response\n return response.body\n end", "def send_text_message(text_message)\n number_to_send_to = text_message.receiver\n message = text_message.content\n twilio_sid = \"AC50070372767bdf26a090b08007bba07f\"\n twilio_token = \"8ae1cdbb08d55b99cab34174c3cd8bbb\"\n twilio_phone_number = \"2245209581\"\n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n @twilio_client.account.sms.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => message\n )\n \n end", "def send_bulk_message(message)\n\n resp = validate_message(message)\n if resp.result != SendResult.enum[\"Success\"]\n resp\n end\n\n req_factory = InjectionRequestFactory.new(@server_id, @api_key)\n request = req_factory.generate_request(message)\n\n # debug\n request_hash = request.to_hash\n debug_json = request_hash.to_json\n @request_json = debug_json\n\n http_request = HttpRequest.new(http_method, { :http_endpoint => @endpoint, :proxy => @proxy })\n response = http_request.send_request(request)\n @response_json = response.to_json\n\n end", "def twilio_text\n \n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n time_str = self.time\n content = \"#{self.content} Sent from the Twilio App. Please do not reply\"\n message = @client.account.messages.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :body => content\n )\n puts message\n end", "def send_bmessage(msg, from = nil)\n msg = \"#{msg} (@#{from})\" unless from.nil?\n @auth_required ? @after_auth.push({:mb => msg}) : send_data({:mb => msg})\n end", "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end", "def send_message(text)\n end", "def send_sms(fromNumber)\n begin\n bodyParams = {\n from: { phoneNumber: fromNumber },\n to: [{ phoneNumber: RECIPIENT }],\n # To send group messaging, add more (max 10 recipients) 'phoneNumber' object. E.g.\n #\n #to: [\n # { phoneNumber: RECIPIENT },\n # { phoneNumber: 'Recipient-Phone-Number' }\n # ],\n text: 'Hello World!'\n }\n endpoint = \"/restapi/v1.0/account/~/extension/~/sms\"\n resp = $platform.post(endpoint, payload: bodyParams)\n puts (\"SMS sent. Message id: \" + resp.body['id'].to_s)\n check_message_status(resp.body['id'])\n rescue StandardError => e\n puts (e)\n end\nend", "def alert\n # @twilio_number = ENV['TWILIO_NUMBER']\n # @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n # binding.pry\n number_to_send_to = self.phone_number\n\n\t twilio_sid = \"ACca4bce79e5cdb95990cdf5a84b89c45b\"\n\t twilio_token = \"5f5703217d9812afe53c1fceea9d0b3f\"\n\t twilio_phone_number = \"5404694050\"\n\n\t @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n # time_str = ((self.time).localtime).strftime(\"%I:%M%p on %b. %d, %Y\")\n reminder = \"Hi 😍 This is a reminder from the Shiviti App. Happy Meditating 🙏\"\n \n # @twilio_client.account.sms.messages.create\n message = @twilio_client.account.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => reminder,\n )\n puts message.to\n end", "def send_bulk_sms(message)\n client = IronWorkerNG::Client.new\n client.tasks.create('master_email', payload)\n payload = {}\n payload['message'] = message\n client.tasks.create('master_sms', payload)\nend", "def mailman\n a = RestClient.post \"https://api:03ee8a853e31d8648cf06b82f7c30dcb-3d0809fb-3486193e\" \\\n\t \"@api.mailgun.net/v3/sandbox023900a156f3425e819b872335392423.mailgun.org/messages\",\n :from => \"MPPP MAILER BOT <yannick.mvondo@paiemequick.com>\",\n :to => \"mvondoyannick@gmail.com\",\n :subject => \"Hello\",\n :text => params[:lorem]\n\n if a.code == 200\n redirect_to dashboard_path, notice: \"Mail sended\"\n else\n redirect_to dashboard_path, notice: \"Impossible to send mail\"\n end\n end", "def send_message!\n msg = Message::Request.from_job(self)\n msg.send!\n end", "def send_request; end", "def notifyViaSMS(number, message, api, user, password)\n result = nil\n message = CGI.escape message\n request = \"/http/sendmsg?api_id=#{api}&user=#{user}&password=#{password}&to=#{number}&text=#{message}&from=RIVR\" \n Net::HTTP.start( 'api.clickatell.com', 80 ) { |http| result = http.get(request).body } \n return result \n end", "def send_request(data)\n \n if $DEBUG\n puts \"[request]data--------------\"\n puts data\n puts \"--------------------------\" \n end\n \n outgoing = Blix.to_binary_data(data)\n options = {}\n \n options[:key] = \"\"\n options[:reply_to] = @reply_to\n options[:content_type] = \"text/xml\"\n options[:message_id] = \"#{@time.to_i}#{rand(9999)}\"\n @out_exch.publish(outgoing, options )\n \n incoming = nil\n while (!incoming)\n msg = @in_queue.pop\n payload = msg[:payload]\n incoming = payload unless payload == :queue_empty\n end\n # \n if $DEBUG\n puts \"[request]response data-----\"\n puts incoming\n puts \"--------------------------\" \n end\n incoming\n end", "def perform(message, to_number)\n logger.info \"Sending message to #{to_number}\"\n TwilioService.new({\n to: to_number,\n msg: message\n }).send_sms\n end", "def send_message(chat_id, message, last_name: \"\")\n\n if chat_id\n #let's party hard!\n HTTParty.post('https://api.telegram.org/bot114815095:AAH0C9oMZKAEG4WMe4eZ9AmYHUZTrnJ1xCc/sendMessage', body: {chat_id: chat_id, text: message})\n else\n print(\"Error! No chat_id\")\n @error = 'Bitte verbinde deinen Telegram-Account für Notifications mit dem <a href=\"https://telegram.me/kryptobot\">Telegram Bot</a>! <p>1. Adde den Bot!</p><p>2. Schicke dem Bot deinen Nachnamen <b>' + last_name + '</b> als Nachricht!</p> '\n end\n\nend", "def setup_bicho\n Bicho.client = Bicho::Client.new(BUGZILLA_URL)\nend", "def setup_bicho\n Bicho.client = Bicho::Client.new(BUGZILLA_URL)\nend", "def request module_id, msg, &block\n req_id = @req_id\n @req_id += 1\n @callbacks[req_id] = block\n msg[:client_id] = @client_id\n msg[:username] = @username\n @ws.send ['client', compose_request(req_id, module_id, msg)].to_json\n end", "def test_post_to_hipchat\n stub_request(:post, 'http://api.hipchat.com/v1/rooms/message').to_return(\n :body => 'OK'\n )\n\n HipChat.post_to_hipchat('fake_room', 'my_message1')\n HipChat.await_retries_for_test\n assert_requested :post, 'http://api.hipchat.com/v1/rooms/message' do |req|\n req.body.match /message=my_message1/\n end\n\n assert_equal 0, HipChat.retries_for_test\n assert_equal 0.0, HipChat.total_backoff_for_test\n end", "def notify(custom_message, phone_number)\n account_sid = ENV['TWILIO_ACCOUNT_SID']\n auth_token = ENV['TWILIO_AUTH_TOKEN']\n client = Twilio::REST::Client.new(account_sid, auth_token)\n message = client.messages.create from: ENV['TWILIO_PHONE_NUMBER'], to: '+1' + phone_number, body: custom_message\n end", "def send_request\n\n uri = URI(\"https://delivery-center-recruitment-ap.herokuapp.com/\")\n time = Time.now\n time = format_date(time)\n header = {\"Content-Type\": \"X-Sent #{time}\"}\n \n # Cria os parâmetros http\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n request = Net::HTTP::Post.new(\"https://delivery-center-recruitment-ap.herokuapp.com/\", header)\n request.body = @request_body.to_json\n response = http.request(request)\n\n #salva resposta para mostrar na tela\n self.resposta = response.body\n self.save\n end", "def build_message\n\n # Get user\n user = User.find(params[\"user_id\"])\n\n # User Info\n user_info = user[\"name\"]+\" \"+user[\"last_name\"]+\" (\"+user[\"email\"]+\"), \"+user[\"jobtitle\"]+\n \", perteneciente al centro de costos \"+user[\"deptname\"]+\", a cursado una solicitud para \"\n\n # Transfer line\n if params[\"request\"] == \"transfer line\"\n ms = user_info+params[\"transfer_line_type\"]+\" su linea de teléfono con número telefónico: +56 9 \"+\n params[\"phone_number\"]\n\n # Smartphone\n elsif params[\"item\"] == \"smartphone\"\n lost = \"\"\n motive = \"\"\n\n #if not technical service\n if params[\"request\"] != \"technical service\"\n # Get smartphone info\n if params[\"want_all\"] == '0'\n params[\"model\"] = get_smartphone(params[\"model_one\"])\n params[\"price\"] = params[\"model\"][\"price\"]\n motive = \"\"\n else\n params[\"model\"] = get_smartphone(params[\"model_all\"])\n motive = \" El modelo smartphone elegido no corresponde al cargo que tiene el trabajador.\n El motivo de la elección que ha dado el trabajador es: \"+params[\"comment\"]+\".\"\n end\n end\n\n # New\n if params[\"request\"] == \"new\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"want_new_number\"] == \"true\"\n ms+= \"debe ser nuevo.\"\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim.\"\n end\n\n # Renew, stolen/lost\n elsif params[\"request\"] == \"renew\" || params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" renovar su smartphone, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor referencial de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms = user_info+\" un nuevo smartphone modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n lost = \" Esta solicitud fue cursada por la pérdido o robo del smartphone que el trabajador tenia asignado anteriormente.\"\n end\n\n if params[\"want_sim\"] == \"true\"\n ms+= \"El smartphone debe traer tarjeta Sim y el número de teléfono asociado a él \"\n if params[\"number_type\"] == \"new\"\n ms+= \"debe ser nuevo.\"\n params[\"want_new_number\"] = true\n elsif params[\"number_type\"] == \"same\"\n ms+= \"será el mismo que tiene asignado actualmente el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"same_number\"]+\".\"\n params[\"want_new_number\"] = false\n params[\"phone_number\"] = params[\"same_number\"]\n else\n ms+= \"será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n params[\"want_new_number\"] = false\n end\n else\n ms+= \"El smartphone no debe traer tarjeta Sim\"\n end\n\n # technical service\n elsif params[\"request\"] == \"technical service\"\n\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el smartphone es enviado al servicio técnico\"\n end\n\n #message\n ms = user_info+\" enviar al servicio técnico su smartphone modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\", con número telefónico +56 9 \"+\n params[\"phone_number\"]+\". El desperfecto que presenta el smartphone es \"+\n params[\"comment\"]+\". \"+replace\n\n ms+= motive+lost\n end\n\n # Bam\n elsif params[\"item\"] == \"bam\"\n\n if params[\"request\"] != \"technical service\"\n # Get bam model's info\n params[\"model\"] = get_bam(params[\"model\"])\n # Get bam plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n end\n\n # New, stolen/lost\n if params[\"request\"] == \"new\" || params[\"request\"] == \"stolen/lost\"\n # Message\n ms = user_info+\" un nuevo dispositivo Bam modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \", asociado al plan \"+params[\"plan\"][\"name\"]+\", el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" Esta solicitud fue cursada por la pérdido o robo del dispositivo Bam que el trabajador tenia asignado anteriormente.\"\n end\n\n # Renew\n elsif params[\"request\"] == \"renew\"\n # Message\n ms = user_info+\" renovar su dispositivo Bam, eligiendo el modelo \"+params[\"model\"][\"model\"]+\n \", con un valor de $\"+params[\"model\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\n \". El usuario mantendrá el mismo plan, el cual tiene un valor de $\"+\n params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". \"\n\n # Technical service\n elsif params[\"request\"] == \"technical service\"\n #If user want replacement\n if params[\"want_replacement\"] == \"true\"\n replace= \"El trabajador va a necesitar un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n else\n replace= \"El trabajador no necesita un dispositivo de reemplazo durante el periodo en que el dispositivo Bam es enviado al servicio técnico\"\n end\n #message\n ms = user_info+\" enviar al servicio técnico su dispositivo Bam modelo \"+\n params[\"model\"]+\", IMEI \"+params[\"imei\"]+\". El desperfecto que presenta el Bam es \"+\n params[\"comment\"]+\". \"+replace\n end\n\n # Sim\n elsif params[\"item\"] == \"sim\"\n # Message\n ms = user_info+\" una nueva Sim y el número de teléfono asociado a él\"\n\n if params[\"request\"] == \"stolen/lost\"\n ms+= \" debe ser el número telefónico: +56 9 \"+params[\"phone_number\"]+\n \". Esta solicitud fue cursada por la pérdida o robo de la Sim que el trabajador tenia asignado anteriormente.\"\n elsif params[\"want_new_number\"] == \"true\"\n ms+= \" debe ser nuevo.\"\n else\n # Message\n ms+= \" será cedido por el usuario, correspondiente al número telefónico: +56 9 \"+\n params[\"phone_number\"]+\".\"\n end\n\n # Roaming\n elsif params[\"item\"] == \"roaming\"\n # Get Roaming plan's info\n params[\"plan\"] = get_plan(params[\"plan\"])\n # Modify date\n date_split = params[\"start_date\"].split(\"-\")\n params[\"start_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n\n date_split = params[\"end_date\"].split(\"-\")\n params[\"end_date\"] = Date.parse(date_split[2]+\"/\"+date_split[1]+\"/\"+date_split[0])\n # Message\n ms = user_info+\" el servicio Roaming, con el plan: \"+params[\"plan\"][\"name\"]+\n \", el cual tiene un valor de $\"+params[\"plan\"]['price'].to_s.reverse.gsub(/.{3}(?=.)/, '\\0.').reverse+\". El servicio\n se solicita ya que el trabajador viaja al extranjero debido a: \"+params[\"comment\"]+\n \", entre las fechas: \"+params[\"start_date\"].strftime('%d/%m/%Y')+\" y \"+params[\"end_date\"].strftime('%d/%m/%Y')+\".\"\n end\n\n return ms\n end", "def send(message)\n info(\"[Smartfocus] Send -> #{message}\")\n end", "def send_sms\n Sms.send_sms(session[:zeepusername], params[:sendmsg][:messagebody])\n \n @zeep_response = \"Message sent to #{session[:zeepusername]}!\"\n \n render :action => \"testloop\"\n \n end", "def sending_message(to, msg)\n\t begin\n\t\t @client = Twilio::REST::Client.new @account_sid, @auth_token\n\t\t data = {\n\t\t\t\t:from => \"+\" + Rails.application.secrets.from_number.to_s, \n\t\t\t\t:to => to,\n\t\t\t\t:body => msg, \n\t\t\t}\n\t\t\tputs data.inspect\n\t\t\t@client.account.messages.create(data)\n\t\trescue\n raise \"Message not send\"\n\t\tend\n end", "def send_message(message)\n\n message_uuid = @uuid.generate\n message = \"#{message_uuid}\\t\" + message.join(\"\\t\")\n message_sent = false\n\n until message_sent\n\n unless is_locked? request_file\n\n lock_file request_file\n\n open(request_file, \"a\") do |file|\n file.write(\"#{message}\\n\")\n end\n\n unlock_file request_file\n\n message_sent = true\n\n end\n\n break if message_sent\n sleep (0.06)\n\n end\n\n response = false\n\n until response\n response = retrieve_response message_uuid\n break if response\n sleep (0.06)\n end\n\n response\n\n end", "def send_text(text, phone)\n account_sid = ENV[\"ACCOUNT_SID\"]\n auth_token = ENV[\"AUTH_TOKEN\"]\n client = Twilio::REST::Client.new account_sid, auth_token\n\n account = client.account\n message = account.sms.messages.create({\n :from => ENV[\"PHONE\"],\n :to => phone,\n :body => text})\n puts message\n end", "def send_direct_message(message)\n\t\t\n\t\turi_path = \"#{@dm.uri_path}/events/new.json\"\n\t\tresponse = @dm.make_post_request(uri_path, message)\n \t#puts \"Attempted to send #{message} to #{uri_path}/events/new.json\"\n\t\n\t\t#Currently, not returning anything... Errors reported in POST request code.\n\t\tresponse\n\n\tend", "def sendslack(message, icon, session_id, event)\n\t\t\t\tif event == \"open\" and $opened.exclude?(session_id)\n\t\t\t\t\tprint_status(message)\n\t\t\t\t\tdata = \"{'text': '#{message}', 'channel': '#{@channel}', 'username': '#{@bot_name}', 'icon_emoji': '#{icon}'}\"\n\t\t\t\t\turl = URI.parse(@webhook_url)\n\t\t\t\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\tresp = http.post(url.path, data)\n\t\t\t\t\t$opened.push(session_id)\n\t\t\t\telsif event == \"close\" and $closed.exclude?(session_id)\n\t\t\t\t\tprint_status(message)\n\t\t\t\t\tdata = \"{'text': '#{message}', 'channel': '#{@channel}', 'username': '#{@bot_name}', 'icon_emoji': '#{icon}'}\"\n\t\t\t\t\turl = URI.parse(@webhook_url)\n\t\t\t\t\thttp = Net::HTTP.new(url.host, url.port)\n\t\t\t\t\thttp.use_ssl = true\n\t\t\t\t\tresp = http.post(url.path, data)\n\t\t\t\t\t$closed.push(session_id)\n\t\t\t\tend\n\t\t\tend", "def send(message = nil)\n @alert = message if message.is_a?(String)\n @data = message if message.is_a?(Hash)\n client.push(payload.as_json)\n end" ]
[ "0.6427578", "0.6205235", "0.60775065", "0.6053971", "0.6053971", "0.6041905", "0.59912735", "0.59523493", "0.59356374", "0.5928938", "0.5898737", "0.5895211", "0.5883637", "0.5870907", "0.58634293", "0.58594537", "0.58574057", "0.5851537", "0.58486885", "0.58300245", "0.5797136", "0.57770336", "0.57666403", "0.57648605", "0.57563287", "0.5743555", "0.5725633", "0.57168823", "0.57145584", "0.5691412", "0.56836665", "0.56811154", "0.56705016", "0.5665773", "0.56582755", "0.56582755", "0.5656417", "0.56441766", "0.56372833", "0.56202245", "0.5609953", "0.5607992", "0.5600394", "0.55952334", "0.559467", "0.5587612", "0.55819273", "0.55725765", "0.55611616", "0.5560804", "0.5558029", "0.5548552", "0.55473626", "0.5545967", "0.55403966", "0.5529852", "0.55268383", "0.5520367", "0.55124503", "0.5504057", "0.549749", "0.5497202", "0.5497187", "0.5492564", "0.5489377", "0.5483054", "0.54775983", "0.54722935", "0.5470685", "0.5452152", "0.545194", "0.5451413", "0.5449252", "0.5446316", "0.54413843", "0.5438512", "0.5427766", "0.54145664", "0.54085207", "0.5379096", "0.5372437", "0.53713274", "0.53701365", "0.5360135", "0.53589916", "0.53401816", "0.53358173", "0.53358173", "0.5335544", "0.53331316", "0.5329101", "0.5320709", "0.52999485", "0.52980745", "0.52957565", "0.52908355", "0.52886575", "0.5279608", "0.5276827", "0.52734643", "0.52662" ]
0.0
-1
Creates a new Kele client authorized with a username and password Params: username = string, password = string
def initialize(email, password) # Bloc's API URL # Params: endpoint = string def api_url(endpoint) "https://www.bloc.io/api/v1/#{endpoint}" end # Use the httparty class method .post to send a post request to the sessions endpoint of Bloc’s API with the email and password in the body of the request. response = self.class.post(api_url("sessions"), body: {"email": email, "password": password}) # The @auth_token instance variable holds the authorization token provided by Bloc's API upon verifying successful username and password. @auth_token = response["auth_token"] # If the username and password are invalid, Bloc's API will not return an authorization token. puts "There was a problem authorizing those credentials. Please try again." if @auth_token.nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n payload = {\n name: name,\n validator: validator,\n # this field is ignored in API V1, but left for backwards-compat,\n # can remove after OSC 11 support is finished?\n admin: admin,\n }\n begin\n # try API V1\n raise Chef::Exceptions::InvalidClientAttribute, \"You cannot set both public_key and create_key for create.\" if !create_key.nil? && !public_key.nil?\n\n payload[:public_key] = public_key unless public_key.nil?\n payload[:create_key] = create_key unless create_key.nil?\n\n new_client = if Chef::Config[:migrate_key_to_keystore] == true\n chef_rest_v1_with_validator.post(\"clients\", payload)\n else\n chef_rest_v1.post(\"clients\", payload)\n end\n\n # get the private_key out of the chef_key hash if it exists\n if new_client[\"chef_key\"]\n if new_client[\"chef_key\"][\"private_key\"]\n new_client[\"private_key\"] = new_client[\"chef_key\"][\"private_key\"]\n end\n new_client[\"public_key\"] = new_client[\"chef_key\"][\"public_key\"]\n new_client.delete(\"chef_key\")\n end\n\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n # under API V0, a key pair will always be created unless public_key is\n # passed on initial POST\n payload[:public_key] = public_key unless public_key.nil?\n\n new_client = chef_rest_v0.post(\"clients\", payload)\n end\n Chef::ApiClientV1.from_hash(to_h.merge(new_client))\n end", "def create\n authorizable_keystore = client(resource).authorizable_keystore(resource[:intermediate_path], resource[:authorizable_id])\n result = authorizable_keystore.create(resource[:password])\n\n handle(result)\n end", "def new_client(username , password)\n @client = Octokit::Client.new(:login => username, :password => password)\nend", "def create_api_credentials\n ::ApiCredentials::Create.new({client_id:@client_id}).perform\n end", "def create(username, password)\n SecKeychainAddGenericPassword(nil, @service.length, @service, username.length, username, password.length, password, nil)\n end", "def create_client\n client_public, client_private = ZMQ::Util.curve_keypair\n store_known_client(client_public)\n\n {\n server_public_key: @public_key,\n public_key: client_public,\n private_key: client_private\n }\n end", "def authenticate(username, password)\n @client = Client.new username, password\n end", "def new_client(credentials, type=\"compute\", ignore_provider=false)\n tokens = credentials.user.split(\"+\")\n if credentials.user.empty?\n raise AuthenticationFailure.new(Exception.new(\"Error: you must supply the username\"))\n end\n if (tokens.size != 2 && api_v2)\n raise ValidationFailure.new(Exception.new(\"Error: expected \\\"username+tenantname\\\" as username, you provided: #{credentials.user}\"))\n else\n user_name, tenant_name = tokens.first, tokens.last\n end\n #check if region specified with provider:\n provider = api_provider\n if (provider.include?(\";\"))\n region = provider.split(\";\").last\n provider = provider.chomp(\";#{region}\")\n end\n connection_params = {:username => user_name, :api_key => credentials.password, :authtenant => tenant_name, :auth_url => provider, :service_type => type}\n connection_params.merge!({:region => region}) if region && !ignore_provider # hack needed for 'def providers'\n safely do\n raise ValidationFailure.new(Exception.new(\"Error: tried to initialise Openstack connection using\" +\n \" an unknown service_type: #{type}\")) unless [\"volume\", \"compute\", \"object-store\", \"network\"].include? type\n OpenStack::Connection.create(connection_params)\n end\n end", "def create_client_of_cybozu\n cybozu = Cybozu.find(1) \n CybozuApi::Client.new(cybozu.url, cybozu.login_id, cybozu.password)\n end", "def new_client(credentials)\n #Fog constructor expecting credentials[:terremark_password] and credentials[:terremark_username]\n terremark_credentials = {:terremark_vcloud_username => \"#{credentials.user}\", :terremark_vcloud_password => \"#{credentials.password}\" }\n safely do\n terremark_client = Fog::Terremark::Vcloud.new(terremark_credentials)\n vdc_id = terremark_client.default_vdc_id\n end\n if (vdc_id.nil?)\n raise \"AuthFailure\"\n end\n terremark_client\n end", "def create_client!\n Chef::ApiClient::Registration.new(node_name, client_path, http_api: rest).run\n end", "def create_pw_client(opts = {})\n usr = opts[:user] || user()\n pw = opts[:password] || password()\n remote = opts[:remote_name] || self.remote_name\n\n logger.info(\"Authorizing #{usr} to work with #{remote}.\")\n\n configure_octokit(opts)\n\n Octokit::Client.new(:login => usr, :password => pw)\n end", "def new_client(credentials)\n safely do\n return SBCClient.new(credentials.user, credentials.password)\n end\n end", "def client(username=nil)\n expiration_time = @lock.synchronize {\n time_now = Time.now.to_i\n\n if time_now > @token_expiration_time - EXPIRE_MARGIN\n @token_expiration_time = time_now + EXPIRE_DELTA\n end\n\n @token_expiration_time\n }\n\n token = @server_auth.login_token(expiration_time, username)\n\n OpenNebula::Client.new(token, @endpoint)\n end", "def new_client(id, env, private_key, secret)\n app_config = AppConfig.new(\n id: id,\n env: env,\n private_key: private_key,\n secret: secret\n )\n\n Client.new(config: app_config)\n end", "def create\n name = shift_argument\n url = shift_argument\n\n unless name && url\n raise(Heroku::Command::CommandFailed, \"Usage: clients:register [NAME] [CALLBACK_URL]\")\n end\n\n validate!(url)\n client = request do\n api.request(\n :body => encode_json(\n { :name => name, :redirect_uri => url }),\n :expects => 201,\n :headers => headers,\n :method => :post,\n :path => \"/oauth/clients\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Registered client \"#{name}\".})\n styled_hash(client)\n end\n end", "def create_keyauth(username, keyauth_key)\n\n url = '/consumers/'+ username +'/key-auth'\n payload = {\n key: keyauth_key\n }\n process_kong_request(url, :POST, payload)\n end", "def one_client_user(user)\n client = Client.new(\"dummy:dummy\")\n client.one_auth = \"#{user[:name]}:#{user[:password]}\"\n \n return client\n end", "def createClient(subdomain, username, password, identifier, header)\n\tpayload = {client: {\n name: 'Ruby HTTP Request',\n identifier: identifier\n }\n }\n\turi = URI.parse(\"https://\"+subdomain+\".zendesk.com/api/v2/oauth/clients.json\")\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\trequest = Net::HTTP::Post.new(uri.request_uri, header)\n\trequest.basic_auth(username, password)\n\trequest.body = payload.to_json\n\tresponse = http.request(request)\n\tdata = JSON.parse(response.body)\n\tputs \"Creating OAuth Client \" + identifier\n\tputs data\n\treturn data[\"client\"][\"id\"]\nend", "def create(password, key=nil, uuid=nil, path=nil)\n key ||= Utils.mk_random_privkey\n\n json = Keystore.make_json key, password\n json[:id] = uuid\n\n new json, password, path\n end", "def new\n @client = Client.new\n end", "def new\n @client = Client.new\n end", "def new\n @client = Client.new\n end", "def create(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.create(struct)\n rt = nil\n val\n end", "def create_client\n\nend", "def authenticate_connection!\n request(\n :method => :post,\n :path => 'certificates',\n :json => {\n :type => :client,\n :name => name,\n :password => password\n }\n )\n end", "def create\n # Revoke the old cert before creating a new one\n cert = certificate_get\n priv_key = private_key_get\n if cert && priv_key\n revoke_cert\n end\n new_cert = create_cert\n client_cert_save(new_cert)\n end", "def create_access_key(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'CreateAccessKey'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :user_name\n\t\t\targs[:query]['UserName'] = optional[:user_name]\n\t\tend\n\t\tself.run(args)\n\tend", "def new\n\t\t@client = Client.new\n\tend", "def build_client(access_token)\n begin\n client = Octokit::Client.new(access_token: access_token)\n client.user.login\n rescue Octokit::Unauthorized\n raise 'Please enter valid Personal Auth Token'\n end\n client\n end", "def launch_client\n client = Marvel::Client.new\n client.configure do |config|\n config.api_key = \"c254d7e19e2172fd7b0a5cd7f585e749\"\n config.private_key = 'f928ea4ae3e710ad33bce4c0ce67368263d5724b'\n end \n client\nend", "def create_username_password(**args)\n\t\t\t\t\tjson_body = {\n\t\t\t\t\t\t'' => '0',\n\t\t\t\t\t\tcredentials: args.merge(\n\t\t\t\t\t\t\t'$class' => 'com.cloudbees.plugins.credentials.impl.'\\\n\t\t\t\t\t\t\t\t'UsernamePasswordCredentialsImpl'\n\t\t\t\t\t\t)\n\t\t\t\t\t}.to_json\n\t\t\t\t\tcreate_(\"json=#{::CGI.escape json_body}\")\n\t\t\t\tend", "def create\n @private_key = User.where(login: params[:api][:login]).first.generate_private_key!\n end", "def create_aws_access_key_for_user(username)\n iam_client = Helpers.create_aws_iam_client\n resp = iam_client.create_access_key(\n user_name: username\n )\n resp\n end", "def setup_client\n @client = Viddler::Client.new(@api_key)\n @client.authenticate!(@username, @password)\n end", "def login\n @client = Octokit::Client.new(login: username, oauth_token: token)\n end", "def initialize(username, password)\n @username = username\n @password = password\n @api_key = \"\"\n end", "def new\n build_client\n end", "def create\n @client = Client.new(client_params)\n \n if @client.valid?\n code = Random.new\n @client.code = code.rand(1000)\n old_password = @client.password\n @client.password = SecureRandom.hex(6)\n status = ApiClient.save(@client)\n\n if status\n @user = User.create(\n name: @client.name,\n email: @client.email,\n password: old_password,\n password_salt: @client.password,\n client_id: @client.code\n )\n end\n end\n\n respond_to do |format|\n if status\n format.html { redirect_to client_path(@client.code), notice: 'Client was successfully created.' }\n format.json { render action: 'show', status: :created, location: @client }\n else\n format.html { render action: 'new', notice: 'Could not create a client.' }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def initialize(api_key, username, password)\n @api_key, @username, @password = api_key, username, password\n setup_client\n end", "def reset_client_api_credentials\n\n r = Aws::Kms.new('saas', 'saas').decrypt(@client.api_salt)\n return r unless r.success?\n\n api_salt_d = r.data[:plaintext]\n\n @client_api_secret_d = SecureRandom.hex\n\n r = LocalCipher.new(api_salt_d).encrypt(@client_api_secret_d)\n return r unless r.success?\n\n api_secret_e = r.data[:ciphertext_blob]\n api_key = SecureRandom.hex\n\n @client.api_key = api_key\n @client.api_secret = api_secret_e\n @client.save!\n success\n end", "def create(body = {})\n @client.token.create(body)\n end", "def create_user(struct)\n struct.remapkeys!\n if struct.has_key? :user and struct.has_key? :pass\n rt = RT_Client.new(:user => struct[:user], :pass => struct[:pass])\n struct.delete(:user)\n struct.delete(:pass)\n else\n rt = RT_Client.new\n end\n val = rt.create_user(struct)\n rt = nil\n val\n end", "def generate_key( username, password, contract)\n response_xml = self.call( :generate_key, message: {\n arg0: username,\n arg1: password,\n arg2: contract\n })\n response = IssueCentre::Response.parse( response_xml,\n {contract_id: contract})\n end", "def create_client\n token = File.open(GITHUB_TOKEN_FILE).read\n Octokit::Client.new(access_token: token)\nend", "def authenticate(username, password)\n perform_request({:action => 'client-authenticate', :username => username, :password => password})\n end", "def create_authorization(opts = {})\n client = opts[:client] || create_pw_client(opts)\n\n return create_authorization_token(client, opts[:two_factor])\n end", "def initialize(*args)\n @config = Betaface::Util::ClientConfig.new \n @key = args[0] || Betaface.key\n @secret = args[1] || Betaface.secret\n if @key.nil? || @secret.nil?\n raise ArgumentError, 'Key and Secret are required'\n end\n end", "def perform(secret, endpoint, _args = {})\n @client = ::OpenNebula::Client.new(secret, endpoint)\n end", "def init_client\n client.credentials?\n end", "def create_key(params)\n ::M2X::Client::Key.create!(@client, params.merge(device: self[\"id\"]))\n end", "def auth_client(client_id, client_secret, params = {})\n RubyLokaliseApi::OAuth2::Auth.new client_id, client_secret, params\n end", "def sign_up_client\n\n end", "def update\n # NOTE: API V1 dropped support for updating client keys via update (aka PUT),\n # but this code never supported key updating in the first place. Since\n # it was never implemented, we will simply ignore that functionality\n # as it is being deprecated.\n # Delete this comment after V0 support is dropped.\n payload = { name: name }\n payload[:validator] = validator unless validator.nil?\n\n # DEPRECATION\n # This field is ignored in API V1, but left for backwards-compat,\n # can remove after API V0 is no longer supported.\n payload[:admin] = admin unless admin.nil?\n\n begin\n new_client = chef_rest_v1.put(\"clients/#{name}\", payload)\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n new_client = chef_rest_v0.put(\"clients/#{name}\", payload)\n end\n\n Chef::ApiClientV1.from_hash(new_client)\n end", "def client\n key, secret = credentials\n @client ||= Cloudkick::Base.new(key, secret)\n end", "def create_client(options = {})\n post(:clients, clients: [options]).pop\n end", "def create\n authorize! :create, Client\n build_client\n save_client or render :new\n end", "def create_consumer(username, email, password)\n add_consumer(username, email, password)\n end", "def auth_client\n raise NOT_IMPLEMENTED_ERROR\n end", "def test_ssl_with_key_pass_phrase\n client = create_client(@connect_info, :connect => false,\n :ssl => true,\n :ssl_cert => CLIENT_CERT_PASS,\n :ssl_key => CLIENT_CERT_PASS,\n :ssl_key_pass_phrase => PASS_PHRASE)\n assert client.connect\n end", "def create_client\n @client = if @opts[:servers]\n Monga::Clients::ReplicaSetClient.new(@opts)\n else\n Monga::Clients::SingleInstanceClient.new(@opts)\n end\n end", "def create\n # default behavior for html requests\n return super if request.format.html?\n\n # handle json authentications\n resource = Client.find_by(name: client_params[:name])\n\n return invalid_login_attempt unless resource\n\n if resource.valid_password?(client_params[:password])\n sign_in(\"client\", resource)\n\n @client = resource\n render \"clients/show\", status: :created\n else\n invalid_login_attempt\n end\n end", "def create\n\n @client = Client.find_or_initialize_by(email: params[:email])\n @client.update(password: params[:password])\n redirect_to client_path(id: @client.id)\n end", "def create\n @client = Client.new(params[:client])\n @client.generate_password\n flash[:success] = \"Cliente creado exitosamente\" if @client.save\n respond_with(@client)\n end", "def seed_api_key\n\t\t\tDoorkeeper::Application.create(name: \"sample app\", \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t uid: \"836ec399a145ffafbd7774c57e06960397b77a53bb1ccc03d4e45d95d0c31a3d\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t secret: \"cf8dc84d17c69e17a8b9d74ec971bdb636f231d3ba7d2ad2ebfca45bdc8ae3c9\",\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t redirect_uri: \"urn:ietf:wg:oauth:2.0:oob\")\n\t\tend", "def client\n puts \"creating client\"\n @client ||= Vineyard::Client.new(options) #unless defined?(@client) && @client.hash == options.hash\n @client\n end", "def create_access_key(options = {})\n request({\n 'Action' => 'CreateAccessKey',\n :parser => Fog::Parsers::AWS::IAM::CreateAccessKey.new\n }.merge!(options))\n end", "def authenticate_with(identity, next_service, username, key_manager); end", "def new_client_application\n OAuth2::Client.new(caller_service.client_id, caller_service.client_secret, :site => authorizator_service.site, :raise_errors => false)\n end", "def encryption_client; end", "def generate_keys\n self.client_id = OAuth::Helper.generate_key(40)[0,40]\n self.client_secret_hash = OAuth::Helper.generate_key(40)[0,40]\n end", "def client\n @client ||= CFoundry::Client.new(@target.to_s).tap do |c|\n c.login(@username, @password)\n end\n end", "def create_client(name, facebook_id, twitter_handle)\n puts name, facebook_id, twitter_handle\n # Point the HTTP POST method at the clients endpoint of Klipfolio's API.\n response = self.class.post(\"https://app.klipfolio.com/api/1.0/clients\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"name\": name,\n \"description\": \"\",\n \"seats\": 5,\n \"status\": \"active\"\n }.to_json)\n puts response.body\n puts \"Client was successfully created.\" if response.success?\n\n # Extract the new client's ID from the HTTP response so that it can be passed to the update_features & update_resources methods.\n client_id = response[\"meta\"][\"location\"]\n client_id.slice!(\"/clients/\")\n p client_id\n\n update_resources(client_id)\n update_features(client_id)\n update_company_properties(client_id, facebook_id, twitter_handle)\n create_group(client_id)\n share_dashboard(client_id)\n end", "def myinitialize()\n # TODO: To improve flexibility, we can allow the user to specify the path to the file.\n client = Stormpath::Client.new api_key_file_location: File.join(ENV['HOME'], '.stormpath', 'apiKey.properties')\n return client\nend", "def ensure_chef_client\n step(\" ensuring chef client exists\")\n return @chef_client if chef_client\n step( \" creating chef client\", :green)\n @chef_client = Chef::ApiClient.new\n @chef_client.name(fullname)\n @chef_client.admin(false)\n #\n # ApiClient#create sends extra params that fail -- we'll do it ourselves\n # purposefully *not* catching the 'but it already exists' error: if it\n # didn't show up in the discovery process, we're in an inconsistent state\n response = chef_api_server_as_admin.post_rest(\"clients\", { 'name' => fullname, 'admin' => false, 'private_key' => true })\n client_key.body = response['private_key']\n client_key.save\n @chef_client\n end", "def create(password)\n @call_params[:password] = password\n @call_params[:path] = \"/#{@call_params[:path]}\" unless @call_params[:path].start_with? '/'\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def initialize(user, password)\n @user = user\n @password = password\n\n # In the constructor, try to authenticate and get the access_token and\n # client_id\n authenticate\n end", "def create\n # Revoke the old cert before creating a new one\n revoke_cert if certificate && private_key && check_cert_exists\n new_cert = create_cert\n client_cert_save(new_cert)\n end", "def init_client; end", "def create body = {}\n @connection.request(method: :post, path: \"/secrets/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def client\n @client ||= Client.new(config[:credentials], config[:end_point])\n end", "def create\n @client = Client.create(client_params)\n # byebug\n if @client.valid?\n render json: { client: ClientSerializer.new(@client) }, status: :created\n else\n render json: { error: 'failed to create account' }, status: :not_acceptable\n end \n end", "def authenticate_client\n client.authenticate if client.session.expired?\n end", "def client\n @client ||= ActiveSupport::MessageEncryptor.new(@key, cipher: 'aes-256-cbc')\n end", "def authenticate(client)\n \n end", "def create_client\n Metaforce.configuration.log = false\n\n target_org_name = \"production\"\n\n # Pull org credentials from a YAML file for now.\n # Awesome use of YML and Constants.\n config = YAML.load(File.read(METAFORCE_CONFIG_FILE_PATH))\n # {\"production\"=>{\"username\"=>\"coolcat24@domain.com\", \"password\"=>\"som3p4ss\", \"security_token\"=>\"A23bG523dad\"}, \"developer\"=>...}\n\n #if (target_org_name == \"production\")\n # This is a hard habit to break, but if statements with ()'s are a code smell in ruby.\n # They're only ever needed for complex conditionals and ruby has better ways of handling them.\n #\n if (true)\n config_username = config[target_org_name][:username]\n config_password = config[target_org_name][:password]\n config_security_token = config[target_org_name][:security_token]\n end\n\n # You probably wants this to be a class var.\n @client = Metaforce.new :username => config_username, :password => config_password, :security_token => config_security_token\nend", "def _register_client(credentials)\n DoubleDutch::SpaceCadet::Config.register(\n \"#{credentials[:region]}-#{credentials[:env]}\".downcase,\n credentials[:username].downcase,\n credentials[:key],\n credentials[:region].upcase\n )\n end", "def create(api_params)\n keygen = SSHKey.generate\n api_params[:privatekey] = keygen.private_key\n api_params[:publickey] = keygen.ssh_public_key\n api_request(SSHKEYS, CREATE, api_params)\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def run\n assert_destination_writable!\n retries = Config[:client_registration_retries] || 5\n client = nil\n begin\n client = api_client(create_or_update)\n rescue Net::HTTPFatalError => e\n # HTTPFatalError implies 5xx.\n raise if retries <= 0\n\n retries -= 1\n Chef::Log.warn(\"Failed to register new client, #{retries} tries remaining\")\n Chef::Log.warn(\"Response: HTTP #{e.response.code} - #{e}\")\n retry\n end\n write_key\n client\n end", "def create\n @client = Client.new(params[:client])\n\n if @client.password == nil then @client.password = temp_password && @client.password_confirmation = temp_password end\n password = @client.password\n\n respond_to do |format|\n if @client.save\n ClientMailer.new_client(@client, password).deliver\n format.html { redirect_to project_url(:id => @client.project_id, :page => 'options'), notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tclient = Client.find_by_email(params[:email])\n\t\t\tif client && client.authenticate(params[:password])\n\t\t\t\tsession[:client_id] = client.id\n \t\t\t\tredirect_to root_path \n \t\t\telse\n \t\t\t\trender \"new\" , alert: \"User Id And or Password Invalid\"\n \t\t\tend\n \tend", "def create(username, groups = '', opts = {})\n payload = {\n :account => {\n :username => username,\n :comment => '',\n :groups => groups,\n :password => password_opts.merge(opts.fetch(:password, {}))\n }\n }\n @server.commands.get(post(payload)['command']['id'])\n end", "def init_client keyfile, options\n verify_keyfile! keyfile\n client_opts = client_options keyfile, options\n Signet::OAuth2::Client.new client_opts\n end", "def initialize(server, username: nil, password: nil)\n self.class.base_uri(URI.join(server, '/v1/').to_s)\n\n auth = if username && password\n Base64.encode64(\"#{username}:#{password}\")\n else\n ENV['KINTO_API_TOKEN']\n end\n\n self.class.headers('Authorization' => \"Basic #{auth}\")\n\n @server = KintoServer.new(client: self)\n end", "def create\n conn = EM::Hiredis::Client.new(@host, @port, @password, @database)\n conn.connect\n conn\n end", "def initialize(key, secret)\n super()\n self.key = key\n self.secret = secret\n end", "def client_key\n @client_key ||= CredentialCache.cache(cache_key(:client_key)) do\n hmac(salted_password, 'Client Key')\n end\n end", "def initialize(username, password)\n @username = username\n @password = password\n end", "def initialize(username, password)\n @username = username\n @password = password\n end", "def initialize(username, password)\n @username = username\n @password = password\n end" ]
[ "0.7007443", "0.6801419", "0.6776164", "0.66389316", "0.6634256", "0.6557456", "0.6525087", "0.6369942", "0.6344741", "0.63208896", "0.6277257", "0.6273922", "0.6256848", "0.62306714", "0.6223341", "0.6159044", "0.615755", "0.6140426", "0.61233187", "0.60774624", "0.59818006", "0.59818006", "0.59818006", "0.5977191", "0.59656316", "0.5954382", "0.59330356", "0.5928006", "0.58731574", "0.5845223", "0.58293957", "0.58039236", "0.5801645", "0.5792767", "0.5791234", "0.5783581", "0.5743975", "0.574032", "0.57304543", "0.57299083", "0.5707495", "0.5707382", "0.57057714", "0.57033485", "0.56963444", "0.5690825", "0.56875587", "0.5687068", "0.5661572", "0.56493175", "0.56448144", "0.56381875", "0.56298137", "0.56270194", "0.5624913", "0.56189626", "0.5618613", "0.5605361", "0.559168", "0.5588574", "0.5556149", "0.5549094", "0.5541621", "0.55279654", "0.55135703", "0.5509275", "0.5507089", "0.5504385", "0.54966915", "0.5491787", "0.5485047", "0.54810184", "0.5475194", "0.5467837", "0.54589295", "0.54548776", "0.54523695", "0.5443911", "0.5440957", "0.5440348", "0.5419109", "0.5412658", "0.5405398", "0.53992856", "0.5398022", "0.5393549", "0.53933966", "0.53901994", "0.537821", "0.5374069", "0.53695005", "0.53672695", "0.5365531", "0.5358846", "0.5358099", "0.5356463", "0.5350657", "0.53502345", "0.5342131", "0.5342131", "0.5342131" ]
0.0
-1
Retrieve's the current user as a JSON blob by passing auth_token to the request to property authenticate against the Bloc API. Params: auth_token = string Use the httparty class method .get to pass the auth_token to Bloc's API with httparty's header option.
def get_me response = self.class.get(api_url("users/me"), headers: { "authorization" => @auth_token }) # Parse the JSON document returned in the response into a Ruby hash JSON.parse(response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated_user_with_token\n ApiKey.find_user_with_token(decoded_token)\n end", "def get_user_by_auth_token\n user = UserSession.find_by_auth_token!(params[:auth_token]).user\n\n json_response 200,\n success: true,\n message_id: 'ok',\n message: I18n.t('success.ok'),\n data: {\n user: user.slice(:id, :username)\n }\n end", "def call\n fetch_user_from_auth_token\n end", "def fetch_user_from_auth_token\n @user = decode_auth_token ? User.find(decode_auth_token['user_id']) : nil\n errors.add(:token, 'invalid token') if @user.nil?\n @user\n end", "def get_current_user\n return if !bearer_token\n decoded_jwt = decode_token(bearer_token)\n User.find(decoded_jwt[0][\"user\"][\"id\"])\n end", "def current_user\n if decode_token\n #returns an array\n #user_id is the key on our payload\n user_id = decode_token[0]['user_id']\n #using user_id to find our user\n @user = User.find_by(id: user_id)\n else\n render json: { message: 'Did not find user.' }, status: :unauthorized \n end\n end", "def authenticate\n authenticate_or_request_with_http_token do |token _options|\n @current_user = User.find_by token: token\n end\n end", "def authenticate\n authenticate_or_request_with_http_token do |token, _options|\n @current_user = User.find_by token: token\n end\n end", "def get_user_datum_by_auth_token(auth_token)\n body = { :auth_token => auth_token}\n options = { body: body.to_json,\n method: :get,\n return_err_value: nil}\n call_external_service(Aylauth::Settings.user_service_base_url + \"/api/v1/users/data.json?\", options)\n end", "def current_user\n if decoded_token\n # Using the decoded token, grab the user_id stored within it and find a user\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n @current_user = User.find_by(token: token)\n @current_user\n end\n end", "def get_user(auth_token)\n if @api_host.present?\n begin\n request_url = @api_host + \"/api/v1/user_details\"\n request_headers = { \"Content-Type\" => \"application/json\", \"Authorization\" => \"Bearer \" + auth_token.to_s }\n response = RestClient.get(request_url, request_headers)\n result = JSON.parse(response.body)\n Rails.logger.info \"===== get user result ===== #{result} =====\"\n result\n rescue RestClient::ExceptionWithResponse => e\n error = JSON.parse(e.response)\n Rails.logger.warn \"===== get user errors ===== #{error} =====\"\n error\n end\n end\n end", "def authenticate_user\n @token = Token.find_by(auth_token: request.headers['HTTP_AUTH_TOKEN'])\n return render json: { message: 'token invalid' }, status: 422 unless @token\n\n @current_user = @token.user\n end", "def current_user\n unless request.format.json?\n @current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]\n end\n @current_user\n end", "def current_user\n payload = TokiToki.decode(bearer_token)\n @current_user ||= User.find_by :github_name => payload[0]['sub']\n end", "def current_user\n puts decoded_token\n \n if decoded_token\n # user_id = User.find_by(id: user_id)\n User.find_by(id: decoded_token[0][\"user_id\"])\n\n end\n end", "def authenticate_token\n authenticate_with_http_token do |token, options|\n User.find_by(auth_token: token)\n end\n end", "def get_me\n response = self.class.get(\"https://www.bloc.io/api/v1/users/me\", headers: { \"authorization\" => @auth_token })\n body = JSON.parse(response.body)\n end", "def authenticate_user\n if not params.has_key?(:auth_token)\n failure\n return\n end\n @current_user = User.find_by_authentication_token(params[:auth_token])\n # Adding the conditional to throw json error\n unless @current_user\n failure\n end\n end", "def current_user\n if auth_token && !@current_user\n if @current_user = User.find_by_auth_token(auth_token)\n @current_user = nil if @current_user.auth_token_expired?\n end\n end\n @current_user\n end", "def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end", "def authenticate_user_from_token!\n raise AuthorizationError unless http_auth_token.present?\n result = find_user\n raise BadRequestError, result.errors if result.failure?\n @current_user = result.current_user\n end", "def api_user\n token = request.headers['Authorization']\n return @current_user ||= User.find_by_api_token(token) if token\n end", "def authenticate\n \n authenticate_or_request_with_http_token do |token|\n begin\n decoded = decode(token)\n @current_user = User.find_by(id: decoded[0][\"user_id\"]) \n \n rescue JWT::DecodeError\n render json: {authorized: false }, status: 401 \n end\n end \n end", "def authenticate\n token = params[:tok]\n if @user = Droom::User.find_by(authentication_token: token)\n render json: @user\n else\n render json: { errors: \"Token not recognised\" }, status: :unauthorized\n end\n end", "def authenticate_user!\n payload = decode_token\n return unless payload.is_a? Hash\n\n @current_user = User.find payload[:user_id]\n end", "def retrieve_auth_token\n http = Net::HTTP.new(auth_endpoint.host, auth_endpoint.port)\n\n request = Net::HTTP::Post.new(auth_endpoint.request_uri)\n\n request.basic_auth(\n TodoableApi.configuration.username,\n TodoableApi.configuration.password\n )\n\n handle_auth_response(http.request(request))\n end", "def get_user_info\n userTokenInfo = request.env['oauth.token']\n @user = userTokenInfo.user\n end", "def user\n @user ||= User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n @user || errors.add(:token, 'Invalid Token') && nil\n end", "def current_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n # Returns nil if not found\n end\n end", "def auth_token\n @@auth_token\n end", "def getUser\n render json: @current_user, status: 200\n end", "def authenticate_request!\n return render_unauthorized unless request.headers['Authorization'].present?\n\n @token ||= AuthenticateRequest.get(User, request.headers['Authorization'].split(' ').last)\n @current_user = @token[:user]\n end", "def auth_token\n self.auth_response[:auth_token]\n end", "def get_user\n response = HTTParty.get(\n GIT_BASE_URL + 'users/' + self.git_id.to_s,\n :headers => {\n 'PRIVATE-TOKEN' => GIT_TOKEN\n }\n )\n Rails.logger.info \"Git server response (get user): #{response}\"\n return response\n end", "def authenticate_and_load_user\n authentication_token = nil\n if request.headers[\"Authorization\"]\n authentication_token = request.headers[\"Authorization\"].split[1]\n end\n if authentication_token\n user = JWT.decode(authentication_token, nil, false, algorithms: 'RS256')\n username = user[0][\"nickname\"]\n email = user[0][\"name\"]\n\n if user[0]['sub'].include? 'google-oauth2'\n email = username + '@gmail.com'\n end\n\n @current_user = User.find_by(email: email, username: username)\n if !@current_user.present?\n user = User.new(email: email, username: username, password: '000000', password_confirmation: '000000', auth_token: authentication_token)\n if user.save\n @current_user = user\n end\n end\n end\n return if @current_user.present?\n render json: {\n messages: \"Can't authenticate user\",\n is_success: false,\n data: {}\n }, status: :bad_request\n end", "def authenticate\n api_key = parse_auth_token(request.headers['HTTP_AUTHORIZATION'])\n return user_not_authorized if api_key.nil?\n @real_user = User.find_by(api_key: parse_auth_token(request.headers['HTTP_AUTHORIZATION']))\n user_not_authorized if @real_user.nil?\n end", "def auth_token\n AuthToken.new payload: { sub: user.id }\n end", "def current_user\n authenticate_token\n end", "def get_current_muser\n return if !bearer_token\n decoded_jwt = decode_token(bearer_token)\n Muser.find(decoded_jwt[0][\"user\"][\"id\"])\n end", "def current_user\n token_locations = [cookies[:auth_token], ENV['DANGEROUS_AUTH_HACK'], params[:auth_token]]\n token = token_locations.find{|x| !x.blank? }\n if token\n Identity.includes(:person).find_by(token: token).try(:person)\n else\n nil\n end\n end", "def get_user_details(token)\n uri = URI('https://api.github.com/user')\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = 'token ' + token\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n res = http.request(req)\n\n case res\n when Net::HTTPSuccess, Net::HTTPRedirection\n # OK\n responseText = ActiveSupport::JSON.decode res.body\n else\n responseText = 'Error receiving user details: ' + res.value\n end\n\n return responseText\n end", "def current_user\n auth_token = request.headers['HTTP_AUTH_TOKEN']\n puts auth_token\n @current_user ||= User.find_by(auth_token: auth_token)\n #puts @current_user.name + \" is logged in\"\n end", "def current_user\n api_key = ApiKey.active.where(access_token: token).first\n if api_key\n return api_key.user\n else\n return nil\n end\n end", "def current_user\n @current_user = User.find_by_authentication_token! params[:authentication_token]\n end", "def current_user\n @current_user ||= User.find_by(token: request.headers[:authorization])\n end", "def get_current_user_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TextMagicApi.get_current_user ...'\n end\n # resource path\n local_var_path = '/api/v2/user'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'User')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TextMagicApi#get_current_user\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def token\n\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email)\n if user && user.authenticate(password) \n render json: { token: user.api_token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def current_user\r\n api_key = ApiKey.active.where(access_token: token).first\r\n if api_key\r\n return api_key.user\r\n else\r\n return nil\r\n end\r\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authentication_error\n end\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n else\n authenticate_error\n end\n end", "def find_current_user\n Current.user = UserSession.find&.user\n\n return if logged_in?\n\n authenticate_with_http_token do |token, options|\n user = User.find_by(api_token: token)\n return unless user.present?\n\n # Compare the tokens in a time-constant manner, to mitigate timing attacks.\n Current.user = user if ActiveSupport::SecurityUtils.secure_compare(user.api_token, token)\n end\n end", "def login_from_jwt_header\n @current_user = if jwt_decoded_payload['sub']\n user_class.sorcery_adapter.find_by_id(jwt_decoded_payload['sub'])\n end\n end", "def authenticate_user_from_token!\n\t\t@api_token = ApiToken.find_by_token(params[:token])\n @user = @api_token.try(:user)\n if @user.nil?\n render json: { error: 'Not authorized' }, status: 401\n end\n end", "def token\n authenticate_with_http_basic do |username, password|\n\n user = User.find_by(username: username)\n if user && user.password == password\n render json: { token: user.token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def set_current_user\n if decoded_auth_token\n @current_user ||= User.find(decoded_auth_token[:user_id])\n end\n end", "def set_current_user\n if decoded_auth_token\n @current_user ||= User.find(decoded_auth_token[:user_id])\n end\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(api_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def authorize_request\n # request.headers[\"Authorization\"] = JsonWebToken.encode(user_id: 1)\n @current_user = (AuthorizeApiRequest.new(request.headers).call)[:user]\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n user = User.find_by(access_token: auth_token)\n\n fail AccessDenied unless user\n\n @current_user = user\n end", "def verify_auth_token\n token = params[:auth_token]\n if token.nil?\n render_json_response(400, \"Authorization token needed\")\n return\n end\n\n user = User.find_by_authentication_token(token)\n if user.nil?\n render_json_response(401, \"Bad token\")\n return\n end\n\n @user = user\n end", "def set_current_user\n if decoded_auth_token\n @current_user ||= User.find_by_id(decoded_auth_token['user_id'])\n end\n end", "def authentication_token\n object.authentication_token if !current_user || object.id == current_user.id\n end", "def authenticate_user_from_token\n unless authenticate_with_http_token { |token, options| User.find_by(auth_token: token) }\n render json: { error: 'Bad Token'}, status: 401\n end\n end", "def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end", "def auth_info(token, options = {})\n params = { 'apiKey' => @api_key,\n 'token' => token }\n params.merge!(options)\n\n json = parse_response(get(\"/api/#{API_VERSION}/auth_info\",\n params))\n User.new(json)\n end", "def token\n authenticated\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n\n if auth_token\n authenticate_with_auth_token auth_token\n # else\n # authentication_error\n end\n end", "def get_me\n response = self.class.get(base_api_endpoint(\"users/me\"), headers: { \"authorization\" => @auth_token })\n @user_data = JSON.parse(response.body)\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def current_user\n @current_user ||=\n if @env.key?(\"HTTP_AUTHORIZATION\")\n decoded_credentials =\n Base64.decode64(@env[\"HTTP_AUTHORIZATION\"][/^Basic (.*)$/, 1])\n email, password = decoded_credentials.split(\":\")\n\n login = Login.new(email: email, password: password)\n login.user\n else\n Guest.new\n end\n end", "def auth\n\n @user = current_user\n render json: @user\n \n end", "def auth_token\n @auth_token ||= ActionController::HttpAuthentication::Token.token_and_options(request)\n end", "def authenticate_token \n\t\tauthenticate_with_http_token do | token, options| \n\t\t\tUser.find_by(auth_token: token)\n\t\tend\n\tend", "def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end", "def logged_in_user\n if decoded_token\n user_id = decoded_token[0]['user_id']\n @user = User.find_by(id: user_id)\n end\n end", "def authenticate_using_http_token\n return if current_user\n authenticate_with_http_token do |token_code, options|\n auth = Tokens::Api.authenticate token_code\n\n # NOTE: Setting the instance variable directly bypasses the session\n # setup. Tokens are generally used in API contexts, so the session\n # cookie would get ignored anyway.\n @current_user = auth unless auth.kind_of? Symbol\n end\n end", "def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n user = user_token && User.find_by_authentication_token(user_token.to_s)\n \n unless user\n render json: { errors: 'user must signed in' }, status: :unprocessable_entity\n end\n end", "def authenticate_request\n begin\n uid = JWT.decode(request.headers['Authorization'], Rails.application.secrets.secret_key_base)[0]['uid']\n @current_user = User.find_by(uid: uid)\n rescue JWT::DecodeError\n render json: 'authentication failed', status: 401\n end\n end", "def authenticate_user_from_token\n authenticate_with_http_token do |token, options|\n user_email = options[:email]\n user_email && User.where(email: user_email, authentication_token: token).first\n end\n end", "def user\n # find a User matching the decoded token if the decode operation was successfull\n user = User.find(decoded_auth_token[:user_id]) if decoded_auth_token\n\n if user\n # return the user if active\n return user if user.active\n\n # Else raise a JWTException Inactive Account\n raise(API::JWTExceptionHandler::InactiveAccount, APIMessages.account_not_active)\n end\n rescue ActiveRecord::RecordNotFound => e\n # Raise an Invalid Token if there is no matching User from db\n raise(API::JWTExceptionHandler::InvalidToken, (\"#{APIMessages.invalid_token} #{e.message}\"))\n end", "def authenticate_user_from_token!\n auth_token = request.headers['Authorization']\n client_id = request.headers['Client-ID']\n\n if auth_token\n authenticate_with_auth_token(auth_token, client_id)\n else\n authentication_error\n end\n end", "def call\n JsonWebToken.encode(user_id: api_user.id) if api_user\n end", "def set_user\n token = request.headers['FARMBOT-AUTH'] || false\n @api_user ||= User.find_by(authentication_token: token)\n if @api_user.nil? || !token\n head :unauthorized and return\n end\n end", "def authenticate_with_api_key\n if @current_user.nil? && request.headers['Authorization'].nil?\n @current_user = authenticate_with_http_token(&method(:authenticator))\n end\n end", "def me\n cookie = cookies[:auth_token]\n @current_user ||= User.find_by_auth_token(cookie) if cookie\n end", "def authenticate_user\n authenticate_or_request_with_http_token do |token, options|\n @user = User.find_by_auth_key(token)\n head :unauthorized unless @user\n return\n end\n end", "def current_user\n api_key = APIKey.active.where(access_token: token).first\n if api_key\n return api_key.usuario\n else\n return nil\n end\n end", "def current_user\n @current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]\n end", "def current_user\n @current_user ||= User.find_by_auth_token(cookies[:auth_token]) if cookies[:auth_token]\n end", "def authenticate_user_from_token!\n user_token = params[:auth_token].presence\n if user_token\n user = User.where(authentication_token: user_token.to_s).first\n if user\n # Notice we are passing store false, so the user is not\n # actually stored in the session and a token is needed\n # for every request. If you want the token to work as a\n # sign in token, you can simply remove store: false.\n sign_in user, store: false\n else\n render status: 401, json: {success: false, error: \"invalid token\" }\n end\n end\n end", "def current_auth_user\n @current_auth_user ||= auth_key.try :owner\n end", "def current_user\n @_current_user ||= authenticate_token\n end", "def current_user\n @_current_user ||= authenticate_token\n end", "def decoded_auth_token\n @decoded_auth_token ||= JsonWebToken.decode(http_auth_header)\n end", "def logged_user\n if decoded_token\n user_id = decoded_token[0].to_i\n @user = User.find user_id\n end\n end", "def auth_token\n TokenProvider.issue_token(\n first_name: object.first_name,\n last_name: object.last_name,\n username: object.username,\n user_id: object.id,\n role: object.role\n )\n end", "def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end", "def set_current_user\n if decoded_auth_token\n begin\n @current_user ||= User.where(active: true).find(decoded_auth_token[:user_id])\n rescue\n raise NotAuthenticatedError\n end\n end\n end", "def show\n # token = request.headers['Authentication'].split(' ')[1]\n # payload = JWT.decode(token)\n # user = User.find(payload['user_id'])\n # if user\n # render json: user\n # else \n # render json: { message: 'Error', user: 'Could not get user from token' }\n # end\n end" ]
[ "0.68131524", "0.6732153", "0.66908926", "0.665829", "0.6595166", "0.642096", "0.64065033", "0.6395047", "0.6388248", "0.6317604", "0.6307986", "0.6293515", "0.6263402", "0.625402", "0.6223923", "0.62147665", "0.6209079", "0.6191752", "0.6190895", "0.6187938", "0.6167497", "0.6161806", "0.6139356", "0.61276704", "0.61146384", "0.6105319", "0.61010426", "0.609531", "0.6084794", "0.6082485", "0.6071682", "0.6066257", "0.60607636", "0.60405445", "0.60400224", "0.602896", "0.60219586", "0.6021015", "0.60146105", "0.59698355", "0.59620607", "0.5946231", "0.59425455", "0.5922841", "0.59065366", "0.5902853", "0.5899114", "0.5895283", "0.5890973", "0.58878446", "0.58878446", "0.5887253", "0.5882496", "0.58796", "0.5873809", "0.5866917", "0.58630496", "0.58630496", "0.584677", "0.5839798", "0.5829601", "0.5806483", "0.58003885", "0.57958126", "0.57953733", "0.5792198", "0.5790529", "0.5774104", "0.5773296", "0.5761", "0.57582635", "0.5750827", "0.574814", "0.5747481", "0.5743968", "0.5741593", "0.5741593", "0.5736973", "0.57368463", "0.5734842", "0.5717968", "0.5713153", "0.5686954", "0.56856227", "0.5684748", "0.5681537", "0.5671254", "0.5666382", "0.56662303", "0.56650746", "0.56648785", "0.5662882", "0.5657889", "0.5649125", "0.5649125", "0.5643881", "0.5643114", "0.56366915", "0.5636653", "0.5627386", "0.56223786" ]
0.0
-1
Don't ask the user for record quantity, just randomly create 10 Customers, Sales Orders and Invoices
def randomize_records puts "Due to the API throughput limitations, this may take some time...\n" execute_customer_record_create(10) execute_sales_order_create(25) execute_invoice_create(25) # 25.times do |t| # execute_payment_create(25) # end puts "\nFinished creating bulk records!" exit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute_customer_record_create(qty)\n puts \"Starting to create Customer records... Please give the API time to respond...\\n\"\n qty.times do |t|\n body = FakeCustomer.new.generate\n # puts JSON.pretty_generate(JSON.parse(body.to_json))\n FakeRestActions.new(endpoint: \"Customers\", body: body, access_token: @access_token).post_request\n end\n end", "def random_batch_quantity\n Factory::Randomiser.number(10..1000)\n end", "def creates_stickers_collection_to_user quantity=15\n\t\tsticker_default_ids = StickerDefault.pluck(:id)\n\t\tquantity.times do \n\t\t\tposition_selected_sticker_default_ids = \n\t\t\t\t\t\t\trand(0..sticker_default_ids.size-1)\n\t\t\tstickers.create({sticker_default_id: \n\t\t\t\tsticker_default_ids[position_selected_sticker_default_ids]})\n\t\tend\n\tend", "def generate_products\n departments = Department.all\n promo_codes = PromoCode.all\n prng = Random.new\n\n 10_000.times do\n promo_code = promo_codes.first\n\n if prng.rand(1..2) == 1\n promo_code = promo_codes[prng.rand(promo_codes.length)]\n end\n\n Product.create(\n name: Faker::Commerce.unique.product_name,\n price: Faker::Commerce.price,\n department: departments[prng.rand(departments.length)],\n promo_code: promo_code\n )\n end\n# Just in case Faker has less data than I imagine\nrescue Faker::UniqueGenerator::RetryLimitExceeded\nend", "def create_orders(count)\n users = User.where(admin: false)\n i = 0\n while i < count.to_i && users.count > 0 do\n Order.create(user: users[i % users.count], total_amount: 0,\n shipping_address: Faker::Address.street_address)\n i += 1\n end\nend", "def create_orders_over_time(amount)\n amount.times do\n profile = UserProfile.all.sample\n created = Faker::Time.between(1.years.ago, Time.now)\n updated = Faker::Time.between(created, Time.now)\n Order.create(\n user_id: profile.id,\n shipping_address_id: profile.shipping_address_id,\n billing_address_id: profile.billing_address_id,\n cc_id: profile.cc_id, in_cart: false,\n created_at: created, updated_at: updated\n )\n add_products(order_id: Order.last.id)\n end\nend", "def generate_contents(order_id)\n (rand(10) + 1).times do\n c = OrderContent.new\n c[:order_id] = order_id\n c[:product_id] = Product.pluck(:id).sample\n c[:quantity] = rand(10)+1\n\n # prevents breaking the uniqueness constraint on\n # [:order_id, :product_id]\n if OrderContent.where(:product_id => c.product_id,\n :order_id => c.order_id).empty?\n c.save\n end\n end\nend", "def generate_inventory(products, below_threshold = false, new_form_warehouse = false)\n products.each do |product|\n count = if new_form_warehouse\n 0\n elsif below_threshold\n rand(1..THRESHOLD_LIMIT - 1)\n else\n rand(THRESHOLD_LIMIT + 1..50)\n end\n inventory.create!(product: product, item_count: count, low_item_threshold: THRESHOLD_LIMIT)\n end\n end", "def generate_promotions\n # This \"promotion\" is the one used to populate products with no promotion\n PromoCode.create(code: 'nopromo', discount: 0)\n Faker::Commerce.unique.exclude :string, [7], %w[nopromo]\n\n 15.times do\n PromoCode.create(\n code: Faker::Commerce.unique.promotion_code,\n discount: Faker::Commerce.price(20.0..50.0)\n )\n end\n# Just in case Faker has less data than I imagine\nrescue Faker::UniqueGenerator::RetryLimitExceeded\nend", "def db_seed\n new_products = []\n 10.times do\n # you will write the \"create\" method as part of your project\n new_products << Product.create(brand: Faker::Company.name,\n name: Faker::Commerce.product_name,\n price: Faker::Commerce.price)\n end\n new_products\nend", "def generateCart\n cart = []\n rand(20).times do\n cart.push(ITEMS.sample) \n end\n cart\nend", "def seed_clients\n 10.times do |n|\n Client.create!({\n sex: %w(male female other).sample,\n year_of_birth: [*1950..2004].sample,\n cell_phone: fake_cell_phone,\n category_ids: [1, 2, 3, 4].sample\n })\n end\nend", "def create_franchises\n 8.times do \n Franchise.create(company_id: Company.all.sample.id, owner_id: Owner.all.sample.id, location: Faker::Address.city, profit: Faker::Number.within(range: -1000.00..1000000.00))\n end\nend", "def db_seed\n 10.times do \n \tProduct.create(brand: Faker::Company.name, name: Faker::App.name, price: Faker::Commerce.price)\n end\nend", "def generate_number\n record = true\n while record\n random = \"O#{Array.new(9){rand(9)}.join}\"\n record = Order.find(:first, :conditions => [\"number = ?\", random])\n end\n self.number = random\n end", "def generate_departments\n 30.times do\n Department.create(name: Faker::Commerce.unique.department)\n end\n# Just in case Faker has less data than I imagine\nrescue Faker::UniqueGenerator::RetryLimitExceeded\nend", "def generateCart\n\t\t@cart = []\n\t rand(20).times do\n\t\t\t@cart.push(ITEMS.sample) \n\t\tend\n\t\t@cart\n\tend", "def create_random_contract\n return nil if contracts.offered.count > 3\n create_third_party_mission available_contract_missions.sample\n end", "def db_seed\n # Your code goes here!\n\n brands = []\n product_names = []\n prices = []\n 10.times do\n brands.push(Faker::Company.name)\n product_names.push(Faker::Commerce.product_name)\n prices.push(Faker::Commerce.price(10..50))\n end\n\n 10.times do\n Product.create(brand: brands.sample, name: product_names.sample, price: prices.sample )\n end\n\nend", "def generateCart\n\tcart = []\n\trand(20).times do\n\t\tcart.push(ITEMS.sample) \n\tend\n\tcart\nend", "def generateCart\n\tcart = []\n\trand(20).times do\n\t\tcart.push(ITEMS.sample) \n\tend\n\tcart\nend", "def get_quantity_used(date, subscription_id)\n random_no = Random.rand(10)\n return random_no\n end", "def db_seed\n # Use faker gem to generate arrays with fake brands, product names, and prices.\n 10.times do\n # Create 10 new Product objects, and save them to the database\n Product.create name: Faker::Commerce.product_name, brand: Faker::Company.name, price: Faker::Commerce.price\n end\nend", "def db_seed\n\n 10.times do\n\n brands = Faker::Commerce.product_name\n product_names = Faker::Name.name \n prices = Faker::Commerce.price\n\n Product.create( brand: brands,\n name: product_names,\n price: prices)\n end\nend", "def generate_order\n user = User.all.sample\n\n # 2 kinds of users can have orders built\n # a user with a billing address is one\n # a user who still needs a shopping cart built is the other\n if user[:billing_id] || !has_cart?(user[:id])\n o = Order.new\n o[:user_id] = user.id\n o[:shipping_id] = random_user_address(user.id)\n o[:billing_id] = random_user_address(user.id)\n\n # first generated order is a shopping cart\n # all since then are placed orders with checkout dates\n if has_cart?(user.id)\n o[:checkout_date] = placement_date(user)\n end\n\n o.save\n generate_contents(o[:id])\n end\nend", "def create_rentalbook\n puts \"Populates 100 rentalbooks records\"\n\n customer_count = Customer.count\n book_count = Book.count\n\n 100.times do\n random_offset_customer = rand(customer_count)\n customer = Customer.offset(random_offset_customer).first\n\n random_offset_book = rand(book_count)\n book = Book.offset(random_offset_book).first\n\n RentalBook.create(book_id: book.id,\n customer_id: customer.id,\n rental_date: Faker::Time.between(from: DateTime.now - 40, to: DateTime.now))\n end\nend", "def generateCart\n cart = []\n rand(20).times do\n cart.push(ITEMS.sample)\n end\n ap cart \nend", "def quantity\n @quantity ||= sold_out ? 0 : rand(100)\n end", "def generate_order_number\n record = true\n while record\n random = \"R#{Array.new(9){rand(9)}.join}\"\n record = self.class.where(:number => random).first\n end\n self.number = random if self.number.blank?\n self.number\n end", "def market_price_for_drug\n rand(500) + 10\n end", "def generate_test_data\n headerrow = ['foo', 'bar', 'baz', 'qux', 'quy', 'quz'] # contents inconsequential\n merchant_name = \"foo bar\" # use for occassional repetition\n item_description = \"baz qux\"\n item_price = 100\n # proc to generate a row of data with occassional repetition as per values above\n rowgen = Proc.new { [Faker::Name.name, [Faker::Commerce.product_name, item_description].sample, [Faker::Number.number(3), item_price].sample, (1..100).to_a.sample, Faker::Address.street_address, [Faker::Company.name, merchant_name].sample] }\n data = [ headerrow ]\n (0..(rand(100)+20)).each{ data << rowgen.call } # generate random number of rows\n data\nend", "def add_units(qty)\n qty.to_i.times do\n #create item\n item = supply_items.new\n item.status = SupplyItem::STATUS_AVAILABLE\n item.save\n end\n end", "def generate_instances(supervisor, quantity = self.quantity)\n quantity.times.map { |i| create_instance(supervisor) }\n end", "def ready_customer_records\n execute_customer_record_create(check_quantity)\n end", "def create_random_list(limit)\n limit.times do\n add(rand(10))\n end\n end", "def generate\n\t\t(1..params[:quantity].to_i).each do |card|\n\t\t\tScratchCard.generate(params[:denom])\n\t\tend\n\t\tflash[:success] = \"sucessfully generated #{params[:quantity]} cards.\"\n\t\tredirect_to scratch_cards_path\n\tend", "def make_customer index, contact_key\n promotions = ['T', 'F'].shuffle.first\n %{INSERT INTO customers VALUES (#{index}, '#{promotions}', #{contact_key});}\nend", "def generate_product\n p = Product.new\n p[:name] = Faker::Commerce.product_name\n p[:category_id] = Category.pluck(:id).sample\n p[:description] = Faker::Lorem.sentence\n p[:sku] = Faker::Code.ean\n p[:price] = random_price\n p.save\nend", "def create_books\n transaction {\n 150.times do\n Book.create(\n title: rand_name,\n author: rand_record(Author),\n publisher: rand_record(Publisher)\n )\n end\n }\n create_message Book\nend", "def create_phone_number\n numbers = []\n amount_of_numbers = rand(0..3)\n amount_of_numbers.times do\n kind_of_number = ['phone_number', 'cell_phone'].sample\n numbers << Faker::PhoneNumber.send(kind_of_number)\n end\n numbers\nend", "def db_seed\n\tbrand = []\n\tproducts_names = []\n\tprices = []\n\tarray = []\n\t10.times do |i|\n\t\tbrand.push(Faker::Commerce.department)\n\t\tproducts_names.push(Faker::Commerce.product_name)\n\t\tprices.push(Faker::Commerce.price)\n\t\tProduct.create(id:i,brand:brand[i],name:products_names[i],price:prices[i])\n\tend\t\nend", "def generate_ebay_items_with_size(num, size=\"LP\", price=10.00)\n ebay_items = []\n num.times { ebay_items << Factory.create(:ebay_item, :size => size, :price => price) }\n ebay_items\n end", "def make_users\r\n admin = User.create!(name: \"Example User\",\r\n email: \"example@railstutorial.org\",\r\n password: \"foobar\",\r\n password_confirmation: \"foobar\",\r\n admin: true)\r\n\r\n 99.times do |n|\r\n name = Faker::Name.name\r\n email = \"example-#{n+1}@railstutorial.org\"\r\n password = \"password\"\r\n User.create!(name: name,\r\n email: email,\r\n password: password,\r\n password_confirmation: password)\r\n end\r\nend", "def generate_transactions\n accounts = if params[:account].eql?('All')\n Account.all\n else\n Account.where(id: params[:account])\n end\n accounts.each do |account|\n matching_dealers = Dealer.where(currency: account.currency)\n (0...params[:how_many].to_i).each do |_i|\n dealer = get_weighted_random_dealer matching_dealers\n account.transactions.create!(\n account: account,\n dealer_account_number: dealer.account_number,\n dealer_name: dealer.name,\n amount: get_random_amount(dealer),\n currency: account.currency,\n created_at: get_random_time(params[:period])\n )\n end\n end\n total_count = params[:how_many].to_i * accounts.length\n redirect_to admin_transactions_path, notice: \"Successfully generated #{total_count} transactions.\"\n end", "def create_objects_merchant_with_many_customers_and_items\n let!(:customer1) { create(:customer) } # Transaction_count = 1\n let!(:customer2) { create(:customer) } # Transaction_count = 3 #=> Top Customer 3\n let!(:customer3) { create(:customer) } # Transaction_count = 5 #=> Top Customer 1\n let!(:customer4) { create(:customer) } # Transaction_count = 4 #=> Top Customer 2\n let!(:customer5) { create(:customer) } # Transaction_count = 1\n let!(:customer6) { create(:customer) } # Transaction_count = 1\n let!(:customer7) { create(:customer) } # Transaction_count = 2 #=> Top Customer 4 (4a)\n let!(:customer8) { create(:customer) } # Transaction_count = 2 #=> Top Customer 5 (4b)\n let!(:customer9) { create(:customer) } # Transaction_count = 1\n let!(:customer10) { create(:customer) } # Transaction_count = 1\n\n let!(:merchant) { create(:enabled_merchant) }\n\n let!(:item1) { create(:item, merchant: merchant) }\n let!(:item2) { create(:item, merchant: merchant) }\n let!(:item3) { create(:item, merchant: merchant) }\n let!(:item4) { create(:item, merchant: merchant) }\n let!(:item5) { create(:item, merchant: merchant) }\n let!(:item6) { create(:item, merchant: merchant) }\n let!(:item7) { create(:item, merchant: merchant) }\n let!(:item8) { create(:item, merchant: merchant) }\n let!(:item9) { create(:item, merchant: merchant) }\n let!(:item10) { create(:item, merchant: merchant) }\n let!(:item11) { create(:item, merchant: merchant) }\n let!(:item12) { create(:item, merchant: merchant) }\n let!(:item13) { create(:item, merchant: merchant) }\n let!(:item14) { create(:item, merchant: merchant) }\n let!(:item15) { create(:item, merchant: merchant) }\n let!(:item16) { create(:item, merchant: merchant) }\n let!(:item17) { create(:item, merchant: merchant) }\n let!(:item18) { create(:item, merchant: merchant) }\n let!(:item19) { create(:item, merchant: merchant) }\n let!(:item20) { create(:item, merchant: merchant) }\n\n let!(:invoice1a) { create(:invoice, :completed, customer: customer1, created_at: '2021-07-24T17:30:05+0700') } # 15\n let!(:invoice1b) { create(:invoice, :completed, customer: customer1, created_at: '2021-07-27T17:30:05+0700') } # 18\n let!(:invoice2a) { create(:invoice, :completed, customer: customer2, created_at: '2021-07-26T17:30:05+0700') } # 17\n let!(:invoice2b) { create(:invoice, :completed, customer: customer2, created_at: '2021-07-17T17:30:05+0700') } # 10\n let!(:invoice2c) { create(:invoice, :completed, customer: customer2, created_at: '2021-07-18T17:30:05+0700') } # 11\n let!(:invoice3a) { create(:invoice, :completed, customer: customer3, created_at: '2021-07-29T17:30:05+0700') } # 20\n let!(:invoice3b) { create(:invoice, :completed, customer: customer3, created_at: '2021-07-22T17:30:05+0700') } # 13\n let!(:invoice3c) { create(:invoice, :completed, customer: customer3, created_at: '2021-07-28T17:30:05+0700') } # 19\n let!(:invoice3d) { create(:invoice, :completed, customer: customer3, created_at: '2021-07-02T17:30:05+0700') } # 2\n let!(:invoice3e) { create(:invoice, :completed, customer: customer3, created_at: '2021-07-15T17:30:05+0700') } # 8\n let!(:invoice4a) { create(:invoice, :completed, customer: customer4, created_at: '2021-07-29T17:30:05+0705') } # 21\n let!(:invoice4b) { create(:invoice, :completed, customer: customer4, created_at: '2021-07-16T17:30:05+0700') } # 9\n let!(:invoice4c) { create(:invoice, :completed, customer: customer4, created_at: '2021-07-08T17:30:05+0700') } # 5\n let!(:invoice4d) { create(:invoice, :completed, customer: customer4, created_at: '2021-07-01T17:30:05+0700') } # 1\n let!(:invoice5a) { create(:invoice, :completed, customer: customer5, created_at: '2021-07-04T17:30:05+0700') } # 3\n let!(:invoice6a) { create(:invoice, :completed, customer: customer6, created_at: '2021-07-06T17:30:05+0700') } # 4\n let!(:invoice7a) { create(:invoice, :completed, customer: customer7, created_at: '2021-07-23T17:30:05+0700') } # 14\n let!(:invoice7b) { create(:invoice, :completed, customer: customer7, created_at: '2021-07-21T17:30:05+0700') } # 12\n let!(:invoice8a) { create(:invoice, :completed, customer: customer8, created_at: '2021-07-25T17:30:05+0700') } # 16\n let!(:invoice8b) { create(:invoice, :completed, customer: customer8, created_at: '2021-07-30T17:30:05+0700') } # 22\n let!(:invoice9a) { create(:invoice, :completed, customer: customer9, created_at: '2021-07-14T17:30:05+0700') } # 7\n let!(:invoice10a) { create(:invoice, :completed, customer: customer10, created_at: '2021-07-13T17:30:05+0700') } # 6\n\n let!(:transaction1a) { create(:transaction, :failed, invoice: invoice1a) }\n let!(:transaction1b) { create(:transaction, :success, invoice: invoice1b) }\n let!(:transaction2a) { create(:transaction, :success, invoice: invoice2a) }\n let!(:transaction2b) { create(:transaction, :success, invoice: invoice2b) }\n let!(:transaction2c) { create(:transaction, :success, invoice: invoice2c) }\n let!(:transaction3a) { create(:transaction, :success, invoice: invoice3a) }\n let!(:transaction3b) { create(:transaction, :success, invoice: invoice3b) }\n let!(:transaction3c) { create(:transaction, :success, invoice: invoice3c) }\n let!(:transaction3d) { create(:transaction, :success, invoice: invoice3d) }\n let!(:transaction3e) { create(:transaction, :success, invoice: invoice3e) }\n let!(:transaction4a) { create(:transaction, :success, invoice: invoice4a) }\n let!(:transaction4b) { create(:transaction, :success, invoice: invoice4b) }\n let!(:transaction4c) { create(:transaction, :success, invoice: invoice4c) }\n let!(:transaction4d) { create(:transaction, :success, invoice: invoice4d) }\n let!(:transaction5a) { create(:transaction, :success, invoice: invoice5a) }\n let!(:transaction6a) { create(:transaction, :success, invoice: invoice6a) }\n let!(:transaction7a) { create(:transaction, :success, invoice: invoice7a) }\n let!(:transaction7b) { create(:transaction, :success, invoice: invoice7b) }\n let!(:transaction8a) { create(:transaction, :success, invoice: invoice8a) }\n let!(:transaction8b) { create(:transaction, :success, invoice: invoice8b) }\n let!(:transaction9a) { create(:transaction, :success, invoice: invoice9a) }\n let!(:transaction10a) { create(:transaction, :success, invoice: invoice10a) }\n\n let!(:invoice_item1a_1) { create(:invoice_item, :pending, item: item1, invoice: invoice1a, quantity: 2, unit_price: 10) }\n let!(:invoice_item1a_2) { create(:invoice_item, :pending, item: item1, invoice: invoice1a, quantity: 5, unit_price: 20) }\n let!(:invoice_item1b_1) { create(:invoice_item, :shipped, item: item2, invoice: invoice1b, quantity: 4, unit_price: 10) }\n let!(:invoice_item1b_2) { create(:invoice_item, :shipped, item: item2, invoice: invoice1b, quantity: 5, unit_price: 20) }\n let!(:invoice_item2a_1) { create(:invoice_item, :shipped, item: item3, invoice: invoice2a, quantity: 1, unit_price: 10) }\n let!(:invoice_item2a_2) { create(:invoice_item, :shipped, item: item3, invoice: invoice2a, quantity: 5, unit_price: 20) }\n let!(:invoice_item2b_1) { create(:invoice_item, :shipped, item: item4, invoice: invoice2b, quantity: 3, unit_price: 10) }\n let!(:invoice_item2b_2) { create(:invoice_item, :shipped, item: item4, invoice: invoice2b, quantity: 5, unit_price: 20) }\n let!(:invoice_item2c_1) { create(:invoice_item, :shipped, item: item5, invoice: invoice2c, quantity: 5, unit_price: 10) }\n let!(:invoice_item2c_2) { create(:invoice_item, :shipped, item: item5, invoice: invoice2c, quantity: 10, unit_price: 20) }\n let!(:invoice_item3a_1) { create(:invoice_item, :shipped, item: item6, invoice: invoice3a, quantity: 6, unit_price: 10) }\n let!(:invoice_item3a_2) { create(:invoice_item, :shipped, item: item6, invoice: invoice3a, quantity: 5, unit_price: 20) }\n let!(:invoice_item3b_1) { create(:invoice_item, :packaged, item: item7, invoice: invoice3b, quantity: 7, unit_price: 17) }\n let!(:invoice_item3b_2) { create(:invoice_item, :packaged, item: item9, invoice: invoice3b, quantity: 1, unit_price: 20) }\n let!(:invoice_item3c_1) { create(:invoice_item, :shipped, item: item8, invoice: invoice3c, quantity: 15, unit_price: 14) }\n let!(:invoice_item3c_2) { create(:invoice_item, :shipped, item: item9, invoice: invoice3c, quantity: 1, unit_price: 20) }\n let!(:invoice_item3d_1) { create(:invoice_item, :packaged, item: item9, invoice: invoice3d, quantity: 1, unit_price: 10) }\n let!(:invoice_item3e_1) { create(:invoice_item, :packaged, item: item9, invoice: invoice3e, quantity: 3, unit_price: 20) }\n let!(:invoice_item4a_1) { create(:invoice_item, :shipped, item: item10, invoice: invoice4a, quantity: 3, unit_price: 10) }\n let!(:invoice_item4a_2) { create(:invoice_item, :shipped, item: item10, invoice: invoice4a, quantity: 5, unit_price: 20) }\n let!(:invoice_item4b_1) { create(:invoice_item, :shipped, item: item11, invoice: invoice4b, quantity: 5, unit_price: 10) }\n let!(:invoice_item4b_2) { create(:invoice_item, :packaged, item: item11, invoice: invoice4b, quantity: 5, unit_price: 20) }\n let!(:invoice_item4b_3) { create(:invoice_item, :shipped, item: item12, invoice: invoice4b, quantity: 5, unit_price: 10) }\n let!(:invoice_item4c_1) { create(:invoice_item, :packaged, item: item12, invoice: invoice4c, quantity: 5, unit_price: 10) }\n let!(:invoice_item4c_2) { create(:invoice_item, :shipped, item: item12, invoice: invoice4d, quantity: 4, unit_price: 25) }\n let!(:invoice_item5a_1) { create(:invoice_item, :shipped, item: item13, invoice: invoice5a, quantity: 6, unit_price: 10) }\n let!(:invoice_item5a_2) { create(:invoice_item, :shipped, item: item13, invoice: invoice5a, quantity: 5, unit_price: 20) }\n let!(:invoice_item6a_1) { create(:invoice_item, :shipped, item: item14, invoice: invoice6a, quantity: 6, unit_price: 10) }\n let!(:invoice_item6a_2) { create(:invoice_item, :packaged, item: item14, invoice: invoice6a, quantity: 5, unit_price: 20) }\n let!(:invoice_item7a_1) { create(:invoice_item, :shipped, item: item15, invoice: invoice7a, quantity: 8, unit_price: 10) }\n let!(:invoice_item7a_2) { create(:invoice_item, :packaged, item: item15, invoice: invoice7a, quantity: 3, unit_price: 20) }\n let!(:invoice_item7a_3) { create(:invoice_item, :shipped, item: item15, invoice: invoice7b, quantity: 2, unit_price: 20) }\n let!(:invoice_item7b_1) { create(:invoice_item, :shipped, item: item16, invoice: invoice7b, quantity: 6, unit_price: 10) }\n let!(:invoice_item7b_2) { create(:invoice_item, :pending, item: item16, invoice: invoice7b, quantity: 5, unit_price: 20) }\n let!(:invoice_item8a_1) { create(:invoice_item, :pending, item: item17, invoice: invoice8a, quantity: 6, unit_price: 10) }\n let!(:invoice_item8a_2) { create(:invoice_item, :pending, item: item17, invoice: invoice8a, quantity: 5, unit_price: 20) }\n let!(:invoice_item8b_1) { create(:invoice_item, :shipped, item: item18, invoice: invoice8b, quantity: 8, unit_price: 10) }\n let!(:invoice_item8b_2) { create(:invoice_item, :shipped, item: item18, invoice: invoice8b, quantity: 8, unit_price: 20) }\n let!(:invoice_item9a_1) { create(:invoice_item, :shipped, item: item19, invoice: invoice9a, quantity: 6, unit_price: 10) }\n let!(:invoice_item9a_2) { create(:invoice_item, :shipped, item: item19, invoice: invoice9a, quantity: 5, unit_price: 20) }\n let!(:invoice_item10a_1) { create(:invoice_item, :pending, item: item20, invoice: invoice10a, quantity: 6, unit_price: 10) }\n let!(:invoice_item10a_2) { create(:invoice_item, :shipped, item: item20, invoice: invoice10a, quantity: 5, unit_price: 20) }\nend", "def create_authors\n transaction { 100.times { Author.create first_name: rand_name, last_name: rand_name } }\n create_message Author\nend", "def seed_users\n 10.times do\n \tu = User.create(name:Faker::Name.name, email:Faker::Internet.free_email, password:\"testing\")\t \n\t\t 5.times do\n\t\t \t\ts = Survey.create(name: Faker::Company.bs)\n\t\t \t\tu.created_surveys << s\n\t\t \t\t\t6.times do\n\t\t\t\t \t\tquestion_text = Faker::Lorem.sentence + \"?\"\n\t\t\t\t \t\tq = Question.create(text: question_text)\n\t\t\t\t \t\t\t\t# each q has 4 choices\n\t\t\t\t \t\t\t4.times do\n\t\t\t\t \t\t\t\tc = Choice.create(choice: Faker::Company.bs)\n\t\t\t\t \t\t\t\tq.choices << c\n\t\t\t\t \t\t\tend\n\t\t\t\t \t\ts.questions << q\n\t\t\t\t \tend\n\t\t \tend\n end\nend", "def create_vans(n)\n puts \"creating #{n} random vans!\"\n n.times do |count|\n v = Van.new(\n title: Faker::FunnyName.name,\n description: 'the best van ever',\n location: addresses.sample,\n brand: ['Volvo', 'Mercedes', 'Ferrari', 'Maserati'].sample,\n category: ['family trip', 'road trip', 'luxury camping'].sample,\n price_per_day: [50,25,120,350].sample,\n seats: [[1,2,3,4]*2,[6]*4,[8]*4,[12]*4].flatten.sample,\n user: random_user\n # photo: camper_van_photos.sample\n )\n v.remote_photo_url = camper_van_photos.sample\n v.save!\n print \"*\"\n print \"\\n\" if (count + 1) % 10 == 0\n end\nend", "def add_extra_projects\n users = User.all\n n = 0\n users.each do |u|\n n += 1\n next if n < 20 || rand < 0.2 || u.projects.count.positive?\n\n u.projects.create(title: \"Project #{n}: #{Faker::Company.catch_phrase}\",\n source_code_url: Faker::Internet.url,\n deployed_url: Faker::Internet.url,\n description: \"Description #{n}: #{Faker::Lorem.paragraph(10)}\",\n created_at: 11.minutes.ago,\n updated_at: 10.minutes.ago)\n end\nend", "def generate_random_sale\n s_types = ShopsSettings::DISCOUNT_TYPES\n sales = [0]\n bonus = fidelity_level_bonus / 100.0 + 1\n bonus += sales_rate_bonus\n s_types.each_pair { |key, value|\n sales.push(key) if value * bonus >= rand(100)\n }\n sales.max\n end", "def add_extra_openings\n users = User.all\n n = 0\n users.each do |u|\n n += 1\n next if n < 20 || rand < 0.2 || u.openings.count.positive?\n\n u.openings.create(title: \"Opening #{n}: #{Faker::Job.title}\",\n description: \"Description #{n}: #{Faker::Lorem.paragraph(10)}\",\n created_at: 11.minutes.ago,\n updated_at: 10.minutes.ago)\n end\nend", "def crear_productos_contratados\n @lis_products = Sale::ProductQuotation.where(sale_quotation_id: self.sale_quotation_id)\n @lis_products.each do |product|\n product.quantity.times do\n Payment::ContractedProduct.create(\n plan_id: self.id,\n product_product_id: product.product_product_id,\n price_contracted: product.product_product.price,\n valid_until: Date.today + product.product_product.valid_days,\n user_created_id: self.user_created_id)\n end\n end\n end", "def create_users\n 50.times do\n Person.create(\n first_name: Faker::Name.first_name,\n last_name: Faker::Name.last_name,\n display_name: Faker::Name.title,\n email: Faker::Internet.email,\n password: \"test1234\",\n password_confirmation: \"test1234\"\n )\n end\nend", "def test_generate_random_unique_order_number\n sample_number = Order.generate_order_number\n assert_nil Order.find(:first, :conditions => [\"order_number = ?\", sample_number])\n end", "def generate_characteristics_for(micropost, num_characteristics)\r\n\twhile num_characteristics > 0 do\r\n\t\tFactoryGirl.create(:characteristic, micropost: micropost)\r\n\t\t\r\n\t\tnum_characteristics-=1\r\n\tend\r\nend", "def create_players(team, classes, num_players)\n num_players.times do\n player = Player.new\n player.first_name = Faker::Name.first_name \n player.last_name = Faker::Name.last_name \n player.team = team\n player.class_of = classes.sample\n player.save\n end\nend", "def create_admin_accounts\n puts \"creating admin accounts\"\n 1.times do |n|\n create_single_admin(n)\n end\nend", "def user_accounts\n \n 3.times do\n user = User.new\n user.username = Faker::Internet.user_name\n user.email = Faker::Internet.email\n user.password = \"123456789\"\n user.password_confirmation = \"123456789\"\n user.save!\n puts \"created user\"\n end\nend", "def records( quantity = 1 )\n persons = []\n quantity.times do\n persons.push( self.record() )\n end\n persons\n end", "def populate_items\n return if @items.size >= 15\n\n type = rand\n if type < 0.010\n @items.push(Goody.new(:apple))\n elsif type < 0.040\n @items.push(Goody.new(:merde))\n end\n end", "def create_random_contract\n available_contract_missions.each do |m|\n end\n end", "def create_joiners(person)\n plants_number = rand(1..4)\n plants_number.times do \n PlantParenthood.create(\n plant_id: Plant.all.sample.id, \n person_id: person.id, \n affection: rand(101), \n favorite?: [true, false].sample\n )\n end\nend", "def test_item\n 20.times do |i|\n new_item = Item.new\n new_item.title = Faker::Name.name\n new_item.description = Faker::Lorem.paragraph(8)\n new_item.price = Faker::Number.decimal(2)\n new_item.image_url = Faker::Avatar.image\n # temporaly, add item to first category\n new_item.category_id = Category.first.id\n new_item.save\n end\nend", "def enter_100k(num_rosters=1)\n contest_type = self.contest_types.where(\"name = '100k'\").first\n raise \"no 100k contest\" if contest_type.nil?\n system_user = User.where(:name => 'SYSTEM USER').first\n raise \"could not find system user\" if system_user.nil?\n num_rosters.times { Roster.generate(system_user, contest_type).fill_randomly.submit! }\n end", "def generate_ordernum(digits = 11)\n #Date.today.strftime(\"%Y%m%d\").to_s + (\"%04d\" % (Order.where(\"created_at >= ?\", Time.zone.now.beginning_of_day).count + 1))\n case self.payment_type\n when \"atm_transfer\"\n type = \"AT\"\n when \"credit_card\"\n type = \"CR\"\n when \"COD\"\n type = \"CD\"\n when \"Vaccount\"\n type = \"VA\"\n when \"paypal\"\n type = \"PP\"\n end\n self.ordernum ||= loop do\n # Make a random number.\n random = \"#{type}#{Array.new(digits){rand(10)}.join}\"\n # Use the random number if no other order exists with it.\n if self.class.exists?(ordernum: random)\n # If over half of all possible options are taken add another digit.\n digits += 1 if self.class.count > (10 ** digits / 2)\n else\n break random\n end\n end\n end", "def generate_content\n # Create all order states\n all_order_states = ['PENDING', 'AWAITING PAYMENT', 'AWAITING FULFILLMENT', 'COMPLETED']\n\n all_order_states.each do |state|\n State.find_or_create_by(name: state)\n end\n\n # Create provinces\n all_provinces = []\n all_provinces_short_name = %w[AB BC MB NB NL NS NT NU ON PE QC SK YT]\n\n all_provinces_short_name.each do |province, _index|\n new_province = Province.create(name: province)\n all_provinces << new_province\n end\n\n # Create customers\n all_customers = []\n 4.times do |_index|\n customer_name = Faker::Name.unique.name\n password = Faker::Number.number(digits: 6)\n new_customer = User.create(\n name: customer_name,\n password: password,\n password_confirmation: password,\n email: Faker::Internet.email(name: customer_name, separators: '.'),\n address: Faker::Address.unique.street_address,\n postal_code: Faker::Address.unique.postcode,\n province: all_provinces.sample\n )\n end\n\n # Generate 10 genres\n base_genres = ['Horror', 'Fantasy', 'Crime', 'Comic/Graphic Novel']\n all_genres = []\n base_genres.each do |genre|\n new_genre = Genre.find_or_create_by(name: genre)\n all_genres << new_genre\n end\n\n all_authors = []\n 10.times do |_index|\n new_author = Author.find_or_create_by(name: Faker::Book.unique.author)\n all_authors << new_author\n end\n\n all_books = []\n 100.times do |_index|\n book_name = Faker::Book.unique.title\n new_book = Book.find_or_create_by(\n title: book_name,\n author: all_authors.sample,\n genre: all_genres.sample,\n price: Faker::Number.decimal(l_digits: 2),\n description: Faker::GreekPhilosophers.quote,\n pages: Faker::Number.number(digits: 3),\n image: get_cover(book_name)\n )\n all_books << new_book\n end\nend", "def create_order_number\n alpha = %w[0 1 2 3 4 5 6 7 8 9 A B C D E F G H I J K L M N O P Q R S T U V W X Y Z]\n # try a short order number first\n # in case of collision, increase length of order number\n (4..10).each do |length|\n self.order_number = Time.now.strftime(\"%Y%m%d-\")\n length.times {self.order_number += alpha[rand 36]}\n existing_order = Order.find_by(order_number: order_number)\n return if existing_order.nil?\n end\n end", "def test_it_can_create_a_new_invoice_when_sent_create_with_params\n previous_invoice_count = @instance.all.count\n customer1 = @instance.engine.customer_repository.find_by_id(1)\n merchant1 = @instance.engine.merchant_repository.find_by_id(1)\n item1 = @instance.engine.item_repository.find_by_id(1)\n item2 = @instance.engine.item_repository.find_by_id(2)\n @instance.create(customer: customer1,\n merchant: merchant1,\n status: \"shipped\",\n items: [item1, item1, item2])\n assert_equal previous_invoice_count + 1, @instance.all.count\n end", "def sample_products( facturama )\n sample_products_list(facturama) # Listar todos los productos\n\n sample_products_create(facturama) # Agregar producto y eliminarlo\n end", "def generate_invoice!\n self.invoice ||=\n Invoice.create!( \n customer: self.customer,\n cost_total: self.cost\n )\n end", "def create_fake\n unless Rails.configuration.x.login.use_demo?\n raise ActionController::RoutingError.new('Not Found')\n end\n num_existing = @current_user.incidents.reject(&:deleted?).count\n if num_existing >= Incident::MAX_FAKE_INCIDENTS_TOTAL\n flash[:notice] = \"In this demo, you can only generate up to \" \\\n \"#{Incident::MAX_FAKE_INCIDENTS_TOTAL} incidents in total.\"\n return redirect_to :back\n end\n\n num_generated = [Incident::MAX_FAKE_INCIDENTS_TOTAL - num_existing, Incident::MAX_FAKE_INCIDENTS_PER_BATCH].min\n\n FactoryGirl.create_list(:incident, num_generated, user: @current_user,\n status: 'approved',\n ori: @current_user.ori)\n\n note_about_incident_count = begin\n if num_generated == Incident::MAX_FAKE_INCIDENTS_PER_BATCH\n \"giving you #{@current_user.incidents.reject(&:deleted?).count} total\"\n else\n \"in this demo, you can only generate up to #{Incident::MAX_FAKE_INCIDENTS_TOTAL} incidents in total\"\n end\n end\n\n flash[:notice] = \"You have generated #{num_generated} incidents with random data (#{note_about_incident_count}). \" \\\n \"Use the links on the left to view, submit, or analyze them.\"\n redirect_to :back\n end", "def generate_random\n Machine.generate_random params[:count].to_i, current_operator\n redirect_to \"/\", notice: \"#{params[:count].to_i} Vengo Machines have been installed!\"\n end", "def create\n @virtualtest = Virtualtest.new\n @virtualtest.duration = params[:virtualtest][:duration]\n @virtualtest.online = false\n\n nombre = 0\n loop do\n nombre = rand(100)\n break if Virtualtest.where(:number => nombre).count == 0\n end\n @virtualtest.number = nombre\n\n if @virtualtest.save\n flash[:success] = \"Test virtuel ajouté.\"\n redirect_to virtualtests_path\n else\n render 'new'\n end\n end", "def generate_questions difficulty, number_of_questions\n @questions.clear\n random_range = case difficulty\n when 1, 3 then 9\n else 99\n end\n if number_of_questions > 3\n number_of_questions = 3\n elsif number_of_questions < 1\n number_of_questions = 3\n end\n number_of_questions.times do\n @questions.push(Question.new((@number_generator.rand(random_range) + 1), generate_operator(difficulty), (@number_generator.rand(random_range) + 1)))\n end\n end", "def random_objects_with_max(max, model_type)\n number_of_objects = Random.rand(1..max)\n objects = []\n number_of_objects.times do |index|\n objects[index] = create(model_type)\n end\n objects\nend", "def price(date)\n rand(1..100)\n end", "def generate_questions\n Question.destroy_all\n\n puts 'Generating photo questions'\n MULTIPLIER.times do\n Question.make_photo_question\n end\n\n puts 'Generating type questions'\n MULTIPLIER.times do\n Question.make_type_question\n end\nend", "def new_users\n print \"\\nadding 5 new users: \"\n users = []\n 5.times do\n print '.'\n user = User.create!(\n email: Faker::Internet.unique.email,\n password: \"password\",\n first_name: Faker::Superhero.descriptor,\n last_name: Faker::Superhero.suffix\n )\n users << user\n end\n users\nend", "def create_additional_addresses(amount)\n amount.times do\n profile = UserProfile.all.sample\n Address.create fake_address(profile_id: profile.id)\n end\nend", "def generate_nonop_fields(request, max_funds)\n has_nonop = rand > 0.6\n return unless has_nonop\n request.nonop_funds = (max_funds * rand).round(2)\n request.nonop_source = Faker::Company.name\n end", "def build_random_question(params = {})\n # default values\n params[:previous_question] ||= nil\n params[:duration] ||= 600\n\n # build and return the question\n question = Question.generate_random(params.slice(:number_of_goods))\n question.user = self\n question.duration = params[:duration]\n question\n end", "def generate_results\n Result.destroy_all\n\n puts 'Generating results'\n\n (MULTIPLIER * 3).times do\n user_id = User.all.sample.id\n question_id = Question.all.sample.id\n result = ['true', 'false'].sample\n Result.create(user_id: user_id, question_id: question_id, result: result)\n end\nend", "def create\n @sale = Sale.new(sale_params)\n respond_to do |format|\n if @sale.save\n quantity = params[:quotes_quantity].gsub(/[^\\d^\\.]/, '').to_i\n\n for i in 1..quantity\n @quote = Quote.new\n @quote.amount = (params[:amount]).gsub(/[^\\d^\\.]/, '').to_f\n @quote.is_paid = false\n @quote.number = i\n @quote.total = quantity\n @quote.mounth = (@sale.date + i.month).month\n @quote.year = (@sale.date + i.month).year\n @quote.sale = @sale\n @quote.save\n end\n\n format.html { redirect_to @sale, notice: 'Sale was successfully created.' }\n format.json { render action: 'show', status: :created, location: @sale }\n else\n format.html { render action: 'new' }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def records( quantity = 1 )\n phone_numbers = []\n quantity.times do\n phone_numbers.push( self.record() )\n end\n phone_numbers\n end", "def random\n @shop = Shop.find(params[:shop_id])\n @random = @shop.items.all.sample\n end", "def new_order\r\n clear\r\n puts \"How many #{self.drink}s would you like to order?\"\r\n order_qty = gets.chomp.to_i\r\n self.add_drink(order_qty)\r\n clear\r\n puts \"You ordered #{self.qty} #{self.drink}(s)!\"\r\n puts\r\n end", "def temp_count\n @count = rand(0..10)\n end", "def create_10000_random_zone_records()\n for time in (1..100)\n random_login_internal\n for i in (1..100)\n @user = User.find_by_id( session[:user_id] )\n if @user == nil\n redirect_to( :controller => \"users\", :action => \"index\" )\n else\n if (@user.avg_soldiers_per_zone < 1)\n # UserZone.train_soldiers(@user.id, GameRules::TURNS_PER_TRAINING)\n else\n @result = ScalabilityTest.random_expand_or_attack(@user.id, :MODE_EXPAND_ATTACK)\n if @result != true\n flash[:notice] = @result\n end\n end\n end\n end\n end\n end", "def create_starting_items\n items.create name: \"Starter item\", attack: 5, defense: 5, life: 10, experience_bonus: 0\n end", "def create_card(character_id, quantity_released)\n available = true #default value\n quantity_released.to_i.times do |card_edition|\n user_id = current_user()[\"id\"]\n \n params = [character_id, card_edition + 1, available, user_id]\n sql_query = \"INSERT INTO cards(character_id, card_edition, available, owner_id) values($1, $2, $3, $4);\"\n run_sql(sql_query, params)\n\n # Add new card listing to the marketplace. Default listing by admin\n latest_card = get_latest_card()\n card_id = latest_card[\"id\"]\n price = latest_card[\"initial_price\"]\n\n create_card_listing(user_id, card_id, price)\n end\nend", "def new_account_number\n return rand(99999999)\n end", "def new_account_number\n return rand(99999999)\n end", "def create_samples(n)\n n.times do |i|\n Post.create(title: \"New Post #{i}\", body: \"Body of post #{i}\", created_at: Time.now)\n end\nend", "def signup(n=N)\n puts \"-- Signup #{n} Users\"\n n.times do |i|\n User.create(\"testuser#{i}\", \"password#{i}\")\n end\nend", "def c_users(first, last, isCustomer = false)\n un = \"#{first}#{last}\" # username\n un = un.delete(' ')\n user = User.create(first_name: first,\n last_name: last,\n user_name: un,\n img_path: \"profiles/#{un}.png\",\n email: Faker::Internet.email,\n role: isCustomer ? USER : TECHY,\n password: PW)\n puts \"#{isCustomer ? 'Customer' : 'Techy'}: #{un}\"\n\n # add one offer per techy\n unless isCustomer\n # generate 1 to 5 skills -> connected numbers\n skill_id = rand(0...Skill.count - 4)\n skills = Skill.all[skill_id..(skill_id + rand(0..4))]\n # randomize available_now -> only 1/3 are true\n now = (rand(1..3) % 2).zero?\n # generate rate\n rate = rand(25..150)\n # reviews\n puts \"\\n\"\n reviews = []\n rand(2..6).times do\n review = Review.create(\n title:REVIEW_TITLE.sample,\n content:REVIEW_CONTENT.sample,\n rating:rand(4..5)\n )\n reviews.push(review)\n end\n # create offer\n offer = Offer.create(title: c_title(skills.sample),\n description: Faker::Hacker.say_something_smart,\n user: user,\n skills: skills,\n available_now: now,\n hourly_rate: rate,\n reviews: reviews)\n puts \"-> added offer\"\n skills.each { |skill| puts \" #{skill.name}\" }\n end\nend", "def generate_order_number\n r = Random.new\n \"#{self.class.to_s.gsub(/[a-z]/, '')}#{Time.now.to_i}\"\n end", "def create_question_responses\n 10.times do\n response = Response.create(content: \"that sucks\", response_context_type: \"Question\", response_context_id: rand(1..12))\n User.find(rand(3)+1).responses << response\n end\nend", "def create_comments\n Author.all.each do |author|\n 2.times do\n Comment.create(body: Faker::Hipster.sentence(2), author_id: author.id, article_id: Article.pluck(:id).sample)\n end\n end\nend", "def createDeck\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(5, 5, 5, '5 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(2, 2, 2, '2 cost minion'))\n\t\tend\n\t\t10.times do |f|\n\t\t\t@deck.push(Card.new(1, 1, 1, '1 cost minion'))\n\t\tend\t\t\n\t\t@deck.shuffle!\t\n\tend", "def fill_database(db, number_of_people, number_of_villages)\r\n number_of_people.to_i.times do\r\n fill_nightswatch(db, Faker::GameOfThrones.character, Faker::GameOfThrones.house, Faker::Number.between(1, number_of_villages), Faker::Number.between(1, 5), Faker::Number.between(1, 60))\r\n end\r\n number_of_villages.times do\r\n fill_village_table(db, Faker::GameOfThrones.city)\r\n end\r\nend" ]
[ "0.70539945", "0.6952793", "0.6700388", "0.66585565", "0.6645221", "0.6553587", "0.6525742", "0.6455582", "0.64101386", "0.63748324", "0.6339594", "0.63063043", "0.6258709", "0.6230114", "0.61926", "0.61608404", "0.6147892", "0.61292994", "0.6126526", "0.61087227", "0.61087227", "0.60924464", "0.608959", "0.6084966", "0.60828656", "0.6074619", "0.6051887", "0.60437125", "0.60389537", "0.60382336", "0.60334224", "0.5993386", "0.59933394", "0.5985242", "0.5978041", "0.5968918", "0.5952949", "0.59309053", "0.59215045", "0.59161204", "0.59098333", "0.5879237", "0.5826323", "0.58107585", "0.5803962", "0.5798645", "0.57933486", "0.57928985", "0.5782711", "0.5776636", "0.57649404", "0.5761894", "0.57479906", "0.5719426", "0.571034", "0.5701019", "0.569796", "0.5697142", "0.5695713", "0.56924224", "0.5690423", "0.56785846", "0.5677672", "0.5670342", "0.5662306", "0.5660173", "0.5659948", "0.5656321", "0.5653101", "0.56431663", "0.5641263", "0.56401044", "0.5639161", "0.5638441", "0.56365603", "0.56258166", "0.5624562", "0.56195706", "0.5615073", "0.55999184", "0.5597103", "0.55930954", "0.5586913", "0.5585774", "0.55839694", "0.5579751", "0.5574408", "0.5569219", "0.5568855", "0.5566198", "0.5535391", "0.5535391", "0.55352104", "0.55346495", "0.55315024", "0.55295336", "0.5517398", "0.5482142", "0.54814744", "0.5477407" ]
0.6756391
2
We ask the user to tell us how many records they want with these methods
def ready_customer_records execute_customer_record_create(check_quantity) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record_count\n\t\t# TODO\n\tend", "def num_records\n num_urls + num_docs\n end", "def num_records\n num_urls + num_docs\n end", "def retrieved_records\n results.count\n end", "def records_per_page\n\t\t@params[:records_per_page] || 25\n\tend", "def total_records\n record.records.count\n end", "def length; @records.length; end", "def records_per_page\n params[:per_page] || 25\n end", "def records_per_page\n params[:per_page] || 20\n end", "def total_results\n numberOfRecords\n end", "def total_results\n numberOfRecords\n end", "def records_per_page\n params[:per_page] || 30\n end", "def count_records(records)\n records.count(:all)\n end", "def size\n @records.size\n end", "def count_records(params, columns)\n 0\n end", "def count_records(params, columns)\n 0\n end", "def check_records_limit\n if current_user.records_limit_reached?\n flash[:alert] = 'Sorry, you have reached the maximum number of records.'\n redirect_to records_path and return\n end\n end", "def count; end", "def count; end", "def count; end", "def count\n end", "def count\n end", "def count\n sql = order_by(nil).to_sql(pagination: false)\n\n @connection.ask(\"SELECT COUNT(*) FROM (#{sql}) _total_count\", *args)\n end", "def count\n load_page(1) if @num_records.nil? # load pagination metadata\n @num_records\n end", "def numberOfResults\n @@numberOfResults\n end", "def query_7\n document_ids = Perpetuity[Document].select {|document| document.id}.to_a\n return document_ids.size\nend", "def count_records(params)\n scope_data_class(params) do\n params[:scope] = config[:scope]\n data_adapter.count_records(params, final_columns)\n end\n end", "def records\n @process.instance_variable_get(:@values).count\n end", "def count_records(records)\n if (Rails::VERSION::MAJOR == 5 && ActiveRecord::VERSION::MINOR >= 1) || Rails::VERSION::MAJOR >= 6\n records.count(:all)\n else\n records.count\n end\n end", "def count\n @options[:select] = \"COUNT\"\n @options.delete(:attributes_to_get)\n\n response = run\n\n while continue?(response)\n @options[:exclusive_start_key] = response.last_evaluated_key\n response = run(response)\n end\n\n response.count\n end", "def get_field_count\n\t\tend", "def how_many\r\n # single standalone puts for a line break to create a less cluttered terminal\r\n puts\r\n # Requesting user input for how many of that specific drink type that they would like\r\n puts \"How many of that drink would you like?:\"\r\n no_of_drinks = gets.chomp\r\n # Ensuring any silly users trying to get a bit wild a correctly dealt with\r\n if no_of_drinks == \"Inventory.length\" or no_of_drinks.to_i >= 15\r\n puts `clear`\r\n puts \"Security guard, he's had too much, gettem outta here!\"\r\n puts\r\n puts \"<boots you out of the door>\"\r\n puts\r\n exit\r\n # Data validation to ensure the user can't break the program using a negative number. If the user does not enter a positive number, they enter the\r\n # until block until \r\n elsif no_of_drinks.to_i < 0\r\n until no_of_drinks.to_i > 0 \r\n puts\r\n puts \"Please give me a real number\"\r\n puts\r\n puts \"How many of that drink would you like?:\"\r\n end\r\n end\r\n # Return a variable for the number of drinks request. Didn't end up needing this variable. Just called how_many.to_i, which I think would function\r\n # without this explicit return.\r\n return no_of_drinks\r\n end", "def total_results\n records&.size || 0\n end", "def index\n @apply_record=ApplyRecord.find(params[:id])\n @art_works = @apply_record.art_works.order(:created_at=>:desc).page(params[:page])\n a=params[:page].to_i\n if a==0\n @count=0\n else\n @count=(a-1)*10\n end\n end", "def records_count\n @klass.all.size\n end", "def results_limit\n # max number of search results to display\n 10\n end", "def enforce_max_records_scan=(_arg0); end", "def max_results\n $testCaseID = \"VT229-0012\"\n con_remove\n createContact 20\n \n @count = Rho::RhoContact.find(:count,:max_results)\n puts @count\n Alert.show_status('Contacts',@count,'hide')\n redirect :action => :index\n end", "def count\n @params[:rettype] = 'count'\n self\n end", "def count_records **args\n logger.progname = 'RestOperations#CountRecords'\n query = OrientSupport::OrientQuery.new args\n \tquery.projection << 'COUNT (*)'\n \tresult = get_records raw: true, query: query\n begin\n result.first['COUNT']\n rescue\n return 0\n end\n end", "def query_for_data\n if self.record_klass < ActiveRecord::Base\n self.dataset = self.record_klass.find(:all, self.query)\n \n count_query = self.query.reject do |k, v| \n [:limit, :offset, :order].include?(k.to_sym )\n end\n self.resultcount = self.record_klass.count(:all, count_query)\n \n elsif self.record_klass < ActiveResource::Base\n self.dataset = self.record_klass.find(:all, :params => self.query)\n self.resultcount = self.dataset.delete_at(self.dataset.length - 1).total\n else\n raise \"Unable to query for data. Supported base classes are 'ActiveRecord::Base' and 'ActiveResource::Base' but '#{self.record_klass}' was given\"\n end\n \n self.resultcount = self.resultcount.length if self.resultcount.respond_to?(:length)\n end", "def field_count\n super\n end", "def query(recordings)\n @num += 1 if @num.zero?\n recordings.select! { |r| r[:user] == @user } unless @everyone\n limit = @all ? recordings.length : [@num, recordings.length].min\n recordings.reverse! unless @inorder\n recordings.take(limit)\n end", "def size\n\n fetch_all(:count => true)\n end", "def records_total\n records\n @config[:records_total]\n end", "def list_all(name, options)\n records = find(:all, :limit => options[:limit], :offset => options[:offset])\n if options[:skip_count]\n record_count = records.size\n else\n\t\t record_count = count\n\t end\n\t return records, record_count\n end", "def index\n @data_kejuaraans = DataKejuaraan.all\n # @row_number = ((params[:page] - 1) * per_page) + 1\n end", "def display_all_contacts(contacts)\n count = 0\n contacts.each do |contact|\n if count < 5\n count += 1\n puts \"#{contact.id}: #{contact.name} (#{contact.email}) (#{contact.phone_number})\"\n else\n puts \"Press Enter to continue.\"\n STDIN.gets\n # if user_input == \"\\n\"\n count = 1\n system \"clear\"\n puts \"#{contact.id}: #{contact.name} (#{contact.email}) (#{contact.phone_number})\"\n # end\n end\n end\n puts \"\"\n puts \"---------\"\n puts \"#{contacts.count} records total\"\n end", "def num_records\n @opened ? @num_records : nil\n end", "def test_records_numbers\n assert_not_equal [], @test_records\n assert_equal 15, @test_records.size\n end", "def count\n query.count\n end", "def count\n query.count\n end", "def index\n @total_count = Manage::Student.count()\n puts @total_count\n offset = params[:start]\n limit = params[:limit]\n query = '%' + params[:query].to_s + '%'\n @manage_students = Manage::Student.where(\"stuid like ? or name like ?\",query,query).limit(limit).offset(offset)\n end", "def show\n if is_admin_permission? session[:permission]\n index = Record.where('created_at >= ?', @record.created_at).count\n else\n index = Record.where('created_at >= ? and (user_id = ? OR (participant_id = ? AND participant_type = ?))', @record.created_at, session[:user_id], session[:user_id], User.name).count\n end\n @page = index_to_page(index)\n end", "def deleting_Records\n\t\tprint \"Do you want to delete all records or Particular Records \\n\"\n\t\tprint \"1. All Records \\n\"\n\t\tprint \"2. Particular Records \\n\"\n\t\tprint \"Enter your option: \\n\"\n\t\top1 = gets.chomp.to_i\n\t\t\tcase op1\n\t\t\t\twhen 1\n\t\t\t\t\tbegin\n\t\t\t\t\t\tcount = Products.delete_all()\n\t\t\t\t\t\tputs \"#{count} Records Deleted Succesfully ....\"\n\t\t\t\t\trescue\n\t\t\t\t\t\tputs \"Problem occur while deleting the records\"\n\t\t\t\t\tend\n\t\t\t\twhen 2\n\t\t\t\t\tbegin\n\t\t\t\t\t\tprint \"Enter Which record do you want to delete\"\n\t\t\t\t\t\tpar = gets.chomp.to_i\n\t\t\t\t\t\tcount = Products.delete(par)\n\t\t\t\t\t\tputs \"#{count} Record Deleted....\"\n\t\t\t\t\trescue\n\t\t\t\t\t\tputs \"Problem Occur while deleting record\"\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tputs \"Invalid Option\"\n\t\t\tend\n\tend", "def dashboard(user)\n @songs = Music.where(user_id: user.id).limit(4)\n @hasMoreMusic = has_more(@songs,'music')\n @movies = Movie.where(user_id: user.id).limit(4)\n @hasMoreMovies = has_more(@movies,'movies')\n @games = Game.where(user_id: user.id).limit(4)\n @hasMoreGames = has_more(@games,'games')\n @documents = Document.where(user_id: user.id).limit(4)\n @hasMoreDocuments = has_more(@documents,'documents')\n end", "def records_filtered_count\n (records.blank? ? 0 : records.first['filtered_count']) || records_total_count\n end", "def requested_records\n num = request_header.fetch(:replacements, {}).fetch(config.requested_records_parameter, nil)\n num.present? ? num.to_i : I18n.t(\"qa.linked_data.search.default_requested_records\")\n end", "def index\n params[:search]='' if params[:commit]=='Показать все'\n params[:search].strip! if params[:search]\n @questionnaires = Questionnaire.where('fio LIKE ? AND user LIKE ?', \"%#{params[:search]}%\", @current_user_email).order(:fio).paginate(:page => params[:page], :per_page => 15)\n @count = @questionnaires.count\n end", "def more_invoices\n # logic to see how many possbile pages there are...\n total_invoices = Invoice.find(:all).length\n logger.debug total_invoices\n pages_possible = total_invoices / 5.0\n dec = pages_possible.abs.modulo(1) \n if(dec > 0.0)\n pages_possible = pages_possible.to_i + 1\n end\n \n # if less than 5 invoices for x user do not try and load.\n if(total_invoices <= 5)\n render :text => \"Fail\"\n else\n @invoices = Invoice.page(params[:page]).per(5)\n current_page = params[:page].to_i\n total_page = @invoices.length\n if(current_page > pages_possible)\n render :text => \"Fail\"\n else\n render :layout => false \n end\n end\n \n end", "def record_count\n return nil unless @rows\n @rows.size - 1 # Don't include the header row\n end", "def view_record\n\tfound = false\n\tputs \"\\n\"\n\tprint \"First Name: \"\n\tfname = gets.chomp.upcase\n\tprint \"Last Name: \"\n\tlname = gets.chomp.upcase\n\t\n\t@personnel.each do |a|\n\t\tif a.fname == fname && a.lname == lname\n\t\t\tfound = true\n\t\tend\n\tend\n\n\tif found == true\n\t\taccount_view(fname,lname)\n\telsif @count < 3 \n\t\t@count += 1\n\t\tputs \"Account not found. Please try again.\"\n\t\taccount_menu\n\telse\n\t\tputs \"Too many login attempts. Please contact customer service.\"\n\t\tmain_menu\n\tend\nend", "def limit; end", "def limit; end", "def limit; end", "def records_total_count\n fetch_records.unscope(:group, :select).count(:all)\n end", "def records( quantity = 1 )\n persons = []\n quantity.times do\n persons.push( self.record() )\n end\n persons\n end", "def read_record(*args)\r\n\t\t\tnum,in_length=args\r\n\t\t\tif num.nil?\r\n\t\t\t\traise \"Number of the record must be defined when reading it\\n\"\r\n\t\t\tend\r\n\t\t\tif self.last_record>0 and num>self.last_record\r\n\t\t\t\tputs \"Can't read record #{num}, there is not so many of them\\n\"\r\n\t\t\tend\r\n\t\t\tif in_length.nil?\r\n\t\t\t\tin_length=@record_len\r\n\t\t\tend\r\n\t\t\tif in_length<0\r\n\t\t\t\tin_length=-@record_len\r\n\t\t\tend\r\n\t\t\toffset=self.get_record_offset(num)\r\n\t\t\treturn if offset.nil?\r\n\t\t\tself.read_from(offset,in_length)\r\n\t\tend", "def how_many(klass)\n JSON.parse(@client.raw_read(resource: klass, summary: \"count\").response[:body])[\"total\"].to_i\n end", "def number_of_senator\n\ta = Legislator.where(\"title=?\",\"Sen\")\n\tputs \"Senators:\" +\"#{a.count}\"\nend", "def count\n @rows.count\n end", "def enforce_max_records_scan; end", "def records( quantity = 1 )\r\n selected_values = []\r\n quantity.times do\r\n selected_values.push( record )\r\n end\r\n selected_values\r\n end", "def index\n @qbo = Qbo.first\n @customer_count = Customer.count\n @qbo_item_count = QboItem.count\n @qbo_employee_count = QboEmployee.count\n @qbo_invoice_count = QboInvoice.count\n @qbo_estimate_count = QboEstimate.count\n end", "def per_page; end", "def count\n @documents.count\n end", "def validate_records\n have_enough_items_to_trade?\n end", "def request_count; end", "def index\n @records = Record.all.order('count desc').take(100)\n end", "def count\n @count\n end", "def count\n @count\n end", "def count\n @count\n end", "def count(options)\n raise \"Not implemented\"\n end", "def recommendations_menu\n if @user.mylist.length.positive?\n recommendation = Rec.new(@user)\n recommendation.amount_of_suggestions\n else\n no_items\n end\n end", "def upload_records(&block)\n count = input.upload_records(&block)\n self.record_count = (record_count || 0) + count\n count\n end", "def count\n # implement in subclasses\n end", "def count ; @count ||= table.count end", "def records\n fail 'Not yet implemented'\n end", "def nitems() end", "def show\n @id = params[:id].to_i\n @max_id = Phone.count\n end", "def num_of_customers()\n customers.size\nend", "def create\n num = params['number-of-records'].to_i\n if (!num.is_a? Numeric) || (num < 1)\n @errors = { number_of_records: \"Not a valid number\" }\n render :new and return\n end\n\n queue_creation(num)\n flash[:notice] = 'success'\n render :new\n end", "def numrows\n cache_get(:_numrows) || @opts[:numrows]\n end", "def count\n collection.count\n end", "def returned_sheets\n return 0 if course.profs.empty? || form.get_tutor_question.nil?\n tutor_db_column = form.get_tutor_question.db_column.to_sym\n RT.count(form.db_table, {:barcode => course.barcodes, \\\n tutor_db_column => tutnum})\n end", "def count\n @all.size\n end", "def count\n @count\n end", "def count\n self.all.count\n end", "def records( quantity = 1 )\n phone_numbers = []\n quantity.times do\n phone_numbers.push( self.record() )\n end\n phone_numbers\n end", "def submitted\n records.where(received: true).count\n end", "def user_count; end" ]
[ "0.68464315", "0.63600236", "0.63600236", "0.63318706", "0.632335", "0.63220537", "0.6243119", "0.6214137", "0.62105274", "0.6207605", "0.6207605", "0.61525023", "0.6150881", "0.6007105", "0.5986569", "0.5986569", "0.5946007", "0.59169185", "0.59169185", "0.59169185", "0.59125805", "0.59125805", "0.5858348", "0.58294225", "0.5796568", "0.57800686", "0.57665116", "0.5758685", "0.57348764", "0.5712607", "0.5701061", "0.5695286", "0.5692811", "0.5686051", "0.5676232", "0.5675823", "0.56720245", "0.5656274", "0.5635041", "0.56275904", "0.5621421", "0.56092876", "0.5607455", "0.55994743", "0.5588322", "0.558832", "0.5581839", "0.5581296", "0.5577879", "0.5565581", "0.5563141", "0.5563141", "0.5553628", "0.55484974", "0.55245847", "0.5523273", "0.5520328", "0.55183154", "0.55160046", "0.54999185", "0.5493306", "0.5492424", "0.54870677", "0.54870677", "0.54870677", "0.54848766", "0.5478256", "0.54768324", "0.5475984", "0.54744685", "0.5463351", "0.54463613", "0.54424953", "0.5442234", "0.5440756", "0.5435746", "0.5431966", "0.5431849", "0.54157376", "0.54106635", "0.54106635", "0.54106635", "0.54094595", "0.5394308", "0.53796947", "0.53732526", "0.53710335", "0.5370217", "0.5368572", "0.53662664", "0.53618956", "0.535715", "0.53451943", "0.5341721", "0.53406036", "0.5339434", "0.5336476", "0.5328048", "0.531643", "0.5315989", "0.5315504" ]
0.0
-1
Execute record creation based in quantity input
def execute_customer_record_create(qty) puts "Starting to create Customer records... Please give the API time to respond...\n" qty.times do |t| body = FakeCustomer.new.generate # puts JSON.pretty_generate(JSON.parse(body.to_json)) FakeRestActions.new(endpoint: "Customers", body: body, access_token: @access_token).post_request end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(_obj, args, _ctx)\n create_table = Table.new(\n name: args[:name],\n quantity: args[:quantity],\n )\n return create_table if create_table.save\n GraphQL::ExecutionError.new(\"invalid data\")\n end", "def add_units(qty)\n qty.to_i.times do\n #create item\n item = supply_items.new\n item.status = SupplyItem::STATUS_AVAILABLE\n item.save\n end\n end", "def create\n num = params['number-of-records'].to_i\n if (!num.is_a? Numeric) || (num < 1)\n @errors = { number_of_records: \"Not a valid number\" }\n render :new and return\n end\n\n queue_creation(num)\n flash[:notice] = 'success'\n render :new\n end", "def ready_customer_records\n execute_customer_record_create(check_quantity)\n end", "def create(name, price, description, quantity)\n @products.exec(\"INSERT INTO acme_shop (name, price, description, quantity) VALUES ('#{name}','#{price}','#{description}','#{quantity}');\")\n print \"You created #{name} (#{id}), #{description}, that costs $#{price}\"\nend", "def create_card(character_id, quantity_released)\n available = true #default value\n quantity_released.to_i.times do |card_edition|\n user_id = current_user()[\"id\"]\n \n params = [character_id, card_edition + 1, available, user_id]\n sql_query = \"INSERT INTO cards(character_id, card_edition, available, owner_id) values($1, $2, $3, $4);\"\n run_sql(sql_query, params)\n\n # Add new card listing to the marketplace. Default listing by admin\n latest_card = get_latest_card()\n card_id = latest_card[\"id\"]\n price = latest_card[\"initial_price\"]\n\n create_card_listing(user_id, card_id, price)\n end\nend", "def create\n load_object\n variant = Variant.find(params[:purchase_line_item][:variant_id])\n\n before :create\n\n @purchase_order.add_variant(variant, params[:purchase_line_item][:qty].to_i)\n\n if @purchase_order.save\n after :create\n set_flash :create\n response_for :create\n else\n after :create_fails\n set_flash :create_fails\n response_for :create_fails\n end\n\n end", "def create\n load_object\n variant = Variant.find(params[:line_item][:variant_id])\n\n before :create\n\n @order.add_variant(variant, params[:line_item][:quantity].to_i)\n\n if @order.save\n after :create\n set_flash :create\n response_for :create\n else\n after :create_fails\n set_flash :create_fails\n response_for :create_fails\n end\n\n end", "def create \n params[:record][:invoice_id] = params[:invoice_id]\n invoice = Invoice.find(params[:invoice_id])\n record = InvoiceLineItem.where(invoice: invoice).find_or_create_by(sku: params[:record][:sku_id]) \n record.quantity = params[:record][:quantity]\n\n\n respond_to do |format|\n if record.save\n format.html \n format.json { render json: record }\n else\n format.html { render action: \"new\" }\n format.json { render json: {alert: 'failed'} }\n end\n end\n end", "def new_quantity args={}\n SY::Quantity.new args.merge( composition: self )\n end", "def execute_convert_stock_one_on_one( employee, quantity) \n source = self.one_to_one_source \n source_item = source.item \n \n new_convert_stock = ConvertStock.new \n new_convert_stock.source_quantity = quantity \n new_convert_stock.creator_id = employee.id \n new_convert_stock.stock_conversion_id = self.id \n today_datetime = DateTime.now \n new_convert_stock.year = today_datetime.year \n new_convert_stock.month = today_datetime.year \n \n \n \n if not quantity.present? or quantity <= 0 or quantity > source_item.ready # if it is not one to one -> quantity*source.quantity > source_item.ready \n new_convert_stock.errors.add(:source_quantity , \n \"Jumlah Konversi harus setidaknya 1, dan tidak boleh lebih dari #{source_item.ready}\" ) \n return new_convert_stock \n end\n \n new_convert_stock.save \n \n # create stock entry\n new_convert_stock.execute_conversion_one_on_one(employee) \n # create stock mutation \n end", "def create\n get_data\n @sale_detail = @sale.details.create(params[:sale_detail])\n @sale_detail.quantity = 1 if @sale_detail.quantity.to_i==0\n get_data\n end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "def create_new_acquisition(data_set)\n enter_acquisition_info_data data_set\n save_record\n end", "def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params.dig(:description)\n )\n end", "def create\n old_batch = Batch.where(:batch_number => batch_params[:batch_number] , :brand_id => batch_params[:brand_id]).first\n #if batch number exists, just update store and qty\n if old_batch\n @batch = old_batch\n @batch.qty = batch_params[:qty]\n @batch.recipient_store = batch_params[:recipient_store]\n @batch.add_loose_units\n else\n @batch = Batch.new(batch_params)\n end\n\n #begin\n if @batch.save\n i = Inventory.where(:brand_id => @batch.brand_id, :store_id => @batch.recipient_store).first\n @batch.loose_units||= 0\n if i.blank?\n #create inventory.\n i = Inventory.create(:brand => @batch.brand, :store_id => @batch.recipient_store, :pharm_item => @batch.brand.pharm_item)\n end\n\n i.update(:qty_last_added => (@batch.qty.to_f * @batch.brand.pack_size.to_f) + @batch.loose_units.to_i, :rate_per_unit => \"%.2f\" % (@batch.rate / @batch.brand.pack_size.to_f))\n ibatches = i.inventory_batches.where(:batch => @batch)\n if ibatches.blank?\n InventoryBatch.create(:inventory => i, :batch => @batch, :units => (@batch.qty.to_i * @batch.brand.pack_size.to_i) + @batch.loose_units.to_i)\n else\n ibatches.first.update(:units => (ibatches.first.units) + (@batch.qty.to_i* @batch.brand.pack_size.to_i) + @batch.loose_units.to_i )\n end\n\n\n redirect_to ramp_up_batches_path, :notice => \"Batch created successfully\"\n else\n redirect_to ramp_up_batches_path, :notice => \"Batch creation failed\"\n end\n #rescue => e\n # redirect_to ramp_up_batches_path, :notice => \"Batch creation failed. #{e.message}\"\n #end\n end", "def create(product, price, description, quantity)\n\t@conn.exec(\"INSERT INTO amazone (product, price, description, quantity) VALUES ('#{product}', '#{price}', '#{description}', '#{quantity}');\")\n\tputs \"I added your product to the table.\"\nend", "def to_quantity args={}\n # All the work is delegated to the quantity table:\n QUANTITY_TABLE[ args.merge( self ) ]\n end", "def create\n @quantity = Quantity.new(params[:quantity])\n\n respond_to do |format|\n if @quantity.save\n format.html { redirect_to @quantity, notice: 'Quantity was successfully created.' }\n format.json { render json: @quantity, status: :created, location: @quantity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @quantity.errors, status: :unprocessable_entity }\n end\n end\n end", "def prorate_create_item(t, tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n if t == 'P'\n create_pre_invoice_item(tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n else\n create_invoice_item(tariff, invoice_id, subcode, price, quantity, measure, tax_type_id, discount_pct, user_id, d)\n end\n end", "def product_details(choice)\n\t#fetch record from products for select user product\n\t\tstatement1=@connection.prepare(\"select * from products where p_id=?\")\n\t\tstatement1.execute(choice)\n\t\trecordset1=statement1.fetch\n\n\t\tloop do\n\t\t\tprint \"\\n\\n\\t\\tEnter quantity: \"\n\t#get quantity from user\n\t\t\t@quantity=gets.to_i\n\t#check quantity condition\n\t\tbreak if @quantity>0 and @quantity<recordset1[2]+1\n\t\t\tputs \"\\n\\n\\t\\tInvalid Quantity!!!...Enter Correct\"\n\t\tend\n\n\t\trows=[]\n\n\t\ttable=Terminal::Table.new\n\t\ttable.headings=[\"Name\",\"Price\",\"Available Stock\",\"Quantity\"]\n\n\t\trows<<[recordset1[1],recordset1[3],recordset1[2],@quantity]\n\n\t\ttable.rows=rows\n\n\t\tputs \"\\n#{table}\"\n\t#insert values into inline product that user selected product\n\t\tstatement3=@connection.prepare(\"insert into inline_products values(?,?,?)\")\n\t\tstatement3.execute(@card_no,choice,@quantity)\n\t\t@connection.commit\n\t#call purchase_more_item method\n\t\tpurchase_more_item\n\tend", "def create\n ordered_item_from_table = OrderedItem.new(passed_parameters_from_items_index)\n order = Order.where(id: ordered_item_from_table.order_id, confirmed: false, user_id: current_user.id).last\n ordered_item_from_db = OrderedItem.where(order_id: order.id, item_id: ordered_item_from_table.item_id).last\n \n if ordered_item_from_db.present?\n item = Item.where(id: ordered_item_from_db.item_id).last\n if item.quantity > 0\n if ordered_item_from_db.update(quantity: ordered_item_from_db.quantity + 1) && item.update(quantity: item.quantity - 1)\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n else \n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n @ordered_item = OrderedItem.new(passed_parameters_from_items_index)\n @item = Item.find(@ordered_item.item_id)\n\n if @item.quantity > 0\n @item.quantity -= @ordered_item.quantity\n @item.update(quantity: @item.quantity )\n if @ordered_item.save\n redirect_to items_path\n flash[:notice] = \"Item has been added to your order.\"\n else\n redirect_to items_path\n flash[:alert] = \"Item can not be added to your order.\"\n end\n \n\n else\n flash[:alert] = \"Something went wrong! Item was not added to the cart\"\n redirect_to items_path\n end\n\n end\n end", "def add_produce (db, name, serving_size, calories, protein, carbs, fat)\n db.execute(\"INSERT INTO produce (name, serving_size, calories, protein, carbs, fat) VALUES (?, ?, ?, ?, ?, ?)\", [name, serving_size, calories, protein, carbs, fat])\nend", "def insertOperation\n\t\tputs \"Enter Product Id\"\n\t\tproid = gets.chomp.to_i\n\t\tputs \"Enter Product Name\"\n\t\tproname = gets.chomp\n\t\tproname = \"'\"+proname+\"'\"\n\t\tputs \"Enter Product Quantity\"\n\t\tproqty = gets.chomp.to_i\n\t\tputs \"Enter Product Cost\"\n\t\tprocost = gets.chomp.to_i\t\n\t\t\t\n\t\tbegin\n\t\t\tresult = @statement.executeUpdate(\"insert into products values(#{proid},#{proname},#{proqty},#{procost})\")\n\t\t\tif result\n\t\t\t\tputs \"Record Inserted Successfully...........\"\n\t\t\telse\n\t\t\t\tputs \"Error Occur while inserting Record\"\n\t\t\tend\n\t\t\t\t#Closing the Connections\n\t\t\t@connection.close\n\t\t\t@statement.close\n\t\trescue Exception => e\n\t\t\tputs e.message\n\t\tend\n\tend", "def create_product(attr_hash)\n product_already_exists = Product.find_by_name(attr_hash['name'])\n if product_already_exists\n @skipped_records += 1\n else\n new_product = Product.new(attr_hash)\n @failed_queries += 1 if not new_product.save\n end\n end", "def create\n # Find the item in the user's cart, if the user does not already\n # have the item in their cart, create a new line_item\n current_item = LineItem.find_or_create_by product_size_id: params[:product_size_id], cart_id: @cart.id\n\n # Increment the item's quantity by one\n requested_qty = current_item.quantity + 1\n\n # Invoke method in line_item.rb that checks the\n # requested qty against current stock levels\n update_qty = current_item.get_update_qty requested_qty\n\n # If the user's requested quantity can not be fulfilled, set a flash error\n unless update_qty == requested_qty\n flash[:item_error] = \"Sorry, not enough stock. Your shopping basket has been adjusted accordingly.\"\n end\n\n # Save the line_item update\n current_item.update quantity: update_qty\n\n # Redirect to My Basket page\n redirect_to cart_path\n end", "def create_new_item(name, price)\n client = create_db_client\n client.query(\"insert into items (name, price) values ('#{name}', '#{price}')\")\nend", "def create_item_pack_product_code\n puts \"IN RETAIL CREATE IPC\"\n cosmetic_code = \"\"\n if self.label_code == \"U\" \n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"UL\"\n else\n cosmetic_code = \"WX\"\n end\n else\n if self.carton_setup.treatment_code == \"U\"\n cosmetic_code = \"LB\"\n else\n cosmetic_code = \"LW\"\n end\n \n end\n \n \n class_code = self.carton_setup.product_class_code\n puts \"prod sched: \" + self.production_schedule_code\n commodity = RmtSetup.find_by_production_schedule_name(self.production_schedule_code).commodity_code\n grade_code = self.carton_setup.grade_code\n \n std_count = StandardSizeCount.find_by_standard_size_count_value_and_commodity_code_and_basic_pack_code(self.carton_setup.standard_size_count_value,commodity,self.basic_pack_code)\n \n if !std_count\n err = \"An IPC could not be found or created, because no standard_size_count record exists for the following field values: <br>\"\n err += \"standard_size_count_value: \" + self.carton_setup.standard_size_count_value.to_s + \"<br>\"\n err += \"commodity: \" + commodity + \"<br>\"\n err += \"basic_pack_code: \" + self.basic_pack_code\n raise err\n \n end\n actual_count = std_count.actual_count\n \n variety = self.carton_setup.marketing_variety_code\n \n item_pack = ItemPackProduct.find_by_product_class_code_and_commodity_code_and_grade_code_and_actual_count_and_marketing_variety_code_and_cosmetic_code_name_and_size_ref_and_basic_pack_code(class_code,commodity,grade_code,actual_count,variety,cosmetic_code,self.size_ref,self.basic_pack_code)\n \n if ! item_pack\n \n item_pack = ItemPackProduct.new\n item_pack.product_class_code = class_code\n item_pack.commodity_code = commodity\n item_pack.commodity_group_code = std_count.commodity.commodity_group_code\n item_pack.cosmetic_code_name = cosmetic_code\n item_pack.grade_code = grade_code\n item_pack.basic_pack_code = self.basic_pack_code\n \n item_pack.treatment_code = self.carton_setup.treatment_code\n item_pack.treatment = Treatment.find_by_treatment_code_and_treatment_type_code(item_pack.treatment_code,\"PACKHOUSE\")\n item_pack.grade = Grade.find_by_grade_code(grade_code)\n item_pack.standard_size_count = std_count\n item_pack.standard_size_count_value = std_count.standard_size_count_value\n item_pack.marketing_variety_code = variety\n item_pack.actual_count = actual_count\n item_pack.size_ref = self.size_ref\n puts item_pack.size_ref\n item_pack.create\n \n \n end\n \n \n if ! self.new_record?\n old_ri = RetailItemSetup.find(self.id)\n old_ipc = old_ri.item_pack_product_code \n old_mark = old_ri.mark_code\n end\n \n self.item_pack_product = item_pack\n \n \n self.item_pack_product_code = item_pack.item_pack_product_code\n \n if ! self.new_record? && self.carton_setup.fg_setup\n \n if old_ipc != self.item_pack_product_code||old_mark != self.mark_code\n @update_fg = true\n end\n end\n \n end", "def create\n @batch = Batch.new\n @batch.item = Item.find(params[:item_id])\n @batch.company = current_user.company if current_user.company?\n @batch.count = params[:amount].to_i\n @batch.count *= 1000 if @batch.item.have_weight\n @batch.price = params[:price].to_i\n @batch.supplier_price = params[:supplier_price].to_i\n @batch.barcode = Barcode.find_by_code params[:barcode]\n @batch.user = current_user\n respond_to do |format|\n if @batch.save\n format.json { render json: nil, status: :created }\n else\n format.json { render json: @batch.errors, status: :unprocessable_entity }\n end\n end\n end", "def execute\n guest.cart.order_items.create product: product\n end", "def add_quantity(quantity, variant, sub_location, row_hash)\n # if only one sub location listed\n if sub_location.split(\",\").length > 1\n @errors << { :part_number => row_hash[:name], :condition => row_hash[:condition], :message => \"Cannot add initial quantity for part with multiple sub locations (#{sub_location})\" }\n # otherwise if there is a sub_location stock item\n elsif stock_item = variant.sub_location(sub_location)\n #if !(stock_item = @new_product_condition.where(\"sub_location=?\", sub_location)).empty\n stock_item.adjust_count_on_hand(quantity)\n else\n @errors << { :part_number => row_hash[:name], :condition => row_hash[:condition], :message => \"Cannot find stock item for \" + sub_location }\n end\n\n end", "def create\n product_exists = false\n product_id = params[:sale_details][:product_id].to_i\n @sale.sale_details.each do |detail|\n if detail.product_id == product_id\n product_exists = true\n @sale_detail = detail\n @save_sale_detail = detail.id\n break\n end\n end\n if product_exists\n @sale_detail.qty += params[:sale_details][:qty].to_i\n @sale_detail.price = params[:sale_details][:price].to_f\n @sale_detail.save!\n else\n sale_detail = SaleDetail.new(sale_detail_params)\n if @sale.sale_details.last.nil?\n sale_detail.number = 1\n else\n sale_detail.number = @sale.sale_detils.last.number + 1\n end\n @sale.sale_details << sale_detail\n end\n @sale.save!\n end", "def create\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @item = Item.find_by_id params[:item_id]\n @quantity = params[:sales_entry][:quantity].to_i\n @selling_price_per_piece = BigDecimal( params[:sales_entry][:selling_price_per_piece] )\n \n @has_past_item = @sales_order.has_sales_entry_for_item?(@item) \n \n \n @sales_entry = @sales_order.add_sales_entry_item( @item, \n @quantity, \n @selling_price_per_piece )\n \n @has_no_errors = @sales_entry.errors.messages.length == 0 \n end", "def insert_param_based_on_quantity(param_name)\n insert_param_method_generic(param_name,\"quantity\")\n end", "def increment_quantity\n self.quantity_needed += self.quantity\n save\n end", "def manufacture\n if required_param_types_present?\n generate_new_item_object\n else\n raise RuntimeError.new(\"One or more required objects is missing.\")\n end\n end", "def carton_new(entry)\n log_msg \"in new\"\n record_map = eval entry.record\n create_carton_util(record_map)\n \n end", "def carton_new(entry)\n #log_msg\"in new\"\n record_map = eval entry.record\n create_carton_util(record_map)\n\n end", "def recreate_tray_plans(batch_id, phase_info, quantity, tray)\n # p \"Quantity: #{quantity}\"\n loop do\n plan_capacity = if quantity >= tray.tray_capacity\n tray.tray_capacity\n else\n quantity\n end\n new_tray_plan = build_tray_plan(batch_id,\n phase_info,\n tray,\n plan_capacity)\n # p \"TrayPlan # capacity : #{plan_capacity}\"\n Cultivation::TrayPlan.create(new_tray_plan)\n quantity -= plan_capacity\n break if quantity <= 0\n end\n end", "def create \n @product = Product.find_by_title(params[:product]) \n @line_item = LineItem.new(params[:line_item])\n @line_item.product_id = @product.id\n @line_items= LineItem.where(:demand_id => @line_item.demand_id, :product_id => @line_item.product_id)\n \n @quantity = @line_item.quantity\n \n if @line_items != nil\n @line_items.each do |item|\n @quantity += item.quantity\n LineItem.find(item.id).destroy\n end\n @line_item.update_attributes(:quantity => @quantity)\n end\n \n respond_to do |format|\n if @line_item.save\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def execute\n return false unless super\n ActiveRecord::Base.transaction do\n # Location Create\n location_params = @recipient_location.merge({name: @parcel_details[:recipient_name] })\n recipient_loc = create_parcel_destination_location(location_params)\n\n # Parcel Create\n parcel_params = @parcel_details.merge({destination_location_id: recipient_loc.id })\n parcel_object = create_parcel(parcel_params) if valid?\n if valid?\n # Mission Create\n mission_params = {\n drone_id: @drone.id,\n warehouse_id: @warehouse.id,\n parcel_id: parcel_object.id\n }\n @result = create_mission(mission_params)\n end\n raise ActiveRecord::Rollback unless valid?\n end\n valid?\n end", "def increment_quantity\n self.quantity += 1\n save\n end", "def updating_Records\n\t\tprint \"Enter Product Number to Update Quantities \\n\"\n\t\tpno = gets.chomp.to_i\n\t\tprint \"Enter Quantities to Update: \\n\"\n\t\tpqty = gets.chomp.to_i\n\t\t\tbegin\n\t\t\t\tProducts.update(pno,\"pro_quantity\"=>pqty)\n\t\t\t\tputs \"Records Updated\"\n\t\t\trescue\n\t\t\t\tputs \"Problem Occur while Updating the table\"\n\t\t\tend\n\tend", "def propose_item_with_quantity(name, price, quantity, selling_mode, increment, end_time, description = \"\", log = true)\r\n item = self.propose_item(name,price,selling_mode,increment,end_time, quantity, description,log)\r\n item\r\n end", "def businesslogic\n\n begin \n #getting user choice according to product id\n print \"\\n Enter your Product Id to purchase:\"\n ch=gets\n \n if (ch=~ /^[0-9]+$/) #check regular expression for correct rating\n \n choice=ch.to_i\n res50=@con.prepare(\"select * from product_storage where pid=?\")\n res50.execute(choice)\n if (data=res50.fetch).nil? #validation for\n\n puts\"Enter valid product id......\"\n else\n break #break loop if user enter corrcect rating\n end \n else \n\n puts\"Enter only no......\"\n end\n\n end while(ch!=~ /^[0-9]+$/) #@continue until user not enter correct choice \n \n \n name1=@con.prepare(\"select pname from product_storage where pid=?\")\n name1.execute(choice)\n\n data=name1.fetch\n nm=data[0]\n \n \n puts\"\\n You have selected #{nm}\"\n print\"\\n Enter How many #{nm} do u want:\"\n no=gets.to_i\n #getting quqntity and prize of product \n res5=@con.prepare(\"select quantity,prize from product_storage where pid=?\")\n res5.execute(choice)\n row3=res5.fetch\n avilable=row3[0].to_i\n prize=row3[1].to_i\n\n #check for avilable stock in store\n if(no<=avilable)\n\n #insert user selected item into inline_item \n res6=@con.prepare(\"insert into inline_item values(?,?,?)\")\n res6.execute(@cart_no,choice,no)\n tot=prize*no\n\n #create unique bill no each time and store in to bill table\n\n order # call order method to genrate bill no\n \n puts\"\\n #{tot} amount added on your cart..........\"\n puts\"\\n your order no is...............:#{@bill_no}\"\n\n #insert bill no cart no total bill into bill table \n res7=@con.prepare(\"insert into bill values(?,?,?)\")\n res7.execute(@bill_no,@cart_no,tot)\n\n #calculate remaining product quantity\n totquqntity=avilable-no\n grandtot=totquqntity.to_i\n\n #update quqntity in product table \n res8=@con.prepare(\"update product_storage set quantity=(?) where pid=(?)\")\n res8.execute(grandtot,choice)\n #call to bill method\n bill\n \n else\n\n puts\"\\n Sorry !!!#{no} are not avilable we have only #{avilable} \"\n end\n end", "def generate_sales_entry_add_product_form\n @item= Item.find_by_id params[:selected_item_id]\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @new_object = SalesEntry.new \n end", "def run\r\n ridFieldName = @qbc.lookupFieldNameFromID( \"3\")\r\n records = Records.new\r\n @qbc.iterateRecords(@dbid,@qbc.getFieldNames(@dbid),nil,@id,nil,qyclst()){|qb_record|\r\n record = Record.new\r\n record.build(@qbc,ridFieldName, qb_record)\r\n records << record\r\n }\r\n records\r\n end", "def create\n code = order_params[:order_code].to_i\n shirt_type = @order_codes[code][:type]\n letter = @order_codes[code][:letter]\n count = @order_codes[code][:count]\n size = order_params[:shirt_size]\n if order_params[:letter_3] != 'none'\n letter_3 = order_params[:letter_3]\n else\n letter_3 = nil\n end\n number = OrderNumber.create!(id: order_params[:order_number])\n @order = Order.new(letter_1: order_params[:letter_1], \n letter_2: order_params[:letter_2], \n letter_3: letter_3, \n shirt_type: shirt_type, \n shirt_size: order_params[:shirt_size], \n shirt_color: order_params[:shirt_color], \n top_color: order_params[:top_color], \n bottom_color: order_params[:bottom_color], \n user_id: current_user.id,\n order_number: number)\n\n order_params[:quantity].to_i.times do |order| \n letter_1 = Letter.where(position: 'top', name: order_params[:letter_1], color: order_params[:top_color]).first.remove_one\n letter_2 = Letter.where(position: 'top', name: order_params[:letter_2], color: order_params[:top_color]).first.remove_one\n letter_4 = Letter.where(position: 'bottom', name: order_params[:letter_1], color: order_params[:bottom_color]).first.remove_one\n letter_5 = Letter.where(position: 'bottom', name: order_params[:letter_2], color: order_params[:bottom_color]).first.remove_one\n unless order_params[:letter_3] == 'none'\n letter_3 = Letter.where(position: 'top', name: order_params[:letter_3], color: order_params[:top_color]).first.remove_one\n letter_6 = Letter.where(position: 'bottom', name: order_params[:letter_3], color: order_params[:bottom_color]).first.remove_one\n end\n end\n order_params[:quantity].to_i.times do |x|\n if Item.where(item_type: shirt_type, color: order_params[:shirt_color], size: size).count > 0\n item = Item.where(item_type: shirt_type, color: order_params[:shirt_color], size: size).first\n @cost = item.cost\n item.status = 'sold'\n item.save\n else\n new_item = Item.create(item_type: shirt_type, color: order_params[:shirt_color], size: size, user_id: current_user.id, cost: 3.88)\n new_item.status = 'sold'\n @cost = item.cost\n new_item.save\n end\n end\n cost_breakdown = @order.order_breakdown(shirt_type, letter, order_params[:order_total], count, order_params[:quantity], @cost)\n current_user.account.update(\n mom_pay: current_user.account.mom_pay += cost_breakdown[:mom_pay],\n tanya_pay: current_user.account.tanya_pay += cost_breakdown[:tanya_pay],\n shop_money: current_user.account.shop_money += (cost_breakdown[:shop_money] + (order_params[:paid_shipping].to_f - order_params[:shipping_spent].to_f)),\n inventory_money: current_user.account.inventory_money += cost_breakdown[:inventory_money],\n etsy_bill: current_user.account.etsy_bill += (cost_breakdown[:etsy_bill] + order_params[:shipping_spent].to_f)\n )\n \n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Order was successfully created.' }\n format.json { render :show, status: :created, location: @order }\n else\n format.html { render :new }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item(title, price, quantity=1)\n self.total += price * quantity #Think about this logically\n #you go into a store and buy and item. How do you get the total of the item.\n #you MULTIPLY BY THE PRICE!!!! DURRRRR!!! GOD MORTY YOUR SO DUMB\n @price = price\n #do this x amount of times.\n quantity.times do\n @items << title\n end\n\n end", "def run\n create_coins_from_attributes\n end", "def add_item(title, price, quantity=1)\n self.total += price * quantity\n #quantity amount of times it'll add the title to the items array\n quantity.times {items << title}\n self.last_transaction = price * quantity\n end", "def create_line_item_for_per_person_charge qty, vendor_id, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n new_line_items = create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\")\n line_items.push(new_line_items)\n new_line_items\n end", "def add_item(title, price, quantity=1) \n self.total += price * quantity\n quantity.times do\n items << title \n end\n self.last_transaction = price * quantity\n\n end", "def new_order(items, quantities, tweet_id, campaign_id)\r\n\r\n #Creates the new order in the table, with the passed parameters\r\n order = Order.new do |u|\r\n u.user_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:id).join\r\n u.tweet_id = tweet_id\r\n u.order_state_id = 1\r\n u.location_id = User.where(twitter_id: get_user_from_tweet(tweet_id)).pluck(:location_id).join\r\n if(campaign_id)\r\n u.campaign_id = campaign_id\r\n end\r\n end\r\n order.save\r\n\r\n #Creates each order_item in the Order linking table\r\n items.each_with_index do |item,i|\r\n order_item = OrderItem.new do |u|\r\n u.order_id = order.id\r\n u.item_id = Item.find_by(name: item).id\r\n u.quantity = quantities[i].to_i\r\n end\r\n order_item.save\r\n end\r\nend", "def add_item(db)\n\tcreate_table_cmd = <<-SQL\n\tCREATE TABLE IF NOT EXISTS items (\n\t\tid INTEGER PRIMARY KEY,\n\t\tname VARCHAR(255),\n\t\tcalories INT\n\t)\n\tSQL\n\tdb.execute(create_table_cmd)\n\n\t$table_exists = true\n\n\tputs \"Please enter item name:\"\n\titem_name = gets.chomp\n\tputs \"Please enter calories for #{item_name}:\"\n\tcals = gets.chomp.to_i\n\tdb.execute(\"INSERT INTO items (name, calories) VALUES (? ,?)\", [item_name, cals])\n\tputs \"Item added successfully!\"\nend", "def create\n notice = \"\"\n if current_member.disabled\n flash[:notice] = \"Account is disabled. Cannot order until re-enabled.\"\n redirect_to(root_path)\n return\n end\n params[:order][:order_details_attributes].each{ |k,v|\n params[:order][:order_details_attributes].delete(k) if v[:quantity].to_f == 0.0 or v[:quantity].strip == ''\n }\n\n # combine same-stock entries\n stock_quantities = {}\n params[:order][:order_details_attributes].each{ |k,v|\n sid = v[:stock_id].to_i\n q = v[:quantity].to_f\n if stock_quantities[sid].nil?\n stock_quantities[sid] = q\n else\n stock_quantities[sid] += q\n OrderDetail.find(v[:id]).destroy unless v[:id].nil?\n params[:order][:order_details_attributes].delete(k)\n end\n }\n params[:order][:order_details_attributes].each{ |k,v|\n params[:order][:order_details_attributes][k][:quantity] = stock_quantities[v[:stock_id].to_i]\n }\n\n @order = Order.new(params[:order])\n unless current_member.admin\n @order.member = current_member\n end\n\n # first check to make sure there is enough stock available\n @order.order_details.each{ |od|\n if od.stock.limited and od.stock.quantity < od.quantity\n unless current_member.admin\n @order.errors.add \"Limited Stock Item:\",\"Sorry, there are only #{od.stock.quantity} #{od.stock.product.units} #{od.stock.name} remaining\"\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n return false\n else\n notice = \"Limited Stock Item: There were only #{od.stock.quantity} \n #{od.stock.product.units} #{od.stock.name} remaining, \n but I let you do it anyway since you're the boss!\"\n end\n elsif od.stock.quantity < od.quantity and !od.stock.limited\n notice = \"You have ordered more than is currently in stock. There may be some delay in filling this order-item.\"\n end\n }\n\n respond_to do |format|\n if @order.save\n # calculate costs and update stock\n @order.order_details.each{ |od|\n od.stock.quantity -= od.quantity\n od.stock.save\n }\n format.html { redirect_to(orders_path, :notice => \"Order was successfully created. #{notice}\") }\n format.xml { render :xml => @order, :status => :created, :location => @order }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bulk(quantity, _)\n quantity >= @quantity ? quantity * value : 0\n end", "def create_food(name,description,quantity)\n\t\t\tresult = @db.exec_params(%Q[ INSERT INTO foods (name,description,quantity)\n\t\t\t\tVALUES ($1,$2,$3) RETURNING id;], [name,description,quantity])\n\n\t\t\treturn result.first[\"id\"]\n\t\tend", "def initialize( quantity)\n #@item_name = item_name\n @quantity = quantity\n\n end", "def perform_transaction()\n transaction_record = {\n 'transaction_id' => transaction_id,\n 'record_code' => '400',\n 'subrecord_code' => '00',\n 'record_sequence_number' => '00',\n 'update_type' => '2',\n 'goods_nomenclature' => {\n 'goods_nomenclature_sid' => '96196',\n 'goods_nomenclature_item_id' => '0305720040',\n 'producline_suffix' => '80',\n 'validity_start_date' => '2012-01-01',\n 'statistical_indicator' => '0'\n }\n }\n\n TaricImporter::RecordProcessor.new(transaction_record, operation_date).process!\n end", "def execute_trade!\n offer_inventory = @offer[:records].map{ |e| [e.item_name.to_sym, e]}.to_h\n for_inventory = @for[:records].map{ |e| [e.item_name.to_sym, e]}.to_h\n\n @offer[:items].each do |name, quantity|\n offer_inventory[name.to_sym].quantity -= quantity\n for_inventory[name.to_sym].quantity += quantity\n end\n\n @for[:items].each do |name, quantity|\n for_inventory[name.to_sym].quantity -= quantity\n offer_inventory[name.to_sym].quantity += quantity\n end\n\n ActiveRecord::Base.transaction do\n @offer[:records].each(&:save)\n @for[:records].each(&:save)\n end\n end", "def create\n entry = params[:pro_entry]\n var = entry[:products_id] \n\n\n @product = Product.find(var)\n cant_product = @product.quantity\n puts \"#{cant_product} estaes la 1111111**************************************************************###}\"\n\n @pro_entry = ProEntry.new(pro_entry_params) \n qu_in = @pro_entry.quantity_input \n puts \"#{qu_in} cantidad subida**************************************************************###}\"\n \n inputs = cant_product + qu_in\n puts \"#{inputs} suma del 33333**************************************************************###}\"\n\n @product.quantity = inputs\n\n @product.save\n\n url= \"/products/\"\n\n respond_to do |format|\n if @pro_entry.save\n format.html { redirect_to url, notice: 'Pro entry was successfully created.' }\n format.json { render :show, status: :created, location: url }\n else\n format.html { render :new }\n format.json { render json: url.errors, status: :unprocessable_entity }\n end\n end\n end", "def order(id, quantity_number)\n @conn.exec(\"UPDATE products SET #{product} = '#{query_term}' WHERE id = '#{id}';\")\n #{quantity} =\n #{n}=\n puts \"ADDITION\"\nend", "def process_row(purchaser_name, item_description, item_price, purchase_count, merchant_address, merchant_name)\n purchaser = Purchaser.find_or_create!(purchaser_name)\n merchant = Merchant.find_or_create!(name: merchant_name, address: merchant_address)\n Order.create!(purchaser: purchaser,\n merchant: merchant,\n item_description: item_description,\n item_price: item_price,\n purchase_count: purchase_count)\n end", "def perform_transaction()\n transaction_record = {\n 'transaction_id' => transaction_id,\n 'record_code' => '400',\n 'subrecord_code' => '00',\n 'record_sequence_number' => '199',\n 'update_type' => '1',\n 'goods_nomenclature' => {\n 'goods_nomenclature_sid' => '70180',\n 'goods_nomenclature_item_id' => '1604141620',\n 'producline_suffix' => '80',\n 'validity_start_date' => '1998-07-14',\n 'validity_end_date' => '2011-12-31',\n 'statistical_indicator' => '0'\n }\n\n }\n\n TaricImporter::RecordProcessor.new(transaction_record, operation_date).process!\n end", "def create\n details = params[:purchase_transfer][:product_mutation_details_attributes].values\n @purchase_transfer = PurchaseTransfer.new(purchase_transfer_params.merge(status: ProductMutation::PENDING, mutation_date: Time.now,\n total_price: details.map{|mutation|(ProductSize.find_by_id(mutation[\"product_size_id\"]).product.cost_of_products.to_f)}.sum, sender_id: current_user.id,\n total_quantity: details.map{|mutation|mutation[\"quantity\"].to_i}.sum,\n sell_price: details.map{|mutation|(ProductSize.find_by_id(mutation[\"product_size_id\"]).product.selling_price)}.sum\n ))\n respond_to do |format|\n if @purchase_transfer.save\n hash = {}\n params[:purchase_transfer][:product_mutation_details_attributes].values.map{|a|\n hash = hash.merge(a.values[1] => a.values[0])\n }\n pr = PurchaseRequest.find_by_number(params[:pr_name])\n if pr.present?\n detail = pr.purchase_request_details\n pr_closed = false\n ProductMutationDetail.where(\"product_mutation_id IN (SELECT transfer_product_id FROM pr_transfer_products WHERE purchase_request_id=?) AND quantity>0\", pr.id)\n .group_by(&:product_size_id).each{|b|\n if detail.find_by_product_size_id(b[0]).approved_qty >= b[1].map(&:quantity).compact.sum+hash[\"#{b[0]}\"].to_i\n pr_closed = false\n break\n end\n pr_closed = true\n }\n PrTransferProduct.create purchase_request_id: pr.id, transfer_product_id: @purchase_transfer.id,\n receiving_id: (Receiving.find_by_purchase_order_id(pr.purchase_order_id).id rescue nil)\n pr.update_attributes(status: pr_closed ? 'CLOSED' : PurchaseRequest::TRANSFER_ON_PROGRESS)\n end\n flash[:notice] = t(:successfully_created)\n else\n flash[:error] = @purchase_transfer.errors.full_messages.join('<br/>')\n end\n format.js\n end\n end", "def create\n product = Product.find(params[:product_id])\n qty=params[:quantity].to_i \n @ordered_product = @cart.add_product(product.id,qty)\n @ordered_product.save\n respond_to do |format|\n format.html { redirect_to store_index_url, notice: 'Order placed successfully' }\n format.json { head :no_content }\n end\n end", "def create\n \n #作業明細マスターの更新\n update_working_middle_item\n\n ###モーダル化対応\n @quotation_detail_middle_classification = QuotationDetailMiddleClassification.create(quotation_detail_middle_classification_params)\n \n #歩掛りの集計を最新のもので書き換える。\n update_labor_productivity_unit_summary\n #小計を再計算する\n recalc_subtotal \n \n #手入力用IDの場合は、単位マスタへも登録する。\n @working_unit = nil\n if @quotation_detail_middle_classification.working_unit_id == 1\n #既に登録してないかチェック\n @check_unit = WorkingUnit.find_by(working_unit_name: @quotation_detail_middle_classification.working_unit_name)\n \n\t if @check_unit.nil?\n unit_params = { working_unit_name: @quotation_detail_middle_classification.working_unit_name }\n @working_unit = WorkingUnit.create(unit_params)\n\t\t else\n\t\t @working_unit = @check_unit\n\t end\n end\n \n #品目データの金額を更新\n save_price_to_large_classifications\n #行挿入する \n\t @max_line_number = @quotation_detail_middle_classification.line_number\n if (params[:quotation_detail_middle_classification][:check_line_insert] == 'true')\n line_insert\n end\n \n #行番号の最終を書き込む\n quotation_dlc_set_last_line_number\n\t\n #add 180210\n #カテゴリー保持状態の保存\n set_category_save_flag\n \n if params[:quotation_detail_middle_classification][:quotation_header_id].present?\n @quotation_header_id = params[:quotation_detail_middle_classification][:quotation_header_id]\n end\n if params[:quotation_detail_middle_classification][:quotation_detail_large_classification_id].present?\n @quotation_detail_large_classification_id = params[:quotation_detail_middle_classification][:quotation_detail_large_classification_id]\n end\n #\n \n @quotation_detail_middle_classifications = \n QuotationDetailMiddleClassification.where(:quotation_header_id => @quotation_header_id).\n where(:quotation_detail_large_classification_id => @quotation_detail_large_classification_id)\n\n ###\n end", "def create_operation(data)\n puts \"Importing Operation #{data[:invoice_num]}\"\n Operation.find_or_create_by(company_id: find_company_id(data[:company]),\n invoice_num: data[:invoice_num],\n invoice_date: parse_date(data[:invoice_date]),\n operation_date: parse_date(data[:operation_date]),\n amount: data[:amount] || 1.0,\n reporter: data[:reporter],\n notes: data[:notes],\n status: data[:status],\n kind: data[:kind] \n )\n end", "def create\n @posm_store_inventory = PosmStoreInventory.new(posm_store_inventory_params)\n posm_data = Posm.where('id = ? AND quantity > ?', params.fetch(:posm_id).to_i, 0).first\n store_data = Store.find(params.fetch(:store_id).to_i)\n\n if posm_data.present? && store_data.present?\n @posm_store_inventory.store = store_data\n @posm_store_inventory.posm = posm_data\n @posm_store_inventory.user = current_user\n\n @posm_store_inventory.transaction do\n if @posm_store_inventory.save\n posm_data.update(quantity: posm_data.quantity - params.fetch(:quantity).to_i)\n render :show, status: :created\n else\n @message = @posm_store_inventory.errors\n render :error, status: :unprocessable_entity\n end\n end\n else\n @message = \"store or posm not available on db\"\n render :error, status: :not_found\n end\n\n end", "def add_instruments(product, quantity, attributes)\n Array.new(quantity) do\n create_order_detail({ product: product, quantity: 1 }.merge(attributes))\n end\n end", "def create_new_product\n begin\n db = SQLite3::Database.open(ENV[\"BANGAZON\"])\n db.execute('INSERT INTO products (product_title, product_price, customer_id) VALUES (?, ?, ?)',[ @product_title, @product_price, @customer_id])\n last_record = db.last_insert_row_id\n db.close\n last_record\n rescue SQLite3::Exception => e\n p \"Exception with create_new_product database query: #{e}\"\n end\n\n end", "def run(*args)\n \tproduct = repository.new_product(*args)\n \tresult = repository.validate_product_nil(product, \"Product is nil\").lift_to_a +\n \tresult = repository.validate_name_not_blank(*args, \"Name is blank\").lift_to_a\n\n \tunless Validator.valid?(result){|args| product}\n \t result.left.bind do |e|\n \t \tboundary.failure(e.join(', '))\n \t end\n \telse\n \t if repository.save_product(product)\n \t boundary.success(product)\n \t else\n \t boundary.failure(\"Product not saved\")\n \t end\n \tend\n end", "def create_product(row)\n #create new product\n product = Product.new\n product.model = row['model']\n product.sku = ''\n product.upc = ''\n product.ean = ''\n product.jan = ''\n product.isbn = ''\n product.mpn = ''\n product.location = ''\n product.stock_status_id = 5\n product.manufacturer_id = 0\n product.shipping = true\n product.price = row['price']\n product.points = 0\n product.tax_class_id = 0\n product.date_available = DateTime.now\n product.weight = row['weight']\n product.weight_class_id =0\n product.length = 0\n product.width = 0\n product.height = 0\n product.length_class_id = 1\n product.subtract = 1\n product.sort_order = 0\n product.status = false\n product.date_added = DateTime.now -2\n product.date_modified = DateTime.now -2\n product.save\n\n #add product name\n productDescription = ProductDescription.new\n productDescription.product_id = product.product_id\n productDescription.language_id = 1\n productDescription.name = row['english']\n productDescription.description = ''\n productDescription.meta_description = ''\n productDescription.meta_keyword = ''\n productDescription.tag = ''\n\n\n productDescription.save\n\n pd = ProductDescription.new\n pd.product_id = product.product_id\n pd.language_id = 2\n pd.name = row['chinese']\n pd.description = ''\n pd.meta_description = ''\n pd.meta_keyword = ''\n pd.tag = ''\n\n pd.save \n\n #add product to store\n productStore = ProductStore.new\n productStore.product_id = product.product_id\n productStore.store_id = 0\n productStore.save\n\n \n\n end", "def create_line_item\n\t\tset_sale\n\t\tpopulate_products\n\n\t\texisting_line_item = Item.where('product_id = ? AND sale_id = ?', params[:product_id], @sale.id).first\n\n\t\tif existing_line_item.blank?\n\t\t\tline_item = Item.new(product_id: params[:product_id], sale_id: params[:sale_id], quantity: params[:quantity])\n\t\t\tline_item.price = line_item.product.price\n\t\t\tline_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(line_item)\n\t\telse\n\t\t\texisting_line_item.quantity += 1\n\t\t\texisting_line_item.save\n\n\t\t\tremove_item_from_stock(params[:product_id])\n\t\t\tupdate_line_item_totals(existing_line_item)\n\t\tend\n\n\t\tupdate_totals\n\n\t\trespond_to do |format|\n\t\t\tformat.js { ajax_refresh }\n\t\tend\n\tend", "def create\n purchase = @order.purchases.first(:conditions => {\n :purchasable_id => params[:purchase][:purchasable_id],\n :purchasable_type => params[:purchase][:purchasable_type]\n })\n\n if purchase\n purchase.quantity += params[:purchase][:quantity].to_i\n purchase.save\n else\n @order.purchases << Purchase.new(params[:purchase])\n @order.save\n end\n\n if params[:redirect_to]\n flash[:success] = %{#{params[:purchase][:name]} has been added to your order. <a href=\"/order/purchases\">Proceed to checkout</a>.} unless params[:hide_flash]\n redirect_to params[:redirect_to]\n else\n redirect_to order_purchases_path\n end\n end", "def create\n item = Item.find(params[:item_id])\n @line_item = @cart.line_items.find_by(item: item)\n if @line_item\n @line_item.quantity += 1\n else\n @line_item = @cart.line_items.new(item: item)\n end\n\n respond_to do |format|\n if @line_item.save\n format.html { redirect_to @line_item.cart, notice: 'Line item was successfully created.' }\n format.json { render :show, status: :created, location: @line_item }\n else\n format.html { render :new }\n format.json { render json: @line_item.errors, status: :unprocessable_entity }\n end\n end\nend", "def add\n @item.increment(:quantity)\n @item.save!\n\n refresh\n end", "def create\n @stock = Stock.new(stock_params)\n @stock.user_id = current_user.id # set user_id\n @item = Stock.where(\"user_id = ? and item_name = ?\" , current_user.id , @stock.item_name )\n @uom = Stock.where(\"user_id = ? and item_name = ? and unit_of_measure = ?\" , current_user.id , @stock.item_name , @stock.unit_of_measure)\n @stocks = Stock.where(\"user_id = ? and item_name = ? and unit_of_measure = ? and batch_number = ? \" , current_user.id , @stock.item_name , @stock.unit_of_measure , @stock.batch_number)\n time = Time.now.strftime(\"%Y-%m-%d\")\n respond_to do |format|\n if @stock.expiry_date <= Date.parse(time)\n format.html { redirect_to @stock, notice: 'Product is alreday expired, check the expiry date' }\n\n elsif @stock.quantity <= 0\n format.html { redirect_to @stock, notice: 'Quantity should be positive' }\n\n else\n if !@stocks.present?\n\n master = Master.where(\"item_name = ? and uom = ?\" , @stock.item_name , @stock.unit_of_measure)\n\n # if item is not in masters then consider it as personal item\n if master.present?\n # base is master's row with level = 1 , to get base uom\n base = Master.where(\"item_name = ?\" , @stock.item_name )\n base = base.where(\"level = ? \" , \"1\")\n uom = base.pluck(:uom)\n uom = uom[0]\n mrp = base.pluck(:mrp)\n mrp = mrp[0]\n # onlt if given unit_of_measure is base_uom(level=1)\n if uom.to_s == @stock.unit_of_measure.to_s\n price = @stock.quantity*mrp\n purchase=Purchase.create(user_id: current_user.id , wholesaler: \"Stock Correction\",item_name: @stock.item_name ,\n batch_number: @stock.batch_number ,unit_of_measure: uom ,\n expiry_date: @stock.expiry_date , quantity:@stock.quantity , date_of_purchase: time , total_price:price)\n\n # update in report\n report = Report.find_by(item_name: @stock.item_name , user_id: current_user.id)\n if report.present?\n report.value = (price + report.value*report.quantity)/(@stock.quantity + report.quantity)\n report.quantity = report.quantity + @stock.quantity\n report.save\n else\n report=Report.create(user_id:current_user.id , item_name:@stock.item_name,value:(price/(@stock.quantity)),\n quantity:@stock.quantity)\n end\n\n if @stock.save\n format.html { redirect_to @stock, notice: 'New Item has been successfully added.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n\n else\n format.html { redirect_to @stock, notice: 'Item from masters list is only allowed with base unit_of_measure(level=1)' }\n format.json { render :show, status: :created, location: @stock }\n end\n\n else\n # is personal item present in stock\n if @item.present?\n # only 1 uom is allowed for personal item\n if @uom.present?\n # find average value of product\n report = Report.find_by(item_name: @stock.item_name , user_id: current_user.id)\n price = @stock.quantity*report.value\n\n purchase=Purchase.create(user_id: current_user.id , wholesaler: \"Stock Correction\",item_name: @stock.item_name ,\n batch_number: @stock.batch_number ,unit_of_measure: @stock.unit_of_measure ,\n expiry_date: @stock.expiry_date , quantity:@stock.quantity , date_of_purchase: time , total_price:price)\n\n report.value = (price + report.value*report.quantity)/(@stock.quantity + report.quantity)\n report.quantity = report.quantity + @stock.quantity\n report.save\n\n if @stock.save\n format.html { redirect_to @stock, notice: 'New Item has been successfully added.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n\n else\n # as defined Personal item with only one unit_of_measure is allowed\n format.html { redirect_to @stock, notice: 'Personal item with only one unit_of_measure is allowed' }\n format.json { render :show, status: :created, location: @stock }\n end\n\n else\n purchase=Purchase.create(user_id: current_user.id , wholesaler: \"Stock Correction\",item_name: @stock.item_name ,\n batch_number: @stock.batch_number ,unit_of_measure: @stock.unit_of_measure ,\n expiry_date: @stock.expiry_date , quantity:@stock.quantity , date_of_purchase: time , total_price:0)\n\n report=Report.create(user_id:current_user.id , item_name:@stock.item_name,value:0,\n quantity:@stock.quantity)\n\n if @stock.save\n format.html { redirect_to @stock, notice: 'New Item has been successfully added.' }\n format.json { render :show, status: :created, location: @stock }\n else\n format.html { render :new }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n\n end\n end\n else\n format.html { redirect_to @stock, notice: 'Item with corresponding unit_of_measure and batch number already exist.' }\n format.json { render json: @stock.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def add_product(item_id,user_id,line_item_type)\n\tcurrent_item = line_items.where(:item_id => item_id,:user_id=>user_id,:line_item_type => line_item_type).first\n item = Item.find(item_id)\n if line_item_type.to_i!=0\n -1\n elsif current_item\n if(item.availability<=current_item.quantity && current_item.line_item_type.to_i==0)\n -1\n else\n current_item.quantity += 1\n current_item\n end\n else\n if(item.availability<=0 && line_item_type.to_i==0)\n -1\n else\n current_item = LineItem.new(:item_id=>item_id,:user_id=>user_id,:line_item_type => line_item_type)\n line_items << current_item\n current_item\n end\n end\n end", "def create_line_item_for_per_person_charge qty, vendor_id, include_price_in_expense, include_price_in_revenue, notes\n event_vendor = event_vendors.where(:vendor_id => vendor_id).first\n line_items.push(create_line_item_for_per_person_charge_2(event_vendor.participation, event_vendor, true, true, \"\"))\n end", "def creation #wizard will be able to create objects, his proficiency is based on the skill level he has in this type of magic\r\n \r\n end", "def create\n @order = Order.find(params[:order_id])\n if current_user.role?('manager') and !Manager.find(current_user.manager_id).validity\n redirect_to order_order_items_path(@order), notice: t(:manager_not_valid)\n return \n end\n @order_item = OrderItem.new(params[:order_item])\n @product_ids = ProductPrice.where(price_list_id: @order.price_list_id).select('product_id').map {|x| x.product_id}\n @products = Product.where(validity: true).where(id: @product_ids) \n @select_unit_of_measure = params[:order_item][:unit_of_measure_id] \n @unit_of_measure_ids = ProductUnitOfMeasure.where(product_id: params[:order_item][:product_id]).select('unit_of_measure_id').map {|x| x.unit_of_measure_id}\n @unit_of_measures = UnitOfMeasure.where(id: @unit_of_measure_ids) \n \n @order.order_items << @order_item \n \n respond_to do |format|\n if @order_item.save\n format.html { redirect_to order_order_item_path(@order, @order_item), notice: t(:order_item_created) }\n format.json { render json: @order_item, status: :created, location: @order_item }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @item = Item.new(item_params)\n #@item.user_id = current_user.id \n if !@item.buyitnow \n @item.qty = 1; \n end\n if @item.seq.blank? \n @item.seq = Item.maximum(\"seq\") + 1\n else \n @items = @item.auction.items.all\n @items.each do |i|\n if i.seq >= @item.seq \n i.seq += 1 \n end\n end\n end\n respond_to do |format|\n if @item.save\n format.html { redirect_to @item, notice: 'Item was successfully created.' }\n format.json { render :show, status: :created, location: @item }\n else\n format.html { render :new }\n format.json { render json: @item.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_item(name, price, quantity, description=\"No description available\", image=\"\")\n new_item = Item.created( name, price, self.working_for, quantity, description, image)\n if !(identical = self.working_for.list_items_inactive.detect{|i| i == new_item }).nil?\n identical.quantity += new_item.quantity\n else\n self.working_for.offers.push(new_item)\n new_item.save\n end\n Activity.log(self, \"add_item\", new_item, self.working_for)\n return new_item\n end", "def create\n init = params[:sku][:name][0]\n brand_id = Brand.find_by_name(params[:brand_id])\n sku_number = Sku.create_number(params)\n @sku = Sku.new(sku_params.merge(:code => (('%03d' % ((Sku.last.code.to_i rescue 0)+1)))).merge(:brand_id => brand_id.id))\n if @sku.save\n flash[:notice] = 'Divisi berhasil ditambahkan'\n redirect_to skus_path\n else\n flash[:error] = @sku.errors.full_messages\n render \"new\"\n end\n end", "def add_to_list(database, item, quantity, store_name, purchased)\n $database.execute(\"INSERT INTO shopping (item, quantity, store_name, purchased) VALUES (?, ?, ?, ?)\", [item, quantity, store_name, purchased])\nend", "def perform_split(quantity, type, approval_path_id = nil)\n return false if (quantity > total_open_count) or (quantity === 0)\n\n split_type = type.present? ? type : inventory_release_type\n\n new_attributes = {\n :inventory_release_type => split_type,\n :skip_totals_validation => true,\n :approval_path_id => approval_path_id\n }\n\n original_released_count = total_released_count\n\n # dont make me resort to raw sql....\n ActiveRecord::Base.transaction do\n if quantity != total_open_count\n new_attributes[:total_released_count] = quantity\n new_release = self.dup\n if update_attributes!( :total_released_count => original_released_count - quantity, :skip_totals_validation => true)\n if new_release.update_attributes! new_attributes\n true\n else\n update_attribute!(:total_released_count, original_released_count)\n end\n end\n else\n update_attributes! new_attributes\n end\n end\n end", "def create\n @job = Job.new(job_params)\n @job.remaider = params[:quantity].to_i - params[:completed].to_i\n @job.save!\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render :show, status: :created, location: @job }\n else\n format.html { render :new }\n format.json { render json: @job.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_item(product_id:, quantity: 1)\n product = Product.find(product_id)\n\n order_item = order.items.find_or_create_by(\n product_id: product_id\n )\n\n order_item.price = product.price\n order_item.quantity = 1\n order_item.save\n end", "def set_quantity(purchase, n, entry = find_or_create_item(purchase))\n\n if n == 0\n delete(entry)\n else\n entry.components.clear\n\n max_qty = maximum_quantity_allowed(purchase)\n\n if max_qty > n\n assign_components(entry, purchase, n)\n else\n assign_components(entry, purchase, max_qty)\n if !stock_available?(purchase, n)\n entry.errors.add(:quantity, \"There #{max_qty > 1 ? 'are' : 'is'} only #{max_qty} of this item available.\")\n elsif purchase_limited?(purchase)\n entry.errors.add(:quantity, \"This item is limited to #{purchase.purchase_limit} per customer.\")\n end\n end\n\n entry.quantity = entry.components.map(&:quantity).sum\n\n if entry.quantity == 0\n delete(entry)\n else\n entry.total = entry.components.reduce(SpookAndPuff::Money.new('0')) {|m, c| m + c.total }\n entry.pre_discount_total = entry.total\n end\n end\n\n entry\n end", "def create_stock(stockname, amount)\n $db.execute('INSERT INTO stocks (stockname, amount) VALUES (?, ?)', stockname, amount)\n end", "def create\n if current_user.present?\n Item.transaction do\n item = Item.find(params[:item_id].to_i)\n if item.remain <= 0\n #如果已被抢完,提示投资下一期\n flash[:info] = \"该期已投完,请投资下一期\"\n elsif item.remain > params[:amount].to_i\n #如果还没被抢完,可以抢,创建一条抢投记录,更新期数的已投和剩余的人次数\n if current_user.available.blank?\n flash[:info] = \"请先注册并充值\"\n elsif current_user.cash_flows.count == 1 && current_user.cash_flows.first.cash_flow_description == Dict::CashFlowDescription.prize\n flash[:info] = \"注册红包仅可用于投标\"\n elsif current_user.available >= params[:amount].to_i\n numbers = item.number_array.sample(params[:amount].to_i)\n order = ProductOrder.create_for(current_user, params[:item_id].to_i, params[:amount].to_i, numbers.join(\" \"))\n already = item.already + params[:amount].to_i\n remain = item.remain - params[:amount].to_i\n number_array = item.number_array - numbers\n item.update_already_remain(already, remain, number_array)\n flash[:info] = \"参与成功!\"\n else\n flash[:info] = \"您的账户余额不足,请充值\"\n end\n elsif item.remain <= params[:amount].to_i\n if current_user.available.blank?\n flash[:info] = \"请先注册并充值\"\n elsif current_user.available > params[:amount].to_i\n #如果已最后剩余的被抢完,除了更新记录外,还要创建新的一期,及开奖\n numbers = item.number_array\n order = ProductOrder.create_for(current_user, params[:item_id].to_i, item.remain, numbers.join(\" \"))\n already = item.already + item.remain\n remain = item.remain - item.remain\n number_array = item.number_array - numbers\n item.update_already_remain(already, remain, number_array)\n #更新产品信息\n item_product = item.product\n item_product.already += 1\n item_product.remain -= 1\n item_product.save\n #生成新的期数\n not_finish_product = Product.where(\"already != numbers\").order(\"weight desc\").first\n if not_finish_product.present?\n Item.create(product_id: not_finish_product.id, already: 0, remain: not_finish_product.total_price, number_array: (10000001..(10000000+not_finish_product.total_price)).to_a)\n end\n flash[:info] = \"参与成功!\"\n else\n flash[:info] = \"您的账户余额不足,请充值\"\n end\n end\n end\n else\n flash[:info] = \"请先登录\"\n end\n redirect_to :actions => \"index\"\n end", "def create\n @cart = current_cart\n unless params[:order_detail].nil?\n product_detail = ProductDetail.find(params[:order_detail][:product_detail_id])\n else\n product_detail = ProductDetail.find(params[:product_detail_id])\n end\n if ((product_detail.product_quantity.nil?) || (product_detail.product_quantity < 1))\n render :text => \"fail\", :layout => false\n return\n else\n @order_detail = @cart.order_details.build(:product_detail => product_detail)\n respond_to do |format|\n if @order_detail.save\n if product_detail.product_quantity.nil?\n details = 0\n else\n details = product_detail.product_quantity-1\n end\n product_detail.update_attributes(:product_quantity => details)\n format.html { redirect_to(@order_detail,\n :notice => 'Product was successfully created.') }\n format.xml { render :xml => @order_detail,\n :status => :created, :location => @order_detail }\n\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order_detail.errors,\n :status => :unprocessable_entity }\n end\n end\n end\n end", "def create\n # defined object to receive strict item_params including :description, :price, :stockQty ; else return 400\n @item = Item.new(item_params)\n \n if @item.save\n render json: @item.to_json, status: 201\n else\n head 400\n end\n end", "def add_order(order_item, qty, order)\r\n if order_item == \"latte\"\r\n item = Item.new(\"latte\", $latte_cost, $latte_price)\r\n elsif order_item == \"tea\"\r\n item = Item.new(\"tea\", $tea_cost, $tea_price)\r\n elsif order_item == \"scones\"\r\n item = Item.new(\"scones\", $scones_cost, $scones_price)\r\n end\r\n order.add_item(item, qty)\r\nend", "def add_item(title, amount, quantity=1)\n self.total += amount * quantity\n quantity.times do\n items << title\n end\n self.last_transaction = amount * quantity\n end", "def call(_obj, args, _ctx)\n unless args[:price]\n raise GraphQL::ExecutionError.new('Price cannot be negative')\n end\n\n unless args[:inventory_count]\n raise GraphQL::ExecutionError.new('Product cnnot have negative inventory')\n end\n\n # Create new Product\n Product.create!(\n title: args[:title],\n price: args[:price],\n inventory_count: args[:inventory_count],\n )\n\n # Catch all validation errors\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{\n e.record.errors.full_messages.join(', ')\n }\")\n end", "def create_line_item_for_per_person_charge_2 qty, event_vendor, include_price_in_expense, include_price_in_revenue, notes\n\n [\n # Vendor\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_expense => event_vendor.calculate_menu_level_cogs,\n :tax_rate_expense => 0,\n :payable_party => event_vendor.vendor,\n :include_price_in_expense => include_price_in_expense,\n :menu_template => event_vendor.menu_template),\n\n # Account\n LineItem.create(\n :line_item_type => \"Goods\", :line_item_sub_type => \"Menu-Fee\",\n :sku => \"MT-\" + event_vendor.menu_template_id.to_s.rjust(7, '0'), :name => \"* Per Person Charge (\" + event_vendor.vendor.name + \")\", :quantity => qty,\n :unit_price_revenue => event_vendor.calculate_menu_level_sell_price,\n :billable_party => account,\n :include_price_in_revenue => include_price_in_revenue,\n :menu_template => event_vendor.menu_template)\n ]\n end", "def create\n candidateOrder = Order.new(email: params[:order][:Email],\n totalCost: cart_total,\n user: curr_user)\n cart.each do |pId, info|\n if (prod = Product.find_by(id: pId))\n if prod.stockCount > info[\"Num\"].to_i\n candidateOrder.order_entries.new(\n product: prod,\n quantity: info[\"Num\"].to_i,\n unitprice: prod.price,\n totalprice: prod.price * info[\"Num\"].to_i,\n order_id: candidateOrder.id\n )\n candidateOrder.order_entries.last.validate!\n if candidateOrder.valid?\n prod.stockCount -= info[\"Num\"].to_i\n Product.update(prod.id, stockCount: prod.stockCount)\n end\n end\n end\n end\n if candidateOrder.save!\n clear_cart\n redirect_to order_path(candidateOrder), notice: t(:order_placed)\n else\n redirect_to carts_path, error: t(:order_failed)\n end\n end" ]
[ "0.67013735", "0.65957385", "0.63124126", "0.6233941", "0.6219562", "0.61756307", "0.61744106", "0.6164429", "0.60861033", "0.6059458", "0.6053218", "0.601747", "0.5993268", "0.5993268", "0.59552157", "0.5915156", "0.5906974", "0.5903815", "0.5892649", "0.58911955", "0.5872759", "0.5827257", "0.5802146", "0.579243", "0.57875437", "0.578576", "0.5778375", "0.57625216", "0.5750249", "0.5726406", "0.5722477", "0.5719359", "0.5700097", "0.5697292", "0.56967866", "0.5685402", "0.568411", "0.56807995", "0.5679641", "0.56717026", "0.5648014", "0.5645202", "0.56400913", "0.563929", "0.5634998", "0.5613873", "0.5605714", "0.5600445", "0.5599639", "0.55910265", "0.5587754", "0.5580337", "0.55791897", "0.5578297", "0.5577347", "0.5573852", "0.5564811", "0.5553181", "0.55516845", "0.5547003", "0.55404913", "0.55365026", "0.55352074", "0.55333245", "0.5522016", "0.55190235", "0.5504333", "0.5503125", "0.550176", "0.5497656", "0.54943377", "0.5479839", "0.5475588", "0.5473632", "0.54698604", "0.5469682", "0.5462204", "0.5459206", "0.5457213", "0.5456773", "0.54552615", "0.54463124", "0.5445353", "0.5443385", "0.54420084", "0.54418546", "0.54403025", "0.54387736", "0.54343086", "0.54336727", "0.54317725", "0.5424633", "0.54183066", "0.54069656", "0.5401199", "0.54007965", "0.53995454", "0.5393944", "0.5393625", "0.5391606" ]
0.6794722
0
GET /bookings GET /bookings.json
def index @bookings = Booking.all respond_to do |format| format.html format.json { render :json => @bookings } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def show\n\t\t@booking = Booking.find(params[:id])\n\t\trender json: @booking, status: 200\n\tend", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = @user.bookings\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index\n @bookings = current_user.bookings\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def show\n render json: { booking: @booking }, status: 200\n end", "def show\n @booking = Booking.find(params[:id])\n @rooms = @booking.rooms\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n render json: @booking\n end", "def show\n render json: @booking\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @bookings = prep_bookings\n render json: @bookings, status: :ok\n end", "def index\n @bookings = @hairdresser.bookings\n end", "def index\n bookings = Room.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all rooms', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n @bookings = Booking.user(@user.id)\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def index\n # @bookings = Booking.all\n begin\n @response = Booking.get_bookings\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n # binding.pry\n end", "def all_bookings\n Booking.none\n end", "def index\n if current_user\n @bookings = current_user.bookings.all\n end\n\n if current_host\n @job = Job.find_by(id: params[:job_id])\n @bookings = @job.bookings\n end\n end", "def index\n @bookings = Booking.includes(:services)\n end", "def show\n\n @user_id = current_user\n case params[:id]\n when \"approaching\"\n @bookings = Booking.paginate :conditions=>[ \"user_id = #{@user_id} and enddate >= now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"history\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id} and enddate < now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"all\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n else\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n end\n\n if @bookings.nil?\n @bookings = Array.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @postings = Posting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @postings }\n end\n end", "def show\n @booking = Booking.find_by(id: params[:id])\n if @booking\n render json: {success: true, status: 200, object: @booking}\n else\n render json: {success: false, status: 404, message: \"Not Found\"}\n end\n end", "def index \n session[:link_to_bookings] = params[:classroom][:links].last[:uri] if (params[:classroom]) \n @link = session[:link_to_bookings]\n @params= \"date=#{params[:date]}&limit=#{params[:limit]}&status=#{params[:status]}\"\n @bookings = ClientApi.bookings_list @link, @params\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def index\n @user = User.find_by_id(params[:format])\n @bookings = Booking.where(user_id: params[:format])\n end", "def show\n\n render json: @bookkeeping\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule, methods: :bookings }\n end\n end", "def index\n @booking_infos = BookingInfo.all\n end", "def index\n @books = Book.all\n render json: @books\n end", "def find_user_id\n @listings = Listing.where(\"user_id = ?\",params[:user_id]).all\n if !@listings.empty?\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 on_date\n @bookings = []\n @bookings = Booking.on_date(params[:booking_date]) if params[:booking_date]\n \n respond_to do |format|\n format.html {render \"index\"}\n format.json {render json: @bookings}\n end\n \n end", "def show\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booking }\n end\n end", "def index\n @bookings = Booking.all(:include => [:user, :suite])\n @current_bookings = Booking.current_bookings\n @archived_bookings = Booking.archived_bookings\n @cancelled_bookings = Booking.cancelled_bookings\n\n respond_to do |format|\n format.html { render :layout => \"admin_layout\"}\n format.xml { render :xml => @bookings }\n end\n end", "def index\n @room_bookings = RoomBooking.all\n end", "def index\n @fg_bookings = FgBooking.all\n end", "def index\n @ninety_ten_bookings = NinetyTenBooking.all\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @online_bookings = OnlineBooking.all\n end", "def show\n @booking = Booking.find(params[:id])\n respond_with(@booking)\n end", "def index\n @sayings = Saying.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sayings }\n end\n end", "def index\n @bookings = Booking.all\n if params[:search]\n @search_term = params[:search]\n @bookings = @bookings.search_by(@search_term)\n end\n end", "def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end", "def bookings(fields: nil, options: nil)\n opts_keys = %i[boundaryId boundaryStartsAt direction displayTimeZone jumpToDate profileIds search]\n params = build_option_params options, opts_keys, fields: fields\n res = @connection.get booking_path, params\n map_as_collection res, Booking\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def index\n query = 'SELECT * FROM Booking'\n @bookings = Booking.find_by_sql(query)\n end", "def timeline\n @bookings = Booking.find_waiting_pickup\n respond_to do |format|\n format.xml\n end\n end", "def bookings()\n sql = \"SELECT bookings.*\n FROM bookings\n WHERE bookings.schedule_id = $1\"\n values = [@id]\n result = SqlRunner.run(sql,values)\n bookings = Booking.map_items(result)\n return bookings\n end", "def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end", "def show\n @bookings = @customer.bookings\n end", "def index\n @bookings = current_user.bookings\n binding.pry\n #@bookingsegregator = Booking.segregator\n end", "def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def all_bookings\n Booking.includes(:user, :court).ordered.load\n end", "def index\n @bookings = Booking.where(:customer_id => session['customer_id'])\n end", "def show\n render json: @book\n end", "def index\n @booking_details = BookingDetail.all\n end", "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def find_id\n if Listing.exists?(params[:id])\n @listing = Listing.find(params[:id])\n render :json => @listing.as_json(include: :book)\n else\n render :json => \"listing not found\".to_json\n end\n end", "def index\n @bookings = Booking.order(id: :desc)\n end", "def index\n @biddings = Bidding.all\n end", "def show\n render json: @service_booking\n end", "def show\n @booking = Booking.find(params[:id])\n end", "def show\n @bookings = Booking.all\n @rooms = Room.all\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def index\n @booking_statuses = BookingStatus.all\n end", "def bookings()\n sql = \"SELECT * FROM bookings WHERE bookings.gymclass_id = $1;\"\n values = [@id]\n results = SqlRunner.run(sql, values)\n return results.map {|booking| Booking.new(booking)}\n end" ]
[ "0.8231102", "0.80220497", "0.80220497", "0.80220497", "0.7619097", "0.7607287", "0.7501954", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7473071", "0.7437335", "0.74355394", "0.736671", "0.73389894", "0.73331183", "0.73266363", "0.73217666", "0.72310644", "0.7227939", "0.71933675", "0.71933675", "0.71933675", "0.71933675", "0.7145121", "0.71196496", "0.70844454", "0.7068138", "0.70634925", "0.6997092", "0.6988636", "0.6988636", "0.69486886", "0.6948613", "0.6942897", "0.69407207", "0.69219196", "0.68844646", "0.6873678", "0.68719894", "0.68486196", "0.6814593", "0.6804705", "0.6786011", "0.6759293", "0.6757766", "0.67523646", "0.67449206", "0.6740214", "0.6727567", "0.67193884", "0.6708978", "0.66504943", "0.66458344", "0.664233", "0.6594441", "0.65912014", "0.6579298", "0.65675294", "0.6562665", "0.65623444", "0.6541979", "0.6531522", "0.65299183", "0.64960617", "0.6492825", "0.64922136", "0.6476216", "0.64701396", "0.64521086", "0.6446309", "0.6438177", "0.643674", "0.64366347", "0.6424101", "0.6422121", "0.64186513", "0.6413106", "0.6401445", "0.6396427", "0.63874567", "0.63870436", "0.6386612", "0.63841397", "0.6383486", "0.6375648", "0.63753766", "0.63749844", "0.6365202", "0.6352541", "0.63498" ]
0.80365145
1
GET /bookings/1 GET /bookings/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def show\n\t\t@booking = Booking.find(params[:id])\n\t\trender json: @booking, status: 200\n\tend", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def show\n render json: { booking: @booking }, status: 200\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def show\n @booking = Booking.find_by(id: params[:id])\n if @booking\n render json: {success: true, status: 200, object: @booking}\n else\n render json: {success: false, status: 404, message: \"Not Found\"}\n end\n end", "def index\n @bookings = Booking.order(updated_at: :desc).page(params[:page]).per(NUM_PER_PAGE)\n end", "def index\n @bookings = @user.bookings\n end", "def show\n @booking = Booking.find(params[:id])\n @rooms = @booking.rooms\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking }\n end\n end", "def show\n render json: @booking\n end", "def show\n render json: @booking\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend", "def index\n @bookings = @hairdresser.bookings\n end", "def show\n @booking = Booking.find(params[:id])\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def index\n # @bookings = Booking.all\n begin\n @response = Booking.get_bookings\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n # binding.pry\n end", "def index\n @bookings = Booking.user(@user.id)\n end", "def show\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @booking }\n end\n end", "def show\n begin\n @response = Booking.get_booking(params[:id])\n rescue RestClient::Exception => exception\n @error = exception.response\n end\n end", "def index\n @user = User.find_by_id(params[:format])\n @bookings = Booking.where(user_id: params[:format])\n end", "def index\n @bookings = current_user.bookings\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def find_id\n if Listing.exists?(params[:id])\n @listing = Listing.find(params[:id])\n render :json => @listing.as_json(include: :book)\n else\n render :json => \"listing not found\".to_json\n end\n end", "def show\n @booking = Booking.find(params[:id])\n respond_with(@booking)\n end", "def index\n @bookings = Booking.where(\"user_id = #{current_user.id}\")\n end", "def index\n @bookings = Booking.where(user_id: current_user.id)\n end", "def show\n\n render json: @bookkeeping\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def set_api_v1_booking\n @api_v1_booking = Booking.find(params[:id])\n end", "def show\n @book_shelf = BookShelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_shelf }\n end\n end", "def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n @listings = Listing.all\n render json: @listings\n end", "def index \n session[:link_to_bookings] = params[:classroom][:links].last[:uri] if (params[:classroom]) \n @link = session[:link_to_bookings]\n @params= \"date=#{params[:date]}&limit=#{params[:limit]}&status=#{params[:status]}\"\n @bookings = ClientApi.bookings_list @link, @params\n end", "def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end", "def show\n render json: @book\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end", "def index\n @booking_infos = BookingInfo.all\n end", "def show\n\n @user_id = current_user\n case params[:id]\n when \"approaching\"\n @bookings = Booking.paginate :conditions=>[ \"user_id = #{@user_id} and enddate >= now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"history\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id} and enddate < now()::date\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n when \"all\"\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n else\n @bookings = Booking.paginate :conditions=>[\"user_id = #{@user_id}\"],:page=>params[:page],:order=>'startdate desc, starttime desc', :per_page => 10\n end\n\n if @bookings.nil?\n @bookings = Array.new\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @listings = Listing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @listings }\n end\n end", "def index\n @books = Book.all\n render json: @books\n end", "def show\n \n @booking = Booking.find( params[ :id ] )\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @booking.to_xml }\n format.json { render :json => @booking.to_json }\n format.yaml { render :text => @booking.to_yaml }\n end\n \n end", "def index\n @bookings = Booking.includes(:services)\n end", "def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def index\n if current_user\n @bookings = current_user.bookings.all\n end\n\n if current_host\n @job = Job.find_by(id: params[:job_id])\n @bookings = @job.bookings\n end\n end", "def find_booking\n @booking = Booking.find(params[:id])\n end", "def index\n @listings = Listing.by_user(current_user).all\n\n render json: @listings\n end", "def show\n render json: @api_book\n end", "def all_bookings\n Booking.none\n end", "def book\n fetch('harry_potter.books')\n end", "def show\n @booking = Booking.find(params[:id])\n \n respond_to do |format|\n format.html \n format.xml { render :xml => @booking }\n end\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @bookings = prep_bookings\n render json: @bookings, status: :ok\n end", "def index\n @booking_details = BookingDetail.all\n end", "def show\n query = \"SELECT * FROM Booking WHERE bookingId = #{params[:id]}\"\n @booking = Booking.find_by_sql(query).first\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def index\n query = 'SELECT * FROM Booking'\n @bookings = Booking.find_by_sql(query)\n end", "def show\n @guestbook = Guestbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @guestbook }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @schedule, methods: :bookings }\n end\n end" ]
[ "0.7793375", "0.76496434", "0.76496434", "0.76496434", "0.76409495", "0.76042414", "0.75729305", "0.73645985", "0.73645985", "0.73645985", "0.73645985", "0.7241474", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.7206953", "0.71681803", "0.7167795", "0.71375686", "0.7092144", "0.70906866", "0.7078563", "0.70324767", "0.70096594", "0.6982768", "0.6961544", "0.6929472", "0.6929472", "0.691844", "0.68640864", "0.6857478", "0.6798837", "0.67862725", "0.6784219", "0.6764426", "0.6759001", "0.6747982", "0.67452234", "0.67312276", "0.671604", "0.67027277", "0.667152", "0.6664215", "0.66516304", "0.6618725", "0.66153413", "0.6609551", "0.6576383", "0.6576383", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.65739995", "0.6569968", "0.6563967", "0.65533376", "0.65521395", "0.65521395", "0.65493727", "0.65296346", "0.65290064", "0.6524282", "0.6523396", "0.6519605", "0.6511332", "0.649401", "0.64908516", "0.6488969", "0.64885825", "0.6474606", "0.6473084", "0.6471577", "0.6456041", "0.6444625", "0.64368963", "0.642638", "0.64134103", "0.6409251", "0.6407762", "0.63998723", "0.63961875", "0.63933283", "0.6386636", "0.6371519", "0.63712287", "0.63675565", "0.6362155" ]
0.0
-1
POST /bookings POST /bookings.json
def create @booking = Booking.new(booking_params) @current_room_bookings = Booking.where('room_id=?', @booking.room_id); overlap = false; @current_room_bookings.each do |old_booking| endTime = old_booking.booking_start_time + 2*60*60; currentEndTime = @booking.booking_start_time + 2*60*60; if(@booking.booking_start_time...currentEndTime).overlaps?(old_booking.booking_start_time...endTime) respond_to do |format| format.html { redirect_to new_booking_path, notice: "Booking for that time slot already exists!" } format.json { render json: @booking.errors, status: :unprocessable_entity } end overlap = true; break; end end if(!overlap) respond_to do |format| if @booking.save format.html { redirect_to home_path, notice: 'Booking was successfully created.' } format.json { render :show, status: :created, location: @booking} UserMailer.welcome_email(@booking).deliver! else format.html { render :new } format.json { render json: @booking.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n booking = Booking.create(booking_params)\n render json: booking\n end", "def create\n\t\tbooking = Booking.new(booking_params)\n\n\t if booking.save\n\t \tPeekBooker.use_a_boat(booking.size, booking.timeslot_id)\n\t \tPeekBooker.delete_overlap_assignments(booking.timeslot_id)\n\t \tPeekBooker.upd_availability(booking.timeslot_id)\n\t \t\n\t \trender json: booking, status: 201\n\t end\n\tend", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def create\n @booking = Booking.new(params[:booking])\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render json: @booking, status: :created, location: @booking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(params[:booking])\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render json: @booking, status: :created, location: @booking }\n else\n format.html { render action: \"new\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = @hairdresser.bookings.create(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to hairdresser_booking_path(@hairdresser,@booking), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: \"Booking was successfully created.\" }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er nu oprettet.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n set_parent\n set_session\n if @session.bookings.where(user_id: @parent.id) != []\n render_booked\n else\n @booking = Booking.new(booking_params)\n @booking.parent = @parent\n @booking.session = @session\n if @booking.save\n render json: { booking: @booking, status: :success }\n else\n render_error\n end\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @bookings }\n end\n end", "def index\n bookings = Booking.all\n\n if bookings\n render json: { status: 'SUCCESS', message: 'Successfuly got all bookings', data: bookings }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end", "def create\n\n @listing = Listing.new(listing_params)\n\n @listing.save\n\n render json: @listing\n redirect_to listings_path # redirect to home page\n end", "def create\n @booking = @instrument.bookings.new(booking_params)\n @booking.user = current_user\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: t('.success') }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n invalid_booking = false\n duration = params[:booking][:duration].to_i\n quantity = params[:booking][:quantity].to_i\n bk_day = params[:booking][:booking_day]\n bk_day = Date.strptime(bk_day, '%Y-%m-%d')\n last_day = bk_day + duration.days\n room = params[:booking][:room_id]\n @bookings = []\n @availability_update = []\n\n #Check Availability for room on each day and given quantity.\n #If all available for all days, create bookings and save.\n #Reduce Availability quantity for each day.\n\n (bk_day..last_day).each {|day|\n available = Availability.where(available_day:day).where(room_id:room).where(\"quantity>?\",quantity).first\n\n if available\n #build on params and given date.\n #then add to array of bookings/\n @booking = current_user.bookings.build(booking_params)\n @booking.booking_day = day\n @bookings << @booking\n available.quantity = available.quantity - quantity\n @availability_update << available\n else\n invalid_booking = true\n break\n end\n }\n\n if !invalid_booking\n @bookings.each(&:save!)\n @availability_update.each(&:save!)\n render :json => current_user.bookings, status: :created\n else\n puts 'invalid booking'\n render :json => current_user.bookings, status: :unprocessable_entity\n end\n\n end", "def create\n # @user = User.find(params[:user_id])\n # parking = Parking.find(params[:parking_id])\n # @booking = @user.bookings.build(parking: parking, user: @user)\n @booking = @user.bookings.build(parking: @parking)\n @booking.update(booking_params)\n\n\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @current_user = User.find(session[:user_id])\n @booking = Booking.new(\n user_id: @current_user.id,\n department_id: params[:data]['department_id'],\n timeStamp: params[:data]['timeStamp'],\n doctorsBoard: params[:data]['doctorsBoard'],\n description: params[:data]['description']\n )\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n @booking.save\n redirect_to action: \"index\"\n end", "def create\n @booking = Booking.new(booking_params)\n begin\n @response = Booking.create_booking(booking_options)\n @booking.log = @response\n @booking.picap_id = @response[\"_id\"]\n notice = \"Booking was successfully created.\"\n rescue RestClient::Exception => exception\n @booking.log = exception.response\n alert = exception.response\n end\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to root_path, notice: notice, alert: alert }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking = Booking.new(booking_params)\n @booking.user_id = current_user.id\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.new(book_params)\n\n if @book.save\n render json: @book, status: :created, location: @book\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def booking_params\n params.require(:booking).permit(:number_of_adults, :number_of_children, :price_id, :sale_id, :agent_id, :comment, :progress)\n end", "def create\n @booking = @room.bookings.build(params[:booking])\n\n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Booking was successfully created.'\n format.html { redirect_to property_url(@room.property) }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bookkeeping = @group.bookkeepings.new()\n @bookkeeping.attributes = bookkeeping_params\n @bookkeeping.writer_id = current_user.id\n if @bookkeeping.save\n render json: @bookkeeping, status: :created, location: @bookkeeping\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def create\n # puts params\n @booking = Booking.new(booking_params)\n respond_to do |format|\n if Booking.validate(booking_params) and Booking.time_checking(@booking) and @booking.save\n # if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.'}\n format.json { render :index, status: :created, location: @booking }\n else\n # @listing_id = @booking.listing_id\n format.html { redirect_to bookings_new_path(:listing_id => @booking.listing_id)}\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n flash[:notice] = \"The date is invalid or is booked.\"\n end\n end\n end", "def create\n @ninety_ten_booking = NinetyTenBooking.new(ninety_ten_booking_params)\n\n respond_to do |format|\n if @ninety_ten_booking.save\n format.html { redirect_to @ninety_ten_booking, notice: 'Ninety ten booking was successfully created.' }\n format.json { render :show, status: :created, location: @ninety_ten_booking }\n else\n format.html { render :new }\n format.json { render json: @ninety_ten_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @bookings = Booking.all\n end", "def index\n @service_bookings = ServiceBooking.all\n\n render json: @service_bookings\n end", "def index\n @bookings = Booking.all\n respond_with(@bookings)\n end", "def index\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @bookings = prep_bookings\n render json: @bookings, status: :ok\n end", "def create \n bparams = booking_params\n bparams[:created_by] = User.find_by_name(session[:user])\n bparams[:date] = Date.strptime(session[:date], \"%d.%m.%Y\")\n \n bparams[:accounting_number] = Booking.where(account_id: bparams[:account_id]).map {|b| b.accounting_number}.compact.max.to_i+1\n \n @booking = Booking.new(bparams)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to :back, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking_status = BookingStatus.new(booking_status_params)\n\n respond_to do |format|\n if @booking_status.save\n format.html { redirect_to @booking_status, notice: 'Booking status was successfully created.' }\n format.json { render :show, status: :created, location: @booking_status }\n else\n format.html { render :new }\n format.json { render json: @booking_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @listing = Listing.find_by_id(listing_id_from_params[:listing_id].to_i)\n @booking = @listing.bookings.build(booking_params)\n @booking.user_id = current_user.id\n @booking.price = @booking.calculate_total_price(@listing.price)\n\n respond_to do |format|\n if @booking.save\n BookingJob.perform_later(@booking, \"new\")\n format.html { redirect_to listing_path(@listing), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bookings = smart_listing_create(:bookings, Booking.includes(:seat, :user).where(user_id: current_user.id), partial: \"bookings/listing\")\n end", "def create\n @booking = current_user.bookings.build(booking_params)\n @booking.user = current_user\n logger = MyLogger.instance\n logger.logInformation(\"A new booking made for: \" + @booking.cut)\n respond_to do |format|\n if @booking.save\n format.html { redirect_to @booking, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tablebooking = Tablebooking.new(tablebooking_params)\n\n respond_to do |format|\n if @tablebooking.save\n format.html { redirect_to @tablebooking, notice: 'Tablebooking was successfully created.' }\n format.json { render :show, status: :created, location: @tablebooking }\n else\n format.html { render :new }\n format.json { render json: @tablebooking.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.permit(:user_id, :job_id, :acceptance)\n end", "def booking_params\n params.require(:booking).permit(:start_day, :end_day, :hikers_nb, :user_id, :refuge_id, :status, :payment, :amount)\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def new\n @booking = Booking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @booking }\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def create\n @api_book = Api::Book.new(api_book_params)\n\n if @api_book.save\n render json: @api_book, status: :created, location: @api_book\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def booking_params\n params.require(:booking).permit(:salon_id, :total_price, :service_ids)\n end", "def create\n\n @user = User.find(params[:user_id])\n @flight = Flight.find(params[:flight_id])\n @booking = @user.bookings.new(booking_params)\n respond_to do |format|\n if @booking.save\n format.html { redirect_to booking_path(current_user,@flight,@booking), notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking(data)\n payload = safe_access(data)\n\n params = {\n property_id: payload.get(\"inquiry.room.property_id\"),\n inquiry_id: payload.get(\"inquiry.id\"),\n unit_id: payload.get(\"inquiry.room.unit_id\"),\n check_in: payload.get(\"inquiry.check_in\"),\n check_out: payload.get(\"inquiry.check_out\"),\n guests: payload.get(\"inquiry.num_guests\"),\n subtotal: payload.get(\"inquiry.subtotal\"),\n currency_code: payload.get(\"inquiry.currency_code\"),\n customer: {\n first_name: payload.get(\"inquiry.user.first_name\"),\n last_name: payload.get(\"inquiry.user.last_name\"),\n email: payload.get(\"inquiry.user.email\"),\n phone: payload.get(\"inquiry.user.phone_number\")\n }\n }\n\n env[\"rack.input\"] = StringIO.new(json_encode(params))\n true\n end", "def index\n @bookings = Booking.all\n end", "def booking_params\n params.require(:booking).permit(:date_check_in, :date_check_out,\n :total_price, :status, :description)\n end", "def create\n @booking = @salon.bookings.new(booking_params)\n selected_days = params[:select_days]\n selected_time = params[:select_time]\n timeslot = Time.parse(\"#{selected_days} #{selected_time}\")\n @booking.bookings_services.build(service_id: params[:booking][:service_ids][0], timeslot: timeslot)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to [@salon, @booking], notice: \"Booking was successfully created.\" }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @book = Book.find(book_request_params[:book_id])\n @account = Account.find(params[:account_id])\n @book_request = BookRequest.new(book: @book, reader: @account, holder: @book.account)\n respond_to do |format|\n if @book_request.save\n format.json {\n render json:\n {\n book_id: @book_request.book_id,\n book_request_state: @book_request.state_name\n }\n }\n else\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @booking_waitlist = BookingWaitlist.new(booking_waitlist_params)\n\n respond_to do |format|\n if @booking_waitlist.save\n format.html { redirect_to @booking_waitlist, notice: 'Booking waitlist was successfully created.' }\n format.json { render :show, status: :created, location: @booking_waitlist }\n else\n format.html { render :new }\n format.json { render json: @booking_waitlist.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bookalawn = Bookalawn.new(bookalawn_params)\n\n respond_to do |format|\n if @bookalawn.save\n format.html { redirect_to @bookalawn, notice: 'Booking was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bookalawn }\n else\n format.html { render action: 'new' }\n format.json { render json: @bookalawn.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:cut, :wash, :colour)\n end", "def booking_params\n params.fetch(:booking).permit(:checkin, :checkout, :occupancy)\n end", "def create\n \n @booking = Booking.new(params[:booking])\n params[:booking][:end_time] = @booking.end_time\n \n\n \n @booking = Booking.new(params[:booking])\n if @booking.weights == 1\n @booking.no_ergs = 0\n end\n \n respond_to do |format|\n if @booking.save\n flash[:notice] = 'Your booking was successfully created.'\n format.html { redirect_to bookings_path }\n format.xml { render :xml => @booking, :status => :created, :location => @booking }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bidding = Bidding.new(params[:bidding])\n\n respond_to do |format|\n if @bidding.save\n format.html { redirect_to @bidding, notice: 'Bidding was successfully created.' }\n format.json { render json: @bidding, status: :created, location: @bidding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def booking_params\n params.require(:booking).permit(:fan_id, :user_id, :start_date, :end_date, :status)\n end", "def booking_params\n params.require(:booking).permit(:bookingStartDate, :bnookigEndDate, :user_id, :book_id)\n end", "def create\n @booking = Booking.new(booking_params)\n respond_to do |format|\n if @booking.save(booking_params)\n format.html { redirect_to week_path, notice: 'Booking was successfully created.' }\n format.json { render :show, status: :created, location: month_path }\n else\n format.html { redirect_to week_path, notice: 'Booking overlaps with current booking' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reviewing = Reviewing.new(reviewing_params)\n @book = @reviewing.book\n @user = User.find(current_user.id)\n @user.reviewings << @reviewing\n @book.updateRate(@book.id)\n\n respond_to do |format|\n if @reviewing.save\n format.html { redirect_to book_reviewings_path(@reviewing.book.isbn), notice: 'Reviewing was successfully created.' }\n format.json { render :show, status: :created, location: @reviewing }\n else\n format.html { render :new }\n format.json { render json: @reviewing.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit( :check_in, :checkout, :service_id)\n end", "def index\n @bookings = @user.bookings\n end", "def booking_params\n params.require(:booking).permit(:room_id, :room_type_id, :customer_id, :check_in_date, :check_out_date, :total_price, :num_of_adults, :num_of_children)\n end", "def booking_params\n params.require(:booking).permit(:user_id, :room_id, :book_date, :timespot_id)\n end", "def create\n @booking = @user.bookings.new(booking_params)\n @booking.movie = @movie\n @booking.tickets = @booking.build_tickets(ticket_types_params)\n\n respond_to do |format|\n if @booking.save\n format.html { redirect_to seats_movie_booking_path(@movie,@booking) }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gbooking = Gbooking.new(gbooking_params)\n @gbooking.user = current_user if current_user\n if @gbooking.save\n params[:customizebookings].each_with_index do |customizebooking,index|\n customizebooking.permit!\n @customizebooking = Customizebooking.new(customizebooking.permit!)\n @customizebooking.number = index + 1\n @customizebooking.gbooking = @gbooking\n @customizebooking.save\n end\n\n respond_to do |format|\n format.html { redirect_to(@gbooking, :notice => 'Customizebooking was successfully created.') }\n format.xml { render :xml => @customizebooking, :status => :created, :location => @customizebooking }\n end\n end\n end", "def create\n @shipping_book = ShippingBook.new(shipping_book_params)\n\n respond_to do |format|\n if @shipping_book.save\n format.html { redirect_to @shipping_book, notice: 'Shipping address in Shipping book was successfully created.' }\n format.json { render :show, status: :created, location: @shipping_book }\n else\n format.html { render :new }\n format.json { render json: @shipping_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:book_name, :book_date, :tour_name, :book_price, :book_ticket_num,:book_amount,:package_id,:user_id,:status,:tax,:total_amount,:other)\n end", "def on_date\n @bookings = []\n @bookings = Booking.on_date(params[:booking_date]) if params[:booking_date]\n \n respond_to do |format|\n format.html {render \"index\"}\n format.json {render json: @bookings}\n end\n \n end", "def create\n @online_booking = OnlineBooking.new(online_booking_params)\n\n respond_to do |format|\n if @online_booking.save\n format.html { redirect_to @online_booking, notice: 'Online booking was successfully created.' }\n format.json { render :show, status: :created, location: @online_booking }\n else\n format.html { render :new }\n format.json { render json: @online_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: { booking: @booking }, status: 200\n end", "def booking_params\n params.require(:booking).permit(:check_in, :check_out, :total_amount, :rental_amount, :service_fee)\n end", "def create\n @borrowed_book = BorrowedBook.new(borrowed_book_params)\n\n respond_to do |format|\n if @borrowed_book.save\n format.html { redirect_to @borrowed_book, notice: \"Borrowed book was successfully created.\" }\n format.json { render :show, status: :created, location: @borrowed_book }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @borrowed_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @booking = Booking.find(params[:id])\n render json: @booking\nend", "def booking_params\n params.require(:booking).permit(:booking_reference, :institution, :ticket_type, :access_req, :catering, :certificate, :attended, :dietary_req, :conference_id, :user_id)\n end", "def booking_params\n params.require(:booking).permit(:reference)\n end", "def create\n\n checkIn = parse_datetime_params booking_params, \"check_in\", utc_or_local = \"AEST\"\n checkOut = parse_datetime_params booking_params, \"checkout\", utc_or_local = \"AEST\"\n @service_id = params[:booking][:service_id].to_i\n @consultant_id = Service.find(@service_id).user_id\n @consumer_id = current_user.id\n\n @booking = Booking.new({\n consultant_id: @consultant_id,\n consumer_id: @consumer_id,\n service_id: @service_id,\n status: \"Unconfirmed\",\n check_in: checkIn,\n checkout: checkOut\n })\n\n respond_to do |format|\n if @booking.save\n # ContactMailer.send_contact_email(message:\"Accepted\").deliver_now\n format.html { redirect_to @booking, notice: 'Booking was successfully created. This booking will not be confirmed until the consultant approves it.' }\n format.json { render :show, status: :created, location: @booking }\n else\n format.html { render :new }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @room_booking = RoomBooking.new(room_booking_params)\n\n respond_to do |format|\n if @room_booking.save\n format.html { redirect_to @room_booking, notice: 'Room booking was successfully created.' }\n format.json { render :show, status: :created, location: @room_booking }\n else\n format.html { render :new }\n format.json { render json: @room_booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_lawn\n book_lawn = Lawnbookings.where(booking_date: params[:booking_date], lawn_no: params[:lawn_no])\n \n if book_lawn.count == 0\n @book_lawn = Lawnbookings.new\n @book_lawn.lawn_no = params[:lawn_no]\n @book_lawn.booking_date = params[:booking_date]\n @book_lawn.save\n end\n if request.xhr?\n render :json => {booking_date: params[:booking_date], lawn_no: params[:lawn_no] } \n end\n end", "def create\n @booking = Booking.new(booking_params.merge(user_id: current_user.id))\n respond_to do |format|\n if @booking.save\n format.html { redirect_to action: :index, notice: 'Booking was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:seller_id, :buyer_id, :room_id, :first_name, :last_name,\n :email, :phone, :duration, :guest, :subtotal, \n :service_fee, :total, :room_name, :room_title, :status, :paid,\n :check_in, :check_out, :start_date, :booking_code, :payment_method)\n end", "def create\n @booking = Booking.new\n @booking.ride = @ride\n @booking.user = current_user\n @booking.booking_status = 'pending'\n if @booking.save!\n redirect_to dashboard_path\n else\n render :new\n end\n end", "def create\n @booking_confirmation = BookingConfirmation.new(booking_confirmation_params)\n\n respond_to do |format|\n if @booking_confirmation.save\n format.html { redirect_to @booking_confirmation, notice: 'Booking confirmation was successfully created.' }\n format.json { render :show, status: :created, location: @booking_confirmation }\n else\n format.html { render :new }\n format.json { render json: @booking_confirmation.errors, status: :unprocessable_entity }\n end\n end\n end", "def booking_params\n params.require(:booking).permit(:status, :seatsToBook, :username, :tourname, :user_id, :tour_id, :mode_of_booking)\n end", "def create\n\n @book = Book.new(params[:book])\n\n respond_to do |format|\n if @book.save\n format.html { redirect_to \"/books\", notice: 'Book was successfully created.' }\n format.json { render json: @book, status: :created, location: @book }\n else\n format.html { render action: \"new\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend" ]
[ "0.7353111", "0.7228384", "0.68615675", "0.6782987", "0.6782987", "0.67671645", "0.6642527", "0.66402507", "0.6624695", "0.65151906", "0.6509862", "0.6509862", "0.6509862", "0.64893967", "0.6432859", "0.6378296", "0.634707", "0.63245595", "0.6297444", "0.62888706", "0.6278033", "0.6277215", "0.6276671", "0.624728", "0.6246537", "0.62225837", "0.6215284", "0.6198113", "0.61980736", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.61961746", "0.6189877", "0.61839604", "0.61654115", "0.6153496", "0.6142819", "0.6137891", "0.6137112", "0.6126674", "0.61236805", "0.61116433", "0.6111565", "0.6108925", "0.6108925", "0.61034364", "0.6095088", "0.609437", "0.60901517", "0.607948", "0.6061495", "0.60604256", "0.6053243", "0.6048258", "0.6045076", "0.603975", "0.6036313", "0.6034784", "0.60307556", "0.60295653", "0.6023572", "0.6023286", "0.60165375", "0.6010729", "0.60034376", "0.6003299", "0.6002788", "0.59925467", "0.5986861", "0.5979354", "0.5973712", "0.59579116", "0.5956852", "0.59525394", "0.59507626", "0.59453785", "0.5942715", "0.59384996", "0.5938434", "0.59306085", "0.5929958", "0.59293985", "0.59283525", "0.59279317", "0.5927621", "0.59197617", "0.5917992", "0.59158117", "0.5913346", "0.5902699", "0.5897789" ]
0.0
-1
PATCH/PUT /bookings/1 PATCH/PUT /bookings/1.json
def update respond_to do |format| if @booking.update(booking_params) format.html { redirect_to @booking, notice: 'Booking was successfully updated.' } format.json { render :show, status: :ok, location: @booking } else format.html { render :edit } format.json { render json: @booking.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @booking = Booking.find(params[:id])\n\n if @booking.update(booking_params)\n head :no_content\n else\n render json: @booking.errors, status: :unprocessable_entity\n end\n end", "def update\n @booking = Booking.find(params[:id])\n @booking.update_attributes(params[:booking])\n respond_with(@booking)\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n booking = Booking.find(params[:id])\n \n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.update_attributes(booking_params) \n render json: { status: 'SUCCESS', message: 'Updated booking', data: booking }, status: :ok\n else\n render json: { status: 'ERROR', message: 'Booking not updated', data: booking.errors }, status: :unprocessable_entity\n end\n end\n end", "def update\n @booking = @room.bookings.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n flash[:notice] = 'Booking was successfully updated.'\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_path, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to bookings_url, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to profile_bookings_url(@profile), notice: 'Booking was successfully updated.' }\n format.json { render :index, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er blevet opdateret.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors.messages, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @bookkeeping.update(bookkeeping_params)\n head :no_content\n else\n render json: @bookkeeping.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @bookable.update(bookable_params)\n format.html { redirect_to @bookable, notice: 'Bookable was successfully updated.' }\n format.json { render :show, status: :ok, location: @bookable }\n else\n format.html { render :edit }\n format.json { render json: @bookable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: \"Booking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: \"Booking was successfully updated.\" }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params_update)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to show_booking_path, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to current_user, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_back(fallback_location: salons_path) }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @booking.update(booking_params)\n format.html { redirect_to hairdresser_booking_path(@hairdresser, @booking), notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\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 update\n respond_to do |format|\n if @booking.update(booking_params.except(:mode_of_booking))\n format.html { redirect_to @booking, notice: 'Booking was successfully updated.' }\n format.json { render :show, status: :ok, location: @booking }\n else\n format.html { render :edit }\n format.json { render json: @booking.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_api_v1_booking\n @api_v1_booking = Booking.find(params[:id])\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @booking = Booking.find_by(id: params[:id])\n @booking.update(acceptance: true)\n UserMailer.confirm_email(@booking).deliver_now\n redirect_to job_bookings_path(params[:job_id]), notice: 'Application was successfully updated.' \n # respond_to do |format|\n # if @booking.update(booking_params)\n # format.html { redirect_to @booking, notice: 'Application was successfully updated.' }\n # format.json { render :show, status: :ok, location: @booking }\n # else\n # format.html { render :edit }\n # format.json { render json: @booking.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @booking = Booking.find(params[:id])\n\n respond_to do |format|\n if @booking.update_attributes(params[:booking])\n flash[:notice] = 'Booking was successfully updated.'\n format.html { redirect_to(@booking) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @booking.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find_by_id(params[:id])\n\n if @book.present?\n if @book.update(book_params)\n render json: {\n type: 'success',\n result: @book\n }, status: :created\n else\n render json: {\n type: 'failed',\n message: @book.errors,\n result: {}\n }, status: :bad_request\n end\n else\n render json: {\n type: 'failed',\n message: 'data with id:' + params[:id] + ' not found',\n result: {},\n }, status: :not_found\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_request.update(book_request_params)\n format.html { redirect_to @book_request, notice: 'Book request was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_request }\n else\n format.html { render :edit }\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bookalawn.update(bookalawn_params)\n format.html { redirect_to @bookalawn, notice: 'Booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bookalawn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70660025", "0.7035505", "0.6951961", "0.69296867", "0.69296867", "0.69296867", "0.6925516", "0.68727815", "0.67891777", "0.6737531", "0.67097384", "0.66938263", "0.66938263", "0.66938263", "0.66782904", "0.66559863", "0.66393423", "0.66337067", "0.6626812", "0.6624749", "0.6619827", "0.65981305", "0.6595154", "0.6593476", "0.65934265", "0.659084", "0.6584183", "0.6584166", "0.6561052", "0.65553087", "0.65322477", "0.6529612", "0.6523589", "0.6515063", "0.6515063", "0.6515063", "0.6515063", "0.6515063", "0.6515063", "0.6515063", "0.6515063", "0.6515063", "0.6507954", "0.64862746", "0.64797735", "0.64761007", "0.6454814", "0.6449431", "0.64331555", "0.64331055", "0.643187", "0.6429618", "0.64226043", "0.6413251", "0.64013135", "0.63997084", "0.63967204", "0.63967204", "0.6392915", "0.63899714", "0.63899714", "0.63899714", "0.63899714", "0.63848686", "0.63805646", "0.6373867", "0.6373513", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871", "0.6372871" ]
0.66082895
33
DELETE /bookings/1 DELETE /bookings/1.json
def destroy @booking.destroy respond_to do |format| format.html { redirect_to home_path, notice: 'Booking was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :ok }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to '/bookings' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: t('.success') }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(bookings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_index_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to admin_bookings_url, notice: 'Bookingen er nu slettet.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: \"Booking was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end", "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def destroy\n @booking = @room.bookings.find(params[:id])\n @booking.destroy\n\n respond_to do |format|\n format.html { redirect_to property_room_bookings_url(@property, @room) }\n format.xml { head :ok }\n end\n end", "def destroy\n sql = \"DELETE FROM Booking WHERE bookingId = #{params[:id]}\"\n ActiveRecord::Base.connection.execute(sql)\n\n respond_to do |format|\n format.html { redirect_to bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n\n head :no_content\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bidding = Bidding.find(params[:id])\n @bidding.destroy\n\n respond_to do |format|\n format.html { redirect_to biddings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to profile_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to bookings_url }\n end\n end", "def destroy\n @book_shelf = BookShelf.find(params[:id])\n @book_shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to book_shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bookable.destroy\n respond_to do |format|\n format.html { redirect_to bookables_url, notice: 'Bookable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html do\n redirect_to bookings_url,\n notice: 'Booking was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @bookalawn.destroy\n respond_to do |format|\n format.html { redirect_to bookalawns_url }\n format.json { head :no_content }\n end\n end", "def delete_bookings()\n sql = \"DELETE FROM bookings\n WHERE bookings.member_id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to static_pages_new_booking_enquiry_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @booking = Booking.find(params[:id])\n @booking.destroy\n respond_with(@booking)\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to options_path, notice: 'Booking was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to hairdresser_bookings_path(@hairdresser), notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @guestbook = Guestbook.find(params[:id])\n @guestbook.destroy\n\n respond_to do |format|\n format.html { redirect_to guestbooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to portal_bookings_url, notice: 'booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @booking.destroy\n respond_to do |format|\n format.html { redirect_to user_bookings_url, notice: 'Application was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @businessbook = Businessbook.find(params[:id])\n @businessbook.destroy\n\n respond_to do |format|\n format.html { redirect_to businessbooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fg_booking.destroy\n respond_to do |format|\n format.html { redirect_to fg_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def delete\n api_delete(\"/listings/#{@listing_id}\")\n end", "def destroy\n booking = Booking.find(params[:id])\n\n # Check if user is the owner of the booking\n if current_user[:id] == booking[:user_id]\n if booking.destroy\n render json: { status: 'SUCCESS', message: 'Deleted booking', data: booking }, status: :ok\n else\n render json: { status: 'FAILURE', message: 'Something went wrong' }, status: :unprocessable_entity\n end\n end\n end", "def destroy\n @tblbooking.destroy\n respond_to do |format|\n format.html { redirect_to tbl_bookings_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_booking = TestBooking.find(params[:id])\n @test_booking.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_bookings_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tablebooking.destroy\n respond_to do |format|\n format.html { redirect_to tablebookings_url, notice: 'Tablebooking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_progress.destroy\n respond_to do |format|\n format.html { redirect_to book_progresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n booking = @booking\n @booking.destroy\n respond_to do |format|\n flash[:success] = \"Your Booking was Cancelled Successfully\"\n format.html { redirect_to bookings_url}\n format.json { head :no_content }\n end\n end", "def destroy\n @booking_status.destroy\n respond_to do |format|\n format.html { redirect_to booking_statuses_url, notice: 'Booking status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_step = BookStep.find(params[:id])\n @book_step.destroy\n\n respond_to do |format|\n format.html { redirect_to book_steps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bidding.destroy\n respond_to do |format|\n format.html { redirect_to biddings_url, notice: 'Bidding was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @booking.destroy\n respond_to do |format|\n format.html { redirect_to grounds_url, notice: 'Booking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @bookkeeping.destroy\n\n head :no_content\n end" ]
[ "0.7660707", "0.7660707", "0.7660707", "0.7660707", "0.7657568", "0.7565737", "0.75498253", "0.75498253", "0.739592", "0.7359668", "0.7359668", "0.729106", "0.72711414", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724865", "0.724861", "0.72474027", "0.7243795", "0.7243795", "0.7240045", "0.72398716", "0.72395927", "0.72278243", "0.72186166", "0.7204612", "0.71994567", "0.71873736", "0.7173599", "0.7169725", "0.7169493", "0.7155298", "0.7153458", "0.7148876", "0.7145432", "0.71424234", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.7140181", "0.71385974", "0.71385974", "0.713271", "0.71215683", "0.7104804", "0.70873666", "0.7085463", "0.7085463", "0.7085463", "0.7085463", "0.7085463", "0.7085463", "0.7085463", "0.70769304", "0.7074334", "0.706808", "0.70601404", "0.7051713", "0.70437735", "0.70199597", "0.7010398", "0.7006443", "0.7005126", "0.6986635", "0.69730276", "0.69596344", "0.6955844", "0.6954383", "0.6953511", "0.69530857", "0.6951499", "0.6951499", "0.69402784", "0.6934259", "0.6922136", "0.69216913" ]
0.70330614
83
Use callbacks to share common setup or constraints between actions.
def set_booking @booking = Booking.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 booking_params params.require(:booking).permit(:user_id, :room_id, :booking_start_time, :email) 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 strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \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 model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "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 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 url_whitelist; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def 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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004", "0.6290563", "0.6284484", "0.62436926", "0.6239928", "0.62184125", "0.62158304", "0.6210187", "0.6194002", "0.61786795", "0.61759156", "0.617342", "0.6162248", "0.61528504", "0.61527", "0.6146735", "0.6122714", "0.61169004", "0.61082125", "0.61052656", "0.6091036", "0.60807735", "0.6070328", "0.60634184", "0.60213035", "0.6017676", "0.6013606", "0.601112", "0.6007318", "0.6007318", "0.6001461", "0.6001135", "0.59966296", "0.5992013", "0.59919006", "0.599182", "0.5980991", "0.59676576", "0.5960269", "0.59588194", "0.59585214", "0.59578323", "0.5953503", "0.5952524", "0.59432703", "0.5939858", "0.59388995", "0.59388995", "0.5933866", "0.5930038", "0.5925672", "0.5924214", "0.59169805", "0.59106255", "0.5910254", "0.59086037", "0.5906149", "0.5898294", "0.58981514", "0.5896171", "0.58944154", "0.58943397", "0.5892325", "0.5887239", "0.58842856", "0.5880209", "0.5874584", "0.58694917", "0.5868719", "0.58669394", "0.5866552", "0.58662945", "0.5864085", "0.58623236", "0.5862258", "0.58597904", "0.58579135", "0.58542645", "0.5853335", "0.58517563", "0.5850614" ]
0.0
-1
GET /clients or /clients.json
def index @clients = Client.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @clients = current_user.clients\n render json: @clients\n end", "def index\n @clients = Client.all\n render json: @clients\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "def index\n clients = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients\"\n ).body\n end\n styled_header(\"OAuth Clients\")\n styled_array(clients.map { |client|\n [client[\"name\"], client[\"id\"], client[\"redirect_uri\"]]\n })\n end", "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def client(client, options = {})\n get(\"clients/#{client}\", options).pop\n end", "def index\n @clients = Client.where(params.except(:action, :controller, :format)).to_a # TODO: remove .to_a when Rails to_json bug fixed\n respond_with(@clients)\n end", "def show\r\n @client = Client.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @client }\r\n end\r\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def show\n @client = clients.find(params[:id])\n end", "def show\n\t\t@client = Client.find(params[:id])\n\t\tif @client.status != 0\n\t\t\trender :json => @client, status: 200\n\t\telse\n\t\t\trender :json => @client.status, status: 400\n\t\tend\n\tend", "def get_clients_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthClientsApi.get_clients ...\"\n end\n # resource path\n local_var_path = \"/auth/clients\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceClientResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthClientsApi#get_clients\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_clients(json_payload={})\n conn = @client.get do |req|\n req.url \"/api/v2/client/list?\"\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def show\n render json: @client\n end", "def show\n @client = Client.find(params[:id])\n respond_with(@client)\n end", "def show\n @client = Client.find(params[:id])\n respond_with(@client)\n end", "def index\n render json: Client.all\n end", "def find_client\n cliente = get_cliente(params[:id])\n\n respond_to do |format|\n format.json {render json: {client: cliente}}\n end\n end", "def index\n get_clientes\n end", "def get_clients\n @clients\n end", "def get_clients\n @clients\n end", "def show\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:show [ID]\")\n\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end", "def index \n @clients = ApiClient.all\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def clients\n response = User_GetClients()\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"Client\"].collect{|c| Client.new(c[\"ClientID\"].to_i, c[\"Name\"])}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end", "def show\n @client = Client.find(params[:id])\n authorize! :read, @client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def index\n @clients = Client.all\n end", "def index\r\n user = authenticate\r\n if user\r\n clients = Client.where('clientof = ?', user.id)\r\n render json: {clients: clients, message: 'Success', status: :ok}\r\n else\r\n render json: {message: 'Invalid token', status: :unauthorized}\r\n end\r\n end", "def index\n @clients = Client.page(params[:page] || 1).per(10)\n end", "def recent\n if current_user.is_admin?\n @clients = Client.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def index\n add_breadcrumb(I18n.t('model.list', model: Client.model_name.human))\n\n @clients = Client.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @clients = get_clients\n @client = Client.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @client }\n format.js\n end\n end", "def show\n @client = Client.find(params[:id])\n if @client.nil?\n @clients = Client.all\n flash.now[:alert] = \"Les détails du client n'ont pas été trouvés\"\n render \"index\"\n end\n respond_to do |format|\n format.html #show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def index\n @page_count, @clients = Locomotive::Client.paginated(:page => (params[:page] || 1).to_i)\n display @clients\n end", "def index\n puts params\n puts params[:filter]\n \n @clients = get_clients \n @client = Client.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def show\n @client = Client.find(params[:id])\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def index\n @clients = current_user.is_admin ? Client.all : current_user.clients\n end", "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def clients\n @clients = Vendor.find(params[:id]).clients\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end", "def show\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_client }\n end\n end", "def index_clients\n @client = Client.all\n end", "def show\n\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def clients\r\n ClientsController.instance\r\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def clients\n Harvest::Resources::Client\n end", "def show\n @client = Client.find_by(id: params[:id])\n end", "def client_detail\n service_response = UserManagement::GetClientDetail.new(params).perform\n render_api_response(service_response)\n end", "def all_clients\n resp = get CLIENT_API_PATH\n result = process_response(resp)\n return [] if result.empty? # In case response is {}\n result.each.map { |c| Resources::Client.new(c) }\n end", "def clients\n @clients ||= Harvest::API::Clients.new(credentials)\n end", "def show\n @client = Client.find(params[:id])\n\n end", "def show\n @client = Client.find(@current_user[\"client_id\"])\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @client }\n end\n end", "def client_by_name(client_name, options={})\n params = {\n :klass => Invoicexpress::Models::Client,\n :client_name => client_name\n }\n\n get(\"clients/find-by-name.xml\", params.merge(options))\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def index\n \n @qa_clients = QaClient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qa_clients }\n end\n end", "def get_clients(opts = {})\n data, _status_code, _headers = get_clients_with_http_info(opts)\n return data\n end", "def index\n @clients = current_user.account.clients.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page => params[:page])\n\n @account = current_user.account\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def client(client_id, options={})\n params = { :klass => Invoicexpress::Models::Client }\n\n get(\"clients/#{client_id.to_s}.xml\", params.merge(options))\n end", "def clients_index\n @clients = User.clients\n end", "def clients!\n @clients = search_clients clients_doc!\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end", "def index\n if @clients.count > 0\n @client = params[:client_id].blank? ? @clients[0] :\n Client.find_by_id(params[:client_id])\n @client = @clients[0] unless @client\n else\n @clients = Array.new\n end\n end", "def get_clients\n Client.get(:all).map{|c| c.to_ws}\n end", "def index\n @clients = Client.search(params[:search]).order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n respond_with(@clients)\n end", "def show\n @client = Client.find params[:id]\n end", "def index\n @apps = @client.apps\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @apps }\n end\n end", "def info &block\n em_get( \"/clients/#{uuid}\" ) { |response| block.call( response ) }\n end", "def get_client(id)\n conn = @client.get do |req|\n req.url \"/api/v2/client/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def show\n @my_studio_client = MyStudio::Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_studio_client }\n end\n end", "def show\n @cliente = Cliente.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end", "def index\n @clients = Client.all.paginate(page: params[:page], per_page: 4)\n end" ]
[ "0.75374585", "0.7330886", "0.7307635", "0.72432935", "0.7184106", "0.7164839", "0.71297824", "0.71297824", "0.71297824", "0.71297824", "0.71297824", "0.71297824", "0.71297824", "0.7128865", "0.71083707", "0.7085555", "0.705713", "0.7012124", "0.7004734", "0.6977244", "0.69520146", "0.69423884", "0.6885714", "0.6866808", "0.6866808", "0.6856516", "0.6842825", "0.68406403", "0.6833557", "0.6833557", "0.68209904", "0.6805234", "0.67907375", "0.6741473", "0.6735239", "0.67321247", "0.6727462", "0.6720504", "0.6719959", "0.67100185", "0.67080736", "0.669344", "0.66629606", "0.66561866", "0.66559035", "0.6651147", "0.66290706", "0.6609572", "0.6609214", "0.66063863", "0.6601155", "0.6575382", "0.65628356", "0.6537897", "0.6528117", "0.6525491", "0.6476559", "0.6466405", "0.6465293", "0.6465293", "0.6465293", "0.6465293", "0.64622694", "0.6429473", "0.6413746", "0.6399756", "0.6395322", "0.6391381", "0.6382998", "0.6377292", "0.6366342", "0.635885", "0.63483214", "0.6346283", "0.634045", "0.634045", "0.63396835", "0.6334571", "0.6333312", "0.6326607", "0.6307973", "0.6307973", "0.6307973", "0.63060933", "0.6295792", "0.6291543", "0.62913567", "0.6289421", "0.62725943", "0.6246593", "0.6238695", "0.62312835", "0.6221936" ]
0.67724645
38
GET /clients/1 or /clients/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client(client, options = {})\n get(\"clients/#{client}\", options).pop\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def show\n\t\t@client = Client.find(params[:id])\n\t\tif @client.status != 0\n\t\t\trender :json => @client, status: 200\n\t\telse\n\t\t\trender :json => @client.status, status: 400\n\t\tend\n\tend", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def show\n @client = clients.find(params[:id])\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "def show\r\n @client = Client.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @client }\r\n end\r\n end", "def index\n sanitized_params = parse_params(client_where_params)\n clients = Client.find_all(sanitized_params)\n render json: clients\n end", "def index\n @clients = Client.all\n render json: @clients\n end", "def find_client\n cliente = get_cliente(params[:id])\n\n respond_to do |format|\n format.json {render json: {client: cliente}}\n end\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def index\n @clients = Client.where(params.except(:action, :controller, :format)).to_a # TODO: remove .to_a when Rails to_json bug fixed\n respond_with(@clients)\n end", "def show\n @client = Client.find(params[:id])\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client }\n end\n end", "def get_clients_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthClientsApi.get_clients ...\"\n end\n # resource path\n local_var_path = \"/auth/clients\"\n\n # query parameters\n query_params = {}\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceClientResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthClientsApi#get_clients\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @client = Client.find(params[:id])\n respond_with(@client)\n end", "def show\n @client = Client.find(params[:id])\n respond_with(@client)\n end", "def show\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:show [ID]\")\n\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if options[:shell]\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end", "def index\n clients = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/clients\"\n ).body\n end\n styled_header(\"OAuth Clients\")\n styled_array(clients.map { |client|\n [client[\"name\"], client[\"id\"], client[\"redirect_uri\"]]\n })\n end", "def details\n response = CreateSend.get \"/clients/#{client_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def list_clients(json_payload={})\n conn = @client.get do |req|\n req.url \"/api/v2/client/list?\"\n req.headers[\"Authorization\"] = @token\n req.params = json_payload\n end\n conn.body\n end", "def show\n render json: @client\n end", "def get_clients\n @clients\n end", "def get_clients\n @clients\n end", "def index\n @clients = Client.page(params[:page] || 1).per(10)\n end", "def index\n if @clients.count > 0\n @client = params[:client_id].blank? ? @clients[0] :\n Client.find_by_id(params[:client_id])\n @client = @clients[0] unless @client\n else\n @clients = Array.new\n end\n end", "def index\n render json: Client.all\n end", "def index\n get_clientes\n end", "def client_by_name(client_name, options={})\n params = {\n :klass => Invoicexpress::Models::Client,\n :client_name => client_name\n }\n\n get(\"clients/find-by-name.xml\", params.merge(options))\n end", "def show\n\n @client = Client.find(params[:id])\n end", "def clients\n response = User_GetClients()\n return [] if response.empty?\n unless response[\"Code\"].to_i != 0\n response[\"Client\"].collect{|c| Client.new(c[\"ClientID\"].to_i, c[\"Name\"])}\n else\n raise response[\"Code\"] + \" - \" + response[\"Message\"]\n end\n end", "def index \n @clients = ApiClient.all\n end", "def client_detail\n service_response = UserManagement::GetClientDetail.new(params).perform\n render_api_response(service_response)\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def show\n @client = Client.find_by(id: params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def show\n @client = Client.find(params[:id])\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def recent\n if current_user.is_admin?\n @clients = Client.all\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @clients }\n end\n end", "def info &block\n em_get( \"/clients/#{uuid}\" ) { |response| block.call( response ) }\n end", "def index\n @clients = Client.all\n end", "def show\n @client = Client.find(params[:id])\n authorize! :read, @client\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def index\n @page_count, @clients = Locomotive::Client.paginated(:page => (params[:page] || 1).to_i)\n display @clients\n end", "def show\n @clients = get_clients\n @client = Client.find(params[:id])\n\n respond_to do |format|\n #format.html # show.html.erb\n format.json { render json: @client }\n format.js\n end\n end", "def show\n @client = Client.find(params[:id])\n if @client.nil?\n @clients = Client.all\n flash.now[:alert] = \"Les détails du client n'ont pas été trouvés\"\n render \"index\"\n end\n respond_to do |format|\n format.html #show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def index\n @clientes = Cliente.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clientes }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n end", "def show\n @client = Client.find(params[:id])\n @contracts = Contract.where(:client_id => @client.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @client }\n end\n end", "def index\n add_breadcrumb(I18n.t('model.list', model: Client.model_name.human))\n\n @clients = Client.all()\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def get_client_by_id client_id\n @clients[client_id]\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @api_client }\n end\n end", "def clients\n @clients = Vendor.find(params[:id]).clients\n end", "def index\n puts params\n puts params[:filter]\n \n @clients = get_clients \n @client = Client.new\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index_clients\n @client = Client.all\n end", "def show\n @client = Client.find params[:id]\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @clients }\n end\n end", "def show\n @client = Client.find params[:client_id]\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n @client = Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @client }\n end\n end", "def show\n # @client = Client.find(params[:client_id])\n end", "def show\n @client_number = ClientNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_number }\n end\n end", "def show\n @client = Client.find(@current_user[\"client_id\"])\n\n respond_to do |format|\n format.html \n format.xml { render :xml => @client }\n end\n end", "def show\n @client_need = ClientNeed.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_need }\n end\n end", "def get_client(id)\n conn = @client.get do |req|\n req.url \"/api/v2/client/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end", "def show\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cliente }\n end\n end", "def index\r\n user = authenticate\r\n if user\r\n clients = Client.where('clientof = ?', user.id)\r\n render json: {clients: clients, message: 'Success', status: :ok}\r\n else\r\n render json: {message: 'Invalid token', status: :unauthorized}\r\n end\r\n end", "def get(type, id)\n info = json_get(@target, \"#{type_info(type, :path)}/#{Addressable::URI.encode(id)}\",\n @key_style, headers)\n\n fake_client_id(info) if type == :client # hide client reply, not quite scim\n info\n end", "def index\n @clients = current_user.is_admin ? Client.all : current_user.clients\n end", "def client(client_id, options={})\n params = { :klass => Invoicexpress::Models::Client }\n\n get(\"clients/#{client_id.to_s}.xml\", params.merge(options))\n end", "def client(name)\n @clients[name]\n end", "def index\n @clients = Client.all.paginate(page: params[:page], per_page: 4)\n end", "def show\n @my_studio_client = MyStudio::Client.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_studio_client }\n end\n end", "def index\n \n @qa_clients = QaClient.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @qa_clients }\n end\n end", "def client\n query[\"client_id\"]\n end", "def client_by_code(client_code, options={})\n params = {\n :klass => Invoicexpress::Models::Client,\n :client_code => client_code\n }\n\n get(\"clients/find-by-code.xml\", params.merge(options))\n end", "def clients_index\n @clients = User.clients\n end", "def index\n @clients = current_user.account.clients.search(params[:search]).order(sort_column + \" \" + sort_direction).paginate(:per_page => 10, :page => params[:page])\n\n @account = current_user.account\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n @client_infos = ClientInfo.all\n end" ]
[ "0.7229171", "0.7203965", "0.7196992", "0.71656483", "0.71620274", "0.71615666", "0.71365654", "0.71365654", "0.71365654", "0.71365654", "0.71365654", "0.71365654", "0.71365654", "0.7127474", "0.7113834", "0.7081925", "0.70799977", "0.7051576", "0.6945427", "0.69094324", "0.6841536", "0.68187207", "0.6818287", "0.68154556", "0.68154556", "0.6793889", "0.6781607", "0.6780466", "0.6767054", "0.6714056", "0.6702135", "0.6702135", "0.6702044", "0.66888964", "0.6680451", "0.6673851", "0.66703534", "0.6667874", "0.66523397", "0.66376257", "0.6628373", "0.6626879", "0.66139233", "0.66135484", "0.6612182", "0.6612182", "0.6612182", "0.6612182", "0.6608298", "0.6608298", "0.6608298", "0.6608298", "0.6608298", "0.6608298", "0.6608298", "0.6608298", "0.6605609", "0.6593475", "0.6581108", "0.6577073", "0.6572685", "0.65651274", "0.6562193", "0.65534705", "0.6552915", "0.65467125", "0.65466815", "0.65289426", "0.65243167", "0.652403", "0.6522362", "0.6513855", "0.649592", "0.64754725", "0.64185745", "0.6379196", "0.63460225", "0.6327174", "0.6327174", "0.63264847", "0.63083005", "0.6302927", "0.6286541", "0.6285737", "0.6256294", "0.6250277", "0.6250277", "0.6250277", "0.6249868", "0.6247256", "0.624081", "0.62233704", "0.62231535", "0.6221579", "0.6219134", "0.62070477", "0.62009346", "0.61786795", "0.61758685", "0.6169485", "0.6166572" ]
0.0
-1
POST /clients or /clients.json
def create @client = Client.new(client_params) respond_to do |format| if @client.save format.html { redirect_to @client, notice: "Client was successfully created." } format.json { render :show, status: :created, location: @client } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @client.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_url, notice: 'El cliente se creó correctamente' }\n format.json { render :index, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_client(options = {})\n post(:clients, clients: [options]).pop\n end", "def create\n @client = current_user.clients.build(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save \n format.html { redirect_to @client, :notice => 'Klijent je uspjesno kreiran.' }\n format.json { render :json => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @client = current_user.clients.build(client_params)\n \n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n flash[:notice] = 'Client was successfully created.' if @client.save\n respond_with(@client)\n end", "def create\n @client = Client.new(client_params)\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #newParams = client_params.as_json\n flash[:notice] = \"Cliente creado\"\n @client = current_freelance.clients.create(client_params)\n\n #@client = current_freelance.clients\n #@client.name = params[:name]\n #@client.surname = params[:surname]\n #@client.username = params[:username]\n #@client.password = params[:password]\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully created.' }\n #format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Cliente cadastrado com sucesso!' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Cliente criado com sucesso.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.create(client_params)\n # byebug\n if @client.valid?\n render json: { client: ClientSerializer.new(@client) }, status: :created\n else\n render json: { error: 'failed to create account' }, status: :not_acceptable\n end \n end", "def create\n @client = Client.new(client_params)\n authorize @client\n respond_to do |format|\n if @client.save\n format.html { redirect_back_or_default clients_url, t('Record has been saved') }\n format.json { render :show, status: :created, location: @client }\n format.js { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n format.js { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n \n respond_to do |format|\n if @client.save\n format.html { redirect_to(@client, :notice => \"Client was successfully created. #{undo_link}\") }\n end\n respond_with(@client)\n end\n end", "def create\n @client = current_user.clients.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Event was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n @client.user_id = current_user.id\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client record was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(client)\n @client = Locomotive::Client.new(client)\n\n if @client.save\n redirect resource(@client), :message => {:notice => \"Client was successfully created\"}\n else\n render :new\n end\n end", "def create\n @client = current_user.clients.build(client_params)\n\n if @client.save\n render :create, status: :created\n CareeerMailer.trial_end(current_user.email, @client).deliver_later\n CareeerMailer.welcome(current_user.email, @client).deliver_later\n else\n render json: @client.errors, status: :unprocessable_entity\n end\n end", "def create\r\n params[:client][:version] = ENV[\"VERSION\"]\r\n params[:client][:domain] = current_user.domain\r\n params[:client][:username] = current_user.username\r\n @client = Client.new(client_params)\r\n\r\n respond_to do |format|\r\n if @client.save\r\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\r\n format.json { render json: @client, status: :created, location: @client }\r\n format.js {}\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @client.errors, status: :unprocessable_entity }\r\n format.js {}\r\n end\r\n end\r\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to(@client, :notice => 'Client was successfully created.') }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n client= Client.new\n client.cedula= params[:cedula]\n client.sector= params[:sector]\n client.nombre= params[:nombre]\n client.telefono= params[:telefono]\n client.pagina= params[:pagina]\n client.direccion= params[:direccion]\n if client.save\n render(json: client, status: 201 , location: client)\n else \n render(json: client.errors, status: 422)\n end\n end", "def create\n authorize! :create, Client\n build_client\n save_client or render :new\n end", "def create\n\n client = Cliente.new\n\n client.nombre = params[:nombre]\n client.cedula = params[:cedula]\n client.pagina = params[:pagina]\n\n client.dirrecion = params[:dirrecion]\n client.telefono = params[:telefono]\n \n client.sector = params[:sector]\n \n\n if client.save\n \n\n render(json: client,status: 201 ,location: client)\n else\n\n render(json: client.errors,status: 422 )\n\n end\n end", "def create\n @client = Client.new(client_params)\n respond_to do |format|\n if @client.save\n format.html { redirect_to(@client, :notice => 'Client was successfully created.') }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_client\n if current_admin.present?\n @client = Client.new(params[:client])\n respond_to do |format|\n if @client.save\n flash[:notice] = \"Client has been successfully added!\"\n format.html { redirect_to root_url }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_admin_session_path and return\n end \n end", "def create\n\n @client = Client.new(client_params)\n\n #se não aguardar carregar os dados\n if @client.state == '...'\n sweetalert_warning('Você precisa informar o CEP e aguardar os dados do endereço serem preenchidos.', 'Aviso!', useRejections: false)\n redirect_to new_client_path and return\n end\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Cliente criado com sucesso.' }\n format.json { render :show, status: :created, location: @client }\n sweetalert_success('Cliente cadastrado com sucesso.', 'Sucesso!', useRejections: false)\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.create(client_params)\n @clients = Client.all\n flash[:notice]=\"client créé avec succès!!!\"\n end", "def create\n #create the object of client and assign the attributes in the request\n @client = Client.new(params[:client])\n \n #save the client\n if @client.save\n #if saved, return and redirect to client show page with success message\n return redirect_to client_path(@client), notice: \"client created successfuly\"\n else\n #if not saved, render the form with error messages\n return render action: :new\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to(@client, :notice => 'Le client a bien été créé.') }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def new\n @client = Client.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def create\n @id = client_params[:id].to_i\n @message = ''\n\n if @id.nil? || @id == 0\n @client = Client.new(client_params)\n else\n @client = Client.find_by_id(@id)\n end\n\n if @client.valid?\n if @client.id == 0 || @client.id.nil? \n @client.save()\n else\n @client.update(client_params)\n end\n else\n @message = @client.errors.messages\n end\n\n render json:{client: @client, message: @message}\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n flash[:notice] = 'Client was successfully created.'\n format.html { redirect_to(@client) }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @client = current_user.clients.new(client_params)\n\n @client.save\n redirect_to @client\n end", "def update_client\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 0})\n\t\telsif request.method == \"POST\"\n\t\t\trespond(update_user_client(params))\n\t\tend\n\tend", "def create_client(name, facebook_id, twitter_handle)\n puts name, facebook_id, twitter_handle\n # Point the HTTP POST method at the clients endpoint of Klipfolio's API.\n response = self.class.post(\"https://app.klipfolio.com/api/1.0/clients\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"name\": name,\n \"description\": \"\",\n \"seats\": 5,\n \"status\": \"active\"\n }.to_json)\n puts response.body\n puts \"Client was successfully created.\" if response.success?\n\n # Extract the new client's ID from the HTTP response so that it can be passed to the update_features & update_resources methods.\n client_id = response[\"meta\"][\"location\"]\n client_id.slice!(\"/clients/\")\n p client_id\n\n update_resources(client_id)\n update_features(client_id)\n update_company_properties(client_id, facebook_id, twitter_handle)\n create_group(client_id)\n share_dashboard(client_id)\n end", "def create\n @client = Client.new(client_params)\n authorize! :create, @client\n\n respond_to do |format|\n if not @client.caseworker.can_add_clients?\n @client.errors[:base] << \"You are past your limit. Please come back later.\"\n format.html { render :action => \"new\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n elsif @client.save\n format.html { redirect_to @client, :notice => 'Client was successfully created.' }\n format.json { render :json => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @clients = get_clients\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n @clients = get_clients\n newVisitOnCreate(@client)\n #format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n format.js\n else\n #format.html { render action: \"index\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @client = Client.new(client_params)\n respond_to do |format|\n # if @client.valid? \n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n # else\n # format.html { render :new }\n # format.json { render json: @client.errors, status: :unprocessable_entity }\n # end\n end\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n format.js\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def create\n @clientsOffers = ClientsOffers.new(params[:clientsOffers])\n\n respond_to do |format|\n if @clientsOffers.save\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully created.' }\n format.json { render json: @clientsOffers, status: :created, location: @clientsOffers }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def client_create(global_options, options)\n result = Excon.post(\n \"#{global_options[:fenton_server_url]}/clients.json\",\n body: client_json(options),\n headers: { 'Content-Type' => 'application/json' }\n )\n\n [result.status, JSON.parse(result.body)]\n end", "def create\n @client = Client.new(params[:client])\n @uuid = params[:uuid]\n respond_to do |format|\n if @client.save\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n \n respond_to do |format|\n if @client.save\n flash[:notice] = 'Client was successfully created.'\n format.html { redirect_to client_url(@role) }\n format.xml { head :created, :location => client_url(@role) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors.to_xml }\n end\n end\n end", "def create_client(client, options={})\n if !client || !client.is_a?(Invoicexpress::Models::Client)\n raise ArgumentError, \"Need a Invoicexpress::Models::Client instance\"\n end\n\n if !client.name\n raise ArgumentError, \"Client's name is required\"\n end\n\n params = { :body => client, :klass => Invoicexpress::Models::Client }\n post(\"clients.xml\", params.merge(options))\n end", "def create\n @client = Client.new(client_params)\n\n if @client.save\n redirect_to @client, notice: 'Client was successfully created.'\n else\n render :new\n end\n end", "def index\n @clients = current_user.clients\n render json: @clients\n end", "def update\n @client.update(client_params)\n render json: @client\n end", "def create\n @client = current_client\n @session = @client.session\n debug { \"SessionsController#create - #{@session.inspect}\"}\n raise \"ResourceOwner from token != session.owner\" if doorkeeper_token.resource_owner_id != @session.owner.id\n\n @client.update_attributes!(client_params)\n render json: @client, status: :created, serializer: Sso::ClientSerializer\n end", "def create\n @client = Client.new(params[:client])\n\n respond_to do |format|\n if @client.save\n\t\tClientMailer.registration_confirmation(@client).deliver\n\t\tCountry.create!({'clientkey'=>@client.id, 'country'=>@client.country})\n format.html { redirect_to @client, notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n @client.campaign_id = session[:campaign_id]\n @groups = Group.all.map {|g| [g.name, g.id]}\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to @client, :notice => 'Client was successfully created.' }\n format.json { render :json => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n\t\t@client.logged = false\n if @client.save\n redirect_to signup_clients_path, notice: 'Client was successfully created!'\n else\n render action: \"new\"\n end\n end", "def new\n @client = Client.new\n @account = current_user.account\n @user = current_user\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def clients\r\n ClientsController.instance\r\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n password = params[:password] || random_password\n @client.user.update(password: password)\n\n ClientMailer.after_sign_up(@client, password).deliver_now\n format.html { redirect_to clients_path, notice: \"Client: #{@client.email} was sucessfully created.\" }\n # format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n # format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = clients.new(params[:client])\n\n if @client.save\n flash[:notice] = 'Customer was successfully created.'\n redirect_to(user_company_clients_url(current_company))\n else\n render :action => \"new\"\n end\n end", "def new\n @client = Client.new\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client }\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to admin_client_path(@client, search: params[:search], page: params[:page]),\n notice: 'Клиент успешно создан.' }\n format.json { render :show, status: :created, location: @client }\n else\n format.html { render :new }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n\n format.js\n\n format.html { redirect_to root_path, notice: 'Vous avez bien été ajouté à notre newsletter' }\n\n format.json { render :show, status: :created, location: @client }\n\n else\n\n format.html { render :new }\n\n format.json { render json: @client.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def create\n @client = Client.new(client_params)\n if @client.save\n redirect_to client_path(@client)\n else\n render ‘new’\n end\n end", "def index\n @clients = Client.all\n @uuid = params[:uuid]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def create\n\t\t@client = User.create(clients_params)\n\t\tif @client.save\n flash[:success] = \"Record saved successfully.\"\n\t\t\tredirect_to clients_params\n else\n @error = @client.errors.full_messages\n redirect_to clients_params\n\t\tend\n\tend", "def new\n @client = Client.new\n respond_with(@client)\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n end", "def index\n @clients = Client.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @clients }\n end\n\n end", "def find_client\n cliente = get_cliente(params[:id])\n\n respond_to do |format|\n format.json {render json: {client: cliente}}\n end\n end", "def create\n @client = Client.new(params[:client])\n\n if @client.password == nil then @client.password = temp_password && @client.password_confirmation = temp_password end\n password = @client.password\n\n respond_to do |format|\n if @client.save\n ClientMailer.new_client(@client, password).deliver\n format.html { redirect_to project_url(:id => @client.project_id, :page => 'options'), notice: 'Client was successfully created.' }\n format.json { render json: @client, status: :created, location: @client }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(client_params)\n \n if @client.valid?\n code = Random.new\n @client.code = code.rand(1000)\n old_password = @client.password\n @client.password = SecureRandom.hex(6)\n status = ApiClient.save(@client)\n\n if status\n @user = User.create(\n name: @client.name,\n email: @client.email,\n password: old_password,\n password_salt: @client.password,\n client_id: @client.code\n )\n end\n end\n\n respond_to do |format|\n if status\n format.html { redirect_to client_path(@client.code), notice: 'Client was successfully created.' }\n format.json { render action: 'show', status: :created, location: @client }\n else\n format.html { render action: 'new', notice: 'Could not create a client.' }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_client\n\nend", "def create\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to @cliente, notice: 'Cliente was successfully created.' }\n format.json { render json: @cliente, status: :created, location: @cliente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to @cliente, notice: 'Cliente was successfully created.' }\n format.json { render json: @cliente, status: :created, location: @cliente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to @cliente, notice: 'Cliente criado com sucesso.' }\n format.json { render json: @cliente, status: :created, location: @cliente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n render json: @client\n end", "def add_client\n\n\t\t@clients = Client.new(client_params)\n\t\tif @clients.save\n\t\t\tredirect_to '/details'\n\t\telse\n\t\t\trender 'index'\n\t\tend\n\tend", "def create\n @client = Client.new(params[:client])\n if (params[:commit] == 'Edit')\n @client.valid?\n render :action => :new\n else\n respond_to do |format|\n if @client.save\n format.html { redirect_to(@account.has_role?(:guest) ? new_event_client_path(@event)\\\n : event_clients_path(@event), \n :notice => 'Congratulations, you information has been saved. Please wait to be called.') }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create!(client, params)\n res = client.post(PATH, nil, params, \"Content-Type\" => \"application/json\")\n\n new(client, res.json) if res.success?\n end", "def create!(client, params)\n res = client.post(PATH, nil, params, \"Content-Type\" => \"application/json\")\n\n new(client, res.json) if res.success?\n end", "def create!(client, params)\n res = client.post(PATH, nil, params, \"Content-Type\" => \"application/json\")\n\n new(client, res.json) if res.success?\n end", "def create!(client, params)\n res = client.post(PATH, nil, params, \"Content-Type\" => \"application/json\")\n\n new(client, res.json) if res.success?\n end", "def createClient(subdomain, username, password, identifier, header)\n\tpayload = {client: {\n name: 'Ruby HTTP Request',\n identifier: identifier\n }\n }\n\turi = URI.parse(\"https://\"+subdomain+\".zendesk.com/api/v2/oauth/clients.json\")\n\thttp = Net::HTTP.new(uri.host, uri.port)\n\thttp.use_ssl = true\n\trequest = Net::HTTP::Post.new(uri.request_uri, header)\n\trequest.basic_auth(username, password)\n\trequest.body = payload.to_json\n\tresponse = http.request(request)\n\tdata = JSON.parse(response.body)\n\tputs \"Creating OAuth Client \" + identifier\n\tputs data\n\treturn data[\"client\"][\"id\"]\nend", "def create\n\n @client = Client.new(client_params)\n @client.business_owner_id = helpers.current_business_owner.id\n\n if @client.save\n flash[:notice] = \"#{@client.name} was added as a new client.\"\n redirect_to clients_path\n else\n render :new\n end\n end", "def create\n @cliente = Cliente.new(params[:cliente])\n \n respond_to do |format|\n if @cliente.save\n format.html { redirect_to edit_cliente_path(@cliente), notice: 'Cliente was successfully created.' }\n format.json { render json: @cliente , status: :created, location: @cliente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @members_client = MembersClient.new(members_client_params)\n\n respond_to do |format|\n if @members_client.save\n format.html { redirect_to @members_client, notice: 'Members client was successfully created.' }\n format.json { render :show, status: :created, location: @members_client }\n else\n format.html { render :new }\n format.json { render json: @members_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @clientes_servico = ClientesServico.new(clientes_servico_params)\n\n respond_to do |format|\n if @clientes_servico.save\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully created.' }\n format.json { render action: 'show', status: :created, location: @clientes_servico }\n else\n format.html { render action: 'new' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n respond_to do |format|\n if @client.save\n @user = @client.complete_user\n flash[:notice] = 'Client was successfully created.'\n set_login_cookie(@user.get_psv)\n format.html { redirect_to(settings_path()) }\n format.xml { render :xml => @client, :status => :created, :location => @client }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @client = Client.new(params[:client])\n respond_to do |format|\n if @client.valid?\n if @client.save\n format.html { redirect_to @client, :notice => 'El cliente se ha creado correctamente.' }\n else\n puts 'Algo'\n format.html { render :action => \"new\", :notice => 'Favor de checar los campos en rojo.' }\n end\n else\n format.html { render :action => \"new\", :notice => 'Favor de checar los campos en rojo.' }\n\n end\n end\n end", "def new\n @client = Client.new\n 1.times { @client.projects.build }\n 1.times { @client.notes.build }\n respond_with(@client)\n end", "def create\n\n @client = Client.new(client_params)\n if @client.save\n respond_to do |format|\n format.html { redirect_to(clients_path, :notice => 'Le client « ' + @client.Prenom + ' ' + @client.Nom + ' » a été crée') }\n end\n else\n render :new\n end\n end", "def client(client, options = {})\n get(\"clients/#{client}\", options).pop\n end", "def create\n @otg_client = OtgClient.new(otg_client_params)\n\n respond_to do |format|\n if @otg_client.save\n format.html { redirect_to @otg_client, notice: 'Otg client was successfully created.' }\n format.json { render :show, status: :created, location: @otg_client }\n else\n format.html { render :new }\n format.json { render json: @otg_client.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70459324", "0.70041037", "0.6982345", "0.69419277", "0.691603", "0.6902005", "0.6902005", "0.6902005", "0.6884694", "0.68596154", "0.68228376", "0.68214285", "0.6814508", "0.68108", "0.68108", "0.68108", "0.6749863", "0.673373", "0.6733688", "0.67275417", "0.6692932", "0.6678529", "0.6638258", "0.6636357", "0.6611874", "0.6599547", "0.65597486", "0.65589416", "0.65496427", "0.6544089", "0.65362173", "0.64879674", "0.6480256", "0.64791036", "0.64663595", "0.645926", "0.6459022", "0.64580774", "0.64580774", "0.64580774", "0.64580774", "0.64491963", "0.6440531", "0.6435527", "0.64305794", "0.64299333", "0.64260566", "0.6415231", "0.6414384", "0.64038897", "0.63863903", "0.6368656", "0.63685805", "0.62969875", "0.62625736", "0.6248642", "0.6244097", "0.62387395", "0.6224567", "0.6223342", "0.62093574", "0.62036586", "0.6199395", "0.619034", "0.61881024", "0.6186438", "0.61859643", "0.6185472", "0.61728626", "0.6140654", "0.6133902", "0.6123079", "0.61195004", "0.61114985", "0.61010945", "0.6088684", "0.6085976", "0.6082709", "0.6078215", "0.6077168", "0.6077168", "0.6065485", "0.6065159", "0.60611314", "0.60529155", "0.60503864", "0.60503864", "0.60503864", "0.60503864", "0.6046842", "0.6045149", "0.60393614", "0.6023846", "0.60154945", "0.60154176", "0.60119617", "0.5999856", "0.5998368", "0.5996243", "0.59898835" ]
0.6796346
16
PATCH/PUT /clients/1 or /clients/1.json
def update respond_to do |format| if @client.update(client_params) format.html { redirect_to @client, notice: "Client was successfully updated." } format.json { render :show, status: :ok, location: @client } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @client.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @client.update(client_params)\n render json: @client\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.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_client\n\t\t@client = Client.find(params[:id])\n\n\t \trespond_to do |format|\n\t\t if @client.update_attributes(client_update_params)\n\t\t format.html { redirect_to(@client, :notice => 'Entry was successfully updated.') }\n\t\t format.json { respond_with_bip(@client) }\n\t\t else\n\t\t format.html { render :action => \"edit\" }\n\t\t format.json { respond_with_bip(@client) }\n\t\t end\n\n \t end\n\tend", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_client\n\t\tif(request.method == \"OPTIONS\")\n\t\t\trespond({status: 0})\n\t\telsif request.method == \"POST\"\n\t\t\trespond(update_user_client(params))\n\t\tend\n\tend", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, :notice => 'El cliente se ha actualizado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize @client\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_back_or_default clients_url, t('Record has been saved') }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n params[:client][:version] = ENV[\"VERSION\"]\r\n params[:client][:username] = current_user.username\r\n @client = Client.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @client.update_attributes(client_params)\r\n format.html { redirect_to @client, notice: 'Client 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: @client.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, :notice => 'Klijent je uspjesno izmjenjen.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, Client\n load_client\n build_client\n save_client or render :edit\n end", "def update\n respond_to do |format|\n\n if @client.update(client_params)\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n authorize! :update, @client\n\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to @client, :notice => 'Client was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to clients_url, notice: 'La información del cliente se actualizó correctamente.' }\n format.json { render :index, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clients = get_clients\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n @clients = get_clients\n #format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n #format.html { render action: \"index\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n\n params[:client][:contact_ids] ||= []\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @client.update(client_params)\n head(:ok)\n else\n render json: @client.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n \n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to user_url(@client.id), notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { redirect_to edit_user_url(@client.id)}\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client record was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n succeess_redirect_path = URI(request.referer).path.gsub 'edit', ''\n if @client.update(client_params)\n format.html { redirect_to succeess_redirect_path, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { redirect_to URI(request.referer).path }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n\n format.json { render :show, status: :ok, location: @client }\n\n else\n\n format.html { render :edit }\n\n format.json { render json: @client.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def update\n client=Client.find_by_id params[:id]\n if client!= nil\n client.cedula=params[:cedula] ? params[:cedula]: client.cedula\n client.sector=params[:sector] ? params[:sector]: client.sector\n client.nombre=params[:nombre] ? params[:nombre]: client.nombre\n client.telefono=params[:telefono] ? params[:telefono]: client.telefono\n client.pagina=params[:pagina] ? params[:pagina]: client.pagina\n client.direccion=params[:direccion] ? params[:direccion]: client.direccion\n if client.save\n render(json: client, status: 201)\n end \n else\n render(json: client.errors, status: 404)\n end \n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to(client_url, :notice => 'Client was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\tif signed_in?\n\t\tif params[:client][:encrypted_password_confirmation].blank?\n\t\t\tparams[:client].delete(\"encrypted_password\")\n\t\t\tparams[:client].delete(\"encrypted_password_confirmation\")\n\t\tend\n\t\t@current_client = current_user.username\n\t\tif current_user.username == 'admin'\n\t\t\t@client = Client.find(params[:id])\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path}\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:update [ID] [options]\")\n\n if options.empty?\n raise(Heroku::Command::CommandFailed, \"Missing options\")\n end\n\n validate!(options[:url]) if options[:url]\n shell = options.delete(:shell)\n options[:redirect_uri] = options.delete(:url)\n\n client = request do\n api.request(\n :body => encode_json(options),\n :expects => 200,\n :headers => headers,\n :method => :patch,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n\n if shell\n puts \"HEROKU_OAUTH_ID=#{client[\"id\"]}\"\n puts \"HEROKU_OAUTH_SECRET=#{client[\"secret\"]}\"\n else\n styled_header(%{Updated client \"#{client[\"name\"]}\".})\n styled_hash(client)\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Cliente atualizado com sucesso!' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to(@client, :notice => 'Client was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Client a été mise à jour.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = current_user.clients.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to @client, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Cliente atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_client = ApiClient.find(params[:id])\n\n respond_to do |format|\n if @api_client.update_attributes(params[:api_client])\n format.html { redirect_to @api_client, notice: 'Api client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to(@client, :notice => 'Client was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n respond_to do |format|\n if @client.update_attributes(params[:client])\n \n flash[:notice] = 'Client was successfully updated.'\n format.html { redirect_to(@client) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n \n respond_to do |format|\n if @client.update_attributes(params[:client])\n flash[:notice] = 'Client was successfully updated.'\n format.html { redirect_to client_url(@role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors.to_xml }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to(@client, :notice => 'Les informations du client ont été mises à jour.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n # NOTE: API V1 dropped support for updating client keys via update (aka PUT),\n # but this code never supported key updating in the first place. Since\n # it was never implemented, we will simply ignore that functionality\n # as it is being deprecated.\n # Delete this comment after V0 support is dropped.\n payload = { name: name }\n payload[:validator] = validator unless validator.nil?\n\n # DEPRECATION\n # This field is ignored in API V1, but left for backwards-compat,\n # can remove after API V0 is no longer supported.\n payload[:admin] = admin unless admin.nil?\n\n begin\n new_client = chef_rest_v1.put(\"clients/#{name}\", payload)\n rescue Net::HTTPClientException => e\n # rescue API V0 if 406 and the server supports V0\n supported_versions = server_client_api_version_intersection(e, SUPPORTED_API_VERSIONS)\n raise e unless supported_versions && supported_versions.include?(0)\n\n new_client = chef_rest_v0.put(\"clients/#{name}\", payload)\n end\n\n Chef::ApiClientV1.from_hash(new_client)\n end", "def edit_client\n\t\t@client = Client.find(params[:id])\n\tend", "def update\n @client = Client.find(params[:id])\n flash[:notice] = 'Client was successfully updated.' if @client.update_attributes(params[:client])\n respond_with(@client)\n end", "def update\n @client = clients.find(params[:id])\n\n if @client.update_attributes(params[:client])\n flash[:notice] = 'Client was successfully updated.'\n redirect_to(user_company_clients_url(current_company))\n else\n render :action => \"edit\"\n end\n end", "def update\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n if @clientsOffers.update_attributes(params[:clientsOffers])\n format.html { redirect_to @clientsOffers, notice: 'ClientsOffers was succesfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clientsOffers.errors, status: :unprocesable_entity }\n end\n end\n end", "def update\n if @client.update(client_params)\n redirect_to clients_path\n else\n render :edit\n end\n end", "def update\n @client = Client.find(params[:id])\n flash[:success] = \"Cliente editado exitosamente\" if @client.update_attributes(params[:client])\n respond_with(@client)\n end", "def update\n respond_to do |format|\n if @client_info.update(client_info_params)\n\n format.html { redirect_to @client_info, notice: 'Client info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @client_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @client = args[:client] if args.key?(:client)\n @list_update_requests = args[:list_update_requests] if args.key?(:list_update_requests)\n end", "def update\n @client = Client.find params[:id]\n respond_to do |format|\n if @client.update_attributes(client_params)\n format.html { redirect_to client_path(@client), notice: 'Cliente fue Actualizado correctamente.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\t\t\n if @client.update_attributes(params[:client])\n redirect_to @client, notice: 'Client was successfully updated!'\n else\n render action: \"edit\"\n end\n end", "def update\n if @client.update(client_params)\n redirect_to client_path(@client)\n else\n render :edit\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to(@client, :notice => \"Client was successfully updated. #{undo_link}\") }\n else\n format.html { render :action => \"edit\" }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n\n respond_to do |format|\n \tif params[:client][:logo].blank?\n \t\tparams[:client][:logo] = @client.logo\n \telse\n \t\tnew_file_name = upload_file(params[:client][:logo], \"/public/files/logo_files/\")\n\t \tFileUtils.rm Dir[\"#{Rails.root}/public/files/logo_files/\"+@client.logo.to_s]\n\t \tparams[:client][:logo] = new_file_name\n \tend\n\t \tparams[:client][:updated_by] = current_user.id\n @client.attributes = params[:client]\n if @client.save\n format.html { redirect_to clients_path, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n @client.name = @client.name.upcase\n if session[:user].nil? \n redirect_to :controller => \"login\", :action => \"new\"\n else\n @client.updated_by = session[:user]\n end\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to clients_path(:clientid => @client.id), notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(id, client)\n @client = Locomotive::Client.get(id)\n raise NotFound unless @client\n if @client.update_attributes(client)\n redirect resource(@client), :message => {:notice => \"Client was successfully updated\"}\n else\n display @client, :edit\n end\n end", "def update\n if @client.update(client_params)\n redirect_to show_clients_path(@client), notice: 'Client was successfully updated.'\n else\n render :edit\n end\n end", "def update\n respond_to do |format|\n begin\n ActiveRecord::Base.transaction do\n @client.update!(client_params)\n @client.address.update!(address_params)\n end\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { render :show, status: :ok, location: @client }\n rescue\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_studio_client = MyStudio::Client.find(params[:id])\n\n respond_to do |format|\n if @my_studio_client.update_attributes(params[:my_studio_client])\n format.html { redirect_to @my_studio_client, notice: 'Client was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_studio_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_client\n if current_admin.present?\n @client = Client.friendly.find(params[:id])\n respond_to do |format|\n if params[:client][:permalink].present?\n @client.update_attributes(:slug => params[:client][:permalink])\n end\n if @client.update_attributes(params[:client])\n format.html { redirect_to edit_admin_path(@client), notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n else\n redirect_to new_admin_session_path and return\n end \n end", "def update\n respond_to do |format|\n if @otg_client.update(otg_client_params)\n format.html { redirect_to @otg_client, notice: 'Otg client was successfully updated.' }\n format.json { render :show, status: :ok, location: @otg_client }\n else\n format.html { render :edit }\n format.json { render json: @otg_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n client_id = params[:contact].delete(:client_id)\n @contact = Contact.find(params[:id])\n @contact.client = Client.find(client_id.to_i)\n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.js\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.js { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @qa_client = QaClient.find(params[:id])\n\n respond_to do |format|\n if @qa_client.update_attributes(params[:qa_client])\n format.html { redirect_to @qa_client, notice: 'Qa client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @qa_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_client(client)\n raise ArgumentError, 'Cannot update without id' if client.id.nil?\n resp = put \"#{CLIENT_API_PATH}/#{client.id}\", params: client.as_json\n process_response(resp)\n true\n rescue Errors::UnprocessableEntity\n false\n end", "def update\n respond_to do |format|\n if @clientes_servico.update(clientes_servico_params)\n format.html { redirect_to @clientes_servico, notice: 'Clientes servico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @clientes_servico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n @uuid = params[:uuid]\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @oauth_client = OauthClient.find(params[:id])\n\n respond_to do |format|\n if @oauth_client.update(oauth_client_params)\n format.html { redirect_to oauth_clients_path, notice: 'OAuth client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @oauth_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t @client = User.find(params[:id])\n\t\tif @client.update(clients_params)\n flash[:success] = \"Record updated successfully\"\n\t\t\tredirect_to clients_path\n\t\telse\n flash[:error] = \"Record not updated\"\n\t\t\tredirect_to new_client_path\n\t end\n end", "def update\n\n #se não aguardar carregar os dados\n if client_params[:state] == '...'\n sweetalert_warning('Você precisa informar o CEP e aguardar os dados do endereço serem preenchidos.', 'Aviso!', useRejections: false)\n redirect_to edit_client_path(@client) and return\n end\n\n respond_to do |format|\n\n if @client.update(client_params)\n format.html { redirect_to @client, notice: 'Cliente atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @client }\n sweetalert_success('Cliente atualizado com sucesso.', 'Sucesso!', useRejections: false)\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = Contact.find(params[:id])\n if params[:contact][:clientId] == \"\"\n params[:contact][:clientId] = nil\n end \n\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contato atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_need = ClientNeed.find(params[:id])\n\n respond_to do |format|\n if @client_need.update_attributes(params[:client_need])\n format.html { redirect_to @client_need, notice: 'Client need was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client = Client.find(params[:id])\n @client.campaign_id = session[:campaign_id]\n @groups = Group.all.map {|g| [g.name, g.id]}\n\n respond_to do |format|\n if @client.update_attributes(params[:client])\n format.html { redirect_to @client, :notice => 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @client.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @clients.update(clients_setting_params)\n format.html { redirect_to edit_clients_setting_path(@clients), notice: 'Setting was successfully updated.' }\n format.json { render :show, status: :ok, location: @clients }\n else\n format.html { render :edit }\n format.json { render json: @clients.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @client.update(client_params)\n redirect_to @client, notice: 'Client was successfully updated.'\n else\n render :edit\n end\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to edit_cliente_path(@cliente), notice: 'Cliente was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_resources(client_id)\n response = self.class.put(\"https://app.klipfolio.com/api/1.0/clients/#{client_id}/resources\", basic_auth: @auth, headers: { \"Content-Type\" => \"application/json\" },\n body: {\n \"resources\": [{\"name\":\"dashboard.tabs.total\", \"value\":1}]\n }.to_json)\n puts response.body\n puts \"Client's resources were updated.\" if response.success?\n end", "def update\n respond_to do |format|\n if @live_client.update(live_client_params)\n format.html { redirect_to @live_client, notice: 'Live client was successfully updated.' }\n format.json { render :show, status: :ok, location: @live_client }\n else\n format.html { render :edit }\n format.json { render json: @live_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @client.update(client_params)\n format.html { redirect_to admin_client_path(@client, search: params[:search], page: params[:page]),\n notice: 'клиент сохранен.' }\n format.json { render :show, status: :ok, location: @client }\n else\n format.html { render :edit }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @members_client.update(members_client_params)\n format.html { redirect_to @members_client, notice: 'Members client was successfully updated.' }\n format.json { render :show, status: :ok, location: @members_client }\n else\n format.html { render :edit }\n format.json { render json: @members_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @invoice_client.update(invoice_client_params)\n format.html { redirect_to @invoice_client, notice: 'Invoice client was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoice_client }\n else\n format.html { render :edit }\n format.json { render json: @invoice_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @clients = current_client\n end", "def update_client_with_http_info(client_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: AuthClientsApi.update_client ...\"\n end\n # verify the required parameter 'client_key' is set\n if @api_client.config.client_side_validation && client_key.nil?\n fail ArgumentError, \"Missing the required parameter 'client_key' when calling AuthClientsApi.update_client\"\n end\n # resource path\n local_var_path = \"/auth/clients/{client_key}\".sub('{' + 'client_key' + '}', client_key.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'client_resource'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ClientResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthClientsApi#update_client\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @potential_client.update(potential_client_params)\n format.html { redirect_to @potential_client, notice: 'Potential client was successfully updated.' }\n format.json { render :show, status: :ok, location: @potential_client }\n else\n format.html { render :edit }\n format.json { render json: @potential_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client.update_attributes(client_params)\n @clients = Client.all\n flash[:notice]=\"Client Modifier avec succès!!!\"\n end", "def update\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n if @blocking_client.update_attributes(params[:blocking_client])\n format.html { redirect_to @blocking_client, notice: 'Blocking client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blocking_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n @client = Client.find(params[:id])\n if @client.update(client_params)\n # Save the item successfully\n redirect_to @client\n else\n render :action => \"edit\"\n end\n\n\n end", "def update\n @cliente = Cliente.find(params[:id])\n\n respond_to do |format|\n if @cliente.update_attributes(params[:cliente])\n format.html { redirect_to @cliente, notice: 'Cliente atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kont_klient.update(kont_klient_params)\n format.html { redirect_to @kont_klient, notice: 'Kont klient was successfully updated.' }\n format.json { render :show, status: :ok, location: @kont_klient }\n else\n format.html { render :edit }\n format.json { render json: @kont_klient.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @client.valid?\n old_password = @client.password\n @client.password = SecureRandom.hex(6)\n status = ApiClient.update(@client)\n\n user = User.find_by(client_id: @client.code)\n\n if user\n user.name = @client.name\n user.email = @client.email\n user.password = old_password\n user.password_salt = @client.password\n user.client_id = @client.code\n user.save\n end\n end\n\n respond_to do |format|\n if @client.valid?\n format.html { redirect_to @client, notice: 'Client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @client.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_put(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n respond_to do |format|\n if @company_client.update(company_client_params)\n format.html { redirect_to company_clients_path, notice: 'Клиент успешно отредактирован' }\n format.json { render :show, status: :ok, location: @company_client }\n else\n format.html { render :edit }\n format.json { render json: @company_client.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.72847515", "0.71870065", "0.71870065", "0.7159641", "0.70983404", "0.70771176", "0.70771176", "0.7063752", "0.70605636", "0.7038159", "0.7032087", "0.70251894", "0.7000975", "0.69954747", "0.696068", "0.6934566", "0.69332933", "0.6922324", "0.69015485", "0.69005156", "0.6881483", "0.6871575", "0.6842986", "0.68426687", "0.68426687", "0.68426687", "0.68426687", "0.68426687", "0.6829731", "0.6829731", "0.68240356", "0.6792585", "0.6773429", "0.67636603", "0.6745007", "0.6717933", "0.6714756", "0.67098325", "0.67094713", "0.6704622", "0.6696525", "0.66866297", "0.6685309", "0.6647466", "0.6645268", "0.66245306", "0.661487", "0.6597675", "0.6586893", "0.65501016", "0.65344524", "0.65213436", "0.6498861", "0.64702183", "0.6457975", "0.64576995", "0.6433995", "0.64207006", "0.64119005", "0.6411223", "0.63923126", "0.6364017", "0.6347402", "0.6346372", "0.6337965", "0.6337509", "0.63272554", "0.6322615", "0.63177127", "0.63143206", "0.63129973", "0.63055474", "0.63011235", "0.62684715", "0.6265981", "0.6264255", "0.6250573", "0.6234989", "0.6234989", "0.62337404", "0.62250227", "0.6221046", "0.6216373", "0.6210275", "0.62016076", "0.6201222", "0.6194918", "0.6194859", "0.61932975", "0.6190546", "0.61873275", "0.61871606", "0.6182629", "0.6176455", "0.61750245", "0.61663365", "0.61650926", "0.6154196", "0.6153667", "0.6146885" ]
0.682296
31
DELETE /clients/1 or /clients/1.json
def destroy @client.destroy respond_to do |format| format.html { redirect_to clients_url, notice: "Client was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n chef_rest_v1.delete(\"clients/#{@name}\")\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n authorize! :update, @client\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @client = Client.find(params[:id])\r\n @client.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to clients_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Данные по клиенту удалены.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client a été supprimer.' }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @client\n @client.destroy\n respond_to do |format|\n format.html { redirect_back_or_default clients_url, t('Record has been deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n \n respond_to do |format|\n format.html { redirect_to clients_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Cliente apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Cliente excluído com sucesso!' }\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 @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'El Cliente fue Eliminado Exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully destroyed.' }\n\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n \n if @client.deleted_at.blank?\n @client.destroy\n else\n @client.revive\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n respond_with(@client)\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(clients_url) }\n end\n end", "def destroy\n\n\tif signed_in?\n\t\tif current_user.username == 'admin'\n\t\t\t@client = Client.find(params[:id])\n\t\t\t@client.destroy\n\t\telse\n\t\t\tredirect_to home_path\n\t\tend\n\telse\n\t\tredirect_to signin_path\n\tend\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @uuid = params[:uuid]\n respond_to do |format|\n format.html { redirect_to :controller => 'ads', :action => 'admin_dash', :id => 1, :uuid => @uuid }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_client = ApiClient.find(params[:id])\n @api_client.destroy\n\n respond_to do |format|\n format.html { redirect_to api_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @otg_client.destroy\n respond_to do |format|\n format.html { redirect_to otg_clients_url, notice: 'Otg client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_info.destroy\n respond_to do |format|\n format.html { redirect_to client_infos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = current_user\n @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_path(@user) }\n format.xml { head :ok }\n end\n end", "def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n redirect_to clients_url\n end", "def destroy\n @client = Client.find(params[:id])\n @client.destroy\n @clients = get_clients\n @client = Client.new\n\n respond_to do |format|\n #format.html { redirect_to clients_url }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n id = shift_argument || raise(Heroku::Command::CommandFailed, \"Usage: clients:destroy [ID]\")\n client = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :delete,\n :path => \"/oauth/clients/#{CGI.escape(id)}\"\n ).body\n end\n puts \"Deregistered client '#{client[\"name\"]}'.\"\n end", "def destroy\n @qa_client = QaClient.find(params[:id])\n @qa_client.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_clients_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\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 @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client = clients.find(params[:id])\n @client.destroy\n redirect_to(user_company_clients_url(current_company))\n end", "def delete(client_id)\n id = client_id.to_s\n Client.collection.filter(:id => id).delete\n AuthRequest.collection.filter(:client_id => id).delete\n AccessGrant.collection.filter(:client_id => id).delete\n AccessToken.collection.filter(:client_id => id).delete\n end", "def delete_client\n\t\t@client = Client.find(params[:id])\n\n\t\tif @client.destroy\n\t\t\tredirect_to \"/details\"\n\t\telse\n\t\t\treder :action => \"delete_client\"\n\t\tend\n\tend", "def destroy\n @client = Client.find params[:id]\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Cliente fue Eliminado correctamente.' }\n end\n end", "def destroy\n orden@client.destroy\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to admin_clients_url(search: params[:search], page: params[:page]),\n notice: 'Клиент удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Cliente foi excluido.' }\n format.json { head :no_content }\n sweetalert_success('Cliente excluido com sucesso.', 'Sucesso!', useRejections: false)\n end\n end", "def destroy\n @clientsOffers = ClientsOffers.find(params[:id])\n @clientsOffers.destroy\n\n respond_to do |format|\n format.html { redirect_to clientsOffers_url }\n format.json { head :no_content }\n end\n end", "def destroy(id)\n @client = Locomotive::Client.get(id)\n raise NotFound unless @client\n if @client.destroy\n redirect resource(:clients)\n else\n raise InternalServerError\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 :ok }\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 @client.delete( name )\n end", "def destroy\n @authorized_client.destroy\n respond_to do |format|\n format.html {redirect_to authorized_clients_url, notice: 'Authorized client was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def delete(username)\n perform_request({:action => \"client-delete\", :username => username})\n end", "def destroy\n @clientes_servico.destroy\n respond_to do |format|\n format.html { redirect_to clientes_servicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oauth_client = OauthClient.find(params[:id])\n @oauth_client.destroy\n\n respond_to do |format|\n format.html { redirect_to oauth_clients_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end", "def destroy\n if current_admin.present?\n @client = Client.friendly.find(params[:id])\n @client.destroy\n respond_to do |format|\n format.html { redirect_to admins_url }\n format.json { head :no_content }\n end\n else\n redirect_to new_admin_session_path and return\n end \n end", "def destroy\n @members_client.destroy\n respond_to do |format|\n format.html { redirect_to members_clients_url, notice: 'Members client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.delete(@name)\n end", "def destroy\n authorize! :destroy, Client\n load_client\n destroy_client\n\n redirect_to clients_url\n end", "def destroy\n begin\n @client = Client.find(params[:id])\n @client.destroy\n rescue Exception => e\n flash[:notice]= \"There is no any client regarding this ID.\"\n end\n redirect_to clients_path\n end", "def destroy\n @live_client.destroy\n respond_to do |format|\n format.html { redirect_to live_clients_url, notice: 'Live client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n logger = Logger.new(STDOUT)\n if @client.dois.present?\n message = \"Can't delete client that has DOIs.\"\n status = 400\n logger.warn message\n render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status\n elsif @client.update_attributes(is_active: nil, deleted_at: Time.zone.now)\n @client.send_delete_email unless Rails.env.test?\n head :no_content\n else\n logger.warn @client.errors.inspect\n render json: serialize_errors(@client.errors), status: :unprocessable_entity\n end\n end", "def destroy\n if @client.dois.present?\n message = \"Can't delete client that has DOIs.\"\n status = 400\n Rails.logger.warn message\n render json: {\n errors: [{ status: status.to_s, title: message }],\n }.to_json,\n status: status\n elsif @client.update(is_active: nil, deleted_at: Time.zone.now)\n unless Rails.env.test?\n @client.send_delete_email(responsible_id: current_user.uid)\n end\n head :no_content\n else\n # Rails.logger.error @client.errors.inspect\n render json: serialize_errors(@client.errors, uid: @client.uid),\n status: :unprocessable_entity\n end\n end", "def destroy\n @evclient = Evclient.find(params[:id])\n @evclient.destroy\n\n respond_to do |format|\n format.html { redirect_to evclients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @client_need = ClientNeed.find(params[:id])\n @client_need.destroy\n\n respond_to do |format|\n format.html { redirect_to client_needs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n Client.transaction do\n FileUtils.rm Dir[\"#{Rails.root}/public/files/logo_files/\"+@client.logo.to_s]\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url, notice: 'Client was successfully deleted.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @client.destroy\n redirect_to index_clients_path, notice: 'Client was successfully destroyed.'\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 @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @client = Client.find(params[:id])\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to(search_results_url, :notice => \"Client was successfully destroyed. #{undo_link}\") }\n end\n end", "def destroy\n @player_client = PlayerClient.find(params[:id])\n @player_client.destroy\n\n respond_to do |format|\n format.html { redirect_to player_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @group_client.destroy\n respond_to do |format|\n format.html { redirect_to group_clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client.destroy\n redirect_to clients_url, notice: 'Client was successfully destroyed.'\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def destroy\n @enabled_client.destroy\n respond_to do |format|\n format.html { redirect_to enabled_clients_url, notice: 'Enabled client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_type.destroy\n respond_to do |format|\n format.html { redirect_to client_types_url, notice: 'Tipo de Cliente deletado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n @client.campaign_id = session[:campaign_id]\n @client.destroy\n\n respond_to do |format|\n format.html { redirect_to clients_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_client.destroy\n respond_to do |format|\n format.html { redirect_to invoice_clients_url, notice: 'Invoice client was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @clientz.destroy\n respond_to do |format|\n format.html { redirect_to clientzs_url, notice: 'Clientz was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n raise \"Can't delete a resource without a REST Client\" unless @client\n @client.delete @path\n end" ]
[ "0.766094", "0.76533216", "0.7626295", "0.7626295", "0.7622084", "0.7621878", "0.7621878", "0.7621878", "0.7621878", "0.7621878", "0.7621878", "0.7621878", "0.7621878", "0.7621878", "0.7577433", "0.75709546", "0.7490678", "0.7484262", "0.7465928", "0.74481285", "0.74197084", "0.74196124", "0.7417717", "0.7416569", "0.73879075", "0.7378261", "0.7378138", "0.7378138", "0.7373437", "0.7373437", "0.7373437", "0.7373437", "0.7373437", "0.7373437", "0.7373437", "0.73592", "0.73421305", "0.7321229", "0.73174435", "0.7314451", "0.7244814", "0.7237817", "0.72123", "0.7205056", "0.7200823", "0.7200476", "0.7174589", "0.7155413", "0.7147418", "0.71462965", "0.71283215", "0.7120496", "0.711958", "0.7118554", "0.7116147", "0.7102814", "0.7082137", "0.7056264", "0.70510215", "0.7030212", "0.7005407", "0.70029986", "0.7001823", "0.69946593", "0.6957277", "0.6946811", "0.6946811", "0.6946811", "0.6918076", "0.6912597", "0.6910613", "0.6886583", "0.6874628", "0.6874001", "0.6863442", "0.685886", "0.6858734", "0.6847926", "0.68402606", "0.68354815", "0.68319416", "0.68135947", "0.680676", "0.6794048", "0.6787717", "0.67789716", "0.67789716", "0.6776087", "0.6774753", "0.67743534", "0.6769523", "0.67685205", "0.67675257", "0.6758723", "0.6756543", "0.67557734", "0.67498124", "0.6749513", "0.6749032", "0.67447644" ]
0.7371586
35
Use callbacks to share common setup or constraints between actions.
def set_client @client = Client.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 client_params params.require(:client).permit(:name, :last_billed_at, :billing_day, :client_payment_method) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
Run our predictions that are further defined in the methods below
def virus_effects # predicted_deaths(@population_density, @population, @state) # speed_of_spread(@population_density, @state) predicted_deaths speed_of_spread end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_test\n for i in 0..@count-1\n @predictions << Prediction.new(@test_set[i].user_id,@test_set[i].movie_id, @test_set[i].rating,@database.predict(@test_set[i].user_id, @test_set[i].movie_id))\n end\n end", "def predictions\n @predictions ||= Prediction.predict_for(self)\n end", "def predict\n\t\t@bio = Bio.where(:user_id => current_user.id).last \n\n\t\t# Game_date and @players transformed to JSON and send to API in order to fetch player predictions\n\t\t@game_date = params[:game_date]\n\t\t@players = params[:players] \n\n\t\t# API Returns player predictions\n\t\t\t#first look in database, and if predictions already exist, pull from here\n\t\t\t#else get request to API, and API returns predictions\n\n\t\t# Temp fake data is returned instead // modify this to store into database instead of this weird Array/Url string voodoo\n\t\t@array = Array.new\n\t\t8.times do\n\t\t @array.push Faker::Name.name\n\t\tend\n\n\t\trender(\"sports/predict/\", :notice => \"Successfully fetched player predictions from API.\")\n\t\t\n\tend", "def predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end", "def predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end", "def predict()\n self.extend(Prediction)\n end", "def fit_predict\n raise NotImplementedError, \"#{__method__} has to be implemented in #{self.class}.\"\n end", "def predict_step\r\n batches = @predict_iterator.next_batch(@batch_size)\r\n call_callbacks(:before_predict_on_batch)\r\n @last_predicted_batch = on_predict_step(*batches)\r\n call_callbacks(:after_predict_on_batch)\r\n if @predicted_data\r\n @predicted_data = @predicted_data.concatenate(@last_predicted_batch, axis: 0)\r\n else\r\n @predicted_data = @last_predicted_batch\r\n end\r\n @predict_state = :end_predict_step\r\n end", "def run_test(*k)\n\t\tif !@test_set.empty?\n\t\t\terror_set = []\n\t\t\tif k.length > 0\n\t\t\t\t# Using the variable upper_bound makes sure it is either looking at k items in the test set or the entire test set\n\t\t\t\tupper_bound = k[0]\n\t\t\telse\n\t\t\t\tupper_bound = @test_set.length - 1\n\t\t\tend\n\t\t\tfor i in 0..upper_bound\n\t\t\t\tpredicted_rating = predict(@test_set[i][0], @test_set[i][1])\n\t\t\t\tprint \"AFTER CALLING: \"\n\t\t\t\tputs Time.now\n\t\t\t\t@predictions.push([@test_set[i][0], @test_set[i][1], @test_set[i][2], predicted_rating])\n\t\t\t\terror_set.push((@test_set[i][2] - predicted_rating).abs)\n\t\t\tend\n\t\t\tmovie_test = MovieTest.new(error_set)\n\t\telse\n\t\t\tputs \"There is no test set!!!!\"\n\t\tend\n\tend", "def predict!(current_diff)\n prediction_strategies.flat_map { |strategy| strategy.call(current_diff, map) }\n end", "def predictor\n w = perceptron\n\n train_data = normalize_data(\"votes-test.csv\")\n actual_values = train_data.map { |x| x.last }\n predictions = train_data.map { |x| activation_output(x.first, w) }\n\n wrong = (0..actual_values.length-1).select { |i| actual_values[i] != predictions[i] }.count\n correct = actual_values.length - wrong\n\n p \"CORRECT: #{correct}\"\n p \"WRONG: #{wrong}\"\nend", "def train\n run_thresholds\n run_values_to_ranges\n run_reverse\n\n @classifiers\n end", "def initialize \n\t\t@predictions = []\n\tend", "def run_test k=@test.size\n puts \"No test data specified!\" unless @test\n\n results = Array.new(Array.new)\n @test.first(k).each do |usr, mv, r|\n results.push([usr, mv, r, predict(usr, mv)])\n end\n\n MovieTest.new results\n end", "def calculate_scores_for_predictoins\n return false unless phase_completed\n matches = matches.finished_matches\n matches.each do |match|\n match.calculate_scores_for_predictions\n end\n end", "def predict(observation, method)\n Combine.send(method, @models.map{|t| t.predict(observation, method) })\n end", "def predict_by_iterator(predict_iterator, batch_size: 100)\r\n start_predict_by_iterator(predict_iterator, batch_size: batch_size)\r\n update while evaluating?\r\n predicted_data\r\n end", "def payment_predictions\n @results = Project.payment_prediction_results(@account, params, @start_date, @end_date)\n @totals = Project.payment_prediction_totals(@account, params, @start_date, @end_date)\n end", "def predict(predictive_users, movie_id, user_id)\n score = 0.0\n total = 0.0\n tally = 0.0\n predictive_users.each do |user|\n score = rating(user, movie_id).to_i #Takes the average score of users in the predictive \n #array and sets that to the prediction. \n if score != 0\n total += score\n tally += 1\n end\n end\n \n base_prediction = (total / tally).to_f\n prediction = prediction_modifiers(base_prediction, movie_id, user_id)\n return prediction\n end", "def run_test(k)\n test=MovieTest.new\n @test_data.first(k).each do |data|\n predict_rate=predict(data[0],data[1])\n test.add_to_result([data[0],data[1],data[2],predict_rate])\n end\n return test\n end", "def predict_emails\n @test_dataset.each do |test_item|\n domain_name = test_item[1]\n if !@all_domains.keys.include?(domain_name)\n puts \"Predictions for \" + test_item[0] + \" are - \"\n puts \"Can not predict email for this domain as no sufficient information is available\"\n puts \"-\" * 50\n else\n current_domain = get_current_domain(domain_name) \n current_domain.display_predictions(test_item[0])\n end\n end\n end", "def run_test(k = nil)\n if test_set.empty?\n return nil\n end\n predict_result = []\n if k.nil?\n k = test_set.size\n end\n (0..k-1).each do |i|\n predict_result.push(predict(test_set[i][0],test_set[i][1]))\n end\n #return test\n return MovieTest.new(test_set.transpose,predict_result)\n end", "def initialize(predictions)\n\t\t@predictions = predictions\n\t\t@error_list = make_error_list\n\tend", "def train\n run_aggregation\n run_syntetics\n run_values_to_ranges\n run_reverse\n\n [name, classifier]\n end", "def run_test(k = nil)\n \tpredict_result = []\n \tif k.nil?\n \t\tk = test_set.size\n \tend\n \t(0..k-1).each do |i|\n \t\tpredict_result.push(predict(test_set[i][0],test_set[i][1]))\n \tend\n \ttest = MovieTest.new(test_set.transpose[2][0..k-1],predict_result)\n \tputs test.mean()\n end", "def predict(tokens)\n\n @data.each do |category, counts|\n \n end\n\n predicted_category\n end", "def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris_model.json\", \n \"data_input\" => {'petal length'=> 0.5},\n \"confidence\" => 0.90594,\n\t \"prediction\" => \"Iris-setosa\"}]\n\n puts \"Scenario: Successfully creating a prediction from a local model in a json file\" \n \n data.each do |item|\n puts\n puts \"Given I create a local model from a \"+item[\"filename\"]+\" file \"\n model = BigML::Model.new(item[\"filename\"], @api)\n\n puts \"When I create a local prediction for \"+JSON.generate(item[\"data_input\"])+\" with confidence\"\n prediction = model.predict(item[\"data_input\"], {'full' => true})\n puts \"Then the local prediction is %s \" % item[\"prediction\"]\n assert_equal(prediction[\"prediction\"], item[\"prediction\"])\n\n puts \"And the local prediction's confidence is %s\" % item[\"confidence\"]\n assert_equal(prediction[\"confidence\"], item[\"confidence\"])\n end\n\n end", "def run_test(*args)\n result = Array.new\n k = @testSet.length\n\n if args.size == 1\n k = args[0]\n end\n\n for i in 0..k-1\n subline = @testSet[i].split\n user = subline[0].to_i\n movie = subline[1].to_i\n rating = subline[2].to_i\n #make the prediction and put the result into an array\n prediction = predict(user,movie)\n result.push([user,movie,rating,prediction])\n end\n\n MovieTest.new(result)\n end", "def recalculate_predicted\n\n # reset predicted to actual standing\n users = User.all\n users.each do |u|\n if u.predicted != u.points\n u.predicted = u.points\n u.save\n end\n end\n\n # find the ongoing games and iterate over them\n games = Game.where(\"kickoff < ? AND final <> true\", Time.zone.now)\n games.each do |g|\n # get all tips for each game and interate of the tips\n tips = g.tips\n tips.each do |t|\n # update the predicted with the result form the ongoing game\n predict = calculate_tip_points(t)\n if predict != 0\n t.user.predicted += predict\n t.user.save\n end\n end\n end\n end", "def train\n raise NotImplementedError\n end", "def test_predict\n data = Disco.load_movielens\n recommender = Disco::Recommender.new(factors: 20)\n recommender.fit(data)\n assert_kind_of Array, recommender.predict(data.first(5))\n end", "def fit_predict(x) # rubocop:disable Lint/UselessMethodDefinition\n super\n end", "def set_prediction\n @prediction = Prediction.find(params[:id])\n end", "def set_prediction\n @prediction = Prediction.find(params[:id])\n end", "def create\n params[:predictions].each do |prediction|\n @prediction = current_user.predictions.new(prediction)\n if @prediction.valid?\n @prediction.save\n end\n end\n redirect_to root_path\n end", "def predict title, description, classification_id\n # TODO job = create_job(title, description, classification_id)\n # or preprocessor.process(title, description, classification_id, classification)\n # or something like that\n # maybe even change preprocessor and selector interface because the current one makes not sense\n job = {title: title, description: description, id: classification_id}\n data = preprocessor.process(job)\n features = Libsvm::Node.features(selector.generate_vector(data).data)\n\n label, probs = svm.predict_probability(features)\n # TODO find a more reliable way to find the correct probability value for the given label\n # but nevertheless this should be correct\n return !label.zero?, probs.max\n end", "def get_test_set_data\n\t\treturn @predictions\n\tend", "def predict u, m\n \tif rating(u, m) == 0\n \t\t#puts avg_rating \n \t\treturn avg_rating u\n \telse\n \t\t#puts rating u, m\n \t\treturn rating u, m\n \tend\n end", "def predict_all\r\n @recommendations = Professional.all.map do |professional|\r\n Recommender.new(professional).recommend\r\n end\r\n true\r\n end", "def predict(user, movie)\n\t\tprint \"BEFORE CALLING: \"\n\t\tputs Time.now\n\t\treturn average_of_ratings(@movie_ratings[movie])\n\tend", "def run_test(k=nil)\n k ||= @testSet.data.length\n arr = (@testSet.data[0..k-1]).collect do |item|\n @resaults.new(item[@USER_ID].to_i, item[@MOVIE_ID].to_i, item[@RATING].to_i, predict(item[@USER_ID].to_i, item[@MOVIE_ID].to_i))\n end \n MovieTest.new(arr) \n end", "def predict(x, batch_size: 100)\r\n Utils.check_input_data_type(\"x\", x, Xumo::SFloat)\r\n start_predict(x, batch_size: batch_size)\r\n update while predicting?\r\n predicted_data\r\n end", "def test_scenario15\n data = [['data/iris.csv', {\"weight_field\" => \"000000\", \"missing_numerics\" => false}, {\"petal width\" => 1.5, \"petal length\" => 2, \"sepal width\" => 1}, 'Iris-versicolor', 0.9547, '000004']]\n puts \"\"\n puts \"Scenario: Successfully comparing predictions with text options\"\n\n data.each do |filename, parms, data_input, prediction_result, probability, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n\n source = @api.create_source(File.dirname(__FILE__)+\"/\"+filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create a logistic regression model with objective <%s> and params <%s>\" % [objective, parms]\n logistic_regression = @api.create_logisticregression(dataset, {'objective_field' => objective}.merge(parms))\n \n puts \"And I wait until the logistic regression model is ready\"\n assert_equal(BigML::HTTP_CREATED, logistic_regression[\"code\"])\n assert_equal(@api.ok(logistic_regression), true)\n\n puts \"And I create a local logistic regression model\"\n localLogisticRegression = BigML::Logistic.new(logistic_regression)\n\n puts \"When I create a logistic regression prediction for <%s>\" % JSON.generate(data_input)\n prediction = @api.create_prediction(logistic_regression, data_input)\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n\n puts \"Then the logistic regression prediction is <%s>\" % prediction_result\n assert_equal(prediction_result, prediction[\"object\"][\"output\"])\n\n puts \"And the logistic regression probability for the prediction is <%s>\" % probability\n\n prediction[\"object\"][\"probabilities\"].each do |prediction_value, remote_probability|\n if prediction_value == prediction[\"object\"][\"output\"]\n assert_equal(remote_probability.to_f.round(3),probability.round(3))\n break\n end\n end\n\n puts \"And I create a local logistic regression prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = localLogisticRegression.predict(data_input, {\"full\" => true})\n\n puts \"Then the local logistic regression prediction is <%s>\" % prediction_result\n assert_equal(prediction_result, local_prediction[\"prediction\"])\n\n puts \"And the local logistic regression probability for the prediction is <%s>\" % probability\n assert_equal(probability.round(4), local_prediction[\"probability\"].round(4))\n\n end\n end", "def run_test(k=nil)\n dataset=k.nil? ? @data.testset : @data.testset.take(k)\n MovieTest.new(dataset.map {|item| [item.u_id,item.m_id,item.rating,predict(item.u_id,item.m_id)]})\n end", "def show_prediction_by_postcode\n params = location_params\n @cur_date = {:date => Time.now.strftime(\"%d-%m-%Y\")}\n postcode = Postcode.find_by(postcode: params[:post_code])\n @location = postcode.locations.first\n @predictions = DataHelper.predict(@location, params[:period])\n end", "def index\n @predictions = Prediction.all\n end", "def predict_rating(user,film)\r\n f_amount=SVD_param.find_by_name(@f_amoun_str).value.to_i\r\n\r\n mu=SVD_param.find_by_name(@global_predictor_str).value\r\n user_prd=user.base_predictor\r\n film_prd=film.base_predictor\r\n\r\n baseline=mu+user_prd+film_prd\r\n\r\n user_f_vect=create_user_factor_vector(user.id)\r\n film_f_vect=create_film_factor_vector(film.id)\r\n\r\n prediction=baseline + multiply_vectors(\r\n film_f_vect,\r\n user_f_vect\r\n )\r\n return prediction\r\n end", "def start_predict(x, batch_size: 100)\r\n Utils.check_input_data_type(\"x\", x, Xumo::SFloat)\r\n start_predict_by_iterator(Iterator.new(x, random: false), batch_size: batch_size)\r\n end", "def test_scenario5\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46, \"sepal length\" => 5}, 'Iris-versicolor', \"probability\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46, \"sepal length\" => 5}, 'Iris-versicolor', \"confidence\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, 'Iris-setosa', \"probability\", \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, 'Iris-setosa', \"confidence\", \"000004\"],\n ]\n puts\n puts \"Scenario: Successfully comparing predictions in operating kind for models:\"\n\n data.each do |filename, data_input, prediction_result, operating_kind, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create model\"\n model=@api.create_model(dataset)\n \n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n \n puts \"And I create a local model\"\n local_model = BigML::Model.new(model, @api)\n\n puts \"When I create a prediction for %s in %s \" % [JSON.generate(data_input), JSON.generate(operating_kind)]\n prediction = @api.create_prediction(model, data_input, {\"operating_kind\" => operating_kind})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n\n puts \"Then the prediction for '<%s>' is '<%s>'\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end\n\n puts \"And I create a local prediction for <%s> in <%s>\" % [JSON.generate(data_input), JSON.generate(operating_kind)]\n local_prediction = local_model.predict(data_input, {\"operating_kind\" => operating_kind})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_model.regression) or \n (local_model.is_a?(BigML::MultiModel) and local_model.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n \n end", "def predict(u,m)\n \n # 1. the average\n \t\tcount=0\n \t\tsum=0.0\n \t\tdatab.each do |line| \n\t\t\tif line[\"user_id\"]==u.to_i\n\t\t\tcount+=1\n\t\t\tsum+=line[\"rating\"]\n\t\t\tend\n \t\tend\n \t\tans1 = sum/count\n \t# 2. rating from the most similar user\n \t \ta_movie_data = MovieData0.new(datab)\n \t \t\n \t \tsimilar_user_info_arr = a_movie_data.most_similar(u)\n \t puts\tsimilar_user_info_arr\n \t \tputs \"here predict2\"\n \t \tsimilar_rating = 0.0\n \t \ttop_20percent_index = 0.2*similar_user_info_arr.size() #only search in top 20percent most similar users\n \t \t\n \t \tsimilar_user_info_arr[0..top_20percent_index].each do |hs| \n \t \t\n \t \t\tuser_id=hs[\"user_id\"] \n\t\t\tif z.rating(user_id,m)!=0\n\t\t\tsimilar_rating z.rating(user_id,m)\n\t\t\tend\n \t \tend\n \t \t\n \t \tif similar_rating == 0 \n \t \t\tputs \"no matches\"\n \t \t\treturn ans1\n \t \telse\n \t \t\treturn (similar_rating+ans1)/2\n \t \tend\n end", "def train(inputs, outputs)\n eval(inputs)\n backpropagate(outputs)\n calculate_error(outputs)\n end", "def run_test(number_of_records = nil)\n\t\ttest_file_exists?\n\t\tmovie_test = MovieTest.new\n\t\tcount = 1\n\t\tCSV.foreach(@data_file_path+'/'+@test_file_name, {col_sep: \"\\t\"}) do |row|\n\t\t\tuser_id, movie_id, rating, timestamp = row\n\t\t\trating = rating.to_f\n\t\t\tpredicted_rating = predict(user_id, movie_id)\n\t\t\tmovie_test.add_prediction Prediction.new(user_id, movie_id, rating, predicted_rating)\n\t\t\tcount += 1\n\t\t\tbreak if count == number_of_records\n\t\tend\n\t\tmovie_test\n\tend", "def run_test(lines=nil)\n\t\t@movTest = MovieTest.new\n\t\tload_data(@test_file, @test_data, lines)\n\n\t\t@test_data.each_key do |k|\n\t\t\t@test_data[k].movie_and_rating.each_key do |key|\n\t\t\t\tmovTest.push_results(k,key,@test_data[k].movie_and_rating[key],predict(k, @test_data[k].movie_and_rating[key]))\n\t\t\tend\n\t\tend\n\tend", "def get_prediction(appointment_id)\n\tend", "def test_scenario1 \n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal width'=> 0.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-setosa\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length'=> 6, 'petal width'=> 2},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-virginica\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length' => 4, 'petal width'=> 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}, \n {\"filename\" => File.dirname(__FILE__)+\"/data/iris_sp_chars.csv\",\n \"data_input\" => {\"pétal.length\" => 4, \"pétal&width\\u0000\" => 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}\n\t ]\n \n puts \n puts \"Scenario: Successfully comparing predictions\" \n \n data.each do |item|\n puts \n puts \"Given I create a data source uploading a <%s> file\" % item[\"filename\"]\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create a model\"\n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"And I create a local model\"\n local_model = BigML::Model.new(model, @api)\n\n puts \"When I create a prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = @api.create_prediction(model, item[\"data_input\"])\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n \n puts \"Then the prediction for <%s> is <%s>\" % [item[\"objective\"], item[\"prediction\"]]\n assert_equal(item[\"prediction\"], prediction[\"object\"][\"prediction\"][item[\"objective\"]]) \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n\n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"]) \n\n end\n end", "def test_scenario14\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal width'=> 0.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-setosa\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length'=> 6, 'petal width'=> 2},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-virginica\"},\n {\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal length' => 4, 'petal width'=> 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}, \n {\"filename\" => File.dirname(__FILE__)+\"/data/iris_sp_chars.csv\",\n \"data_input\" => {\"pétal.length\" => 4, \"pétal&width\\u0000\" => 1.5},\n \"objective\" => \"000004\", \n \"prediction\" => \"Iris-versicolor\"}\n\t ]\n \n puts \n puts \"Successfully comparing predictions with supervised model\" \n \n data.each do |item|\n puts \n puts \"Given I create a data source uploading a <%s> file\" % item[\"filename\"]\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create a model\"\n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n\n puts \"And I create a local supervised model\"\n local_model = BigML::SupervisedModel.new(model, @api)\n \n puts \"When I create a prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = @api.create_prediction(model, item[\"data_input\"])\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n \n puts \"Then the prediction for <%s> is <%s>\" % [item[\"objective\"], item[\"prediction\"]]\n assert_equal(item[\"prediction\"], prediction[\"object\"][\"prediction\"][item[\"objective\"]]) \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n\n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"]) \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(item[\"data_input\"])\n prediction = local_model.predict(item[\"data_input\"])\n \n puts \"Then the local prediction is <%s>\" % item[\"prediction\"]\n assert_equal(prediction, item[\"prediction\"])\n \n end\n end", "def initialize()\n @predictions = []\n @difference = []\n @mean = -1\n end", "def run_test(rating_num = @usermovie_rating_test.length)\n\t\t#Confirms that the requested number of predictions is not more than the total number of ratings\n\t\t#in the test set. If not, then the method is run again on all the ratings.\n\t\tif rating_num > @usermovie_rating_test.length\t\n\t\t\tputs \"Error: Test Set is too small.\"\n\t\t\trating_num = @usermovie_rating_test.length\n\t\tend\n\t\t#user_movie_pairs is an array of the concatenated strings that represent all user/movie pairs \n\t\t#in the original test set\n\t\tuser_movie_pairs = @usermovie_rating_test.keys\n\t\t#user_movie_arrays contains an array for each string element in user_movie_pairs\n\t\t#each first element in each array is the user and each second is the movie\n\t\tuser_movie_arrays = user_movie_pairs.map{|pair| pair.split(' ')}\n\t\t#users and movies contain a list of (respectively) all users and all movies from the original test set, in order.\n\t\tusers = user_movie_arrays.map{|pair_array| pair_array[0]}\n\t\tmovies = user_movie_arrays.map{|pair_array| pair_array[1]}\n\t\tresult_list = []\n\t\t#result_list = users.map[]\n\t\t#usermovie_id corresponds to the usermovie_idth element of user_movie_pairs\n\t\t(0...rating_num).each do |usermovie_id|\n\t\t\tscore_key = user_movie_pairs[usermovie_id]\n\t\t\t#user_movie_array is an array element in user_movie_arrays\n\t\t\tscore = @usermovie_rating_test[score_key]\n\t\t\tuser = users[usermovie_id]\n\t\t\tmovie = movies[usermovie_id]\n\t\t\tresult_list.push([user, movie, score, predict(user, movie)])\n\t\tend\n\t\treturn MovieTest.new(result_list)\n\tend", "def run_test(k)\n\t\tto_movietest = []\n\t\t(0..k).each do |i|\n\t\t\trow = @test_set[i]\n\t\t\tpred = predict(row[\"user_id\"],row[\"movie_id\"])\n\t\t\tto_movietest.push({\"user_id\"=>row[\"user_id\"],\"movie_id\"=>row[\"movie_id\"],\"rating\"=>row[\"rating\"],\"predicted\"=>pred})\n\t\tend\n\t\tt = MovieTest.new(to_movietest)\n\t\treturn t\n\tend", "def predict(user, movie)\n\n popularity = @popularityMap[movie].to_i\n \n feature = [popularity]\n linearRegressionModel = user_predictMap[user]\n \n predictRating = linearRegressionModel.predict(feature)\n\n #if there is no enough data to make the predict, then we will take the average rating\n # of the given user\n if predictRating.nan?\n return @avgRatingMap[user].to_i\n end\n if predictRating >= 1 && predictRating<= 5\n if predictRating*10%10 >= 5\n return predictRating.ceil\n else \n return predictRating.floor\n end\n else \n if predictRating > 5\n return 5\n else\n return 1\n end\n end\n end", "def predict\n @stop=Stop.find(params[:id])\n json=fetchPredictionRaw(@stop.stopid)\n @predictions=JSON.parse(json);\n @minimal=params[:minimal]\n respond_to do |format|\n format.html { render :predict, layout: !@minimal }\n format.json { render text: json }\n end\n end", "def click_on_predict_main_link\n\n click_on PREDICT_MAIN_LINK\n sleep(THREAD_SLEEP_2)\n\n end", "def test_scenario1\n data = [\n {\"filename\" => File.dirname(__FILE__)+\"/data/predictions_c.json\", \n \"method\" => 0,\n \"prediction\" => \"a\",\n\t \"confidence\" => 0.450471270879},\n {\"filename\" => File.dirname(__FILE__)+\"/data/predictions_c.json\",\n \"method\" => 1,\n \"prediction\" => \"a\",\n \"confidence\" => 0.552021302649},\n {\"filename\" => File.dirname(__FILE__)+\"/data/predictions_c.json\",\n \"method\" => 2,\n \"prediction\" => \"a\",\n \"confidence\" => 0.403632421178},\n {\"filename\" => File.dirname(__FILE__)+\"/data/predictions_r.json\",\n \"method\" => 0,\n \"prediction\" => 1.55555556667, \n \"confidence\" => 0.400079152063},\n {\"filename\" => File.dirname(__FILE__)+\"/data/predictions_r.json\",\n \"method\" => 1,\n \"prediction\" => 1.59376845074,\n \"confidence\" => 0.248366474212},\n {\"filename\" => File.dirname(__FILE__)+\"/data/predictions_r.json\",\n \"method\" => 2,\n \"prediction\" => 1.55555556667,\n \"confidence\" => 0.400079152063}\n ]\n\n puts \"Scenario: Successfully computing predictions combinations\"\n data.each do |item|\n puts\n\n puts \"Given I create a MultiVote for the set of predictions in file <%s>\" % item[\"filename\"]\n multivote = BigML::MultiVote.new(JSON.parse(File.open(item[\"filename\"], \"rb\").read))\n\n puts \"When I compute the prediction with confidence using method <%s>\" % item[\"method\"]\n combined_results = multivote.combine(item[\"method\"], nil, true)\n\n puts \"And I compute the prediction without confidence using method <%s>\" % item[\"method\"] \n combined_results_no_confidence = multivote.combine(item[\"method\"])\n\n if multivote.is_regression() \n puts \"Then the combined prediction is <%s>\" % item[\"prediction\"]\n assert_equal(combined_results[\"prediction\"].round(6), item[\"prediction\"].round(6))\n puts \"And the combined prediction without confidence is <%s>\" % item[\"prediction\"]\n assert_equal(combined_results_no_confidence.round(6), item[\"prediction\"].round(6))\n else\n puts \"Then the combined prediction is <%s>\" % item[\"prediction\"]\n assert_equal(combined_results[\"prediction\"], item[\"prediction\"])\n puts \"And the combined prediction without confidence is <%s>\" % item[\"prediction\"]\n assert_equal(combined_results_no_confidence,item[\"prediction\"])\n end\n puts \"And the confidence for the combined prediction is %s \" % item[\"confidence\"]\n assert_equal(combined_results[\"confidence\"].round(5), item[\"confidence\"].round(5)) \n end\n\n end", "def update_predictions(user_vector, unrated_content_vectors, content_type)\n inversed_document_frequency_hash = build_inversed_document_frequency_hash(content_type)\n unrated_content_vectors.each do |content_vector|\n set_single_prediction(user_vector, content_vector, inversed_document_frequency_hash, content_type)\n end\n end", "def tell_fortune()\r\n print \"The answer is \" + $prediction + \". \\n\\n: \"\r\n end", "def predict(user_id, movie_id)\n\t\tmovie_avg = movie_avg(movie_id)\n\t\tuser_deviation = user_deviation(user_id)\n\t\tpredict = movie_avg + user_deviation\n\t\tif predict < 1\n\t\t\treturn 1.0\n\t\telsif predict > 5\n\t\t\treturn 5.0\n\t\telse\n\t\t\treturn predict\t\n\t\tend\t\n\tend", "def predict(user_id, movie_id)\n movie_average_rating = set.popularity(movie_id)\n #puts \"The popularity of movie #{movie_id} is #{movie_average_rating}\"\n\n most_similar_users_list_ratings = set.most_similar(user_id)[0..29].collect do |u, r|\n if rating(u, movie_id)!=0 then\n rating(u, movie_id)\n end\n end.compact[0..9]\n #puts \"Actual rating: #{rating(user_id, movie_id)}\"\n #puts \"most_similar_users_list_ratings: #{most_similar_users_list_ratings}\"\n #puts \"Prediction: #{take_average(most_similar_users_list_ratings)}\"\n\n if most_similar_users_list_ratings.size > 0\n avg_most_similar_users_ratings = take_average(most_similar_users_list_ratings)\n 0.3*avg_most_similar_users_ratings+0.7*movie_average_rating\n else\n movie_average_rating\n end\n end", "def run_test(num = -1)\n\t\tpred_list = []\n\t\tcount = 0\n\t\ttest_file.each_line do |line|\n\t\t\tsplited = line.split(\" \")\n\t\t\tuser_id = splited[0].to_i\n\t\t\tmovie_id = splited[1].to_i\n\t\t\trating = splited[2].to_i\n\t\t\tpredict = predict(user_id,movie_id)\n\t\t\terror = (rating - predict).abs\n\t\t\tpred_list << {user_id: user_id, movie_id: movie_id, rating: rating, predict: predict,error: error}\n\t\t\tcount += 1\n\t\t\t#if num is -1 the default value, then run all of the tests\n\t\t\t#if num is positive then check to stop\n\t\t\tif count >= num and num > 0\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\treturn MovieTest.new(pred_list)\n\tend", "def test_scenario9\n \n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 5}, \"000004\", 'Iris-versicolor', {}, \"probability\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, \"000004\", 'Iris-setosa', {}, \"probability\" ]\n ]\n puts\n puts \"Scenario: Successfully comparing predictions for logistic regressions with operating kind and supervised model:\"\n\n data.each do |filename, data_input, objective, prediction_result, params, operating_kind|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create a logistic regression with objective\" \n logisticregression=@api.create_logisticregression(dataset)\n\n puts \"And I wait until the logistic regression is ready\"\n assert_equal(BigML::HTTP_CREATED, logisticregression[\"code\"])\n assert_equal(1, logisticregression[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(logisticregression), true)\n \n puts \"And I create a local logistic regression\"\n localSupervisedModel = BigML::SupervisedModel.new(logisticregression)\n\n puts \"When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(logisticregression['resource'], data_input, {\"operating_kind\" => operating_kind})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n\n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end\n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = localSupervisedModel.predict(data_input, {\"operating_kind\" => operating_kind})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n\n assert_equal(local_prediction, prediction_result)\n \n end\n \n end", "def generate_predictions\n stat_hash = @email_statistics.hashed_statistics\n temp = stat_hash.sort_by{ |k, v| v }\n max_value = temp.last.last\n stat_hash.each{ |k,v| @predictions << k if v == max_value }\n # puts @predictions\n # puts \"-\" * 30\n end", "def test\n rows = Util.get_rows(:file => 'data/vehicles.csv', :n => 3000, :pre_process => true)\n classes = rows.transpose.last\n rows = rows.transpose[0..-2].transpose\n train(rows.first(2000), classes.first(2000))\n \"#{classes.last} classified as #{classify(rows.last)}\"\n end", "def test_scenario2\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-setosa', {\"kind\" => \"probability\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, 'Iris-versicolor', {\"kind\" => \"probability\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\" => 2.4}, 'Iris-setosa', {\"kind\" => \"confidence\", \"threshold\" => 0.1, \"positive_class\" => \"Iris-setosa\"}, \"000004\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"sepal length\" => 4.1, \"sepal width\" => 2.4}, 'Iris-versicolor', {\"kind\" => \"confidence\", \"threshold\" => 0.9, \"positive_class\" => \"Iris-setosa\"}, \"000004\"]\n ]\n puts\n puts \"Scenario : Successfully comparing predictions in operating points for models\"\n\n data.each do |filename, data_input, prediction_result, operating_point, objective|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create model\"\n model=@api.create_model(dataset)\n \n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n \n puts \"And I create a local model\"\n local_model = BigML::Model.new(model, @api)\n\n puts \"When I create a prediction for %s in %s \" % [JSON.generate(data_input), JSON.generate(operating_point)]\n prediction = @api.create_prediction(model, data_input, {\"operating_point\" => operating_point})\n \n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n assert_equal(@api.ok(prediction), true)\n\n puts \"Then the prediction for '<%s>' is '<%s>'\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end\n\n puts \"And I create a local prediction for <%s> in <%s>\" % [JSON.generate(data_input), JSON.generate(operating_point)]\n local_prediction = local_model.predict(data_input, {\"operating_point\" => operating_point})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_model.regression) or \n (local_model.is_a?(BigML::MultiModel) and local_model.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n \n end", "def train(input, expected_output)\n # binding.pry\n output = calculate_output(input)\n backpropogate(expected_output)\n update_weights_from_error\n calculate_error(output, expected_output)\n end", "def test(similarity=\"pearson\",aggregation=\"weight_average\",k=nil)\n data = MovieData.new\n data.load_data('ml-100k',:u1) \n puts (time do\n p = Predicter.new(data,Similarity.method(similarity),Aggregation.method(aggregation))\n puts p.run_test(k).inspect\n end)\nend", "def predict(m, viewer_list)\n return 3 if viewer_list.size == 0\n prediction, similarity_tally = 0, 0\n viewer_list.each do |viewer|\n sim = similarity(viewer)\n similarity_tally += sim\n prediction += sim * viewer.rating_list[m].rating\n end\n return prediction/similarity_tally.to_f unless similarity_tally == 0\n return 3\n end", "def tell_fortunte()\n\t\tprint \"The answer is \" + $prediction + \". \\n\\n: \"\n\tend", "def train_data\n ::RubyFann::TrainData.new(\n :inputs => inputs, \n :desired_outputs=> desired_outputs)\n end", "def predict(day_of_week, minute_of_day)\n return nil if @predictor.nil?\n @predictor.eval([day_of_week, minute_of_day])\n \n rescue Ai4r::Classifiers::ModelFailureError\n return nil\n end", "def test_scenario3\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 4}, '000004', 'Iris-versicolor', {}, {\"kind\" => \"probability\", \"threshold\" => 1, \"positive_class\" => \"Iris-virginica\"}],\n ]\n puts\n puts \"Scenario: Successfully comparing predictions for deepnets with operating point\"\n\n data.each do |filename, data_input, objective, prediction_result, params, operating_point|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create a deepnet with objective <%s> and <%s>\" % [objective, JSON.generate(params)]\n deepnet = @api.create_deepnets(dataset, params.merge({\"objective_field\" => objective}))\n \n puts \"And I wait until the deepnet is ready\"\n assert_equal(BigML::HTTP_CREATED, deepnet[\"code\"])\n assert_equal(@api.ok(deepnet), true)\n \n puts \"And I create a local deepnet\"\n local_deepnet = BigML::Deepnet.new(deepnet['resource'])\n \n puts \" When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(deepnet['resource'], data_input, {\"operating_point\" => operating_point})\n\n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end \n \n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_deepnet.predict(data_input, {\"operating_point\" => operating_point})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_deepnet.regression) or \n (local_deepnet.is_a?(BigML::MultiModel) and local_deepnet.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n end", "def test_scenario1\n data = [{\"filename\" => File.dirname(__FILE__)+\"/data/iris.csv\", \n \"data_input\" => {'petal width'=> 0.5},\n\t \"objective\" => \"000004\",\n\t \"prediction\" => \"Iris-setosa\"},\n\t {\"filename\" => File.dirname(__FILE__)+\"/data/iris_sp_chars.csv\",\n\t \"data_input\" => {'pétal&width'=> 0.5},\n\t \"objective\" => \"000004\",\n\t \"prediction\" => \"Iris-setosa\"}]\n\n puts \n puts \"Scenario: Successfully creating a prediction:\"\n \n data.each do |item|\n\n puts \n puts \"Given I create a data source uploading a \" + item[\"filename\"] + \" file\"\n source = @api.create_source(item[\"filename\"], {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create model\"\n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"When I create a prediction for \" + JSON.generate(item[\"data_input\"])\n prediction = @api.create_prediction(model, item[\"data_input\"])\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n\n puts \"Then the prediction for \" + item[\"objective\"] + \" is \" + item[\"prediction\"]\n assert_equal(item[\"prediction\"], prediction[\"object\"][\"prediction\"][item[\"objective\"]])\n\n end\n\n end", "def test_scenario1\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal width\" => 0.5}, '000004', 'Iris-setosa']]\n\n puts \n puts \"Scenario: Successfully creating a prediction using a public model\"\n\n data.each do |filename, data_input, objective, prediction_result|\n puts \n puts \"Given I create a data source uploading a %s file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n \n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n puts \"And I create model\" \n model=@api.create_model(dataset)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"And I make the model public\"\n model = @api.update_model(model, {'private'=> false, 'white_box' => true})\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_ACCEPTED, model[\"code\"])\n assert_equal(@api.ok(model), true)\n\n puts \"And I check the model status using the model's public url\"\n model = @api.get_model(\"public/%s\" % model[\"resource\"])\n assert_equal(BigML::FINISHED, model[\"object\"][\"status\"][\"code\"]) \n\n puts \"When I create a prediction for <%s>\" % JSON.generate(data_input)\n prediction = @api.create_prediction(model, data_input)\n assert_equal(BigML::HTTP_CREATED, prediction[\"code\"])\n\n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n assert_equal(prediction_result, prediction[\"object\"][\"prediction\"][objective])\n\n puts \"And I make the model private again\"\n model = @api.update_model(model, {'private'=> true, 'white_box' => true})\n assert_equal(BigML::HTTP_ACCEPTED, model[\"code\"])\n \n end\n\n end", "def batch_predict(rows, count=100)\n return raw_predict(rows.to_enum, count, api_limits['predictions_max_response_cells'], api_limits['predictions_max_cols'], true)\n end", "def predict_age(age1, age2, age3, age4, age5, age6, age7, age8)\n ages = [age1, age2, age3, age4, age5, age6, age7, age8]\n ((Math::sqrt(ages.map { |age| age**2 }.sum)) / 2).to_i\nend", "def predict(comment)\n input = @prediction.trainedmodels.predict.request_schema.new\n input.input = {}\n input.input.csv_instance = comment\n\n result = @client.execute(\n :api_method => @prediction.trainedmodels.predict,\n :parameters => {'id' => 'emotion_prediction_id'},\n :headers => {'Content-Type' => 'application/json'},\n :body_object => input\n )\n\n assemble_json_body(result)\n end", "def test_scenario6\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2.46}, '000004', 'Iris-setosa', {}, \"probability\"],\n [File.dirname(__FILE__)+'/data/iris.csv', {\"petal length\" => 2}, '000004', 'Iris-setosa', {}, \"probability\"],\n ]\n \n puts\n puts \"Scenario: Successfully comparing predictions for deepnets with operating kind\"\n\n data.each do |filename, data_input, objective, prediction_result, params, operating_kind|\n puts\n puts \"Given I create a data source uploading a <%s> file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n \n puts \"And I create a dataset\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n \n puts \"And I create a deepnet with objective <%s> and <%s>\" % [objective, JSON.generate(params)]\n deepnet = @api.create_deepnets(dataset, params.merge({\"objective_field\" => objective}))\n \n puts \"And I wait until the deepnet is ready\"\n assert_equal(BigML::HTTP_CREATED, deepnet[\"code\"])\n assert_equal(@api.ok(deepnet), true)\n \n puts \"And I create a local deepnet\"\n local_deepnet = BigML::Deepnet.new(deepnet['resource'])\n \n puts \" When I create a prediction for <%s>\" % [JSON.generate(data_input)]\n prediction = @api.create_prediction(deepnet['resource'], data_input, {\"operating_kind\" => operating_kind})\n\n puts \"Then the prediction for <%s> is <%s>\" % [objective, prediction_result]\n \n if !prediction['object']['prediction'][objective].is_a?(String)\n assert_equal(prediction['object']['prediction'][objective].to_f.round(5), prediction_result.to_f.round(5))\n else\n assert_equal(prediction['object']['prediction'][objective], prediction_result)\n end \n\n puts \"And I create a local prediction for <%s>\" % JSON.generate(data_input)\n local_prediction = local_deepnet.predict(data_input,{\"operating_kind\" => operating_kind})\n \n puts \"Then the local prediction is <%s>\" % prediction_result\n \n if local_prediction.is_a?(Array)\n local_prediction = local_prediction[0]\n elsif local_prediction.is_a?(Hash)\n local_prediction = local_prediction['prediction']\n else\n local_prediction = local_prediction\n end \n \n if (local_deepnet.regression) or \n (local_deepnet.is_a?(BigML::MultiModel) and local_deepnet.models[0].regression)\n assert_equal(local_prediction.to_f.round(4), prediction_result.to_f.round(4))\n else\n assert_equal(local_prediction, prediction_result)\n end \n \n end\n end", "def train_model( instances )\n instances = [ instances ] unless instances.class == Array\n # First randomize data **TODO** Use GSL for ranomization\n instances.sort!{ |xx,yy| rand(3) + 1 }\n # Step through each instance.\n instances.each do |inst|\n # First, predict based on current weights\n sum = score( inst )\n # Now, if we predict incorrectly, then we need to adjust weights\n if sum > @threshold\n # Fix weights for false positives\n demote!( inst ) if !inst.is_class\n else\n # Fix weights for false negatives\n promote!( inst ) if inst.is_class\n end\n end\n instances.push( *instances )\n end", "def new\n @prediction = Prediction.new\n end", "def predict(u,m)\n viewer_list = []\n viewers(m).each do |id|\n viewer_list << @user_list[id]\n end\n @user_list[u].predict(m, viewer_list)\n end", "def doTraining\n\t\t# Ruby fan uses its own special data structure. 2D Array for both X and Y data\n\t\ttrain\t\t= RubyFann::TrainData.new(inputs: @xData[:train], desired_outputs: @yData[:train])\n\t\t# Train\n\t\tmachine\t= RubyFann::Standard.new(num_inputs: @nInputs, hidden_neurons:[2], num_outputs: 1)\n\t\tmachine.train_on_data(train, @iterations, @reportSteps, @maxError) \n\t\t# Remember to send the machine back to the caller\n\t\tmachine\n\tend", "def prediction_data(user_id, movie_id)\n if user_id != @user_marker\n @best_match.clear\n most_similar(user_id) #will return the top 20 best matched viewers.\n @user_marker = user_id\n end\n\n matched_movies = viewers(movie_id) #list of all users who saw the movie\n if matched_movies == 0\n prediction = 1\n return prediction\n end\n predictive_users = (@best_match & matched_movies) #sets our predictive data to be the subset \n # of best_match that has also seen this movie\n \n my_prediction = MoviePredictor.new(@user_hash, @movie_hash)\n \n if predictive_users.empty? \n return my_prediction.rating_average(movie_id)\n end\n \n return my_prediction.predict(predictive_users, movie_id, user_id)\n end", "def index\n @prediction = Prediction.all\n end", "def run_test(k = 150)\n tests = Array.new\n i=0\n\t @test_set.each do |line|\n break if i==k\n\t\t\ttrue_rating = line[2]\n\t\t\tuser_name = line[0]\n\t\t\tmovie_name = line[1]\n\t\t\tguess_rating = predict(user_name, movie_name)\n data = [user_name, movie_name, true_rating, guess_rating] #stores into tuple\n tests << data\n i+=1\n end\n mt = MovieTest.new(tests)\n return mt\n \n end", "def predict_for(user_id, klass, item_id)\n user_id = user_id.to_s\n item_id = item_id.to_s\n\n liked_by_set = Recommendations::Helpers::RedisKeyMapper.liked_by_set_for(klass, item_id)\n similarity_sum = 0.0\n\n # Get sum of similarities of each item in set\n similarity_sum = similarity_total_for(user_id, liked_by_set)\n\n liked_by_count = Recommendations.redis.pipelined do\n Recommendations.redis.scard(liked_by_set)\n end\n prediction = similarity_sum / (liked_count).to_f\n prediction.finite ? prediction : 0.0\n end", "def fit(predictors, targets)\n @predictors = predictors.map { |pred| Vector.elements(pred) }\n @targets = targets\n\n nil\n end", "def predict_batch(batch_data)\n # onnx predictions\n predicts = @onnx_session.run(nil, batch_data)\n\n predicts[0].map do |p|\n p.map do |r|\n r.each_with_index.max[1]\n end\n end\n end", "def create\n @predict = Predict.new(params[:predict])\n\n respond_to do |format|\n if @predict.save\n format.html { redirect_to @predict, notice: 'Predict was successfully created.' }\n format.json { render json: @predict, status: :created, location: @predict }\n else\n format.html { render action: \"new\" }\n format.json { render json: @predict.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_scenario1\n data = [[File.dirname(__FILE__)+'/data/iris.csv', {\"tags\" => [\"mytag\"]}, 'mytag', {\"petal width\" => 0.5}, 'Iris-setosa']]\n\n puts \n puts \"Scenario: Successfully creating a prediction from a multi model\"\n\n data.each do |filename,params,tag,data_input,prediction_result|\n puts \n puts \"Given I create a data source uploading a %s file\" % filename\n source = @api.create_source(filename, {'name'=> 'source_test', 'project'=> @project[\"resource\"]})\n\n puts \"And I wait until the source is ready\"\n assert_equal(BigML::HTTP_CREATED, source[\"code\"])\n assert_equal(1, source[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(source), true)\n\n puts \"And I create dataset with local source\"\n dataset=@api.create_dataset(source)\n\n puts \"And I wait until the dataset is ready\"\n assert_equal(BigML::HTTP_CREATED, dataset[\"code\"])\n assert_equal(1, dataset[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(dataset), true)\n\n list_of_models = []\n puts \"And I create model with params %s\" % JSON.generate(params)\n model=@api.create_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n list_of_models << model \n puts \"And I create model with params %s\" % JSON.generate(params)\n model=@api.create_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true) \n\n list_of_models << model\n\n puts \"And I create model with params %s\" % JSON.generate(params)\n model=@api.create_model(dataset, params)\n\n puts \"And I wait until the model is ready\"\n assert_equal(BigML::HTTP_CREATED, model[\"code\"])\n assert_equal(1, model[\"object\"][\"status\"][\"code\"])\n assert_equal(@api.ok(model), true)\n\n list_of_models << model\n\n puts \"And I create a local multi model\"\n local_multimodel = BigML::MultiModel.new(list_of_models, @api)\n\n puts \"When I create a local prediction for <%s>\" % data_input\n prediction = local_multimodel.predict(data_input)\n\n puts \"Then the prediction is <%s>\" % prediction\n assert_equal(prediction, prediction_result)\n\n end\n\n end", "def forward\n new_x, new_y = forward_prediction\n reset(x: new_x, y: new_y, f: @f)\n end", "def run_test(k = -1)\n file = open(@test)\n t = MovieTest.new()\n if k == -1\n file.each_line do |line|\n attrs = line.split\n uid = attrs[0].to_i\n mid = attrs[1].to_i\n rating = attrs[2].to_i\n prating = predict(uid, mid)\n t.predictions.push([uid, mid, rating, prating])\n difference = (rating - prating).abs\n t.difference.push(difference)\n end\n else\n (0..k-1).each do\n line = file.readline\n attrs = line.split\n uid = attrs[0].to_i\n mid = attrs[1].to_i\n rating = attrs[2].to_i\n prating = predict(uid, mid)\n t.predictions.push([uid, mid, rating, prating])\n difference = (rating - prating).abs\n t.difference.push(difference)\n end\n end\n\n return t\n end", "def predict_age(*args)\n Math.sqrt(args.map {|a| a**2}.sum).div(2)\nend", "def start_predict_by_iterator(predict_iterator, batch_size: 100)\r\n @predicted_data = nil\r\n @last_predicted_batch = nil\r\n @predict_iterator = predict_iterator\r\n @num_predict_datas = predict_iterator.num_datas\r\n @batch_size = batch_size >= @num_predict_datas ? @num_predict_datas : batch_size\r\n @predict_step = 1\r\n @predict_max_steps = (@num_predict_datas.to_f / @batch_size).ceil\r\n @predict_state = :start_predict_step\r\n end" ]
[ "0.73955566", "0.7159063", "0.6958304", "0.6767968", "0.6767968", "0.673815", "0.66892606", "0.6639657", "0.66204596", "0.65931046", "0.65644634", "0.6562667", "0.6496972", "0.6481561", "0.64305604", "0.6427423", "0.62992793", "0.62512964", "0.62239105", "0.62217987", "0.61884254", "0.6114766", "0.60867417", "0.6086214", "0.60754454", "0.60635734", "0.6052799", "0.60122246", "0.60059696", "0.599595", "0.59800655", "0.59618807", "0.59327286", "0.59327286", "0.59257555", "0.5916973", "0.59077793", "0.5895266", "0.58948094", "0.5880513", "0.58581907", "0.585454", "0.5831504", "0.58274585", "0.58270764", "0.58225375", "0.5807139", "0.58033335", "0.5794796", "0.5787233", "0.5785376", "0.57775116", "0.57700294", "0.5754495", "0.57462054", "0.5744612", "0.57350117", "0.57219523", "0.5713742", "0.57089317", "0.57066005", "0.5696361", "0.56941473", "0.5674794", "0.56724226", "0.5672198", "0.56668293", "0.56653094", "0.5661178", "0.56575274", "0.5650628", "0.56490016", "0.56488603", "0.56411165", "0.56364626", "0.56277", "0.56266403", "0.5613262", "0.56050813", "0.5600731", "0.5586683", "0.55761474", "0.55714464", "0.5570754", "0.556962", "0.55590796", "0.5553463", "0.55466175", "0.55370754", "0.55312866", "0.5527886", "0.55218196", "0.55158836", "0.550901", "0.5507449", "0.5507136", "0.5506502", "0.5497568", "0.5496346", "0.5495395", "0.548852" ]
0.0
-1
Based on the density and population for a state, we're determining the number of deaths then printing out the prediction
def predicted_deaths # predicted deaths is solely based on population density # Use case/when for determining number of deaths case @population_density when @population_density >= 200; number_of_deaths = (@population * 0.4).floor when @population_density >= 150; number_of_deaths = (@population * 0.3).floor when @population_density >= 100; number_of_deaths = (@population * 0.2).floor when @population_density >= 50; number_of_deaths = (@population * 0.1).floor else number_of_deaths = (@population * 0.05).floor end print "#{@state} will lose #{number_of_deaths} people in this outbreak" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths # this is going to print out the deaths for each state on the outbreak which is going to be based on population and population density\n \n death_percent = 0.1 if @population_density >= 50\n death_percent = 0.2 if @population_density >= 100\n death_percent = 0.3 if @population_density >= 150\n death_percent = 0.4 if @population_density >= 200\n death_percent = 0.05 if @population_density < 50\n number_of_deaths = (@population * death_percent).floor\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n \n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n ## Refactored for Release: 8\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n \n number_of_deaths = (@population * 0.05).floor if @population_density < 50\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n number_of_deaths = (@population * multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density.to_i/50) * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak!!!\\n\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population_density * (0.1 * (@population / 50)) ).floor\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\r\n \r\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\r\n \r\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\r\n \r\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\r\n \r\n number_of_deaths = (@population * 0.05).floor if @population_density >= 0\r\n \r\n # end\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths(state_density, population)\n # predicted deaths is solely based on population density\n number_of_deaths = ''\n hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\n\n hash.each do |density, float|\n if @population_density >= density\n number_of_deaths = (@population * float).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n number_of_deaths\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n factor = case population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4 \n end\n number_of_deaths = (population * factor).floor\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n case when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n when\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # perhaps a case statement is a little more dry?\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(@population_density, @population, @state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if population_density >= 200 # predicted_deaths passes in the population density and population and uses a ratio to determine the number effected by the virus\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else \n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = death_percentage(0.4)\n elsif @population_density >= 150\n number_of_deaths = death_percentage(0.3)\n elsif @population_density >= 100\n number_of_deaths = death_percentage(0.2)\n elsif @population_density >= 50\n number_of_deaths = death_percentage(0.1)\n else\n number_of_deaths = death_percentage(0.05)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n fractions = [0.4, 0.3, 0.2, 0.1, 0.05]\n density = [200, 150, 100, 50, 0]\n \n index = 0\n while index < density.length\n if @population_density >= density[index]\n number_of_deaths = (@population * fractions[index]).floor\n break\n end\n index += 1\n end\n \n # if @population_density >= density[0]\n # number_of_deaths = (@population * fractions[0]).floor\n # elsif @population_density >= density[1]\n # number_of_deaths = (@population * fractions[1]).floor\n # elsif @population_density >= density[2]\n # number_of_deaths = (@population * fractions[2].floor\n # elsif @population_density >= density[3]\n # number_of_deaths = (@population * fractions[3]).floor\n # else\n # number_of_deaths = (@population * fractions[4]).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n #popd = [200, 150, 100, 50]\n #perc = [0.4, 0.3, 0.2, 0.1]\n\n #popd[i]\n\n if @population_density < 50\n number_of_deaths = (@population * 0.05)\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n else @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n\n\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths =\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n #puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths =\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths \n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\" end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n # case @population_density\r\n # \twhen @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n # \twhen @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n # end\r\n \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n # if population_density >= 200\n # number_of_deaths = (population * 0.4).floor\n # elsif population_density >= 150\n # number_of_deaths = (population * 0.3).floor\n # elsif population_density >= 100\n # number_of_deaths = (population * 0.2).floor\n # elsif population_density >= 50\n # number_of_deaths = (population * 0.1).floor\n # else\n # number_of_deaths = (population * 0.05).floor\n # end\n pop_percentage = 0.0\n density_test = 50\n if population_density >= 50\n while population_density >= density_test do \n pop_percentage += 0.1\n density_test += 50\n end\n number_of_deaths = (population * pop_percentage).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * ((@population_density/50).floor*0.1)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n print \"#{@state} will lose #{(@population * 0.4).floor} people in this outbreak\"\n elsif @population_density >= 150\n print \"#{@state} will lose #{(@population * 0.3).floor} people in this outbreak\"\n elsif @population_density >= 100\n print \"#{@state} will lose #{(@population * 0.2).floor} people in this outbreak\"\n elsif @population_density >= 50\n print \"#{@state} will lose #{(@population * 0.1).floor} people in this outbreak\"\n else\n print \"#{@state} will lose #{(@population * 0.05).floor} people in this outbreak\"\n end\n\n end", "def predicted_deaths\r\n\r\n number_of_deaths = (population * 0.05).floor\r\n \r\n 4.times do |i|\r\n if population_density >= 50*(i+1)\r\n number_of_deaths = (population * 0.1*(i+1)).floor\r\n end\r\n end\r\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths()\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths()\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n\n x = 1\n\n number_of_deaths = (@population * x).floor\n case @population_density\n\n when (150...200)\n x = 0.3\n when (100...150)\n x = 0.2\n when (50...100)\n x = 0.1\n when (0...50)\n x= 0.05\n else\n x = 0.4\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n # number_of_deaths = (@population * (@population_density/500.0)).floor\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = 0\n density_hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1,0 => 0.05}\n density_hash.each_key { |key|\n if @population_density >= key\n number_of_deaths = (@population * density_hash[key]).floor\n end\n }\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density > 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density <= 200 && @population_density >= 50\r\n number_of_deaths = @population * ((@population_density/50) * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density < 50\r\n number_of_deaths = (@population * 0.05).floor\r\n else\r\n increment = (@population_density/50).floor\r\n number_of_deaths=(@population * (increment * 0.1)).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n density = [200, 150, 100, 50, 0]\n multiplier = [0.4, 0.3, 0.2, 0.1, 0.05]\n density.length.times do |x|\n @population_density >= density[x]\n @number_of_deaths = (@population * multiplier[x]).floor \n end\n# if @population_density >= 200\n# number_of_deaths = (@population * 0.4).floor\n# elsif @population_density >= 150\n# number_of_deaths = (@population * 0.3).floor\n# elsif @population_density >= 100\n# number_of_deaths = (@population * 0.2).floor\n# elsif @population_density >= 50\n# number_of_deaths = (@population * 0.1).floor\n# else\n# number_of_deaths = (@population * 0.05).floor\n# end\n\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density < 50\n \tnumber_of_deaths = (@population * 0.05).floor\n elsif @population_density < 100\n \tnumber_of_deaths = (@population * 0.1).floor\n elsif @population_density < 150\n \tnumber_of_deaths = (@population * 0.2).floor\n elsif @population_density < 200\n \tnumber_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 200\n \tnumber_of_deaths = (@population * 0.4).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n number_of_deaths=0\r\n density=[200,150,100,50,0]\r\n death_percentage=[0.4, 0.3, 0.2, 0.1, 0.05]\r\n\r\n density.each_index do |index|\r\n if @population_density >= density[index]\r\n number_of_deaths = (@population * death_percentage[index]).floor\r\n break\r\n end\r\n end\r\n=begin\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n=end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n\n case @population_density \n when 0...50 then i = 0.05 \n when 50...100 then i = 0.1\n when 100...150 then i = 0.2\n when 150...200 then i = 0.3\n else i = 0.4\n end\n\n number_of_deaths = (@population * i).floor\n\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths # Its gonna predict number of deaths based on population density by muliplying population by given factor, for each state\n array = [50, 100, 150, 200].reverse\n array.each do |end_of_range|\n if @population_density >= end_of_range\n number_of_deaths = ( @population * end_of_range / 500 )\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n break\n else\n number_of_deaths = (@population * 0.05).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n break\n end\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n @number_of_deaths = if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n case @population_density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density>= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density>= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n \n pop = @population_density\n case pop \n when pop >= 200 \n number_of_deaths = (@population * 0.4).floor\n when pop >= 150 \n number_of_deaths = (@population * 0.3).floor\n when pop >= 100 \n number_of_deaths = (@population * 0.2).floor\n when pop >= 50 \n number_of_deaths = (@population * 0.1).floor \n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n number_of_deaths = (@population * factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n multiplier = 0\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n # end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n num = case @population_density\n when 200..99999 then 0.4\n when 150...200 then 0.3\n when 100...150 then 0.2\n when 50...100 then 0.1\n when 0...50 then 0.05\n end\n number_of_deaths = (@population * num).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 50\n multiplication_factor = (@population_density.fdiv(50)).floor.fdiv(10)\n # (density / 50), rounded down to int, then divided by 10\n # ex: 200 / 50 = 4, 4/10 = 0.4\n # ex: 185 / 50 = 3.7, rounded to 3, 3/10 = 0.3\n else # if population density < 50\n multiplication_factor = 0.05\n end\n \n \n \n number_of_deaths = (@population * multiplication_factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = (@population * (@population_density/500)).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n case @population_density\n # predicted deaths is solely based on population density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_multiplier = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\n death_multiplier.each do |density, multiplier|\n if @population_density >= density\n @number_of_deaths = (@population * multiplier).floor\n end\n \n end\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0...50 then number_of_deaths = calc_density(0.05)\n when 50...100 then number_of_deaths = calc_density(0.1)\n when 100...150 then number_of_deaths = calc_density(0.2)\n when 150...200 then number_of_deaths = calc_density(0.3)\n else number_of_deaths = calc_density(0.4)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n case @population_density\n when 0 .. 49 then number_of_deaths = (@population * 0.05).floor\n when 50 .. 99 then number_of_deaths = (@population * 0.1).floor\n when 100 .. 149 then number_of_deaths = (@population * 0.2).floor\n when 150 .. 200 then number_of_deaths = (@population * 0.3).floor\n else number_of_deaths = (@population * 0.4).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density > 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density <= 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density/50 * 0.1)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n\r\n # number_of_deaths = @population * ((@population_density / 50).floor / 10)\r\n\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population*((@population_density/50).floor)*(0.1)).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\r\n\r\n #(population_density, population, state) <--- deleted, not necessary\r\n # predicted deaths is solely based on population density\r\n\r\n #idx = 0.4 if population_density >= 200\r\n #idx = 0.3 if population_density >= 150\r\n \r\n case population_density\r\n when 0..49 then idx = 0.05\r\n when 50..99 then idx = 0.1\r\n when 100..150 then idx = 0.2\r\n when 151..200 then idx = 0.3\r\n else idx = 0.4\r\n end\r\n\r\n\r\n # if population_density >= 200\r\n # idx = 0.4\r\n # #number_of_deaths = (population * 0.4).floor\r\n # elsif population_density >= 150\r\n # idx = 0.3\r\n # #number_of_deaths = (population * 0.3).floor\r\n # elsif population_density >= 100\r\n # idx = 0.2\r\n # #number_of_deaths = (population * 0.2).floor\r\n # elsif population_density >= 50\r\n # idx = 0.1\r\n # #number_of_deaths = (population * 0.1).floor\r\n # else\r\n # idx = 0.05\r\n # #number_of_deaths = (population * 0.05).floor\r\n # end\r\n\r\n number_of_deaths = (population * idx).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n elsif @population_density >= 50 && @population_density < 200\n number_of_deaths = ((( @population_density / 50 ) / 10 ) * @population).floor \n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end" ]
[ "0.8503434", "0.84995985", "0.8488351", "0.8488351", "0.8488351", "0.8488351", "0.8488351", "0.8488351", "0.8466374", "0.84660757", "0.84493667", "0.84493446", "0.84487724", "0.84477603", "0.841132", "0.84048444", "0.8403927", "0.839711", "0.8389722", "0.8377348", "0.83712006", "0.83712006", "0.83712006", "0.83712006", "0.83712006", "0.8370738", "0.8366816", "0.83637154", "0.8325496", "0.83245105", "0.8311046", "0.82953143", "0.8293291", "0.8251205", "0.8249033", "0.82299185", "0.8224192", "0.822234", "0.8221161", "0.8217138", "0.8214063", "0.82116896", "0.8209073", "0.82050055", "0.81953317", "0.81905437", "0.8187733", "0.8183235", "0.81812716", "0.81812716", "0.81731457", "0.8170639", "0.81651014", "0.8163369", "0.8156185", "0.8151201", "0.8151201", "0.8146553", "0.8144648", "0.81348217", "0.81332356", "0.81303906", "0.8128997", "0.8127903", "0.81262904", "0.81256706", "0.8124299", "0.8122375", "0.81223583", "0.81223583", "0.81223583", "0.81223583", "0.81223583", "0.81223583", "0.81221426", "0.8117985", "0.8117122", "0.81170285", "0.81166565", "0.81159025", "0.8114048", "0.8113332", "0.81095386", "0.8108676", "0.81077373", "0.8106524", "0.8106524", "0.8105467", "0.8103806", "0.8103682", "0.8102551", "0.8094281", "0.80941796", "0.8094173", "0.809371", "0.809371", "0.809371", "0.809371", "0.809371", "0.809371", "0.809371" ]
0.0
-1
Based on the population density, this predicts the number of months in which the disease will spread across the state
def speed_of_spread #in months # We are still perfecting our formula here. The speed is also affected # by additional factors we haven't added into this functionality. speed = 0.0 case when @population_density >= 200; speed += 0.5 when @population_density >= 150; speed += 1 when @population_density >= 100; speed += 1.5 when @population_density >= 50; speed += 2 else speed += 2.5 end puts " and will spread across the state in #{speed} months.\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predicted_deaths\n # predicted deaths is solely based on population density\n STATE_FORMULA.each do |state_size, calculation|\n if @population_density >= calculation[:pop_density]\n return number_of_deaths = (@population * calculation[:deaths]).floor\n end\n end\n number_of_deaths = (@population * 0.05).floor\n end", "def months_to_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n if @population_density >= 200\n 0.5\n elsif @population_density >= 150\n 1\n elsif @population_density >= 100\n 1.5\n elsif @population_density >= 50\n 2\n else\n 2.5\n end\n\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n\n x = 1\n\n number_of_deaths = (@population * x).floor\n case @population_density\n\n when (150...200)\n x = 0.3\n when (100...150)\n x = 0.2\n when (50...100)\n x = 0.1\n when (0...50)\n x= 0.05\n else\n x = 0.4\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n case @population_density\n when 200..Float::INFINITY\n rate = 0.4\n when 150..199\n rate = 0.3\n when 100..149\n rate = 0.2\n when 50..99\n rate = 0.1\n else rate = 0.05\n end\n\n number_of_deaths = (@population * rate).floor\n\n number_of_deaths\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n multiplier = (@population_density/50).floor\n number_of_deaths = (@population * (multiplier * 0.1)).floor\n end\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * (@population_density.to_i/50) * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak!!!\\n\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n @number_of_deaths = (@population * factor).floor\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density <= 50\n number_of_deaths = (@population * 0.05).floor\n else\n multipler_var = (@population_density / 50) * 0.1\n number_of_deaths = (@population * multipler_var).floor\n end\n end", "def predicted_deaths\n \n # predicted deaths is based on population density\n if @population_density >= 200\n factor = 0.4\n elsif @population_density >= 150\n factor = 0.3\n elsif @population_density >= 100\n factor = 0.2\n elsif @population_density >= 50\n factor = 0.1\n else\n factor = 0.05\n end\n\n @number_of_deaths = (@population * factor).floor\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n factor = case population_density\n when 0...50 then 0.05\n when 50...100 then 0.1\n when 100...150 then 0.2\n when 150...200 then 0.3\n else 0.4 \n end\n number_of_deaths = (population * factor).floor\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\r\n \r\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\r\n \r\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\r\n \r\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\r\n \r\n number_of_deaths = (@population * 0.05).floor if @population_density >= 0\r\n \r\n # end\r\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n\n n = [50, 100, 150, 200]\n \n if @population_density >= n[3]\n coefficient = n[3]/500.0\n elsif @population_density >= n[2]\n coefficient = n[2]/500.0\n elsif @population_density >= n[1]\n coefficient = n[1]/500.0\n elsif @population_density >= n[0]\n coefficient = n[0]/500.0\n else\n coefficient = 0.05\n end\n \n number_of_deaths = (@population * coefficient).floor\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n rate = 0.4\n elsif @population_density >= 150\n rate = 0.3\n elsif @population_density >= 100\n rate = 0.2\n elsif @population_density >= 50\n rate = 0.1\n else\n rate = 0.05\n end\n return number_of_deaths = (@population * rate).floor\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths()\n # predicted deaths is solely based on population density\n case @population_density\n when 200..1000\n @number_of_deaths = (@population * 0.4).floor\n when 150...200\n @number_of_deaths = (@population * 0.3).floor\n when 100...150\n @number_of_deaths = (@population * 0.2).floor\n when 50...100\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n @number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n @number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n @number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n @number_of_deaths = (@population * 0.1).floor\r\n else\r\n @number_of_deaths = (@population * 0.05).floor\r\n end\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n return number_of_deaths\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n multiplier = 0.4\r\n elsif @population_density >= 150\r\n multiplier = 0.3\r\n elsif @population_density >= 100\r\n multiplier = 0.2\r\n elsif @population_density >= 50\r\n multiplier = 0.1\r\n else\r\n multiplier = 0.05\r\n end\r\n number_of_deaths = (@population * multiplier).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n \n number_of_deaths = (@population * 0.05).floor if @population_density < 50\n number_of_deaths = (@population * 0.1).floor if @population_density >= 50\n number_of_deaths = (@population * 0.2).floor if @population_density >= 100\n number_of_deaths = (@population * 0.3).floor if @population_density >= 150\n number_of_deaths = (@population * 0.4).floor if @population_density >= 200\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n fractions = [0.4, 0.3, 0.2, 0.1, 0.05]\n density = [200, 150, 100, 50, 0]\n \n index = 0\n while index < density.length\n if @population_density >= density[index]\n number_of_deaths = (@population * fractions[index]).floor\n break\n end\n index += 1\n end\n \n # if @population_density >= density[0]\n # number_of_deaths = (@population * fractions[0]).floor\n # elsif @population_density >= density[1]\n # number_of_deaths = (@population * fractions[1]).floor\n # elsif @population_density >= density[2]\n # number_of_deaths = (@population * fractions[2].floor\n # elsif @population_density >= density[3]\n # number_of_deaths = (@population * fractions[3]).floor\n # else\n # number_of_deaths = (@population * fractions[4]).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n if population_density >= 200\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2.0\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n #puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n case when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n when\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # perhaps a case statement is a little more dry?\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n when @population_density < 50 then number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n \n # predicted deaths is solely based on population density \n \n death_rate = (@population_density / 500).round(1) \n death_rate = 0.4 if @population_density >= 250\n death_rate = 0.1 if @population_density < 50\n \n (@population * death_rate).floor\n\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n num = 0.4\r\n elsif @population_density >= 150\r\n num = 0.3\r\n elsif @population_density >= 100\r\n num = 0.2\r\n elsif @population_density >= 50\r\n num = 0.1\r\n else\r\n num = 0.05\r\n end\r\nnumber_of_deaths = (@population * num).floor\r\n\r\n end", "def predicted_deaths #(population_density, population, state)\r\n # predicted deaths is solely based on population density\r\n # case @population_density\r\n # \twhen @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\r\n # \twhen @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\r\n # end\r\n \r\n if @population_density >= 200\r\n number_of_deaths = (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n number_of_deaths = (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n number_of_deaths = (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n number_of_deaths = (@population * 0.1).floor\r\n else\r\n number_of_deaths = (@population * 0.05).floor\r\n end\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n end", "def predicted_deaths()\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4)\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3)\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2)\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1)\n else\n number_of_deaths = (@population * 0.05)\n end\n\n end", "def predicted_deaths(population_density, population, state)\n case \n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths(population_density, population, state)\n case\n when @population_density >= 200 then number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150 then number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100 then number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50 then number_of_deaths = (@population * 0.1).floor\n else (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n rate = 0.4\n elsif @population_density >= 150\n rate = 0.3\n elsif @population_density >= 100\n rate = 0.2\n elsif @population_density >= 50\n rate = 0.1\n else\n rate = 0.05\n end\n \n @number_of_deaths = (@population * rate).floor\n\n \n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n puts \" and will spread across the state in #{speed} months.\\n\\n\"\n\n end", "def predicted_deaths(population_density, population, state)\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population_density * (0.1 * (@population / 50)) ).floor\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else \n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths \n case @population_density\n when (0..49)\n rate = 0.05\n when (50..99)\n rate = 0.1\n when (100..149)\n rate = 0.2\n when (150..199)\n rate = 0.3\n else #(200+)\n rate = 0.4\n end\n (@population * rate).floor\n end", "def predicted_deaths(@population_density, @population, @state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n #popd = [200, 150, 100, 50]\n #perc = [0.4, 0.3, 0.2, 0.1]\n\n #popd[i]\n\n if @population_density < 50\n number_of_deaths = (@population * 0.05)\n elsif @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n else @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = death_percentage(0.4)\n elsif @population_density >= 150\n number_of_deaths = death_percentage(0.3)\n elsif @population_density >= 100\n number_of_deaths = death_percentage(0.2)\n elsif @population_density >= 50\n number_of_deaths = death_percentage(0.1)\n else\n number_of_deaths = death_percentage(0.05)\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n if @population_density >= 200\n num_months = 0.5\n elsif @population_density >= 150\n num_months = 1\n elsif @population_density >= 100\n num_months = 1.5\n elsif @population_density >= 50\n num_months = 2\n else\n num_months = 2.5\n end\n\n puts \" and will spread across the state in #{num_months} months.\\n\\n\"\n\n end", "def predicted_deaths(population_density)\n # predicted deaths is solely based on population density\n \n pop = @population_density\n case pop \n when pop >= 200 \n number_of_deaths = (@population * 0.4).floor\n when pop >= 150 \n number_of_deaths = (@population * 0.3).floor\n when pop >= 100 \n number_of_deaths = (@population * 0.2).floor\n when pop >= 50 \n number_of_deaths = (@population * 0.1).floor \n else \n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n # if @population_density >= 50 \n # number_of_deaths = (@population / 500).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n \n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n (@population * multiplier).floor\n end", "def predicted_deaths\n case @population_density\n when 0..50 then (@population * 0.05).floor\n when 51..100 then (@population * 0.1).floor\n when 101..150 then (@population * 0.2).floor\n when 151..200 then (@population * 0.3).floor\n else (@population * 0.4).floor\n end\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n ## Refactored for Release: 8\n if @population_density >= 200\n (@population * 0.4).floor\n elsif @population_density >= 150\n (@population * 0.3).floor\n elsif @population_density >= 100\n (@population * 0.2).floor\n elsif @population_density >= 50\n (@population * 0.1).floor\n else\n (@population * 0.05).floor\n end\n\n # print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def death_rate(population_density, population, state)\n # predicted deaths is solely based on population density\n speed = 0.0\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n speed += 1\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n speed += 1.5\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n speed += 2\n else\n number_of_deaths = (@population * 0.05).floor\n speed += 2.5\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak and will spread across the state in #{speed} months.\\n\\n\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n if @population_density >= 200\n death_rate = 0.4\n elsif @population_density >= 150\n death_rate = 0.3\n elsif @population_density >= 100\n death_rate = 0.2\n elsif @population_density >= 50\n death_rate = 0.1\n else\n death_rate = 0.05\n end\n \n (@population * death_rate).floor\n\n end", "def predicted_deaths # Its gonna predict number of deaths based on population density by muliplying population by given factor, for each state\n array = [50, 100, 150, 200].reverse\n array.each do |end_of_range|\n if @population_density >= end_of_range\n number_of_deaths = ( @population * end_of_range / 500 )\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n break\n else\n number_of_deaths = (@population * 0.05).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n break\n end\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 200\n rate = 0.4\n elsif @population_density >= 150\n rate = 0.3\n elsif @population_density >= 100\n rate = 0.2\n elsif @population_density >= 50\n rate = 0.1\n else\n rate = 0.05\n end\n\n (@population * rate).floor\n\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(population_density, population)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths(state_density, population)\n # predicted deaths is solely based on population density\n number_of_deaths = ''\n hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1}\n\n hash.each do |density, float|\n if @population_density >= density\n number_of_deaths = (@population * float).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n number_of_deaths\n end\n\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 50\n multiplication_factor = (@population_density.fdiv(50)).floor.fdiv(10)\n # (density / 50), rounded down to int, then divided by 10\n # ex: 200 / 50 = 4, 4/10 = 0.4\n # ex: 185 / 50 = 3.7, rounded to 3, 3/10 = 0.3\n else # if population density < 50\n multiplication_factor = 0.05\n end\n \n \n \n number_of_deaths = (@population * multiplication_factor).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200; number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150; number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100; number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50; number_of_deaths = (@population * 0.1).floor\n else number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths(population_density, population, state)\n if population_density >= 200 # predicted_deaths passes in the population density and population and uses a ratio to determine the number effected by the virus\n number_of_deaths = (population * 0.4).floor\n elsif population_density >= 150\n number_of_deaths = (population * 0.3).floor\n elsif population_density >= 100\n number_of_deaths = (population * 0.2).floor\n elsif population_density >= 50\n number_of_deaths = (population * 0.1).floor\n else \n number_of_deaths = (population * 0.05).floor\n end\n\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @population * 0.4\n elsif @population_density >= 150\n @population * 0.3\n elsif @population_density >= 100\n @population * 0.2\n elsif @population_density >= 50\n @population * 0.1\n else\n @population * 0.05\n end\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n rate = case @population_density\n when(200..9999) then 0.4\n when(150..199) then 0.3\n when(100..149) then 0.2\n when(50..99) then 0.1\n else 0.05\n end\n\n number_of_deaths = (@population * rate).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n if @population_density >= 200\n (0.4*@population).floor\n elsif @population_density >= 150\n (0.3*@population).floor\n elsif @population_density >= 100\n (0.2*@population).floor\n elsif @population_density >= 50\n (0.1*@population).floor\n else\n (0.05*@population).floor\n end\n\n\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n if @population_density >= 200\n @number_of_months += 0.5\n elsif @population_density >= 150\n @number_of_months += 1\n elsif @population_density >= 100\n @number_of_months += 1.5\n elsif @population_density >= 50\n @number_of_months += 2\n else\n @number_of_months += 2.5\n end\n end", "def predicted_deaths#(population_density, population, state)\n # predicted deaths is solely based on population density\n # if population_density >= 200\n # number_of_deaths = (population * 0.4).floor\n # elsif population_density >= 150\n # number_of_deaths = (population * 0.3).floor\n # elsif population_density >= 100\n # number_of_deaths = (population * 0.2).floor\n # elsif population_density >= 50\n # number_of_deaths = (population * 0.1).floor\n # else\n # number_of_deaths = (population * 0.05).floor\n # end\n pop_percentage = 0.0\n density_test = 50\n if population_density >= 50\n while population_density >= density_test do \n pop_percentage += 0.1\n density_test += 50\n end\n number_of_deaths = (population * pop_percentage).floor\n else\n number_of_deaths = (population * 0.05).floor\n end\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n\n # Refactored method by simplifying the calculation to make the code more DRY\n if @population_density < 50\n number_of_deaths = (@population * 0.05).floor\n else\n number_of_deaths = (@population *(@population_density/50 * 0.1)).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n # Original method \n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n\n end", "def predicted_deaths\n num = case @population_density\n when 200..99999 then 0.4\n when 150...200 then 0.3\n when 100...150 then 0.2\n when 50...100 then 0.1\n when 0...50 then 0.05\n end\n number_of_deaths = (@population * num).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n case @population_density\n when 0..50 then 2.5\n when 51..100 then 2\n when 101..150 then 1.5\n when 151..200 then 1\n else 0.5\n end\n end", "def predicted_deaths #(population_density, population, state)\n # How are arguements initialized inside a method?\n # => As local variables.\n \n # population NOT @population\n \n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n end", "def predicted_deaths\r\n\r\n number_of_deaths = (population * 0.05).floor\r\n \r\n 4.times do |i|\r\n if population_density >= 50*(i+1)\r\n number_of_deaths = (population * 0.1*(i+1)).floor\r\n end\r\n end\r\n print \"#{state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0..50 then (@population * 0.05).floor\n when 51..100 then (@population * 0.1).floor\n when 101..150 then (@population * 0.2).floor\n when 151..200 then (@population * 0.3).floor\n else (@population * 0.4).floor\n end\n\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n if @population_density >= 200\r\n (@population * 0.4).floor\r\n elsif @population_density >= 150\r\n (@population * 0.3).floor\r\n elsif @population_density >= 100\r\n (@population * 0.2).floor\r\n elsif @population_density >= 50\r\n (@population * 0.1).floor\r\n else\r\n (@population * 0.05).floor\r\n end\r\n\r\n \r\n\r\n end", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n \r\n \r\n\r\n if @population_density >= 200\r\n x = 0.4\r\n\r\n elsif @population_density >= 150\r\n x = 0.3\r\n elsif @population_density >= 100\r\n x = 0.2\r\n\r\n elsif @population_density >= 50\r\n x = 0.1\r\n\r\n else\r\n x = 0.05\r\n end\r\n number_of_deaths = (@population * x).floor \r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n case @population_density\n when 0..50 then 2.5\n when 51..100 then 2\n when 101..150 then 1.5\n when 151..200 then 1\n else 0.5\n end\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n number_of_deaths = 0\n density_hash = {200 => 0.4, 150 => 0.3, 100 => 0.2, 50 => 0.1,0 => 0.05}\n density_hash.each_key { |key|\n if @population_density >= key\n number_of_deaths = (@population * density_hash[key]).floor\n end\n }\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n case @population_density\n when 0..49\n multiplier_factor = 0.05\n when 50..99\n multiplier_factor = 0.1\n when 100..149\n multiplier_factor = 0.2\n when 150..199\n multiplier_factor = 0.3\n else\n multiplier_factor = 0.4\n end\n \n number_of_deaths = (@population * multiplier_factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n number_of_deaths = case\n when @population_density >= 200\n @population * 0.4\n when @population_density >= 50\n @population * 0.1 * (@population_density.to_i/50)\n else\n @population * 0.05\n end\n\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n\n\n if @population_density >= 200\n rate = 0.4\n elsif @population_density >= 150\n rate = 0.3\n elsif @population_density >= 100\n rate = 0.2\n elsif @population_density >= 50\n rate = 0.1\n else\n rate = 0.05\n end\n number_of_deaths = (@population * rate).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n if @population_density >= 200\n multiplier = 0.4\n elsif @population_density >= 150\n multiplier = 0.3\n elsif @population_density >= 100\n multiplier = 0.2\n elsif @population_density >= 50\n multiplier = 0.1\n else\n multiplier = 0.05\n end\n number_of_deaths = (@population * multiplier).floor\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths #(population_density, population, state)\n # predicted deaths is solely based on population density\n if @population_density >= 200\n @number_of_deaths = (@population * 0.4).floor\n elsif @population_density >= 150\n @number_of_deaths = (@population * 0.3).floor\n elsif @population_density >= 100\n @number_of_deaths = (@population * 0.2).floor\n elsif @population_density >= 50\n @number_of_deaths = (@population * 0.1).floor\n else\n @number_of_deaths = (@population * 0.05).floor\n end\n \nend", "def predicted_deaths\r\n # predicted deaths is solely based on population density\r\n\r\n coefficient = case @population_density\r\n when 200..15000 then 0.4\r\n when 150..199 then 0.3\r\n when 100..149 then 0.2\r\n when 50..99 then 0.1\r\n else 0.05\r\n end\r\n\r\n number_of_deaths = @population * coefficient\r\n print \"#{@state} will lose #{number_of_deaths.floor} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n \n density = [200, 150, 100, 50, 0]\n multiplier = [0.4, 0.3, 0.2, 0.1, 0.05]\n density.length.times do |x|\n @population_density >= density[x]\n @number_of_deaths = (@population * multiplier[x]).floor \n end\n# if @population_density >= 200\n# number_of_deaths = (@population * 0.4).floor\n# elsif @population_density >= 150\n# number_of_deaths = (@population * 0.3).floor\n# elsif @population_density >= 100\n# number_of_deaths = (@population * 0.2).floor\n# elsif @population_density >= 50\n# number_of_deaths = (@population * 0.1).floor\n# else\n# number_of_deaths = (@population * 0.05).floor\n# end\n\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_factor = case @population_density.floor\n when 0..49\n 0.05\n when 50..99\n 0.1\n when 100..149\n 0.2\n when 150..199\n 0.3\n else\n 0.4\n end\n number_of_deaths = (@population * death_factor).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n elsif @population_density < 200 && @population_density >= 50\n number_of_deaths = (@population * ((@population_density/50).floor*0.1)).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n case @population_density\n # predicted deaths is solely based on population density\n when @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n when @population_density >= 150\n number_of_deaths = (@population * 0.3).floor\n when @population_density >= 100\n number_of_deaths = (@population * 0.2).floor\n when @population_density >= 50\n number_of_deaths = (@population * 0.1).floor\n else\n number_of_deaths = (@population * 0.05).floor\n end\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end", "def predicted_deaths\n\n case @population_density \n when 0...50 then i = 0.05 \n when 50...100 then i = 0.1\n when 100...150 then i = 0.2\n when 150...200 then i = 0.3\n else i = 0.4\n end\n\n number_of_deaths = (@population * i).floor\n\n \n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n death_multiplier = {0 => 0.05, 50 => 0.1, 100 => 0.2, 150 => 0.3, 200 => 0.4}\n death_multiplier.each do |density, multiplier|\n if @population_density >= density\n @number_of_deaths = (@population * multiplier).floor\n end\n \n end\n # if @population_density >= 200\n # number_of_deaths = (@population * 0.4).floor\n # elsif @population_density >= 150\n # number_of_deaths = (@population * 0.3).floor\n # elsif @population_density >= 100\n # number_of_deaths = (@population * 0.2).floor\n # elsif @population_density >= 50\n # number_of_deaths = (@population * 0.1).floor\n # else\n # number_of_deaths = (@population * 0.05).floor\n # end\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n end", "def speed_of_spread #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n\n case @population_density\n when (0..49)\n 2.5\n when (50..99)\n 2\n when (100..149)\n 1.5\n when (150..199)\n 1\n else #(200+)\n 0.5\n end\n end", "def predicted_deaths\r\n\r\n #(population_density, population, state) <--- deleted, not necessary\r\n # predicted deaths is solely based on population density\r\n\r\n #idx = 0.4 if population_density >= 200\r\n #idx = 0.3 if population_density >= 150\r\n \r\n case population_density\r\n when 0..49 then idx = 0.05\r\n when 50..99 then idx = 0.1\r\n when 100..150 then idx = 0.2\r\n when 151..200 then idx = 0.3\r\n else idx = 0.4\r\n end\r\n\r\n\r\n # if population_density >= 200\r\n # idx = 0.4\r\n # #number_of_deaths = (population * 0.4).floor\r\n # elsif population_density >= 150\r\n # idx = 0.3\r\n # #number_of_deaths = (population * 0.3).floor\r\n # elsif population_density >= 100\r\n # idx = 0.2\r\n # #number_of_deaths = (population * 0.2).floor\r\n # elsif population_density >= 50\r\n # idx = 0.1\r\n # #number_of_deaths = (population * 0.1).floor\r\n # else\r\n # idx = 0.05\r\n # #number_of_deaths = (population * 0.05).floor\r\n # end\r\n\r\n number_of_deaths = (population * idx).floor\r\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\r\n\r\n end", "def predicted_deaths\n # predicted deaths is solely based on population density\n if population_density >= 200\n death_constant = 0.4\n elsif population_density >= 150\n death_constant = 0.3\n elsif population_density >= 100\n death_constant = 0.2\n elsif population_density >= 50\n death_constant = 0.1\n else\n death_constant = 0.05\n end\n\n number_of_deaths = (population * death_constant).floor\n\n print \"#{@state} will lose #{number_of_deaths} people in this outbreak\"\n\n end" ]
[ "0.7408022", "0.7192387", "0.71716064", "0.7138437", "0.70976317", "0.7083109", "0.70770305", "0.7064478", "0.7050245", "0.704741", "0.7028265", "0.70282125", "0.7002906", "0.6991173", "0.6980168", "0.6973679", "0.6972927", "0.6954767", "0.6954621", "0.6951002", "0.6947833", "0.6947833", "0.6947833", "0.6947833", "0.6947833", "0.6946084", "0.6946084", "0.6944054", "0.6939084", "0.6937407", "0.69349784", "0.6931368", "0.69265556", "0.69265556", "0.69265556", "0.69265556", "0.69265556", "0.69265556", "0.69146943", "0.6914269", "0.69131905", "0.6903973", "0.6900952", "0.69006896", "0.6890705", "0.6890621", "0.68891823", "0.68855476", "0.6878224", "0.6872825", "0.6864473", "0.6860532", "0.68386275", "0.6837492", "0.683196", "0.6819209", "0.68065095", "0.6803424", "0.6801428", "0.67932683", "0.67926097", "0.67913747", "0.6779589", "0.6775282", "0.67535305", "0.6745746", "0.6745746", "0.67318624", "0.6724227", "0.672327", "0.67212343", "0.6694443", "0.6687682", "0.6686544", "0.66818315", "0.6673943", "0.66695637", "0.6668259", "0.66648316", "0.66639835", "0.6663412", "0.6659305", "0.6653363", "0.66445494", "0.6642982", "0.663992", "0.66379035", "0.6634918", "0.6633176", "0.66210365", "0.66192573", "0.6618089", "0.6610278", "0.6606224", "0.6604432", "0.6603495", "0.6599425", "0.65990245", "0.6597967", "0.659389", "0.65813476" ]
0.0
-1
make variable/method Service.find_by(name: self.service_name).traffic
def bad_service? Service.find_by(name: self.service_name).traffic != "GOOD SERVICE" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_train_status\n\t\tService.find_by(name: self.service_name).traffic\n\tend", "def obtain_description\n\t\t#it's only pulling traffic train status for now, but we will get it to pull out the description instead.\n\t\tService.find_by(name: self.service_name).traffic\n\tend", "def obtain_description\n\t\t#it's only pulling traffic train status for now, but we will get it to pull out the description instead.\n\t\tService.find_by(name: self.service_name).traffic\n\tend", "def traffic id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/traffic?date=#{date}\"\n fetch uri\n end", "def set_traffic\n @traffic = Traffic.find(params[:id])\n end", "def set_traffic\n @traffic = Traffic.find(params[:id])\n end", "def set_traffic\n @traffic = Task.find(params[:id])\n end", "def direct_costs_for_visit_based_service\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += line_items_visit.subject_count * self.direct_costs_for_visit_based_service_single_subject(line_items_visit)\n end\n total\n end", "def service_request(service); end", "def services\n\n end", "def services\n end", "def service(id)\n request :get, \"/services/#{id}\"\n end", "def overall_traffic\n zone_traffic.values.inject(:+)\n rescue\n raise CouldNotRetrievePageError\n end", "def service; end", "def service_definition(service)\n @analyzer.analyze(service)\n end", "def services\n\tend", "def indirect_costs_for_visit_based_service_single_subject\n if USE_INDIRECT_COST\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += self.direct_costs_for_visit_based_service_single_subject(line_items_visit) * self.indirect_cost_rate\n end\n return total\n else\n return 0\n end\n end", "def index\n @traffics = Traffic.all\n end", "def get_traffic_by_loadbalancer(loadbalancer_id, attributes = {}, headers = {})\n Validators::Traffic.validate_attributes!(attributes, :list)\n get!(\"traffics/loadbalancers/#{loadbalancer_id}\", attributes, headers)\n end", "def srv\n @service_finder\n end", "def service; services.first; end", "def direct_costs_for_visit_based_service_single_subject(line_items_visit)\n # line items visit should also check that it's for the correct protocol\n return 0.0 unless service_request.protocol_id == line_items_visit.arm.protocol_id\n \n research_billing_qty_total = line_items_visit.visits.sum(&:research_billing_qty)\n \n subject_total = research_billing_qty_total * per_unit_cost(quantity_total(line_items_visit))\n subject_total\n end", "def report_service(opts)\n\t\treturn if not active\n\t\taddr = opts.delete(:host) || return\n\t\thname = opts.delete(:host_name)\n\t\thmac = opts.delete(:host_mac)\n\n\t\twait = opts.delete(:wait)\n\t\twspace = opts.delete(:workspace) || workspace\n\n\t\thopts = {:workspace => wspace, :host => addr}\n\t\thopts[:name] = hname if hname\n\t\thopts[:mac] = hmac if hmac\n\t\treport_host(hopts)\n\n\t\tret = {}\n\n\t\ttask = queue(Proc.new {\n\t\t\thost = get_host(:workspace => wspace, :address => addr)\n\t\t\tif host\n\t\t\t\thost.updated_at = host.created_at\n\t\t\t\thost.state = HostState::Alive\n\t\t\t\thost.save!\n\t\t\tend\n\n\t\t\tproto = opts[:proto] || 'tcp'\n\t\t\topts[:name].downcase! if (opts[:name])\n\n\t\t\tservice = host.services.find_or_initialize_by_port_and_proto(opts[:port].to_i, proto)\n\t\t\topts.each { |k,v|\n\t\t\t\tif (service.attribute_names.include?(k.to_s))\n\t\t\t\t\tservice[k] = v\n\t\t\t\telse\n\t\t\t\t\tdlog(\"Unknown attribute for Service: #{k}\")\n\t\t\t\tend\n\t\t\t}\n\t\t\tif (service.state == nil)\n\t\t\t\tservice.state = ServiceState::Open\n\t\t\tend\n\t\t\tif (service and service.changed?)\n\t\t\t\tmsfe_import_timestamps(opts,service)\n\t\t\t\tservice.save!\n\t\t\tend\n\t\t\tret[:service] = service\n\t\t})\n\t\tif wait\n\t\t\treturn nil if task.wait() != :done\n\t\t\treturn ret[:service]\n\t\tend\n\t\treturn task\n\tend", "def service(name)\n \"#{SERVICE_NAME} #{name}\"\n end", "def service\n @service\n end", "def services_walk\n\t\tprint_status('Enumerating Running Services.....')\n\t\tservices=[['Running Services']]\n\t\t@manager.walk('enterprises.77.1.2.3.1.1') { |x| services << [\"#{x.value}\"] }\n\t\tif services.empty?\n\t\t\tprint_error(\"No Values Found!\")\n\t\telse\n\t\t\ttable = services.to_table(:first_row_is_head => true)\n\t\t\tputs table.to_s\n\t\tend\n\tend", "def down_total\n up, down = update_total_traffic_from_router_info\n Traffic::Amount.new down\n end", "def service_name\n @service_name = \"HelloAgent\"\n end", "def as_service\n @service ||= (plan.find_plan_service(self) || PlanService.new(self))\n end", "def as_service\n @service ||= (plan.find_plan_service(self) || PlanService.new(self))\n end", "def service(cfg)\n defaults = { 'state' => 'active' }\n cfg = defaults.merge(cfg)\n query = format(\n \"node_systemd_unit_state{name='%s',state='%s'}\",\n cfg['name'], cfg['state']\n )\n prepare_metrics('service', @client.query(query))\n end", "def initialize(name)\n service = self.class.services[name]\n\n raise 'Undefined service' if service.nil?\n\n @type = service[:method]\n @name = service[:name]\n @endpoint = service[:endpoint]\n end", "def report_service(opts={})\n\t\treturn if not db\n\t\taddr = opts[:host] || return\n\t\tport = opts[:port] || return\n\t\tproto = opts[:proto] || 'tcp'\n\t\tname = opts[:name]\n\t\tstate = opts[:state] || Msf::ServiceState::Up\n\t\t\n\t\tframework.db.report_host_state(self, addr, Msf::HostState::Alive)\n\t\t\n\t\tserv = framework.db.report_service_state(\n\t\t\tself,\n\t\t\taddr,\n\t\t\tproto,\n\t\t\tport,\n\t\t\tstate\n\t\t)\n\t\tif (name and name.length > 1)\n\t\t\tserv.name = name\n\t\t\tserv.save!\n\t\tend\n\tend", "def up_total\n up, down = update_total_traffic_from_router_info\n Traffic::Amount.new up\n end", "def service\n @service ||= fetcher.get(Service, service_id)\n end", "def run_service( subject, data = {} )\n franchise.service( subject, host ).run data\n end", "def set_service\n @service = Service.friendly.find(params[:id])\n end", "def indirect_costs_for_visit_based_service\n if USE_INDIRECT_COST\n self.direct_costs_for_visit_based_service * self.indirect_cost_rate\n else\n return 0\n end\n end", "def service_name; end", "def bi_service\n end", "def service_hash service, duration_hash={}\n base_service_hash = OneclickRefernet::ServiceSerializer\n .new(service, \n { scope: { locale: @locale} })\n .to_hash\n base_service_hash.merge({\n \"drive_time\": duration_hash[\"#{service.id}_CAR\"],\n \"transit_time\": duration_hash[\"#{service.id}_TRANSIT,WALK\"], \n })\n end", "def service\n @service ||= bus.service('com.dubstepdish.i3dstatus')\n end", "def service(nickname, reserved, distribution, type)\n end", "def get_calls(service)\n\t\treturn @transport.get_path(\"calls\",service)\n\tend", "def add_service(name)\n serv = @services[name] || new_service(Service.new(name, self))\n @services.sort{|a,b| \"#{a[0]}\"<=>\"#{b[0]}\"}\n serv\n end", "def service_time\n service_time = 0\n @solution.each { |route| service_time += route.service_time }\n return service_time\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @traffic }\n end\n end", "def vehicles; end", "def stats\n ## TODO:\n end", "def amount(type = 'traffic')\n operations.inject(0) {|sum, o| sum + o.usagevalue(type)}\n end", "def traffic_shaping\r\n TrafficShapingController.instance\r\n end", "def service_description\n Umakadata::Measurement.new(name: MEASUREMENT_NAMES[__method__]).safe do |m|\n activity = endpoint.service_description\n\n m.value = (r = activity.result).is_a?(::RDF::Enumerable) &&\n r.any? { |stmt| stmt.predicate.to_s.start_with?('http://www.w3.org/ns/sparql-service-description#') } ?\n activity.response.body : nil\n m.comment = if (200..299).include?(activity.response&.status) && m.value.present?\n 'The endpoint provides Service Description.'\n else\n 'The endpoint does not provide Service Description.'\n end\n m.activities << activity\n end\n end", "def service=(value)\n @service = value\n end", "def create\n @traffic = Traffic.new(params[:traffic])\n\n respond_to do |format|\n if @traffic.save\n format.html { redirect_to @traffic, notice: 'Traffic was successfully created.' }\n format.json { render json: @traffic, status: :created, location: @traffic }\n else\n format.html { render action: \"new\" }\n format.json { render json: @traffic.errors, status: :unprocessable_entity }\n end\n end\n end", "def services\n @stats.keys.sort\n end", "def tow\n auto_shop.tow_vehicle\n end", "def tow\n auto_shop.tow_vehicle\n end", "def services\n unless @services\n rows = database.view(VIEW_NAME, reduce: false, key: [1, name])['rows'] rescue []\n ids = rows.map {|row| row['value'] }\n @services = Service.all.keys(ids).to_a\n end\n @services\n end", "def stats\n end", "def stats\n end", "def service_info(name)\n\t\tif session_has_services_depend?\n\t\t\tmeterpreter_service_info(name)\n\t\telse\n\t\t\tshell_service_info(name)\n\t\tend\n\tend", "def stats\n \n end", "def cost(meth)\n @costs[meth][\"cost_per_call\"] / 100.0 rescue 0.0\n end", "def analyse\n call_data_service\n end", "def service_url service, path\n @services[service.to_s] + path\n end", "def show\n @service = Service.find(params[:id])\n @addresses = @service.addresses_services\n @a1 = Address.find(@addresses[0][:address_id])\n @a2 = Address.find(@addresses[1][:address_id])\n @status = Status.find(@service.status_id)\n @tipo_vehicle = TipoVehicle.find(@service.tipo_vehicle_id)\n if @status && @status.id != 1\n @chofer = Driver.find(@service.driver_id)\n end\n\n end", "def traffic_monitoring(rule_name,info)\n \n # Will under the default \"Traffic Monitoring\"\n # Check\n if not @ff.text.include?'Traffic Monitoring'\n # Not in this page.\n self.msg(rule_name,:error,'Traffic Monitoring','Did NOT get the \\'Traffic Monitoring\\' page.')\n return\n end\n \n # Parse the json file. \n \n # \"Automatic Refresh\"\n if info.has_key?('Automatic Refresh')\n \n case info['Automatic Refresh']\n \n when 'on'\n \n # Set \"Automatic Refresh\"\n if @ff.text.include?'Automatic Refresh Off'\n \n @ff.link(:text,'Automatic Refresh Off').click\n self.msg(rule_name,:info,'Automatic Refresh',info['Automatic Refresh'])\n \n end\n\n \n when 'off'\n \n # Clear \"Automatic Refresh\"\n if @ff.text.include?'Automatic Refresh On'\n @ff.link(:text,'Automatic Refresh On').click \n end\n self.msg(rule_name,:info,'Automatic Refresh',info['Automatic Refresh'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Traffic Monitoring','Did NOT find the value in \\'Automatic Refresh\\'.')\n return\n \n end # end of case\n \n end # end of if \n \n # \"Refresh\"\n if info.has_key?('Refresh')\n \n case info['Refresh']\n \n when 'on'\n \n # Set \"Refresh\"\n @ff.link(:text,'Refresh').click\n self.msg(rule_name,:info,'Refresh',info['Refresh'])\n \n when 'off'\n \n # Clear \"Refresh\"\n # Do nothing.\n self.msg(rule_name,:info,'Refresh',info['Refresh'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Traffic Monitoring','Did NOT find the value in \\'Refresh\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # \"Reset Statistics\"\n if info.has_key?('Reset Statistics')\n \n case info['Reset Statistics']\n \n when 'on'\n \n # Set \"Refresh\"\n @ff.link(:text,'Reset Statistics').click\n self.msg(rule_name,:info,'Reset Statistics',info['Reset Statistics'])\n \n when 'off'\n \n # Clear \"Refresh\"\n # Do nothing.\n self.msg(rule_name,:info,'Reset Statistics',info['Reset Statistics'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Traffic Monitoring','Did NOT find the value in \\'Reset Statistics\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # Output the result here.\n\n # Find the table.\n sTable = false\n @ff.tables.each do |t|\n if ( t.text.include? 'Status' and \n t.text.include? 'Network' and\n ( not t.text.include? 'Traffic Monitoring') and\n t.row_count >= 5 )then\n sTable = t\n break\n end\n end\n \n if sTable == false\n # Wrong here\n self.msg(rule_name,:error,'Traffic Monitoring','Did NOT find the target table.')\n return\n end\n \n iFlag = 0\n strEntry = \"\"\n iColumn = 2\n \n while iColumn <= (sTable.column_count) do\n \n iFlag = iFlag + 1\n \n # not for first line\n if iFlag == 1\n next\n end\n strEntry = \"Connection\" + (iFlag - 1).to_s \n \n # Output in to the result.\n self.msg(rule_name,strEntry,'Name',sTable[1][iColumn])\n self.msg(rule_name,strEntry,'Status',sTable[2][iColumn])\n self.msg(rule_name,strEntry,'Network',sTable[3][iColumn])\n self.msg(rule_name,strEntry,'Underlying Device',sTable[4][iColumn])\n self.msg(rule_name,strEntry,'Connection Type',sTable[5][iColumn]) \n self.msg(rule_name,strEntry,'IP Address ',sTable[6][iColumn]) \n self.msg(rule_name,strEntry,'Received Packets',sTable[7][iColumn]) \n self.msg(rule_name,strEntry,'Sent Packets',sTable[8][iColumn]) \n self.msg(rule_name,strEntry,'Received Bytes',sTable[9][iColumn]) \n self.msg(rule_name,strEntry,'Sent Bytes',sTable[10][iColumn])\n self.msg(rule_name,strEntry,'Receive Errors',sTable[11][iColumn]) \n self.msg(rule_name,strEntry,'Receive Drops',sTable[12][iColumn]) \n self.msg(rule_name,strEntry,'Time Span',sTable[13][iColumn])\n \n iColumn = iColumn + 1\n \n end # end of while \n\n # \"Close\"\n if info.has_key?('Close')\n \n case info['Close']\n \n when 'on'\n \n # Set \"Close\"\n @ff.link(:text,'Close').click\n self.msg(rule_name,:info,'Close',info['Close'])\n \n when 'off'\n \n # Do nothing.\n self.msg(rule_name,:info,'Close',info['Close'])\n \n else\n \n # Wrong here\n self.msg(rule_name,:error,'Traffic Monitoring','Did NOT find the value in \\'Close\\'.')\n return\n \n end # end of case\n \n end # end of if \n\n # Close the window\n if @ff.text.include?'Close'\n @ff.link(:text,'Close').click\n end\n\n # Output the result\n self.msg(rule_name,:Result_Info,'Traffic Monitoring','SUCCESS') \n \n end", "def services\n Service.where(agency: agencies)\n end", "def call\n # Update service and update context\n self.service = Entities::Service.find_by_system_name(remote: threescale_client,\n system_name: service_system_name)\n if service.nil?\n # Create service and update context\n self.service = Entities::Service.create(remote: threescale_client,\n service_params: service_settings)\n logger.info \"Created service id: #{service.id}, name: #{service_name}\"\n else\n service.update(service_settings)\n logger.info \"Updated service id: #{service.id}, name: #{service_name}\"\n end\n\n report['id'] = service.id\n report['system_name'] = service.system_name\n report['name'] = service.name\n report['backend_version'] = api_spec.service_backend_version\n end", "def show\n @service = Service.find(params[:id])\n end", "def service(nicknam, distribution, info)\n @nickname = nicknam\n send_msg(\"SERVICE #{@nickname} * #{distribution} 0 0 :#{info}\")\n end", "def compute_stops(route)\n route.visited_stops\n end", "def services\n\t\tselect {|x| x.class == Service }\n\tend", "def travel_and_places; end", "def get_relay_meters_swam\r\n @summary.relays.meters_swam\r\n end", "def service(nickname, info, distribution = '*')\n raw \"SERVICE #{nickname} * #{distribution} 0 0 :#{info}\\r\\n\"\n end", "def main_services\n main_co.services\n end", "def get_remote_value\n return nil if service.blank?\n case service\n when 'kshema'\n school.fetch_stat(self.name,ref_date)\n when 'crm'\n school.fetch_stat_from_crm(self.name,ref_date)\n when 'overmind'\n ls = LocalStat.new(name: self.name, ref_date: ref_date, school: school)\n ls.value\n else\n raise \"Unknown service : #{service}\"\n end\n end", "def method_missing(m, *args, &block)\n return @services[m.to_sym] if @services.include? m.to_sym\n raise NoMethodError.new(\"undefined method `#{m}' for #{self}\")\n end", "def set_service\n @service = Service.includes(lineup: :programme).find(params[:id])\n end", "def calculate_shipping_cost\n methods.collect { |name| __send__ name if name.to_s.starts_with? 'shipping_cost_based_on' }.compact.sum zero\n end", "def getAveSpeed()\n @demandStat[\"speedStat\"][\"average\"]\n end", "def zone_cost_stats(zone_name, from = nil, to = nil)\n parameters = \"zone=#{zone_name}\"\n parameters << \"&from=#{from}\" if from\n parameters << \"&to=#{to}\" if to\n request(:get, \"/api/zone/cost?#{parameters}\")\n end", "def suma_visita_servicio\n if Rails.env.production?\n delay(queue: 'estadisticas').suma_visita\n else\n suma_visita\n end\n end", "def attack\n total_for(:attack) \n end", "def get_relay_time_swam\r\n Timing.new( @summary.relays.time_swam )\r\n end", "def show\n @traffic = Traffic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @traffic }\n end\n end", "def service=(service)\n @service = service\n end", "def status\n dist_service( service_name, 'status' )\n end", "def parse_service(data, service)\n data[\"methods\"] ||= {}\n\n data[\"methods\"].each do |name, options|\n options.relative_path = options.path\n options.path = File.join(service.servicePath, options.path)\n options.type = options.httpMethod\n if options.request\n options.request_property = parse_property(\"#{name}_request\", options.request)\n options.request = options.request_property.type\n end\n if options.response\n options.response_property = parse_property(\"#{name}_response\", options.response)\n options.response = options.response_property.type\n end\n # Load service parameters\n if options.parameters.nil? and options.type == \"GET\"\n options.parameters = service.parameters\n end\n end\n\n data.operations = data[\"methods\"]\n\n parse_services(data.resources, service) if data.resources\n\n Types::Service.new(data)\n end", "def method_missing(name, *args, &block)\n # Only handle *bound_from (e.g northbound_from / southbound_from)\n if name =~ /bound_from/\n direction = name.to_s.split('_').first.capitalize\n\n ier = IERailGet.new(\"getStationDataByNameXML?StationDesc=#{args.first}\", \"arrayofobjstationdata\", \"objstationdata\")\n \n ier.response.select { |sd| sd['Direction'] == direction }.map { |sd| StationData.new(sd) }\n end\n end", "def services\n\t\tService.find(:all)\n\tend", "def show\n if @service.published?\n @service.update_visit_count\n @comment = Comment.new\n @categories = Category.all\n else\n redirect_to root_path, notice: 'El servicio que buscas no existe.'\n end\n end", "def debt_service\n property.net_operating_income / debt_payment\n end", "def get_service(giver, service)\n unless giver.is_a?(Person)\n raise PetError, 'A pet can only get a service from a Person'\n end\n unless alive?\n raise PetError, \"Cannot receive a service as I (#{@name}) am already dead.\"\n end\n if service == :stroke\n \"I (#{name}) am getting stroked by #{giver.name}\"\n elsif service == :feed\n \"I (#{name}) am getting fed by #{giver.name}\"\n else\n raise PetError, \"A Pet cannot receive the service '#{service}'\"\n end\n end", "def show\n\n @target = { :lng => cookies[:lng].to_f, :lat => cookies[:lat].to_f}\n\n @services = Service.find_by(slug: params[:id]).salons.joins(:prices).distinct\n @salons = @services.reorder(\"prices.price #{params[:sort] == 'skuplji' ? 'DESC' : 'ASC'}\")\n\n if params[:sort] == 'blizi' or params[:sort] == 'dalji'\n @salons = @services.sort { |l,r| l.distance_to(@target) <=> r.distance_to(@target) }\n end\n\n if params[:sort] == 'dalji'\n @salons = @salons.reverse\n end\n\n @number_of_results = @salons.count\n @salons = @salons.paginate(:page => params[:strana])\n\n\n\n end", "def get id\n @services[id]\n end", "def service\n options[:service]\n end", "def initialize(service)\n @service = service\n end" ]
[ "0.65359384", "0.65186495", "0.651654", "0.6070373", "0.5983686", "0.59749585", "0.57798755", "0.5657848", "0.5430913", "0.53892076", "0.5368636", "0.5344797", "0.5316005", "0.53084785", "0.5297777", "0.5239648", "0.52305055", "0.52204096", "0.5198573", "0.51972246", "0.5168904", "0.51628494", "0.51535255", "0.5140627", "0.51384443", "0.5126254", "0.5114282", "0.51142627", "0.51083726", "0.51083726", "0.51035416", "0.51020354", "0.50842726", "0.5077651", "0.5077425", "0.50730306", "0.5063632", "0.5059724", "0.5042193", "0.5002718", "0.49849528", "0.49602476", "0.49546403", "0.49515527", "0.49466383", "0.4939929", "0.49316517", "0.49203965", "0.49151403", "0.49144232", "0.49132088", "0.4899926", "0.48973262", "0.4876936", "0.48693615", "0.4868087", "0.4868087", "0.4846155", "0.4845167", "0.4845167", "0.48340458", "0.48262575", "0.4823696", "0.48199365", "0.4819312", "0.48126543", "0.48104367", "0.48026785", "0.47922292", "0.47824803", "0.47790986", "0.4764248", "0.47604227", "0.47595277", "0.47575036", "0.4753841", "0.47535157", "0.47415292", "0.47411168", "0.47410256", "0.47371095", "0.47366375", "0.4736085", "0.47335446", "0.4726468", "0.47250018", "0.4723896", "0.47230127", "0.4721371", "0.47200012", "0.47185293", "0.47132674", "0.47093916", "0.47088316", "0.4708211", "0.47080025", "0.47006565", "0.46907768", "0.46906075" ]
0.49125263
52
checks if alert object is selected within critical timeframe of recipient
def relevant_time? self.start < Time.now && self.end >Time.now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_alert? \n check_in = self.query[\"check_in\"].to_datetime if self.query[\"check_in\"]\n check_out = self.query[\"check_out\"].to_datetime if self.query[\"check_out\"]\n if (check_in && (check_in < Time.now)) or (check_out && (check_out < Time.now))\n Authorization::Maintenance::without_access_control do\n ActiveRecord::Base.record_timestamps = false\n self.update_attributes({:active => false})\n ActiveRecord::Base.record_timestamps = true\n end\n return false\n else\n return true\n end\n end", "def in_alert?\n return true if status == 'alert_new' || status == 'alert_still'\n false\n end", "def unacknowledged(seconds)\n @test_time = @time if @test_time.nil?\n @alert &&\n @alert.raised? &&\n !@alert.acknowledged? &&\n (@test_time - @alert.raised_at) >= seconds\n end", "def raised_for(seconds)\n @test_time = @time if @test_time.nil?\n @alert &&\n @alert.raised? &&\n (@test_time - @alert.raised_at) >= seconds\n end", "def check_for_selected\n if changes[:selected] && self.selected == true\n BetaMailer.send_beta_acceptance_email(self).deliver_later\n end\n end", "def passed_event?\n date_time < Time.now.utc\n end", "def booking_is_available?(user, service, order_time)\n order_time > Time.new + 6.hours and user.id != service.user_id\n end", "def canceled?\n #if canceled_on && approved_on && canceled_on.to_time > approved_on.to_time\n if canceled_on != nil\n return true\n else\n return false\n end\n end", "def has_trialed?\n current_user.subscriptions.any? {|s| !s.canceled_at.nil? && s.canceled_at > s.created_at + 13.days }\n end", "def active?\n now = Time.current\n active && (valid_from.nil? || now > valid_from) && (valid_to.nil? || now < valid_to)\nend", "def alert_user?\n # check the three necessary conditions\n # in order of increasing cost\n self.enabled? && have_statuses_changed?\n end", "def confirm_booking(time)\n if @time[time].nil?\n false\n else\n @time[time].click\n @browser.element(css: '#btnConfirm').click\n @browser.element(css: 'body > div.MessageBoxWindow > div.MessageBoxButtons.NoBorder > input:nth-child(1)').click\n @browser.element(css: 'input.MessageBoxButton:nth-child(1)').click\n true\n end\n end", "def check_date()\n event = Event.find_by(id: self.event_id) \n if Time.now > event.start_date then\n halt msg: 'check_date() fail' \n false\n else\n true\n end\n end", "def free_time_frame?\n started_booking_time = Booking.where(start_time: start_time)\n\n if started_booking_time.present? && (started_booking_time.ids.first != id)\n errors.add(:start_time, 'Sorry, this hour is already booked')\n end\n end", "def has_appointment?(date, time)\n datetime = Temporal.generate_datetime(date, time)\n\n !is_available?(datetime, 20) #the time is broken up into 20 minute blocks\n end", "def waits_too_long?(account)\n is?(:asked) and self.asked <= 4.days.ago.to_date\n end", "def contains_event?(e)\n (e.time_from_start >= @start) && (e.time_from_start <= @end)\n end", "def can_buy()\n event = Event.find_by(id: self.event_id)\n if Time.now > event.start_date then\n halt msg: 'can_buy() fail' \n false\n else\n true\n end\n end", "def date_time_check?\n booking_date_time = booking_date.to_datetime\n booking = Booking.where(\"cleaner_id = ? and booking_date > ? and booking_date < ?\", cleaner_id, booking_date_time - 2.hours, booking_date_time + 2.hours)\n if booking.present?\n errors.add('Sorry', \"This Cleaner #{cleaner.first_name} is not available in your select time\")\n end\n end", "def has_awaiting_picked_meeting?\n !completed? && self.notifications.last.is_a?(::Users::Notifications::TradePickedMeeting)\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def available_for_interview?(time, timeblock)\n !interview_availabilities.find_by_time_and_offering_interview_timeblock_id(time.to_time, timeblock).nil?\n end", "def should_send?\n ten_minutes_ago = @set - 10*60\n (@ended and @ended >= ten_minutes_ago) or (@started and @started >= ten_minutes_ago)\n end", "def valid_duration?(cert_obj)\n cert_obj.not_before < Time.now.utc && cert_obj.not_after > Time.now.utc\n end", "def alerted?\n !alert_sent.nil?\n end", "def disabled?\n self.time_event <= Time.now\n end", "def cancel_appointment appointment\n time_range = TimeRange.new appointment.started_at, appointment.finished_at\n if appointment.daily_schedule_id == self.id\n self.free time_range\n true\n end\n false\n end", "def updated_within_current_event_duration?(margin)\n return false unless event.current_start_time\n\n updated_at > (event.current_start_time - margin) &&\n updated_at < event.current_end_time\n end", "def is_active?\n (start_time.nil? || start_time < Clock.time) && (end_time.nil? || end_time > Clock.time)\n end", "def active?\n today = Time.now.strftime('%Y-%m-%d %H:%M')\n today >= self.begin_date.strftime('%Y-%m-%d 06:00') && today <= self.end_date.strftime('%Y-%m-%d 23:59')\nend", "def valid_venue_time?\n valid_time = self.venue.matches.all? do |match|\n !(match.start_time >= self.start_time && match.start_time <= self.end_time || match.end_time >= self.start_time && match.end_time <= self.end_time)\n end\n errors.add(:start_time, \"The venue is not available for this time\") unless valid_time\n end", "def trying_to_hide_by_changing_slacking_off_selector?\n will_save_change_to_notify_progress_report_recipient_id_if_i_miss_more_than_3_weeks? && notify_progress_report_recipient_id_if_i_miss_more_than_3_weeks_was.present?\n end", "def cancelable?\n eventbookingstatus.key != 'cancelled'\n end", "def off_peak_class()\n if @start_at.between?(\"11:00\", \"15:00\")\n return true\n else\n return false\n end\n end", "def active?\n Time.current - recent_at <= PERIOD_ACTIVE\n end", "def time_allow(get_time, min_period_time, max_period_time)\n to_time = Time.parse(get_time)\n now_time = Time.now\n return to_time - now_time < max_period_time - min_period_time && to_time - now_time > min_period_time\n end", "def alert_already_exists?\n BlockedEditsAlert.where('created_at >= ?', 8.hours.ago).exists?\n end", "def next_alert_time\n false\n end", "def must_pay_to_avoid_cancellation\n\t\tif @event.start_date < (Time.now + 1.week) && @event.paid == false \n\t\t\t#cannot book event\n\t\tend\n\tend", "def active?(date=Time.now)\n date < self.end_date && date > self.start_date\n end", "def current_time_active\n if self.active_start_time.nil? or self.active_stop_time.nil?\n return false\n end\n \n # get the current time\n current_time = Time.now.utc\n \n # check if current time is in range\n if self.active_start_time.utc.strftime( \"%H%M%S%N\" ) <= current_time.utc.strftime( \"%H%M%S%N\" ) and self.active_stop_time.utc.strftime( \"%H%M%S%N\" ) >= current_time.utc.strftime( \"%H%M%S%N\" )\n return true\n else\n return false\n end\n \n return false\n end", "def active_on?(date)\n relieving_date.nil? || relieving_date >= date\n end", "def affects?(event)\n !event.deleted &&\n time_matches?(event) &&\n faculty_matches?(event) &&\n semester_matches?(event) &&\n course_matches?(event) &&\n timetable_slot_matches?(event)\n end", "def time_window_restriction?\n self.try(:restriction).try(:time_window) ? true : false\n end", "def resendable?\n (self.sent_at + 15.minutes) < Time.current\n end", "def locked?\n self.played_at <= self.class.hours_before_start_time_to_bet.hour.from_now\n end", "def time_passed?(_event, time)\n Time.now > time\n end", "def student_can_cancel?\n return false if sent? || flagged? || Time.since(created_at) < 3.weeks\n reminder = reminders.where(type: Reminders::SendBooks).reorder(:created_at).first\n reminder && Time.since(reminder.created_at) >= 1.week\n end", "def filter\n # #YELLOW\n if @event['check']['alert'] == false # rubocop:disable GuardClause\n puts 'alert disabled -- filtered event ' + [@event['client']['name'], @event['check']['name']].join(' : ')\n exit 0\n end\n end", "def valid?(time=Time.now.utc)\n time>not_before && time<self.not_after\n end", "def in_time_window?\n self.starts_at <= Time.now && self.ends_at >= Time.now\n end", "def within_threshold?\n\n s_timing_threshold = scheduled_time_local.in(self.threshold)\n now_in_target_tz = DateTime.now.in_time_zone(Sundial::Config.default_time_zone)\n\n logger.info(\"Checking schedule [#{self.id}] timing threshold [#{s_timing_threshold}] using current time in \"\\\n \"schedule's time zone: #{now_in_target_tz}\")\n\n return now_in_target_tz <= s_timing_threshold\n end", "def show_only?\n now = Time.now.to_i\n now >= end_time && now <= close_time\n end", "def isBusy(meeting_start, meeting_end, start_time, end_time)\n if start_time > meeting_start && end_time < meeting_end\n return true\n end \n return false\nend", "def relevant_time?\n\t\tself.start <= DateTime.now && self.end >= DateTime.now\n\t\t# (self.start.hour <= DateTime.now.hour) (self.start.minute <= DateTime.now.minute) && (self.end.hour >\tDateTime.now.hour) \n\tend", "def is_within?(other_time, leeway = 5)\n is_before?(other_time, leeway) && is_after?(other_time, leeway)\n end", "def cancellable?\n !cancelled? and !missed? and (start_time - Time.now) > CANCELLATION_DEADLINE\n end", "def waiting?\n entered_at.nil?\n end", "def on_hold?\n status == :inactive\n end", "def current_date_active\n if self.active_start_date.nil? or self.active_stop_date.nil?\n return false\n end\n \n # get the current time\n current_time = Time.now\n \n if self.active_start_date <= current_time and self.active_stop_date >= current_time\n return true\n else\n return false\n end\n \n return false\n end", "def trial_over?\n unless self.trial_started_at.blank?\n return Time.now - APP_CONFIG['trial_length'].days > self.trial_started_at\n else\n return false\n end\n end", "def past_time_threshold?\n return true if @past_time_threshold # no need to check again once past\n @past_time_threshold = (Time.now-@start_time) >= N_PLUS_ONE_TIME_THRESHOLD\n end", "def can_wait_objection?\n seconds.count >= 2\n end", "def open_at_this_time?\n now = timenow\n time_inside?(now, start_time.utc, end_time.utc)\n end", "def is_active\n\t\tself.active and self.start_date <= Date.today and self.end_date >= Date.today\n\tend", "def wait_alert_accept_if_exist\n sleep 1.5 #should wait animation\n wait_true(timeout: 30, message: 'waiting alert dialog via wait_alert_accept_until_display_alert') {\n execute_script('$.mainApp().alert().buttons().length > 0')\n }\n alert_accept_if_exist\n end", "def can_cancel?\n !canceled? && reserve_start_at > Time.current && actual_start_at.nil? && actual_end_at.nil?\n end", "def can_enter?(user)\n self.is_active &&\n self.teams.include?(user.team) &&\n (self.start_date < Time.now) && (!self.finish_date || self.finish_date > Time.now)\n end", "def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end", "def can_be_canceled?\n return true if actionable_date.nil?\n\n cancel_by = actionable_date - SolidusSubscriptions.configuration.minimum_cancellation_notice\n cancel_by.future? || cancel_by.today?\n end", "def better_to_confirm\n ! (self.confirmed && (((Time.zone.now - self.confirmed).to_i / 86400) < 365))\n end", "def editable?(current_user_id)\n # calculate how old is the feedback\n created_at = self.created_at.to_time\n diff_seconds = (Time.now - created_at).round\n\n (self.user.id == current_user_id) && (diff_seconds < TEN_MINUTES)\n end", "def check_deadline\n true\n end", "def reminders_need_to_be_sent?(event, local_time_job_started, job_interval)\n # Could put other logic here...\n return self.time_to_remind?(event, local_time_job_started, job_interval) && self.reminders_sent_today?(event, local_time_job_started)\n end", "def editing?\n if Time.now > self.select_event.ordering_window_end_time\n # Cutoff time has passed\n false\n elsif self.edit_mode\n # SnapPea user is editing this select order\n true\n else\n # Default => not editing since the edit_mode field isn't set\n false\n end\n end", "def alert?\n severity == :ALERT\n end", "def call?\n if rejection_reason\n TinyDialer::Log.info \"Rejected #{phone}: #{rejection_reason}\"\n return\n end\n # Make sure (now, now) overlaps (start, stop)\n now = (Time.now.utc + (3600*(timezone)).to_i).strftime('%H:%M')\n unless TinyDialer.db.fetch(\"select ('#{now}'::text::time, '#{now}'::text::time) OVERLAPS ('#{state.start}'::text::time, '#{state.stop}'::text::time)\").first[:overlaps]\n TinyDialer::Log.info \"Rejected #{phone}: Outside of calling times #{state.start} and #{state.stop}\"\n return false\n end\n true\n rescue => e\n TinyDialer::Log.error e\n return\n end", "def checkTrigger\n\t end", "def invited?(event)\n\t\tattended_events.include?(event)\n\tend", "def schedule_impact?\n self.impact != 'None'\n end", "def matches? invoice\n invoice.order_date.between?(time_range.first, time_range.last)\n end", "def check_attendee_slack\n if current_user and HackumassWeb::Application::SLACK_ENABLED and current_user.is_attendee? and !current_user.has_slack?\n redirect_to join_slack_path, alert: 'You will need to join slack before you access our hardware page.'\n end\n end", "def late?\n \t\tTime.now > @delivery_time\n \t\treturn true\n \tend", "def active_trial?\n trial_end_date > Time.now ? true : false\n end", "def confirmation_sms_period_valid?\n confirmation_sms_sent_at && confirmation_sms_sent_at.utc >= self.class.sms_confirm_within.ago\n end", "def get_eligible\n #older than 1 day, not older than X date (whenever they get these cards).\nend", "def time_removed?\n self.impact == 'Removed'\n end", "def active?\n self.inactive_date && Time.now < self.inactive_date\n end", "def open?\n (AVAILABLE == status) and in_redemption_period?\n end", "def is_redeemed?\n redeemed_at?\n end", "def check_for_alerts(intervals)\n min = @threshold\n alert = nil\n conditions = @conditions[min]\n intervals.each do |time, swell_info|\n recent = false\n conditions.each do |type, value|\n if swell_info[type] >= value\n alert = min\n recent = true\n min += 1\n return alert if min > @max_level\n conditions = @conditions[min]\n break\n end\n end\n redo if recent\n end\n alert\n end", "def booking_deadline_has_passed?\n Date.current > deadline\n end", "def is_expired?\n\t\tself.event_date < DateTime.now\n\tend", "def all_activated(user, email_alert_definition)\n true\n end", "def check_hours\n if @recorder.current_recording_hours >= @rec_show.req_recording_hours\n return true\n end\n false\n end", "def has_aired\n self.airdate < Time.now\n end", "def active?\n (start_date <= DateTime.now) and (DateTime.now <= end_date)\n end", "def alert_timeout\n super\n end", "def inside_operating_window?\n CmeFixListener::AvailabilityManager.new(current_time).available?\n end" ]
[ "0.6003306", "0.5897826", "0.5823105", "0.5713491", "0.5645782", "0.5639726", "0.5616117", "0.5594783", "0.5553861", "0.5548916", "0.55438477", "0.55414087", "0.5497674", "0.5495964", "0.5448917", "0.54387844", "0.5426253", "0.54149675", "0.54113847", "0.5410548", "0.5396336", "0.5396336", "0.53805083", "0.53798884", "0.53502786", "0.5345969", "0.5338746", "0.5333643", "0.5331945", "0.5328305", "0.5314985", "0.5312799", "0.5311149", "0.53005004", "0.52956265", "0.52914816", "0.5289108", "0.5284594", "0.52713895", "0.52695626", "0.52631617", "0.5253235", "0.5245189", "0.5230204", "0.5224859", "0.5217565", "0.52129203", "0.5210769", "0.5195804", "0.5190011", "0.5187258", "0.51813173", "0.51809967", "0.518079", "0.5169259", "0.51688313", "0.51510966", "0.51386267", "0.5134237", "0.5126301", "0.51158756", "0.51145965", "0.51143265", "0.5113031", "0.5102877", "0.50997454", "0.5091404", "0.50909173", "0.5086604", "0.50849706", "0.5075368", "0.50720924", "0.50719815", "0.50694424", "0.5069201", "0.5064927", "0.50551754", "0.504952", "0.5048839", "0.5048049", "0.5046754", "0.50424075", "0.50396216", "0.50290585", "0.50264394", "0.5025771", "0.50237614", "0.50193363", "0.50168717", "0.50149375", "0.5009075", "0.5005425", "0.5005248", "0.50009584", "0.49803302", "0.49791193", "0.49784285", "0.49733457", "0.49714655", "0.49679005" ]
0.5545619
10
Relates to creating text to voice calls.
def obtain_description #it's only pulling traffic train status for now, but we will get it to pull out the description instead. Service.find_by(name: self.service_name).traffic end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speech; end", "def incoming_text\n # Looks up the incoming phone number in our database and\n # retrieves the lead if found:\n begin\n standard_phone = Phoner::Phone.parse(params['From'], country_code: '1').to_s\n @lead = Lead.find_by(standard_phone: standard_phone) if standard_phone\n rescue\n # An exception may happen if the texter's phone number has a very unusual\n # format. We can just move on, as finding the texter's number in our\n # database is not critical.\n end\n\n # If we do find the texter in our database, we provide extra info about\n # this lead to our call converter:\n extra_info = @lead.email if @lead\n\n # We text the texter's message to the call converter's phone:\n @client = Twilio::REST::Client.new\n @client.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: ENV['EMPLOYEE_PHONE_NUMBER'],\n body: \"Message from #{params['From']}: #{params['Body']}. Extra Info: #{extra_info}\"\n )\n end", "def calling_speak\n speak\n end", "def speak\n object_instance = object_instances.last\n Liquid::Template.parse(text_to_voice).render(object_instance.try(:attributes))\n end", "def speak_text(texttospeak)\r\n fixedmessage = texttospeak\r\n fixedmessage = fixedmessage.gsub(\"\\r\", \" \")\r\n fixedmessage = fixedmessage.gsub(\"\\n\", \" \")\r\n fixedmessage = fixedmessage.strip\r\n exec(\"AGI\", \"speak_text.agi|\\\"\" + fixedmessage + \"\\\"\")\r\n\tend", "def speak\n \"#{name} says Assalaam alaykum\"\n end", "def voice\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end", "def speak \n \"#{self.name} says arf!\"\n end", "def speak\n \"#{self.name} says arf!\"\n end", "def speak\n \"#{name} says arf!\"\n end", "def speak\n \"#{name} says arf!\"\n end", "def speak\n \"#{name} says Arf!\"\n end", "def speak\n \"#{@name} says Arf!\"\n end", "def speak\n \"#{name} says arf!\"\nend", "def speak\n \"#{name} says arf!\"\nend", "def speak\n \"#{name} says arf!\"\nend", "def speak\n \"#{name} says wuff!\"\n end", "def speak\r\n \"#{name} say Arf!\"\r\n end", "def say(speaker,text,outputList)\n\tif speaker =~ /(.*) : On \\d+\\/\\d+\\/\\d+, at \\d+:\\d+ \\w*, (.*) wrote/\n\t\tspeaker = $1.to_s\n\t\tquotedSpeaker = $2.to_s\n\t\tmessage = quoteAppend(speaker,quotedSpeaker)\n\telse\n\t\tmessage = speechAppend(speaker)\n\tend\n\tvoice = 'Bruce'\n\t#change these to the people in your chat. Won't work with many more people because of the limited number of voices.\n\tif speaker =~ /cody/i\n\t\tvoice = 'Ralph'\n\telsif speaker =~ /kidd/i\n\t\tvoice = 'Bruce'\n\telsif speaker =~ /hamstra/i\n\t\tvoice = 'Kathy'\n\telsif speaker =~ /munsch/i\n\t\tvoice = 'Princess'\n\telsif speaker =~ /schott/i\n\t\tvoice = 'Junior'\n\telsif speaker =~ /hennings/i\n\t\tvoice = 'Agnes'\n\telsif speaker =~ /aguiniga/i\n\t\tvoice = 'Zarvox'\n\telsif speaker =~ /brandon/i\n\t\tvoice = 'Whisper'\n\telsif speaker =~ /shah/i\n\t\tvoice = 'Vicki'\n\telsif speaker =~ /mcdonald/i\n\t\tvoice = 'Victoria'\n\telsif speaker =~ /williams/i\n\t\tvoice = 'Alex'\n\telsif speaker =~ /wadley/i\n\t\tvoice = 'Cellos'\n\tend\n\n\t#speak the text to .aiff files, track the files to later be combined\n\tif $current_speaker != speaker\n\t\t`say -v Fred \"#{message}\" -o recordings/\"#{$audio_file_count}\".aiff`\n\t\toutputList.write(\"file 'recordings/\"+$audio_file_count.to_s+\".aiff'\\n\")\n\t\t$audio_file_count+=1\n\t\t$current_speaker = speaker\n\tend\n\t`say -v #{voice} \"#{text}\" -o recordings/\"#{$audio_file_count}\".aiff`\n\toutputList.write(\"file 'recordings/\"+$audio_file_count.to_s+\".aiff'\\n\")\n\t$audio_file_count+=1\nend", "def transcribe\n @call = Call.find(params[:id])\n @call.update_attribute :transcription_text, params[:TranscriptionText] || @call.transcription_text\n @call.update_attribute :transcription_status, params[:TranscriptionStatus] || @call.transcription_status\n \n render \"calls/twiml/recording/#{@call.template}.xml.erb\"\n end", "def speak\n \"#{@name} says Arf!!\"\n end", "def speak\n \"#{@name} says arf!\"\n end", "def speak\n \"#{@name} says arf!\"\n end", "def text\n lead = Lead.find(params[:lead_id])\n client = Twilio::REST::Client.new\n if params[:auto_text] || !params[:body].blank?\n client.messages.create(\n from: ENV['TWILIO_PHONE_NUMBER'],\n to: lead.phone,\n body: params[:auto_text] ? custom_message(lead.first_name) : params[:body]\n )\n flash[:success] = \"Text Sent!\"\n else\n flash[:alert] = \"NO TEXT SENT\"\n end\n redirect_to \"/leads/#{lead.id}/edit\"\n rescue Twilio::REST::RequestError => error\n redirect_to \"/leads/#{lead.id}/edit\"\n flash[:alert] = \"NO TEXT SENT - #{error}\"\n end", "def create_speech(*options)\n CreateSpeech.new(self, options).run\n end", "def speak\n super(\"Woof\")\n end", "def send_text\n Rails.logger.info \"Sending \\\"#{text}\\\" to #{number}...\"\n Twilio::Sms.message(TWILIO_CONFIG['caller_id'], number, text)\n end", "def text(type, msg)\n\tcase type\n when META_TEXT, META_LYRIC, META_CUE\n @track.events << MetaEvent.new(type, msg, @curr_ticks)\n\twhen META_SEQ_NAME, META_COPYRIGHT\n @track.events << MetaEvent.new(type, msg, 0)\n\twhen META_INSTRUMENT\n @track.instrument = msg\n\twhen META_MARKER\n @track.events << Marker.new(msg, @curr_ticks)\n\telse\n $stderr.puts \"text = #{msg}, type = #{type}\" if $DEBUG\n\tend\n end", "def twilio_text\n \n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n time_str = self.time\n content = \"#{self.content} Sent from the Twilio App. Please do not reply\"\n message = @client.account.messages.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :body => content\n )\n puts message\n end", "def text text\n end", "def create_phrase\n @phrase_text = add_text(base_x, base_y, 0, 16, @phrase)\n end", "def send_text\n\nend", "def talk(text, name)\n if @os == 'osx'\n `say \"#{ text }\" -v \"#{ name.strip }\"`\n else\n `echo \"#{ text }\" | espeak`\n end\n end", "def speak\n #\"#{@name} says arf!\"\n #\"#{name} says arf!\"\n \"#{self.name} says arf!\"\n end", "def add_text(text); end", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n \"#{@name} says arf!\"\nend", "def speak\n @arr = 'Shiber Me Timbers You Scurvey Dogs!!'\n @speak_a.push(\"@what\", \"@arr\")\n @speak = speak.a.join(/\\n /)\n end", "def speak(text)\n @conn.post 'speak.json', :message => {:body => text}\n end", "def show_text(text, options={})\n add_actor Gamework::Text.new(text, options)\n end", "def send(text)\n super(\"#{@name}|#{text.to_s}\")\n end", "def voice\n twiml do |r|\n r.Say \"Welcome to #{@session.current_state.titleize}... This area is currently under construction.\"\n r.Pause length: 2\n r.Say \"Have a nice day\"\n end\n end", "def call\n system(SPEECH_COMMAND)\n end", "def gen_speak_with_define_method(message)\r\n self.class.send(:define_method, :speak) do\r\n @speech_count += 1\r\n message\r\n end\r\n end", "def speak\n\t\t\"#{name} says ARf!\" #changed #{@name} for name to call the inst. name method as oposed to the \n\t\t#inst. var @name. This only works for the GETTER method. For the setter we need to use self\n\tend", "def tvText _args\n \"tvText _args;\" \n end", "def speak\n \"This animal is silent.\"\n end", "def triggerText _args\n \"triggerText _args;\" \n end", "def speak\n puts \"WOOF WOOF\"\n end", "def send_text(text, phone)\n account_sid = ENV[\"ACCOUNT_SID\"]\n auth_token = ENV[\"AUTH_TOKEN\"]\n client = Twilio::REST::Client.new account_sid, auth_token\n\n account = client.account\n message = account.sms.messages.create({\n :from => ENV[\"PHONE\"],\n :to => phone,\n :body => text})\n puts message\n end", "def _text(text)\n @target << text\n end", "def voice\n reminder = Reminder.find(params[:id])\n \tresponse = Twilio::TwiML::Response.new do |r|\n r.Say 'This is a reminder message from the Remmyo service.',:voice => 'alice'\n \t r.Say reminder.message, :voice => 'alice'\n r.Say 'End of message.',:voice => 'man'\n # r.Play 'http://linode.rabasa.com/cantina.mp3'\n \tend\n\n \trender_twiml response\n end", "def new_event(n, text)\n @events_list_iter.set_value(0, n.to_s)\n @events_list_iter.set_value(1, text)\n @events_list.append\n @events_list_iter.next!\n\n if false # XXX actually this is supposed to be just an option\n # XXX stupid hack to force macOS's speech synthesis to actually respect periods\n spoken_text = text.gsub('.', '..')\n GLib::Spawn.async(Dir.pwd, [\"say\", \"-v\", \"Daniel\", \"-r\", \"200\", spoken_text], \"\", 0) # XXX Haven't found the actual docs for this yet\n end\n end", "def speak\n\t\traise 'You must implement this in a subclass'\n\tend", "def part_of_speech\n raise NotImplementedError\n end", "def create\n @texter = Texter.new(texter_params)\n \n respond_to do |format|\n if @texter.save\n message = \"The message sent '#{@texter.client_name}' was just added.\"\n TwilioTextMessenger.new(message).call\n format.html { redirect_to @texter, notice: 'Texter was successfully created.' }\n format.json { render :show, status: :created, location: @texter }\n else\n format.html { render :new }\n format.json { render json: @texter.errors, status: :unprocessable_entity }\n end\n end\n end", "def voice\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'Hey there. Congrats on integrating Twilio into your Rails 4 app.', :voice => 'alice'\n r.Play 'http://linode.rabasa.com/cantina.mp3'\n end\n \n render_twiml response\n end", "def voice\n from_number = params['FromNumber'].blank? ? ENV['TWILIO_CALLER_ID'] : params['FromNumber']\n twiml = Twilio::TwiML::Response.new do |r|\n if params['To'] and params['To'] != ''\n r.Dial callerId: from_number do |d|\n # wrap the phone number or client name in the appropriate TwiML verb\n # by checking if the number given has only digits and format symbols\n if params['To'] =~ /^[\\d\\+\\-\\(\\) ]+$/\n d.Number params['To']\n else\n d.Client params['To']\n end\n end\n else\n r.Say \"Thanks for calling!\"\n end\n end\n\n render xml: twiml.text\n end", "def text(options, params, object_name, format=\"\")\n body = \"\"\n if format.empty?\n outgoing_text_option = @account.outgoing_text_options.where(:name => object_name).first\n # Find the format string from fields that were passed.\n body = outgoing_text_option.build_text(object_name, params)\n else\n body = format\n end\n\n from_phone_number = options[:from_phone_number]\n phone_number = options[:phone_number]\n\n begin\n twilio_account.sms.messages.create(:from => from_phone_number, :to => phone_number, :body => body)\n rescue\n Rails.logger.error \"Unable to send SMS...: #{$!.message}\"\n Rails.logger.error $!.backtrace.join(\"\\n\")\n raise\n end\n ::SmsExtension::Message.create(:from => from_phone_number, :to => phone_number, :body => body)\n end", "def speak\n speak_what = params[:text_to_speak]\n logger.debug \"speak_what=#{speak_what}\"\n if !speak_what.present? then return end\n speak_what_encoded = ERB::Util.url_encode(speak_what)\n logger.debug \"speak_what_encoded=#{speak_what_encoded}\"\n uri = \"#{HOST}:#{PORT}/sayall/#{speak_what_encoded}\"\n begin\n logger.debug \"uri=#{uri}\"\n response = open(uri).read \n rescue ActionController::UnknownFormat => e\n if e.include? '204'\n # do nothing\n else\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e\n end\n rescue Exception => e\n logger.debug \"Exception in text_to_speech_controller: #{e.to_s}\"\n raise e \n end\n redirect_to :controller => 'presets', :action => 'display'\n end", "def speak\n\t`say 'I am a product.`\nend", "def speak\n puts \"Ho, ho, ho! Haaaaappy holidays! I'm #{@name}!\"\n end", "def speak\n puts \"I'm a person\"\n end", "def setSpeech _obj, _args\n \"_obj setSpeech _args;\" \n end", "def speak(text=\"Destroy all robots\")\n system(\"say #{text}\")\n end", "def speak\n puts \"Ho Ho Ho! Haaaaaappy holidays! from #{@name} Santa\"\n end", "def speak\n puts \"ho, ho, ho! happy hollandaise!\"\n end", "def speakIntoFiles(spanishText, germanText, englishText)\n @spanishText = spanishText\n @germanText = germanText\n @englishText = englishText\n\n\n readingSpeedES = 140\n readingSpeedDE = 180\n readingSpeedEN = 140\n\n spanishVoice = \"Jorge\"\n germanVoice = \"Markus\"\n englishVoice =\"Susan\"\n\n # we set the character length of the file name\n # languageFileDE = \"#{germanText[0,55]}\"\n languageFileES = \"#{spanishText[0,20].chomp}\"\n languageFileEN = \"#{englishText[0,20].chomp}\"\n languageFileDE = \"#{germanText[0,20].chomp}\"\nputs `say -v #{spanishVoice} -r #{readingSpeedES} \"#{spanishText}\" -o \"#{languageFileES}\".aif`\nputs `say -v #{germanVoice} -r #{readingSpeedDE} \"#{germanText}\" -o \"#{languageFileDE}\".aif`\nputs `say -v #{englishVoice} -r #{readingSpeedEN} \"#{englishText}\" -o \"#{languageFileEN}\".aif`\nend", "def light_the_way\n HisMastersVoice.instance.tell_me(self)\n end", "def speak\n \"#{@name} says Arf!\" # using instance variables in methods\n end", "def create\n @text = Text.new(text_params)\n notify_android(text_params[:token])\n respond_to do |format|\n if @text.save\n format.html { redirect_to @text, notice: 'Text was successfully created.' }\n format.json { render :show, status: :created, location: @text }\n else\n format.html { render :new }\n format.json { render json: @text.errors, status: :unprocessable_entity }\n end\n end\n end", "def text(*)\n super\n end", "def speak(message = '', context = [])\n return @mouth.construct_sentence(message,context)\n end", "def speak\n\t\tputs \"My name is #{@name}. I am a #{@colour} dog. I am #{@age} years old and live in #{@home}\"\n\tend", "def manage\n case text\n when /\\A\\/start/\n Dialogue.new(@patient).welcome(chat_id)\n else\n contact.nil? ? phone_number = nil : phone_number = contact_phone_number\n if valid(phone_number)\n init_user\n else\n Dialogue.new(@patient).send_not_allowed(chat_id)\n end\n end\n end", "def pbTrainerSpeak(msg, bgm = nil, index = 0)\n # in case the dialogue is a hash for bgm change as well as text display\n file = (msg.is_a?(Hash) && msg.has_key?(:file)) ? msg[:file] : nil\n bgm = msg[:bgm] if msg.is_a?(Hash) && msg.has_key?(:bgm)\n msg = msg[:text] if msg.is_a?(Hash) && msg.has_key?(:text)\n # play specified BGM\n pbBGMPlay(bgm) if !bgm.nil?\n self.custom_bgm = bgm if !bgm.nil?\n # safety check\n if msg.is_a?(Proc)\n wrapper = CallbackWrapper.new\n wrapper.set({\n :battle => @battle, :scene => self, :sprites => @sprites,\n :battlers => @battle.battlers, :opponent => @battle.opponent,\n :viewport => @viewport, :vector => self.vector\n })\n return wrapper.execute(msg)\n end\n return pbBattleCommonEvent(msg) if msg.is_a?(Integer)\n return if !msg.is_a?(String) && !msg.is_a?(Array)\n msg = [msg] if !msg.is_a?(Array)\n # show opponent Trainer on screen\n clearMessageWindow\n pbShowOpponent(index, true, file) if (@battle.opponent && @battle.opponent[index]) || !file.nil?\n # display message\n for m in msg\n @battle.pbDisplayPaused(m)\n end\n clearMessageWindow\n # hide opponent Trainer off screen\n pbHideOpponent(true, true) if (@battle.opponent && @battle.opponent[index]) || !file.nil?\n end", "def user_choice_text_version\n this_here = pick_a_story\n puts \"\\n #{this_here.title}\"\n puts \"\\n\"\n Narrabot::Scraper.aesop_fable_text(this_here) if !this_here.text_and_moral\n puts this_here.text_and_moral\n puts \"\\n\"\n #puts \"Would you like me to read this story in my beautiful voice?\"\n #input = gets.chomp\n #switch = yes_or_no(input)\n #if switch == true\n # puts \"\"\n # \"#{this_here.text_and_moral}\".play (\"en\")\n #else\n # puts \"\"\n # play_and_puts(\"Okay\")\n #end\n end", "def speak\n response = Twilio::TwiML::Response.new do |r|\n r.Say 'hello there', :voice => 'woman'\n end\n @xml=response.text\nend", "def say\n send_text \"You just said: #{params}\"\n end", "def speak\n\t\tputs \"Meow. My name is #{@name.capitalize}.\"\n\t\tputs \"I am #{@age} years old and I live in #{@location}\"\n\t\tputs \"I am a #{@colour.downcase} #{@breed.downcase}.\"\n\tend", "def text!\n @grpc.type = :PLAIN_TEXT\n end", "def say(payload)\n {\n action: 'say',\n options: {\n payload: payload,\n voice: 'male',\n language: 'en-US'\n }\n }\nend", "def create_texts\n add_text(TEXT_OX, 0, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 0)) # Attack !\n add_text(TEXT_OX + DELTA_X, 0, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 1)) # Bag\n add_text(TEXT_OX, DELTA_Y, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 2)) # Pokemon\n add_text(TEXT_OX + DELTA_X, DELTA_Y, DELTA_X - TEXT_OX, DELTA_Y, text_get(32, 3)) # Flee\n end", "def speechRecognizer_didRecognizeCommand( sender, command )\n # do something with the command\n # command needs to be converted to a proper ruby string: command.to_s\nend", "def text(name, title, text)\n push(name, {\"title\" => title, \"msg\" => text})\n end", "def speak\r\n\t\tputs \"Ho, ho, ho! Merry Christmas and Haaaappy holidays to all!\"\r\n\tend", "def gen_speak(message)\r\n @speak_lambda = lambda do\r\n @speech_count += 1\r\n message\r\n end\r\n def speak()\r\n @speak_lambda.call\r\n end\r\n end", "def create_texts\n self.title = I18n.t(:options)\n @new_btn.label = I18n.t(:begin)\n @quit_btn.label = I18n.t(:quit)\n @idiom_rdo[0].label = I18n.t(:english)\n @idiom_rdo[1].label = I18n.t(:portuguese)\n @idiom_rdo[2].label = I18n.t(:spanish)\n @mode_rdo[0].label = I18n.t(:player_player)\n @mode_rdo[1].label = I18n.t(:player_very_easy)\n @mode_rdo[2].label = I18n.t(:player_easy)\n @mode_rdo[3].label = I18n.t(:player_medium)\n @mode_rdo[4].label = I18n.t(:player_impossible) \n end", "def speak(data)\n sender = get_sender(data['sender'])\n conversation_id = data['conversation_id']\n message = data['message']\n\n raise 'No conversation_id!' if conversation_id.blank?\n convo = get_convo(conversation_id) # A conversation\n raise 'No conversation found!' if convo.blank?\n raise 'No message!' if message.blank?\n\n # set receiver of message\n # receiver = get_user(data['receiver']) || convo.recipient(sender)\n\n # saves the message and its data to the DB\n Message.create!(\n conversation: convo,\n sender: sender,\n # receiver: receiver,\n receiver: convo.recipient(sender),\n body: message\n )\n end", "def send(text)\n super(\"|/pm #{@id}, #{text.to_s}\")\n end", "def speak\n\t raise NotImplementedError.new(\"#{self.class.name}#speak is an abstract method.\")\n end", "def speech_recognized(object, connection, phrase)\n\t\tif @state == :DEFAULT_STATE \n\t\t\tif phrase.match(/^next/i)\n\t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\t\t@state = :DEFAULT_STATE\n\t\t\t\t# @tweetText = $1\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\n \"Port\" => 800,\n \"Binmode\" => true,\n # \"Timeout\" => 10,\n \"Telnetmode\" => true,\n \"Prompt\" => \"\"\n ) { |resp| print \"==> \"+resp }\n # pass username and password as commands not .login method\n @telnet.cmd(\"iam:SIRINextPage\") # { |c| print c }\n # @telnet.puts(\"\") { |c| print c }\n # @telnet.write(\"\\n\\n\\n\\n\\ Ciao\")\n # @response = ''\n # @telnet.cmd(\"String\" => \"response\", \"FailEOF\" => false) # { |c| print c; @response += c }\n @telnet.close\n \n\t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Gone to next page.\")\n\t\t\t\t# return self.generate_tweet_response(connection.lastRefId, $1);\n\t\t\telsif phrase.match(/^back/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n \t\t\t\t# @tweetText = $1\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\n \"Port\" => 800,\n \"Binmode\" => true,\n # \"Timeout\" => 10,\n \"Telnetmode\" => true,\n \"Prompt\" => \"\"\n ) { |resp| print \"==> \"+resp }\n # pass username and password as commands not .login method\n @telnet.cmd(\"iam:SIRIPreviousPage\") # { |c| print c }\n # @telnet.puts(\"\") { |c| print c }\n # @telnet.write(\"\\n\\n\\n\\n\\ Ciao\")\n # @response = ''\n # @telnet.cmd(\"String\" => \"response\", \"FailEOF\" => false) # { |c| print c; @response += c }\n @telnet.close\n\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Gone to previous page.\")\n \t\t\t\t# return self.generate_tweet_response(connection.lastRefId, $1);\n\t\t\t elsif phrase.match(/^search for (.+)/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n \t\t\t\t# @tweetText = $1\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\n \"Port\" => 800,\n \"Binmode\" => true,\n # \"Timeout\" => 10,\n \"Telnetmode\" => true,\n \"Prompt\" => \"\"\n ) { |resp| print \"==> \"+resp }\n # pass username and password as commands not .login method\n @telnet.cmd(\"iam:SIRISearch\"+$1) # { |c| print c }\n # @telnet.puts(\"\") { |c| print c }\n # @telnet.write(\"\\n\\n\\n\\n\\ Ciao\")\n # @response = ''\n # @telnet.cmd(\"String\" => \"response\", \"FailEOF\" => false) # { |c| print c; @response += c }\n @telnet.close\n # return self.generate_search_response(connection.lastRefId, $1);\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Ok, which one do you want?\")\n \t\t\t\t# return self.generate_tweet_response(connection.lastRefId, $1);\n \t\t\t elsif phrase.match(/^the first/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex0\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the second/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex1\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the third/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex2\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the fourth/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex3\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t elsif phrase.match(/^the fifth/i)\n \t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n \t\t\t\t@state = :DEFAULT_STATE\n @telnet = Net::Telnet::new(\"Host\" => \"192.168.2.9\",\"Port\" => 800,\"Binmode\" => true,\"Telnetmode\" => true,\"Prompt\" => \"\") { |resp| print \"==> \"+resp }\n @telnet.cmd(\"iam:SIRISearchIndex4\") # { |c| print c } \n @telnet.close\n \t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Here it is.\")\n \t\t\tend\n\t\t\t\n\t\telsif @state == :CONFIRM_STATE\n\t\t\tif phrase.match(/yes/i)\n\t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\t\t@state = :DEFAULT_STATE\n\t\t\t\t# @twitterClient.update(@tweetText) # this should probably be done in a seperate thread\n\t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Ok it has been posted to Twitter.\")\n\t\t\tend\n\t\t\tif phrase.match(/no/i)\n\t\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\t\t@state = :DEFAULT_STATE\n\t\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Ok I won't send it.\")\n\t\t\tend\n\n\t\t\tself.plugin_manager.block_rest_of_session_from_server\n\t\t\treturn generate_siri_utterance(connection.lastRefId, \"Do you want me to send it?\", \"I'm sorry. I don't understand. Do you want me to send it? Say yes or no.\", true)\n\t\tend\n\n\t\tobject\n\tend", "def send_text(call_job)\n from = '+18015131966'\n\n req_params = {\n from: from,\n to: call_job.phone,\n status_callback: \"#{ENV['CALL_SERVICE_URL']}twilio/provider_text_status_callback.xml\",\n body: call_job.body\n }\n\n if Rails.env == \"development\"\n url = \"http://127.0.0.1:4567/send_text\"\n RestClient.post url, req_params\n else\n client = Twilio::REST::Client.new(ENV[\"TWILIO_SID\"], ENV[\"TWILIO_TOKEN\"])\n\n account = client.account\n message = account.sms.messages.create(req_params)\n end\n end", "def save_text\n @lexemes << @lexeme\n end", "def send_text_message(text_message)\n number_to_send_to = text_message.receiver\n message = text_message.content\n twilio_sid = \"AC50070372767bdf26a090b08007bba07f\"\n twilio_token = \"8ae1cdbb08d55b99cab34174c3cd8bbb\"\n twilio_phone_number = \"2245209581\"\n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n @twilio_client.account.sms.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => message\n )\n \n end", "def speechAppend(speaker)\n\tprng = Random.new\n\tnum = prng.rand(5)\n\tif num ==0\n\t\tmessage = \"then \"+speaker+\" said \"\n\telsif num == 1\n\t\tmessage = \"and \"+speaker+\" was like\"\n\telsif num == 2\n\t\tmessage = \"so \"+speaker+\" replied \"\n\telsif num == 3\n\t\tmessage = \" and \"+speaker+\" whispered \"\n\telse\n\t\tmessage = \". \"+speaker+\" pondered this, and said \"\n\tend\n\treturn message\nend", "def speak(utterance)\n prints utterance\n end" ]
[ "0.6667594", "0.6629084", "0.6580173", "0.6555955", "0.65346307", "0.6510406", "0.6409636", "0.64002955", "0.636529", "0.63589513", "0.63281953", "0.63158625", "0.6287795", "0.62788105", "0.62788105", "0.62788105", "0.62649494", "0.6263339", "0.62570095", "0.62348783", "0.62340677", "0.6234047", "0.6234047", "0.62257767", "0.62220967", "0.6134345", "0.61104226", "0.61021614", "0.608567", "0.6066425", "0.6064745", "0.6057384", "0.60567665", "0.6056675", "0.6045433", "0.6041355", "0.6041355", "0.6041355", "0.6041355", "0.6041355", "0.6041355", "0.6020415", "0.60077864", "0.59948653", "0.59701943", "0.5955542", "0.59143054", "0.591127", "0.5899587", "0.5891008", "0.5890805", "0.5885088", "0.587842", "0.58181924", "0.58173484", "0.5814878", "0.5812073", "0.5801735", "0.5790048", "0.57868236", "0.57781386", "0.5776218", "0.5769333", "0.5754728", "0.57518196", "0.5745077", "0.5740369", "0.57303625", "0.57265383", "0.5724146", "0.5723538", "0.5723505", "0.57215273", "0.5715791", "0.5715442", "0.5692515", "0.5685879", "0.56743747", "0.56725234", "0.56717753", "0.5659001", "0.56500566", "0.564995", "0.5644386", "0.5641944", "0.56383", "0.56372666", "0.562904", "0.56223243", "0.56209785", "0.5620333", "0.5616552", "0.5616235", "0.56094366", "0.5608742", "0.5607592", "0.5601255", "0.5600869", "0.55971843", "0.55969775", "0.5594519" ]
0.0
-1
We are following this url example below to to format the url for a call:
def call end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_url(request)\n \"#{@api_prefix}#{request}\"\n end", "def request_url\n base_url = \"http://#{api_host}#{PATH}?\"\n base_url << \"appid=#{app_id}\"\n base_url << \"&callname=#{call_name}\"\n base_url << \"&siteid=#{site_id}\"\n base_url << \"&version=#{API_VERSION}\"\n base_url\n end", "def format_url(url_params)\n url_base = \"https://agencyrecruiting.apihealthcare.com/UAM2/index.cfm\"\n args = format_arguments(url_params)\n url = \"#{url_base}?#{args}\"\n return url\n end", "def build_call_url(word)\r\n\t\t\tURI.parse(URI.escape(base_url + word))\r\n\t\tend", "def encoded_call_no\n URI.encode_www_form_component(@call_number)\n end", "def url\n endpoint+'?'+query_string\n end", "def construct_url(method, format, dev_id, signature, session_id, formatted_timestamp)\n \"#{API_END_POINT}/#{method}#{format}/#{dev_id}/#{signature}/#{session_id}/#{formatted_timestamp}\"\n end", "def build_urlpath\n render_endpoint_request do\n erb = EndpointRequestBuilder.new(@endpoint)\n extra_params = erb.formatted_url_path(@arguments)\n render json: { success: extra_params }, status: 200\n end\n end", "def consume_url; end", "def url(params)\n \"%s%s\" % [config['endpoint'], query_string(params)]\n end", "def make_url\n # This works for most of the twitter calls\n \"http://ws.audioscrobbler.com/2.0/?method=#{resource_path}&artist=#{identifier}&limit=100&page=#{page}&api_key=#{api_key}&format=json\"\n end", "def url\n ::URI.join(\"#{service.service_url}/\", ::URI.escape(url_chunk)).to_s\n end", "def api_rb(call)\n <<-EOS\n#{call[:id]} = http_#{call[:method]}(\n \"#{call[:endpoint]}\",\n #{field_param(call[:params])}\n)\nEOS\n end", "def formatted_url\n if @request.scheme == \"https\"\n @request.url.gsub(/:#{@request.port}/, '')\n else\n @request.url\n end\n end", "def make_url\n [ \"http://ws.audioscrobbler.com/2.0/?method=#{api_method}#{identifier}\",\n \"&limit=#{max_items}&api_key=#{api_key}&format=json\",\n \"&page=#{page}\" ].join(\"\")\n end", "def url()\n set_signature\n\n url = service_end_point + \"?\"\n\n param_string = @params.map do |key,value|\n [key,value].map { |string| Amazon::FPS::SignatureUtils.urlencode(string) }.join '='\n end.join '&'\n\n url + param_string\n end", "def url()\n\t\t\turi = URI.parse(@service_end_point)\n\t\t\tsignature = Amazon::FPS::SignatureUtils.sign_parameters({parameters: @params, \n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\taws_secret_key: @secret_key,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\thost: uri.host,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tverb: @http_method,\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\turi: uri.path })\n\t\t\t@params[Amazon::FPS::SignatureUtils::SIGNATURE_KEYNAME] = signature\n\n\t\t\treturn get_url(@service_end_point, @params)\n\tend", "def sub_url (p)\n res = (p != \"\") ? \"http://\" + request.host + \":3000\" + p.sub(\"/execute/\", \"/rest2/\") : p\n end", "def url\n connection.build_url(url_chunk, params).to_s\n end", "def request_uri; end", "def plan_url(request)\n build_url(request[:from], request[:to], request[:trip_time], request[:arrive_by], request[:options] || {})\n end", "def url\n URI.parse(endpoint).join(path.to_s).to_s\n end", "def do_rest_url(api_name)\n raise 'Signature should not be blank. Please generate signature by LazadaOP#do_signature.' if @common_params[:sign].blank?\n length = @server_url.length\n rest_url = @server_url[(length - 1)] == '/' ? @server_url.chomp!('/') : @server_url\n\n common_params_string = ''\n @common_params.each do |key, value|\n common_params_string += '&' unless common_params_string.blank?\n common_params_string += \"#{key}=#{value}\"\n end\n \"#{rest_url + api_name}?#{common_params_string}\"\n end", "def get_call call_id\n opts = {:single_quoted => false}\n params = {\n :query => {\n \"ClientToken\" => self.token,\n \"Call_ID\" => Type::String.safe_value(call_id, opts)\n }\n }\n\n get 'get_call.php', params\n end", "def to_url\n \"%s/web/api/%s/%s/authkey=%s/%s\" % [ host, target, url_options, authkey, output ]\n end", "def request_uri(path)\n \"#{@api_url}#{path}\"\n end", "def show url\n function = ''\n \n params = {}\n params[:url] = url\n\n request(@resource, function, params)\n end", "def url(path)\n \"#{API}/#{path}\"\n end", "def base_url\n 'http://ow.ly/api/1.1/url/shorten'\n end", "def build_request_url\n \"http://snipr.com/site/snip?r=simple&link=#{ensure_http}\"\n end", "def api_url\n \"#{@@base_url}/#{format}/#{resource}?apikey=#{@@api_key}#{parameters}\"\n end", "def GETCall url\n \n a = Time.now.to_f\n \n uri = URI.parse url\n \n http = Net::HTTP.new(uri.host,443)\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.use_ssl = true if uri.scheme == 'https'\n req = Net::HTTP::Get.new uri.path\n response = http.request req\n code = response.code.to_f.round\n body = response.body\n \n b = Time.now.to_f\n c = ((b-a)*100).round.to_f/100\n \n final = {code: code}\n final = final.merge(body: body)\n final = final.merge(time: c)\n \n final\n \n end", "def make_phone_call(number, international_code = 1, area_code = 646)\n puts \"Calling #{international_code}-#{area_code}-#{number}\"\nend", "def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n details = [uid, code]\n parameters = {\n uid: uid,\n code: code\n }\n query_string = parameters.to_a.map { |x| \"#{x[0]}=#{x[1]}\" }.join(\"&\")\n url = \"https://api.wavecell.com/otp/v1/#{sub_account}/#{uid}?code=#{code}\"\n HTTParty.get(url.to_str,\n :body => parameters.to_json,\n :headers => {\n \"Content-Type\" => \"application/json\",\n \"Authorization\" => \"Bearer #{api_key}\"\n })\n end", "def generate_request_url\n # analytics base url\n analytics_url = \"https://api.ibmaspera.com/analytics/v2/organizations/#{ORGANIZATION_ID}/\"\n # resource within analytics application\n analytics_resource = 'transfers'\n # query parameters\n start_time = CGI.escape('2019-01-19T23:00:00Z')\n stop_time = CGI.escape('2019-01-26T23:00:00Z')\n limit = 3\n parameters = \"?start_time=#{start_time}&stop_time=#{stop_time}&limit=#{limit}\"\n # print what the request url will look like\n puts \"\\n\\nanalytics_url: #{analytics_url + analytics_resource + parameters}\"\n analytics_url + analytics_resource + parameters\nend", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def url=(_arg0); end", "def to_s; @url; end", "def person_url(id)\n 'https://swapi.co/api/people/' + id.to_s\nend", "def http_call(payload); end", "def generate_url\n api_key = WavecellOtpAndSms.configuration.api_key\n sub_account = WavecellOtpAndSms.configuration.sub_account\n puts `curl -X POST https://api.wavecell.com/sms/v1/#{sub_account}/single -H \"Authorization: Bearer #{api_key}\" -H \"Content-Type: application/json\" -d $'{ \"source\": \"#{source}\", \"destination\": \"+63#{destination}\", \"text\": \"#{text}\", \"encoding\": \"#{encoding}\" }'`\n end", "def makeURL(path)\n \"#{self.api_endpt + path}?token=#{self.token}\"\n end", "def request_url(method, params={})\n url = \"#{@host}#{@api}/#{method}?ApiKey=#{@api_key}\"\n params.each_pair do |key, val|\n url += \"&#{key}=\" + CGI::escape(val.to_s)\n end\n url\n end", "def create_openurl(request, wh)\n metadata = request.referent.metadata\n \n co = OpenURL::ContextObject.new\n cor = co.referent\n cor.set_format(wh['record_type'])\n cor.add_identifier(\"info:oclcnum/#{wh['oclcnum']}\")\n cor.set_metadata('aulast', metadata['aulast'] ) if metadata['aulast']\n cor.set_metadata('aufirst', metadata['aufirst']) if metadata['aufirst']\n cor.set_metadata('aucorp', metadata['aucorp']) if metadata['aucorp']\n cor.set_metadata('title', wh['title'])\n link = @openurl_base + '?' + co.kev\n return link\n end", "def url(name, *params)\n params.map! do |param|\n if param.is_a?(Hash)\n param[:format] = param[:format].to_s if param.has_key?(:format)\n param.each { |k,v| param[k] = v.to_param if v.respond_to?(:to_param) }\n end\n end\n url = router.generator.generate(name, *params)\n uri_root != \"/\" ? uri_root + url : url\n end", "def create_url\n uri = Addressable::URI.new\n uri.query_values = properties\n \"#{ BASE_URI }#{ Hubspotter.configuration.portal_id }#{ create_endpoint }#{ uri.query }\"\n end", "def url_template; end", "def url_template; end", "def barclaysPingItURI\n\n \t#barclays://08/07543651833/3.50/07543651833//\n \tmode = \"08\"\n \tdestinationNumber = self.user.phone\n \tsetPrice = self.amount\n \tconfirmNumber = self.destination_user.phone\n \turi = \"barclays://#{mode}/#{destinationNumber}/#{setPrice}/#{confirmNumber}\"\n\n end", "def call_params\n params.require(:call).permit(\n :api_id, :name, :title, :link, :status, :content\n )\n end", "def url\n end", "def url\n end", "def create url\n function = ''\n \n post_data = {}\n post_data[:url] = url\n\n request(@resource, function, nil, 'post', post_data)\n end", "def api_create_url\n \"#{self.name.split(\"::\").last.downcase}\"\n end", "def generate_url(api_key, page_number, username)\n %W[\n ws.audioscrobbler.com\n /2.0/?method=user.getrecenttracks&user=#{username}&api_key=#{api_key}&format=json&page=#{page_number}\n ]\n end", "def build_url(input)\n url = \"#{GOOGLE_BOOKS_API_BASE_URL}#{input}\"\n url\nend", "def make_call (number, international_code = 1, area_code = 646)\n puts \"Calling #{international_code}-#{area_code}-#{number}\"\n end", "def make_phone_call(number, international_code = '+254', area_code = 7)\n puts \"calling #{international_code}-#{area_code}#{number}\"\nend", "def request_uri(resource, options)\n @format = options[:format] || :json\n URI.mixpanel(resource, normalize_options(options))\n end", "def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.CallInstance #{values}>\"\n end", "def get_calls(service)\n\t\treturn @transport.get_path(\"calls\",service)\n\tend", "def build_uri_for(provider, args={})\n args = args.inject('?'){ |res, hash| res += \"#{hash[0]}=#{hash[1]}&\" }\n case provider\n when 'CF'\n URI.parse(\"https://api.commissionfactory.com.au/V1/Affiliate/DataFeeds/#{args}apiKey=7fec5f11e26a493a8360175035c0014e\")\n end\n end", "def ping_url(rft_id)\n ping_url_template.expand(:rft_id => rft_id).to_str\n end", "def to_s\n values = @params.map{|k, v| \"#{k}: #{v}\"}.join(\" \")\n \"<Twilio.Api.V2010.CallInstance #{values}>\"\n end", "def on_request_uri(cli, req)\n\t\tcode = %Q{\n\t\t\tdocument.body.innerHTML = \"<iframe src=tel:#{datastore['phoneNumber']}></iframe>\";\n\t\t\tXSSF_POST(\"Phone call launched\",'#{self.name}');\n\t\t}\n\t\t\n\t\tsend_response(cli, code)\n\tend", "def tracking_url url, consignment_number\n url.sub('{{consignment_number}}', consignment_number)\n end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url; end", "def url(*args)\n named_route, params, recall, options = extract_params!(*args)\n\n options[:parameterize] ||= lambda { |name, param| Utils.escape_uri(param) }\n\n unless result = generate(:path_info, named_route, params, recall, options)\n return\n end\n\n uri, params = result\n params.each do |k, v|\n if v\n params[k] = v\n else\n params.delete(k)\n end\n end\n\n uri << \"?#{Utils.build_nested_query(params)}\" if uri && params.any?\n uri\n end", "def url\n raise InvalidQueryError unless query && page\n\n \"http://#{ENDPOINT}#{REQUEST_URI}\" + # base\n \"?#{canonical_query_string}\" + # query\n \"&Signature=#{uri_escape(signature)}\" # signature\n end", "def api_url(id)\n name = get_tourney_name(id)\n return \"https://api.challonge.com/v1/tournaments/uxie#{id}#{name}\"\nend", "def get_url\n \"http://#{self.domain}/#{self.path}#{self.params.it_keys_to_get_param}\"\n end", "def _url path = request.path, options = {}\n\t\tstr = path\n\t\tunless options.empty?\n\t\t\tstr += '?'\n\t\t\toptions.each do | k, v |\n\t\t\t\tstr = str + k.to_s + '=' + v.to_s + '&'\n\t\t\tend\n\t\tend\n\t\tstr\n\tend", "def string_to_sign\n \"GET\\n#{ENDPOINT}\\n#{REQUEST_URI}\\n#{canonical_query_string}\"\n end", "def build_request_url(params)\n \"http://api.nytimes.com/svc/search/v2/articlesearch.json?\"+params\n end", "def url\n uri.to_s\n end", "def partner_ref_url(resource)\n uri = URI.parse(root_url)\n uri.query = URI.encode_www_form(partner: resource.name)\n uri.to_s\n end", "def rest_endpoint=(_arg0); end", "def endpoint\n \"http://api.urlvoid.com/#{identifier}/#{api_key}\"\n end" ]
[ "0.68915445", "0.68886673", "0.6685401", "0.66527754", "0.6510911", "0.64814883", "0.6468134", "0.6452945", "0.63216484", "0.6302338", "0.6196032", "0.6175477", "0.6157846", "0.61501914", "0.6138132", "0.61146605", "0.60992926", "0.60152376", "0.5979382", "0.5978775", "0.59588", "0.59568495", "0.5953674", "0.5928693", "0.5915911", "0.58938384", "0.5893351", "0.5888583", "0.58826196", "0.58630145", "0.5855943", "0.5842854", "0.58370674", "0.58346343", "0.5818954", "0.5813659", "0.5813659", "0.5813659", "0.5813659", "0.5813659", "0.5813659", "0.5813659", "0.5807703", "0.5807605", "0.5799542", "0.5795926", "0.5786915", "0.5785065", "0.57807845", "0.577869", "0.5778264", "0.5758219", "0.5758219", "0.5749597", "0.5748208", "0.57479346", "0.57438046", "0.57401973", "0.57359344", "0.5731986", "0.5730568", "0.5724663", "0.571514", "0.57114893", "0.5704215", "0.5697878", "0.5696887", "0.5696662", "0.5691923", "0.56897503", "0.5683399", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.567884", "0.5673045", "0.56675386", "0.56546956", "0.56495607", "0.5647366", "0.5639957", "0.56393176", "0.56347764", "0.5628348", "0.56126076", "0.561187" ]
0.0
-1
TODO: set default_tee set password????
def config_user atts = {} u = @device.user unless params[:name].blank? return render json: {:status=>11, :message=>'用户名已经设置,不能修改'} if u.name return render json: {:status=>12, :message=>'用户名已存在'} if User.find_by_name params[:name] atts[:name] = params[:name] end unless params[:email].blank? unless u.email.eql?(params[:email]) return render json: {:status=>13, :message=>'邮箱已经注册过'} if User.find_by_email params[:email] end atts[:email] = params[:email] end unless params[:pass].blank? return render json: {:status=>14, :message=>'密码已经设置'} if u.password atts[:password] = params[:pass] end atts[:score_mode] = params[:score_mode] unless params[:score_mode].blank? atts[:tee] = params[:default_tee] unless params[:default_tee].blank? u.update_attributes(atts) ret = {:status=>0} unless params[:password].blank? @device.update_token ret[:token] = @device.token end render json: ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setpwent\n ::Etc.setpwent\n end", "def session_passwd\n super\n end", "def session_passwd\n super\n end", "def passwd=(p0) end", "def passwd=(p0) end", "def passwd\r\n @password = \"12345\"\r\n end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def password=(_arg0); end", "def set_password; nil; end", "def passwd(*) end", "def passwd(*) end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def password; end", "def password\n super\n end", "def reset_password\n set :password, Proc.new {\n Capistrano::CLI.password_prompt(\"Password (for user: #{user}): \")\n } \n end", "def default_fabricator_password\n \"password\"\nend", "def password=(should); end", "def set_default_password\r\nself.password = :random\r\nend", "def password\n @teacher = current_teacher\n end", "def password\n @password ||= ENV['RUBYFORGE_PASSWORD']\n @password ||= (\n $stdout << \"Password for #{username}: \"\n $stdout.flush\n until inp = $stdin.gets ; sleep 1 ; end ; puts\n inp.strip\n )\n end", "def setup_credentials\n\n cmd = @config[:path] + @command_line_tool + \" \" + @@login_command\n\n Open3.popen3( cmd ) { |input, output, error|\n input.puts @config[:url]\n input.puts @config[:user]\n input.puts @config[:password]\n input.close\n } \n\n end", "def password=(new_password); end", "def password(value)\n @config[:password] = value\n end", "def change_temp_password\n\tend", "def password\n\t\t# We expect that the default OpenMRS interface is used to create users\n\t\t#self.password = encrypt(self.plain_password, self.salt) if self.plain_password\n\t\t#raise @password.to_yaml\n\t\tself[:password]\n\tend", "def setforwardingentitypassword(value)\r\n setvalue(SVTags::FORWARDING_ENTITY_PASSWORD, value)\r\n end", "def default_password\n self.password = \"password_dummy\"\n self.password_confirmation = \"password_dummy\"\n end", "def prompt_password\n TTY::Prompt.new.mask(\"Redacted password?\", required: true)\n end", "def bind_password\n super\n end", "def set_password!(opts = {})\n password!(opts.merge(:verb => :post))\n end", "def password; datastore['PASSWORD']; end", "def prompt_for_user_password!\n e.execute_as_user('')\n end", "def set_passphrase\n @pass = get_passphrase()\n end", "def password\n @password||=@options['password']\n end", "def password=(password)\n @password = password\n end", "def lucee_password\n @lucee_password||=@options['lucee_password']\n end", "def passphrase\n super\n end", "def service_password( password )\n\t\t\tself.password_digest = Digest::SHA2.hexdigest( password )\n\t\t\tDRbService.log.debug \"Setting encrypted password for %p to \"\n\t\tend", "def new_password; nil; end", "def set_password(opts = {})\n password(opts.merge(:verb => :post))\n end", "def enter_password_shared\n end", "def deploy_password\n set :password, deploy_script_password rescue nil\nend", "def password\n nil\n end", "def agent_passwd(arg = nil)\n set_or_return :agent_passwd, arg,\n kind_of: [Odsee::Secrets, String],\n default: Odsee::Secrets.new(node[:odsee][:agent_password]).freeze\n end", "def set_temp_password() \n\t\t#Generate new password\n\t\tpassword = User.generate_password()\n\t\t\n\t\tsalt = self.salt\n\t\tenc_password = Digest::SHA1.hexdigest(salt+password)\n\t\t\n\t\tself.temp_password = enc_password\n\t\tself.save\n\t\t\n\t\t#Ignore temp password if user is already logged in\n\t\tself.temp_password = nil\n\t\t\n\t\t#Notify user\n\t\tAppMailer.temporary_password_created(self, password).deliver\n\tend", "def password(password)\n @options[:password] = password\n end", "def use_demo_credentials!\n self.username = 'demo'\n self.password = 'password'\n end", "def change_password\n #raise current_user.inspect\n end", "def obtain_password\n i = o = File.open('/dev/tty', 'w+')\n\n o.print 'Password: '\n\n # store original settings\n state = `stty -F /dev/tty -g`\n\n # don't echo input\n system \"stty -F /dev/tty -echo\"\n\n p = i.gets.chomp\n\n # restore original settings\n system \"stty -F /dev/tty #{state}\"\n\n p\n end", "def password\n end", "def password\n end", "def mail_password\n if @yaml[\"mail\"][\"password\"] != \"example\"\n @yaml[\"mail\"][\"password\"]\n end\n end", "def set_admin_user(user, password)\n @user = user\n @password = password\n end", "def set_temp_password\n self.password = SecureRandom.urlsafe_base64(6)\n end", "def password=(value)\n reset_agent\n @password = value\n end", "def password=(value)\n reset_agent\n @password = value\n end", "def password=(value)\n reset_agent\n @password = value\n end", "def add_default_auth(user, password, domain = T.unsafe(nil)); end", "def get_password host,username\n print \"Password for \"+username+\"@\"+host+\": \"\n system \"stty -echo\"\n pw = gets.delete(\"\\n\")\n system \"stty echo\"\n puts\n pw\n end", "def prompt_password prompt = ''\n prompt += ' ' unless prompt.empty?\n $stderr.write \" CMS: #{prompt}password: \"\n system 'stty -echo'\n pass = $stdin.readline\n pass.chomp!\n pass\n ensure\n $stderr.write \"\\n\"\n system 'stty echo'\n end", "def set_password(user, newpassword)\n\t\t\t\t# We are going to do this with an expect script instead of in pure ruby...\n\t\t\t\t# partly because doing it in pure ruby turns out to be pretty tricky since\n\t\t\t\t# ruby doesn't have very good tools for interacting with shell programs, but\n\t\t\t\t# also because Expect does, and we like doing things with the right tool\n\t\t\t\t\n\t\t\t\tCfruby.controller.attempt(\"Changing password for \\\"#{user}\\\"\", 'destructive') {\n\t\t\t\t\t# we must be running as root\n\t\t\t\t\tif(Process.euid() != 0)\n\t\t\t\t\t\traise(ChangePasswordError, \"Passwords can only be set by root\")\n\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\t# first check for the existence of expect\n\t\t\t\t\thaveexpect = `/usr/bin/env expect -v`\n\t\t\t\t\tif(haveexpect !~ /expect version/i)\n\t\t\t\t\t\traise(ChangePasswordError, \"Expect binary could not be found\")\n\t\t\t\t\tend\n\t\t\t\t\n\t\t\t\t\t# create a specialized expect script to change the password\n\t\t\t\t\t# and run it\n\t\t\t\t\tchangepass = <<CHANGEPASS\n#!/usr/bin/env expect\n\nspawn passwd #{Cfruby::Exec.shellescape(user)}\nset password \"#{newpassword.gsub(/(\")/, \"\\\\\\1\")}\"\nexpect \"New password:\"\nsend \"$password\\\\r\"\nexpect \"password:\"\nsend \"$password\\\\r\"\nexpect eof\nCHANGEPASS\n\n\t\t\t\t\tscriptfile = Tempfile.new('cfruby')\n\t\t\t\t\tCfruby::FileOps.chmod(scriptfile.path, \"u+x,go-rwx\")\n\t\t\t\t\tscriptfile.print(changepass)\n\t\t\t\t\tscriptfile.close(false)\n\t\t\t\t\t`cp #{scriptfile.path} ./footest`\n\t\t\t\t\toutput = Cfruby::Exec.exec(scriptfile.path)\n\t\t\t\t}\n\t\t\tend", "def set_password\n @password = Password.last\n @new_password = Password.new\n end", "def password=(value)\n @password = value\n end", "def master_password(ignore_this)\n @db.passphrase = prompt(\"Enter new master password\", :echo => '*', :validate => true, :width => 45) \n hsay \"New master password set.\", :information\n end", "def password=(value)\n\t\t\t@password = value\n\t\tend", "def determine_default_user_password\n Cadenero.default_user_password = options[\"default-user-password\"].presence ||\n ask(\"What will be the password for the default user owner of the default account? [change-me]\").presence ||\n 'change-me'\n end", "def echo_and_update_password(args)\n new_pass = args[0].gsub(\"'\", '')\n current_dir_name = Dir.pwd.split('/').last\n File.open('nouveau_mdp.txt', 'w') { |f| f.puts(new_pass) }\n update_new_teacher_password(current_dir_name, new_pass)\n end", "def createNagiosPasswd\n `touch /usr/local/nagios/etc/htpasswd.users`\n `echo nagiosadmin:uPODiTjNs5eaY >> /usr/local/nagios/etc/htpasswd.users` \n end", "def password\n ENV['DESK_PASSWORD']\n end", "def send_expert_password(user)\n @expert = user\n mail(to: @expert.email, subject: 'New Password')\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end", "def set_Password(value)\n set_input(\"Password\", value)\n end" ]
[ "0.6496828", "0.63807863", "0.63807863", "0.63689125", "0.63689125", "0.6309606", "0.625712", "0.625712", "0.625712", "0.625712", "0.6195145", "0.61910325", "0.61910325", "0.608439", "0.608439", "0.608439", "0.608439", "0.608439", "0.608439", "0.5996619", "0.5990703", "0.59588885", "0.5958506", "0.59326947", "0.5881641", "0.5880441", "0.58488816", "0.5836617", "0.5834428", "0.58202523", "0.58192873", "0.57921386", "0.5776003", "0.57494015", "0.5744288", "0.57440794", "0.57334965", "0.5716201", "0.57131183", "0.57057565", "0.5694542", "0.5685892", "0.56604767", "0.56602687", "0.56537735", "0.56489027", "0.5646165", "0.5646054", "0.5645761", "0.5629771", "0.56276023", "0.5604741", "0.5592708", "0.55843645", "0.5582213", "0.55794126", "0.55794126", "0.55767345", "0.55754054", "0.55645394", "0.55611944", "0.55611944", "0.55611944", "0.5558485", "0.5556582", "0.55460817", "0.5540339", "0.553776", "0.55372536", "0.5532142", "0.5531056", "0.5530453", "0.55272067", "0.55168945", "0.5503987", "0.5498525", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563", "0.54852563" ]
0.0
-1
GET /student_app_cat_regnos GET /student_app_cat_regnos.json
def index @student_app_cat_regnos = StudentAppCatRegno.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @all_registration = AllRegistration.new\n @all_registration.reg_no=number_retrive(\"REG\")\n @college_master = CollegeMaster.last\n @years = which_category.years.find(:all)\n # @year1.map!(&:year)\n @semesters = \"B-Tech\".include?(@college_master.category) ? @category.semesters : \"\" unless @college_master.blank?\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @all_registration }\n end\n end", "def create\n @student_app_cat_regno = StudentAppCatRegno.new(student_app_cat_regno_params)\n\n respond_to do |format|\n if @student_app_cat_regno.save\n format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully created.' }\n format.json { render :show, status: :created, location: @student_app_cat_regno }\n else\n format.html { render :new }\n format.json { render json: @student_app_cat_regno.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n # @student_categories = StudentCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_categories }\n end\n end", "def set_student_app_cat_regno\n @student_app_cat_regno = StudentAppCatRegno.find(params[:id])\n end", "def index\n @registrations = Registration.order(:last_name).where(\"created_at >= ?\", Date.today.beginning_of_year)\n\n respond_to do |format|\n format.html\n format.json { render json: @registrations, include: { students: { only: [:first_name, :last_name, :shirt_size]}} }\n end\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def index\n @student_types = StudentType.all\n\n render json: @student_types\n end", "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def index\n @programs = Program.all(:include => :category)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end", "def index\n @registration_requests = RegistrationRequest.all\n\n render json: @registration_requests\n end", "def index\n @students = Student.all\n render json: @students\n end", "def new\n # @student_category = StudentCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_category }\n end\n end", "def index\n @student_profiles = StudentProfile.all \n render json: @student_profiles\n end", "def index\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_cares = @patient.managed_cares.joins(:subscriber)\n @title = \"Patient Managed Care Information\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managed_cares }\n end\n end", "def index\n if current_user.is_student?\n @companies = Company.where(:reg_status => [2,3])\n respond_with @companies.as_json({:student_id => current_user.id})\n elsif\n respond_with Company.all\n end\n end", "def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end", "def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end", "def new\n @student_application = StudentApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_application }\n end\n end", "def show\n # @student_category = StudentCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_category }\n end\n end", "def index\n if params[:registration_id]\n @registration = Registration.find(params[:registration_id])\n @registration_classes = RegistrationClass.where(:registration_id => params[:registration_id])\n elsif params[:discipline_class_id]\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n @registration_classes = RegistrationClass.where(:discipline_class_id => params[:discipline_class_id])\n @unregistrations = Registration.where('id not in (?)', @registration_classes.map { |v| (v.registration_id)}).where(:course_matrix_id => @discipline_class.matrix_discipline.course_matrix.id) \n else\n @registration_classes = RegistrationClass.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @registration_classes }\n end\n end", "def index\n @regdetails = Regdetail.all\n end", "def index\n @stu_reg_semesters = StuRegSemester.all\n end", "def get_all_single_critic_movies\n\t\treviews_array = []\n\t\tcritic_id = params[:id]\n\t\treviews = Critic.find(critic_id).critic_movies\n\t\treviews_array.push(reviews)\n\t\treviews = reviews_array.to_json\n\t\trender :json => reviews\n\tend", "def index\n # logger.info \"☻ request query parameters: #{request.query_parameters}\"\n\n # logger.info \"--> #{request.fullpath}\"\n # logger.info \"--> GITHUB_KEY: #{ENV['GITHUB_KEY']}\"\n # logger.info \"--> GITHUB_SECRET: #{ENV['GITHUB_SECRET']}\"\n\n class_name = params[:class_name] || \"unknown\"\n year = params[:year] || \"2011\"\n semester = params[:semester] || \"summer\"\n\n if params[:class_name]\n @students = Student.where(class_name: class_name, year: year, semester: semester)\n else\n @students = Student.where(year: 2011, semester: \"summer\", class_name: \"unallocated\")\n end\n\n # @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def index\n @gclife_registration_flatdetails = GclifeRegistrationFlatdetail.all\n end", "def new\n @student_major = StudentMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_major }\n end\n end", "def index\n @course = Course.select('course.*','course_cate.*').joins(:cate_course)\n \n render :json =>@course.group_by { |t| t.cate_course.name }\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def destroy\n @student_app_cat_regno.destroy\n respond_to do |format|\n format.html { redirect_to student_app_cat_regnos_url, notice: 'Student app cat regno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def new\n @supervision.student = Student.find(params[:student_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @supervision }\n end\n end", "def show\n render json: @student_type\n end", "def index\n courses = Course.includes(:professors).includes(:ratings).all\n\n render json: courses.to_json(include: [:professors, :ratings])\n end", "def scubooks\n sections = Section.all\n render json: sections\n end", "def get_groups\n @course = Course.find(params[:course_id])\n render json: @course.groups\n end", "def show\n render json: @student\n end", "def index\n @registrations = Registration.all\n \n render json: @registrations\n end", "def new\n @client_sex = ClientSex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_sex }\n end\n end", "def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end", "def new\n @resource = Resource.new\n @terms = Term.all_iit_subjects\n @iit_terms = Term.all_iit_subjects\n @non_iit_terms = Term.all_iit_non_subjects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @news = News.new\n @cats = News.all.distinct(:category)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def new\n @attendance = Attendance.new\n @students = Student.order(\"lastname\").find(:all)\n @programs = Program.order(\"name\").find(:all)\n @levels = Level.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @attendance }\n end\n end", "def students\n @course = Course.find(params[:id])\n\t\t@students = @course.students\n\t\t@other_students = Student.find(:all, :conditions => [\"id not in (select student_id from courses_students where course_id=?)\", @course.id])\n\n respond_to do |format|\n format.html # students.html.erb\n format.json { render :json => @students }\n end\n end", "def index\n @students = current_user.groups[0].students\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def index\n # We will be creating a new student object to use with Register URL form\n @student = Student.new \n @students = Student.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def new\n @studentset = Studentset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentset }\n end\n end", "def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end", "def findreg\n @detalles = Detalle.find(params[:id])\n render json: @detalles\n end", "def show_group\n\t\t@student = Student.find(params[:student_id])\n\t\trender json: @student.groups.find_by(course_id: params[:course_id])\n\tend", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def index\n @discipline_class_exam_types = DisciplineClassExamType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_class_exam_types }\n end\n end", "def search\n render json: Consultation.first(10)\n end", "def new\n @action = \"new\"\n @registration = Registration.new\n @weight_classes = WeightClass.order(\"age, gender, beginner_elite, weight\").all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end", "def index\n students = Student.order(\"created_at DESC\")\n @count = students.count\n\n render json: {status: 'SUCCESS', message:'Students list', total_students: @count, data:students}, status: :ok\n end", "def index\n @students = Student.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def index\n @disciplines = Discipline.paginate(:page => params[:page], per_page: 30)\n @number = Discipline.count\n respond_to do |format|\n format.html\n format.json { render :json => Discipline.all.to_json(include: :department) }\n end\n end", "def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def index\n @citations = Citation.all\n\n render json: @citations\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def index\n @additional_registrant_accesses = @user.additional_registrant_accesses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @additional_registrant_accesses }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @certification }\n end\n end", "def index\n categories = Category.all\n render json:categories\n end", "def index\n @career_specialties = CareerSpecialty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @career_specialties }\n end\n end", "def index\n \n @patients = nil\n #Fazer a verificação se é neuropsicologo\n if current_login.has_role? :secretary\n logged_user = Secretary.first(:conditions => \"login_id = #{current_login.id}\")\n @patients = Patient.is_active.in_clinic(logged_user.clinic.id).all\n elsif current_login.has_role? :neuropsychologist\n logged_user = Neuropsychologist.first(:conditions => \"login_id = #{current_login.id}\")\n # para obter os pacientes do neuropsicolgo é necessario ir a tabela das sessoes\n appointments = Appointment.where(:neuropsychologist_id => logged_user.id)\n @patients = appointments.collect(&:patient).uniq\n end\n\n \n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @patients }\n end\n end", "def get_subjects\n if params[:c].present?\n sc_id = params[:c].to_i\n subjects = Subject.joins(:school_cycle_has_subjects).where(\"school_cycle_id = ?\", sc_id)\n msg = { \"success\": \"true\", \"subjects\": subjects }\n else\n msg = { \"success\": false, \"subjects\": 0 }\n end\n\n render json: msg\n end", "def index\n respond_to do |format|\n format.html {\n @book_labels = BookLabel.all\n @acad_year = AcademicYear.current\n }\n format.json {\n if params[:section]\n search = params[:section] || \"\"\n @book_labels = BookLabel.where(grade_section_id: search)\n elsif params[:term]\n @book_labels = BookLabel.where('UPPER(name) LIKE ?', \"#{params[:term].upcase}%\")\n end\n }\n end\n\n end", "def index\n @careers = Career.all\n json_response(@careers)\n end", "def show\n @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_application }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def new\n @csosn = Csosn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @csosn }\n end\n end", "def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\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 new\n @studentgrade = Studentgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentgrade }\n end\n end", "def new\n @student_sub_course = StudentSubCourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_sub_course }\n end\n end", "def index\n @occupants = Occupant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occupants }\n end\n end", "def index\n @reagent_groups = ReagentGroup.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reagent_groups }\n end\n end", "def index\n @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @students }\n end\n end", "def new\n # @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def new\n @familium = Familium.new\n @numCategs = Categorium.count\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @familium }\n end\n end", "def index\n @allergen_warnings = AllergenWarning.all\n\n render json: @allergen_warnings\n end", "def index\n @studentinfos = Studentinfo.all\n end", "def show\n @course = Course.find(params[:id])\n @studysessions = @course.study_sessions\n @myStudySessions = StudySession.where(\"host_id = '#{current_user.id}' AND course_name = '#{@course.name}'\")\n @allstudysessions = StudySession.where(\"(is_private is NULL OR is_private is FALSE) AND course_name = '#{@course.name}'\") - @myStudySessions\n @classmates = @course.getClassmates\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "def index\n @student_entities = StudentEntity.all\n render json: @student_entities, status: :ok\n end", "def index\n @reward_categories = RewardCategory.all\n respond_with(@reward_categories) do |format|\n format.json { render :json => @reward_categories.as_json }\n end\n end", "def new\n @secry = Secry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @secry }\n end\n end", "def identified\n if CommodityType.aliases.keys.include?(params[:commodity])\n commodity = CommodityType.aliases[params[:commodity]]\n else\n commodity = CommodityType.where(:convertedcommod=>params[:commodity]).pluck(:commodid)\n end\n\n if params[:year]\n year = params[:year].to_i\n else\n year=Date.today.year.to_i\n end\n\n scope = Resource.mineral(commodity).year(year).nonzero\n\n if params[:recoverability] == 'recoverable'\n scope=scope.recoverable \n elsif params[:recoverability] == 'insitu' \n scope=scope.insitu \n end\n\n if !params[:state].blank? || !params[:status].blank?\n scope = scope.includes(:deposit_status)\n scope=scope.merge(DepositStatus.state(@state)) unless @state.blank?\n scope=scope.merge(DepositStatus.status(@status)) unless @status.blank?\n end\n\n resources = scope.all\n\n @identified_resources = IdentifiedResourceSet.new(resources)\n\n respond_to do |format|\n format.json #{ render :json => @grades.to_json }# grade.html.erb\n end\n end", "def index\n @catgrades = Catgrade.all\n end", "def show\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_major }\n end\n end", "def index\n @customers = Customer.all.map {|t| t.to_h}\n\n #Collection.all.map {|t| t.to_h}\n\n @seguros =Device.count\n\n respond_to do |format|\n format.html \n format.json { render json: { :customers => @customers , :seguros => @seguros } }\n end\n end", "def show\n @all_registration = AllRegistration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @all_registration }\n end\n end", "def new\n @app = App.new\n #@ec2_sg_filtered = ec2_sg_filtered\n load_ec2_sg_filtered\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def show\n @client_sex = ClientSex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_sex }\n end\n end", "def get_grades\r\n grade_nodes = BankNodestructure.grade_gather(params[:subject])\r\n render json: grade_nodes.to_json\r\n end", "def get_register_details(title_no)\n\n response = rest_get_call($LR_SEARCH_API_DOMAIN + '/auth/titles/' + title_no)\n\n return JSON.parse(response.body)\n\nend", "def cuadrant\n # We expect a :criteria hash to tell us what to report on\n render :text => 'Internal error: missing criteria', :status => 500 and return unless params[:criteria]\n @green_list = StudentResponse.green_list(params[:criteria])\n @orange_list = StudentResponse.orange_list(params[:criteria])\n @yellow_list = StudentResponse.yellow_list(params[:criteria])\n @red_list = StudentResponse.red_list(params[:criteria])\n end", "def index\n @college_registrations = CollegeRegistration.all\n end" ]
[ "0.6189821", "0.60448205", "0.5916937", "0.5742928", "0.5697935", "0.55680597", "0.5528712", "0.5516869", "0.5514594", "0.55056554", "0.5497031", "0.54948574", "0.5491098", "0.5450131", "0.5445969", "0.54315805", "0.5430632", "0.5398704", "0.5384641", "0.5384532", "0.5376649", "0.53554213", "0.533233", "0.5321539", "0.5312473", "0.52975804", "0.529507", "0.52839303", "0.52471876", "0.5198325", "0.51974267", "0.5186177", "0.51780903", "0.5177775", "0.51766104", "0.5174606", "0.5174416", "0.517291", "0.5166416", "0.5151834", "0.5150491", "0.5146135", "0.5138484", "0.5132743", "0.51297516", "0.51284075", "0.51282114", "0.5127338", "0.5126244", "0.51244384", "0.51235497", "0.51186454", "0.51179117", "0.5112133", "0.5110831", "0.5107668", "0.51045805", "0.51024747", "0.51008207", "0.50991136", "0.5095576", "0.5095576", "0.5094939", "0.5091289", "0.508254", "0.50818837", "0.5079885", "0.5077085", "0.5072516", "0.5070415", "0.5068708", "0.5066887", "0.5063697", "0.5057969", "0.50560784", "0.50560087", "0.50556177", "0.5051197", "0.5050481", "0.5049068", "0.5048835", "0.50475776", "0.50469303", "0.5038288", "0.50380826", "0.5037496", "0.50373274", "0.50365925", "0.5035907", "0.5033596", "0.503161", "0.50240767", "0.50205356", "0.50169706", "0.5016559", "0.5016203", "0.5011174", "0.50106394", "0.5010401", "0.5009574" ]
0.7220545
0
GET /student_app_cat_regnos/1 GET /student_app_cat_regnos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @student_app_cat_regnos = StudentAppCatRegno.all\n end", "def new\n @all_registration = AllRegistration.new\n @all_registration.reg_no=number_retrive(\"REG\")\n @college_master = CollegeMaster.last\n @years = which_category.years.find(:all)\n # @year1.map!(&:year)\n @semesters = \"B-Tech\".include?(@college_master.category) ? @category.semesters : \"\" unless @college_master.blank?\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @all_registration }\n end\n end", "def create\n @student_app_cat_regno = StudentAppCatRegno.new(student_app_cat_regno_params)\n\n respond_to do |format|\n if @student_app_cat_regno.save\n format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully created.' }\n format.json { render :show, status: :created, location: @student_app_cat_regno }\n else\n format.html { render :new }\n format.json { render json: @student_app_cat_regno.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_student_app_cat_regno\n @student_app_cat_regno = StudentAppCatRegno.find(params[:id])\n end", "def index\n # @student_categories = StudentCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @student_categories }\n end\n end", "def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end", "def index\n @registrations = Registration.order(:last_name).where(\"created_at >= ?\", Date.today.beginning_of_year)\n\n respond_to do |format|\n format.html\n format.json { render json: @registrations, include: { students: { only: [:first_name, :last_name, :shirt_size]}} }\n end\n end", "def new\n # @student_category = StudentCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_category }\n end\n end", "def show\n # @student_category = StudentCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_category }\n end\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def new\n @student_application = StudentApplication.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_application }\n end\n end", "def index\n @patient = Patient.find(params[:patient_id])\n set_patient_session @patient.id, @patient.patient_name \n @managed_cares = @patient.managed_cares.joins(:subscriber)\n @title = \"Patient Managed Care Information\"\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @managed_cares }\n end\n end", "def index\n @programs = Program.all(:include => :category)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @programs }\n end\n end", "def index\n @registration_requests = RegistrationRequest.all\n\n render json: @registration_requests\n end", "def index\n @student_types = StudentType.all\n\n render json: @student_types\n end", "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def index\n @student_profiles = StudentProfile.all \n render json: @student_profiles\n end", "def index\n @students = Student.all\n render json: @students\n end", "def get_all_single_critic_movies\n\t\treviews_array = []\n\t\tcritic_id = params[:id]\n\t\treviews = Critic.find(critic_id).critic_movies\n\t\treviews_array.push(reviews)\n\t\treviews = reviews_array.to_json\n\t\trender :json => reviews\n\tend", "def new\n @student_major = StudentMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_major }\n end\n end", "def index\n if params[:registration_id]\n @registration = Registration.find(params[:registration_id])\n @registration_classes = RegistrationClass.where(:registration_id => params[:registration_id])\n elsif params[:discipline_class_id]\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n @registration_classes = RegistrationClass.where(:discipline_class_id => params[:discipline_class_id])\n @unregistrations = Registration.where('id not in (?)', @registration_classes.map { |v| (v.registration_id)}).where(:course_matrix_id => @discipline_class.matrix_discipline.course_matrix.id) \n else\n @registration_classes = RegistrationClass.all\n end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @registration_classes }\n end\n end", "def destroy\n @student_app_cat_regno.destroy\n respond_to do |format|\n format.html { redirect_to student_app_cat_regnos_url, notice: 'Student app cat regno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def new\n @supervision.student = Student.find(params[:student_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @supervision }\n end\n end", "def index\n @regdetails = Regdetail.all\n end", "def semesters\n uni_year = UniYear.find_by_id(params[:uni_year_id])\n @semesters = uni_year ? uni_year.semesters : []\n \n respond_to do |format|\n format.json { render json: @semesters }\n end\n end", "def index\n if current_user.is_student?\n @companies = Company.where(:reg_status => [2,3])\n respond_with @companies.as_json({:student_id => current_user.id})\n elsif\n respond_with Company.all\n end\n end", "def show\n @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_application }\n end\n end", "def index\n @gclife_registration_flatdetails = GclifeRegistrationFlatdetail.all\n end", "def get_register_details(title_no)\n\n response = rest_get_call($LR_SEARCH_API_DOMAIN + '/auth/titles/' + title_no)\n\n return JSON.parse(response.body)\n\nend", "def index\n # logger.info \"☻ request query parameters: #{request.query_parameters}\"\n\n # logger.info \"--> #{request.fullpath}\"\n # logger.info \"--> GITHUB_KEY: #{ENV['GITHUB_KEY']}\"\n # logger.info \"--> GITHUB_SECRET: #{ENV['GITHUB_SECRET']}\"\n\n class_name = params[:class_name] || \"unknown\"\n year = params[:year] || \"2011\"\n semester = params[:semester] || \"summer\"\n\n if params[:class_name]\n @students = Student.where(class_name: class_name, year: year, semester: semester)\n else\n @students = Student.where(year: 2011, semester: \"summer\", class_name: \"unallocated\")\n end\n\n # @students = Student.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @students }\n end\n end", "def new\n @client_sex = ClientSex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_sex }\n end\n end", "def show\n render json: @student_type\n end", "def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end", "def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end", "def index\n @course = Course.select('course.*','course_cate.*').joins(:cate_course)\n \n render :json =>@course.group_by { |t| t.cate_course.name }\n end", "def show\n @co_reg_value = CoRegValue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @co_reg_value }\n end\n end", "def new\n @co_reg_value = CoRegValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @co_reg_value }\n end\n end", "def show\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_major }\n end\n end", "def new\n @studentset = Studentset.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentset }\n end\n end", "def index\n @recipies = Recipy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @recipies }\n end\n end", "def new\n @resource = Resource.new\n @terms = Term.all_iit_subjects\n @iit_terms = Term.all_iit_subjects\n @non_iit_terms = Term.all_iit_non_subjects\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n\n if params.has_key?(:discipline_class_id)\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n if params.has_key?(:registration_id)\n @registration = Registration.find(params[:registration_id])\n end\n \n @registration_class = RegistrationClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registration_class }\n end\n end", "def new\n @news = News.new\n @cats = News.all.distinct(:category)\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @news }\n end\n end", "def movie_data\n response = RestClient.get(\"critics.api.mks.io/movie-genres\")\n JSON.parse(response)\nend", "def new\n @attendance = Attendance.new\n @students = Student.order(\"lastname\").find(:all)\n @programs = Program.order(\"name\").find(:all)\n @levels = Level.find(:all)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @attendance }\n end\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def index\n @one_reg_institutions = OneRegInstitution.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @one_reg_institutions }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @certification }\n end\n end", "def show\n @client_sex = ClientSex.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_sex }\n end\n end", "def new\n @familium = Familium.new\n @numCategs = Categorium.count\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @familium }\n end\n end", "def new\r\n @student1 = Student1.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @student1 }\r\n end\r\n end", "def show\n render json: @student\n end", "def search\n render json: Consultation.first(10)\n end", "def new\n @csosn = Csosn.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @csosn }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n @disciplines = Discipline.all\n\n render json: @disciplines\n end", "def new\n # @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def findreg\n @detalles = Detalle.find(params[:id])\n render json: @detalles\n end", "def index\n students = Student.order(\"created_at DESC\")\n @count = students.count\n\n render json: {status: 'SUCCESS', message:'Students list', total_students: @count, data:students}, status: :ok\n end", "def new\n @student_sub_course = StudentSubCourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_sub_course }\n end\n end", "def attendance_result\n history_id = params[\"history_id\"]\n Net::HTTP.get(URI.parse(\"#{ENV['PY_SERVER_URL']}/image_matching/history/#{history_id}\"))\n history_student = HistoryStudent.where(history_id: history_id)\n render json: history_student\n end", "def index\n @discipline_class_exam_types = DisciplineClassExamType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @discipline_class_exam_types }\n end\n end", "def new\n @app = App.new\n #@ec2_sg_filtered = ec2_sg_filtered\n load_ec2_sg_filtered\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @app }\n end\n end", "def show\n @all_registration = AllRegistration.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @all_registration }\n end\n end", "def show\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exam_category }\n end\n end", "def show\n \n if params.has_key?(:discipline_class_id)\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n if params.has_key?(:registration_id)\n @registration = Registration.find(params[:registration_id])\n end \n \n @registration_class = RegistrationClass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @registration_class }\n end\n end", "def index\n # We will be creating a new student object to use with Register URL form\n @student = Student.new \n @students = Student.paginate(:page => params[:page], :per_page => 10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @urls }\n end\n end", "def new\n @action = \"new\"\n @registration = Registration.new\n @weight_classes = WeightClass.order(\"age, gender, beginner_elite, weight\").all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end", "def new\n @exam_category = ExamCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam_category }\n end\n end", "def index\n @career_specialties = CareerSpecialty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @career_specialties }\n end\n end", "def show_group\n\t\t@student = Student.find(params[:student_id])\n\t\trender json: @student.groups.find_by(course_id: params[:course_id])\n\tend", "def new\n @studentgrade = Studentgrade.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @studentgrade }\n end\n end", "def index\n @careers = Career.all\n json_response(@careers)\n end", "def new\n @indexstudent = Indexstudent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @indexstudent }\n end\n end", "def new\n @student = Student.find(params[:student_id])\n @inschool = @student.inschools.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inschool }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def index\n @stu_reg_semesters = StuRegSemester.all\n end", "def new\n @clinical_course = ClinicalCourse.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clinical_course }\n end\n end", "def show\n @course = Course.find(params[:id])\n @studysessions = @course.study_sessions\n @myStudySessions = StudySession.where(\"host_id = '#{current_user.id}' AND course_name = '#{@course.name}'\")\n @allstudysessions = StudySession.where(\"(is_private is NULL OR is_private is FALSE) AND course_name = '#{@course.name}'\") - @myStudySessions\n @classmates = @course.getClassmates\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "def show\n @program_genre = ProgramGenre.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @program_genre }\n end\n end", "def index\n @disciplines = Discipline.paginate(:page => params[:page], per_page: 30)\n @number = Discipline.count\n respond_to do |format|\n format.html\n format.json { render :json => Discipline.all.to_json(include: :department) }\n end\n end", "def show\n render json: @course, status: :found\n end", "def show\n @lab = Lab.find(params[:id])\n @lab_student = Student.where(\"cname = ?\",@lab.course.name)\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab }\n end\n end", "def new\n @secry = Secry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @secry }\n end\n end", "def index\n \tif params[:term]\n \t @v1_forms = V1::Form.search(params[:term]).order(\"visits_count ASC\")\n \telse\n \t @v1_forms = V1::Form.all.order(\"created_at DESC\")\n \tend\n render json: @v1_forms, include: :category\n end", "def show\n @student_sub_course = StudentSubCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_sub_course }\n end\n end", "def student_show\n @course = Course.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n \n end", "def new\n @student_availability = StudentAvailability.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_availability }\n end\n end", "def index\n @inciting_incidents = IncitingIncident.all\n render json: @inciting_incidents\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def show\n @clinical_course = ClinicalCourse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clinical_course }\n end\n end" ]
[ "0.7038048", "0.6241537", "0.6068811", "0.5967954", "0.5823859", "0.55989313", "0.55699086", "0.5553694", "0.5542902", "0.5526952", "0.54778993", "0.547211", "0.5433817", "0.5428422", "0.5421693", "0.5419726", "0.5409812", "0.5390164", "0.538287", "0.53789496", "0.5365086", "0.5326209", "0.5317078", "0.5311429", "0.5307943", "0.5287737", "0.5260697", "0.52559173", "0.5246205", "0.5245469", "0.5243764", "0.52109855", "0.5208161", "0.5205615", "0.5205194", "0.5203205", "0.5202547", "0.5198778", "0.51950455", "0.51931715", "0.5190349", "0.51878506", "0.51872694", "0.51840234", "0.51827437", "0.51787156", "0.51776654", "0.516252", "0.51611286", "0.5158638", "0.51551896", "0.5146996", "0.5142477", "0.51368624", "0.5134212", "0.5134", "0.5126057", "0.5124605", "0.5115838", "0.51085186", "0.5102474", "0.5100584", "0.5100283", "0.509929", "0.5095485", "0.50941664", "0.5085207", "0.5083333", "0.50823873", "0.50803065", "0.5078414", "0.5077896", "0.5077111", "0.5074446", "0.50743973", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50729054", "0.50727665", "0.50724685", "0.50702834", "0.5070119", "0.5069549", "0.506907", "0.50664073", "0.50615275", "0.50611174", "0.5059603", "0.505787", "0.5057735", "0.5056325", "0.50520337", "0.5051559" ]
0.0
-1
POST /student_app_cat_regnos POST /student_app_cat_regnos.json
def create @student_app_cat_regno = StudentAppCatRegno.new(student_app_cat_regno_params) respond_to do |format| if @student_app_cat_regno.save format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully created.' } format.json { render :show, status: :created, location: @student_app_cat_regno } else format.html { render :new } format.json { render json: @student_app_cat_regno.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @student_app_cat_regnos = StudentAppCatRegno.all\n end", "def set_student_app_cat_regno\n @student_app_cat_regno = StudentAppCatRegno.find(params[:id])\n end", "def new\n @all_registration = AllRegistration.new\n @all_registration.reg_no=number_retrive(\"REG\")\n @college_master = CollegeMaster.last\n @years = which_category.years.find(:all)\n # @year1.map!(&:year)\n @semesters = \"B-Tech\".include?(@college_master.category) ? @category.semesters : \"\" unless @college_master.blank?\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @all_registration }\n end\n end", "def student_app_cat_regno_params\n params.require(:student_app_cat_regno).permit(:registrationnumber, :firstname, :lastname)\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end", "def create\n @classificationList = StudentRequest::CLASSIFICATION_LIST\n @majorList = Major.pluck(:major_id)\n #check the reenter uin and email is same\n if params[:session][:uin2] == params[:session][:uin] and params[:session][:password2] == params[:session][:password]\n #use the uin and email to check if the student has signed up\n @student = Student.where(\"uin = '#{params[:session][:uin]}'\")\n if @student[0].nil?#the student hasn't signed up before\n record = scrape_info(params[:session][:name], params[:session][:email])\n if record.length() != 0#scrape the record\n # sign up email confirm feature\n @newStudent = Student.new(:name => record['First Name']+' '+record['Last Name'], :uin => params[:session][:uin], :email => record['Email Address'], :password => params[:session][:password],\n :major => record['Major'], :classification => record['Classification'])\n if @newStudent.save#succeed to create the account of student\n StudentMailer.registration_confirmation(@newStudent).deliver\n flash[:notice] = \"Please check your tamu email to activate your account!\"\n redirect_to root_path\n else\n flash[:error] = \"Ooooppss, something went wrong!\"\n redirect_to root_path\n end\n else#can't scrape the record\n flash[:warning] = \"Warning: Your information is incorrect!\\nPlease use your TAMU email to register!\\nUse your name as which is on your Student ID!\"\n redirect_to students_signup_path\n end\n else#the student has signed up\n flash[:warning] = \"Warning: You have already signed up!\"\n redirect_to root_path\n end\n else\n flash[:warning] = \"Warning: The twice entered UIN and password must be same!\"\n redirect_to students_signup_path\n end\n end", "def create\n # @student_category = StudentCategory.new(params[:student_category])\n\n respond_to do |format|\n if @student_category.save\n format.html { redirect_to @student_category, notice: 'Student category was successfully created.' }\n format.json { render json: @student_category, status: :created, location: @student_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mg_student_category = MgStudentCategory.new(mg_create_student_category_params)\n @mg_student_category.save\n redirect_to '/student_categories'\n\n \n end", "def create\n # @regdetail = Regdetail.new(regdetail_params)\n #\n # respond_to do |format|\n # if @regdetail.save\n # format.html { redirect_to @regdetail, notice: 'Regdetail was successfully created.' }\n # format.json { render :show, status: :created, location: @regdetail }\n # else\n # format.html { render :new }\n # format.json { render json: @regdetail.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def destroy\n @student_app_cat_regno.destroy\n respond_to do |format|\n format.html { redirect_to student_app_cat_regnos_url, notice: 'Student app cat regno was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def regdetail_params\n params.require(:regdetail).permit(:user_id, :semester_id, :course, :cgpa)\n end", "def create\n @catgrade = Catgrade.new(catgrade_params)\n\n respond_to do |format|\n if @catgrade.save\n format.html { redirect_to @catgrade, notice: 'Catgrade was successfully created.' }\n format.json { render action: 'show', status: :created, location: @catgrade }\n else\n format.html { render action: 'new' }\n format.json { render json: @catgrade.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registration = Registration.new(registration_params)\n @registration.student_id = current_user.tec_id\n @registration.approved = false\n @registration.date = DateTime.current\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to completed_registration_path(@registration.id), notice: 'Registration was successfully created.' }\n format.json { render :completed, status: :created, location: @registration }\n else\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @risk_classification = RiskClassification.new(params[:risk_classification])\n\n respond_to do |format|\n if @risk_classification.save\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully created.' }\n format.json { render json: @risk_classification, status: :created, location: @risk_classification }\n else\n format.html { render action: \"new\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @regulatory = Regulatory.new(regulatory_params)\n\n respond_to do |format|\n if @regulatory.save\n format.html { redirect_to @regulatory, notice: 'Regulatory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @regulatory }\n else\n format.html { render action: 'new' }\n format.json { render json: @regulatory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new\n @student.name = params[:student][:name]\n @student.registration = params[:student][:registration]\n @student.admission = params[:student][:admission]\n respond_to do |format|\n if @student.save\n if params[:student][:pc] == 0\n format.html { redirect_to students_path}\n else\n format.html { redirect_to complete_new_user_path(params[:student][:registration], params[:student][:pc]), method: 'post'}\n format.json { render :show, status: :created, location: @student }\n end\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n # @student_category = StudentCategory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_category }\n end\n end", "def create\n @nmrdetailc = Nmrdetailc.new(nmrdetailc_params)\n\n respond_to do |format|\n if @nmrdetailc.save\n format.html { redirect_to @nmrdetailc, notice: 'Nmrdetailc was successfully created.' }\n format.json { render :show, status: :created, location: @nmrdetailc }\n else\n format.html { render :new }\n format.json { render json: @nmrdetailc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n p = params[:registration]\n training = Training.find_by_code(p[:training_code])\n owner = Student.find_by_wp_email(p[:owner_email])\n reg_type = p[:reg_type]\n if reg_type == 'single-self'\n registerable = owner\n elsif reg_type == 'single-other'\n registerable = Student.find_by_wp_email(p[:registrant_email])\n else \n registerable = Group.find_by_handle(p[:group_handle])\n end\n @registration = Registration.new(reg_type: reg_type)\n @registration.owner = owner\n @registration.registerable = registerable\n @registration.training = training\n\n # Fix this. We need to have a sequence in the database.\n @registration.code = 100000 + rand(900000)\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: 'Registration was successfully created.' }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html do\n @trainings = Training.all\n render :new\n end\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @co_reg_value = CoRegValue.new(params[:co_reg_value])\n\n respond_to do |format|\n if @co_reg_value.save\n format.html { redirect_to @co_reg_value, notice: 'Co reg value was successfully created.' }\n format.json { render json: @co_reg_value, status: :created, location: @co_reg_value }\n else\n format.html { render action: \"new\" }\n format.json { render json: @co_reg_value.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_with_code\n @registration = Registration.new\n @registration.student_id = current_user.tec_id\n @registration.approved = true\n @registration.evidence_id = session[:matching_evidence]\n @registration.date = DateTime.current\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to completed_registration_path(@registration.id), notice: 'Registration was successfully created.' }\n format.json { render :completed, status: :created, location: @registration }\n else\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n respond_to do |format|\n if @incidentcategory.save\n format.html { redirect_to incidentcategories_path, notice: 'Incidentcategory was successfully created.' }\n format.json { render :show, status: :created, location: @incidentcategory }\n else\n format.html { render :new }\n format.json { render json: @incidentcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @student_app_cat_regno.update(student_app_cat_regno_params)\n format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_app_cat_regno }\n else\n format.html { render :edit }\n format.json { render json: @student_app_cat_regno.errors, status: :unprocessable_entity }\n end\n end\n end", "def regdetail_params\n params.require(:regdetail).permit(:user_id, :semester_id, :course_id, :gpa)\n end", "def create\n @categoria_rec = CategoriaRec.new(categoria_rec_params)\n\n respond_to do |format|\n if @categoria_rec.save\n format.html { redirect_to @categoria_rec, notice: 'Categoria rec was successfully created.' }\n format.json { render :show, status: :created, location: @categoria_rec }\n else\n format.html { render :new }\n format.json { render json: @categoria_rec.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(student_params)\n\n if @student.save\n render json: @student, status: :created\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end", "def create\n @socio_carteira_prof = SocioCarteiraProf.new(socio_carteira_prof_params)\n\n respond_to do |format|\n if @socio_carteira_prof.save\n format.html { redirect_to @socio_carteira_prof, notice: 'Socio carteira prof was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_carteira_prof }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_carteira_prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reg = Reg.new(reg_params)\n\n respond_to do |format|\n if @reg.save\n format.html { redirect_to @reg, notice: 'Reg was successfully created.' }\n format.json { render :show, status: :created, location: @reg }\n else\n format.html { render :new }\n format.json { render json: @reg.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @student = Student.new\n @title = \"יצירת סטודנט חדש\"\n @student.requests.build\n\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\n end", "def create\n @stu_reg_semester = StuRegSemester.new(stu_reg_semester_params)\n\n respond_to do |format|\n if @stu_reg_semester.save\n format.html { redirect_to @stu_reg_semester, notice: 'Stu reg semester was successfully created.' }\n format.json { render :show, status: :created, location: @stu_reg_semester }\n else\n format.html { render :new }\n format.json { render json: @stu_reg_semester.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @student.save\n @group = @student.group\n @program = @group.program\n format.html { redirect_to program_group_path(@program, @group), notice: 'Vous inscription est enregistrée.' }\n format.json { render :show, status: :created, location: user_student_path(@user, @student) }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_evaluaiton_to_student\n @evaluation = Evaluation.new\n @evaluation.student_id = :student_id\n @student = Student.find(params[:id])\n @student.evaluation << @student unless @group.students.include? @student\n render json: @evaluation\n end", "def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end", "def create\n @reg = Reg.new(reg_params)\n\n respond_to do |format|\n if @reg.save\n format.html { redirect_to @reg, notice: 'Reg was successfully created.' }\n format.json { render action: 'show', status: :created, location: @reg }\n else\n format.html { render action: 'new' }\n format.json { render json: @reg.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_major = StudentMajor.new(student_major_params)\n\n respond_to do |format|\n if @student_major.save\n format.html { redirect_to @student_major, notice: 'Student major was successfully created.' }\n format.json { render json: @student_major, status: :created, location: @student_major }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @all_staff = Certifier.all\r\n @current_staff = Certifier.where(:IsAvailable => true)\r\n @student_visit = StudentVisit.new(student_visit_params)\r\n\r\n\r\n respond_to do |format|\r\n if @student_visit.save\r\n format.html { redirect_to @student_visit }\r\n format.json { render :show, status: :created, location: @student_visit }\r\n\r\n\r\n session[:student_id] = nil\r\n session[:first_name] = nil\r\n session[:last_name] = nil\r\n session[:email] = nil\r\n else\r\n format.html { render :new }\r\n format.json { render json: @student_visit.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @registeredstudent = Registeredstudent.new(registeredstudent_params)\n\n respond_to do |format|\n if @registeredstudent.save\n format.html { redirect_to @registeredstudent, notice: \"Registeredstudent was successfully created.\" }\n format.json { render :show, status: :created, location: @registeredstudent }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @registeredstudent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @college_registration = CollegeRegistration.new(college_registration_params)\n\n respond_to do |format|\n if @college_registration.save\n format.html { redirect_to @college_registration, notice: 'College registration was successfully created.' }\n format.json { render :show, status: :created, location: @college_registration }\n else\n format.html { render :new }\n format.json { render json: @college_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #@classregistration = ClassRegistration.new(class_registration_params) \n \n \n @parent = Parent.new(parent_params)\n\n respond_to do |format|\n if @parent.save\n\n studentId = Student.select(\"id\").where(\"parent_id = \"+ @parent.id.to_s)\n\n regObj = ClassRegistration.new\n regObj.student_id = studentId[0].id\n regObj.classroom_id = params[:classroomId]\n regObj.save\n\n format.html { redirect_to controller: 'students', action: 'index', classroomId: params[:classroomId] , notice: 'Parent was successfully created.' }\n format.json { render :show, status: :created, location: @parent }\n else\n format.html { render :new }\n format.json { render json: @parent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @reserved_category = ReservedCategory.new(reserved_category_params)\n @reserved_categories = ReservedCategory.all\n respond_to do |format|\n if @reserved_category.save\n @reserved_category = ReservedCategory.new\n format.js { @flag = true }\n else\n flash.now[:alert] = 'Reserved Category Already Exist.'\n format.js { @flag = false }\n end\n end\n end", "def create\n @indcategory = Indcategory.new(indcategory_params)\n\n respond_to do |format|\n if @indcategory.save\n format.html { redirect_to @indcategory, notice: 'Indcategory was successfully created.' }\n format.json { render :show, status: :created, location: @indcategory }\n else\n format.html { render :new }\n format.json { render json: @indcategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @spore_type_count = SporeTypeCount.new(spore_type_count_params)\n\n @category_count = [[\"Rare: 1 to 10\",\"Rare: 1 to 10\"], [\"Low: 11 to 100\",\"Low: 11 to 100\"], [\"Medium: 101 to 1000\",\"Medium: 101 to 1000\"], [\"High: > 1000\",\"High: > 1000\"]] \n @tape_bulk_coc = @spore_type_count.tape_bulk_coc_sample.tape_bulk_coc\n\n respond_to do |format|\n if @spore_type_count.save\n format.html { redirect_to tape_bulk_coc_path(@spore_type_count.tape_bulk_coc_sample.tape_bulk_coc), notice: 'Spore type count was successfully created.' }\n format.json { render :show, status: :created, location: @spore_type_count }\n format.js\n else\n format.html { render :new }\n format.json { render json: @spore_type_count.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n Rails.logger.debug \"[ClassificationsController.create] params.class: #{params.class}, params: #{params}\"\n @classifaction = Classification.new transaction_data: params\n @classifaction.classifiers << StatusCodeClassifier.classify( @classifaction.transaction_data )\n @classifaction.classify\n\n if @classifaction.save\n render json: @classifaction.as_jsonapi, status: :created\n else\n render json: { error: 'oops' }, status: 500\n end\n end", "def create\n @courses = Course.active.select{|c| c.registration_course.nil?}\n @registration_course = RegistrationCourse.new(params[:registration_course])\n @additional_fields = StudentAdditionalField.active.sort_by(&:priority)\n\n respond_to do |format|\n if @registration_course.save\n @registration_course.manage_pin_system(params[:is_pin_enabled])\n flash[:notice] = t('create_successfully')\n format.html { redirect_to(:action=>\"index\") }\n format.xml { render :xml => @registration_course, :status => :created, :location => @registration_course }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_course.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @specialization_category = SpecializationCategory.new(specialization_category_params)\n\n respond_to do |format|\n if @specialization_category.save\n format.html { redirect_to @specialization_category, notice: 'Specialization category was successfully created.' }\n format.json { render :show, status: :created, location: @specialization_category }\n else\n format.html { render :new }\n format.json { render json: @specialization_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @client_sex = ClientSex.new(params[:client_sex])\n\n respond_to do |format|\n if @client_sex.save\n format.html { redirect_to @client_sex, notice: 'Client sex was successfully created.' }\n format.json { render json: @client_sex, status: :created, location: @client_sex }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_sex.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sundry_grn = SundryGrn.new(params[:sundry_grn])\n\n respond_to do |format|\n if @sundry_grn.save\n format.html { redirect_to @sundry_grn, :notice => 'Sundry grn was successfully created.' }\n format.json { render :json => @sundry_grn, :status => :created, :location => @sundry_grn }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sundry_grn.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n @gt_registration = GtRegistration.new(gt_registration_params)\n @gt_registration.gt_race = @gt_race\n @gt_registration.gt_category = @gt_category\n respond_to do |format|\n if @gt_registration.save && !(@gt_race.registration_end && @gt_race.registration_end < DateTime.now)\n format.html { redirect_to [@gt_race,@gt_category,@gt_registration], notice: 'Gt registration was successfully created.' }\n format.json { render :show, status: :created, location: @gt_registration }\n Notifier.race_registration(@gt_registration).deliver_now\n if Rails.env.production?\n Notifier.race_registration_direct(@gt_registration, \"adamplansky@seznam.cz,hege8400@seznam.cz,jiricimler@centrum.cz\").deliver_now\n end\n else\n #format.html { render :new, :params => { gt_race: @gt_race, gt_category: @gt_category } }\n format.html { render :new }\n format.json { render json: @gt_registration.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @clinicalsection = Clinicalsection.new(params[:clinicalsection])\n\n respond_to do |format|\n if @clinicalsection.save\n format.html { redirect_to clinicalsections_path, notice: 'Clinical specialty was successfully created.' }\n format.json { render json: @clinicalsection, status: :created, location: @clinicalsection }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clinicalsection.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @course_registration_param_sets = params[:registration].delete(:course_registrations)\n @registration = Registration.new(params[:registration])\n\n respond_to do |format|\n if @registration.save\n # @course_registration_param_sets.each do |course_registration_params|\n # CourseRegistration.create!(course_registration_params)\n # end\n flash[:notice] = 'Thank you for registering!'\n format.html { redirect_to(@registration) }\n format.xml { render :xml => @registration, :status => :created, :location => @registration }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #@patient = Patient.new(patient_params)\n @params = patient_params\n @doctor = Doctor.find(params[:doctor_id])\n @patient = Patient.new(patient_params.except(:document_name, :allergy))\n @allergy_list = Patient.allergy_counts\n @patient.allergy_list.add(@params[\"allergy\"])\n @patient.document_name_list.add(@params[\"document_name\"])\n\n logger.debug(\"create\")\n\n respond_to do |format|\n if @patient.save\n logger.debug(\"#{@doctor.id} #{@patient.id}\")\n format.html { redirect_to new_doctor_patient_visit_path(@doctor.id, @patient.id), notice: \"#{t 'activerecord.successful.messages.created'}\" }\n format.json { render :show, status: :created, location: @patient }\n else\n format.html { render :new }\n format.json { render json: @patient.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @studentannotation = Studentannotation.new(studentannotation_params)\n\n respond_to do |format|\n if @studentannotation.save\n format.html { redirect_to @studentannotation, notice: 'Studentannotation was successfully created.' }\n format.json { render :show, status: :created, location: @studentannotation }\n else\n format.html { render :new }\n format.json { render json: @studentannotation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n program = params[:student][:programa]\n sem = params[:student][:semesters]\n @student = Student.new(student_params)\n\n programs = Program.where(nombre: program.split(\"-\").at(1))\n semester = Semester.find(sem)\n @student.semesters << semester\n programs.each do |program|\n @student.programa = program.id\n @student.matricula = program.matricula.to_f\n end\n \n if @student.save\n redirect_to @student\n else\n puts @student.errors.inspect\n render :new\n end\n end", "def create\n @student = Student.new(params[:student])\n current_user.groups[0].students << @student\n respond_to do |format|\n if @student.save\n format.js \n else\n format.js \n end\n end\n end", "def create\n @exam_category = ExamCategory.new(params[:exam_category])\n\n respond_to do |format|\n if @exam_category.save\n format.html { redirect_to @exam_category, notice: 'Exam category was successfully created.' }\n format.json { render json: @exam_category, status: :created, location: @exam_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exam_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def catgrade_params\n params.require(:catgrade).permit(:libcatgrade)\n end", "def create\n @online_student = OnlineStudent.new(params[:online_student])\n latest_id = OnlineStudent.maximum('id')\n if latest_id.nil?\n cur_id = 1\n else\n cur_id = latest_id + 1\n end\n\n # Generate Application Number\n @online_student.application_number = \"VP-OL-%.6d\" % cur_id\n # @online_student.application_number = \"VP-OL-%.6d\" % cur_id\n\n respond_to do |format|\n if @online_student.save\n format.html { redirect_to @online_student, notice: 'Your Application was successfully submitted.' }\n format.json { render json: @online_student, status: :created, location: @online_student }\n else\n format.html { render action: \"new\" }\n format.json { render json: @online_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n #grab the medical record object by its id and store in local variable\n @medical_record = MedicalRecord.find(params[:medical_record_id])\n\n #grab the associated patient by find the id sotred in the session\n @patient = Patient.find_by(params[session[:patient_id]])\n\n #grab all allergies associated with the patient\n @allergies = @patient.allergies\n\n #grab the result from the check_allergy method by passing in two parameters;\n #1. the prescribed drug\n #2. the patients allergies\n\n @allergies.each do |allergy| \n puts(\"\\n\"+allergy.allergy_name.to_s+\"\\n\")\n end\n \n \n\n drug_name = prescription_params[:drug_name]\n\n puts(\"\\n\\n\"+drug_name)\n\n @result = Checkallergy.check_allergy(\"#{drug_name}\", @allergies)\n puts(\"\\n\\n response:\"+ @result.to_s+\"\\n\\n\")\n\n #set the status code and status message to local variables accordingly\n @status_code = @result[:status_code]\n @status_message = @result[:status_message]\n\n puts(\"\\n\\n code:\"+ @status_code.to_s+\"\\n\\n\")\n\n puts(\"\\n\\n message:\"+ @status_message+\"\\n\\n\")\n\n if @status_code.eql? 1\n respond_to do |format|\n format.html { redirect_to @medical_record }\n flash[:danger] = @status_message\n end\n else\n @prescriptions = @medical_record.prescriptions.create(params[:prescription].permit(:drug_name, :drug_strength, :drug_code))\n redirect_to medical_record_path(@medical_record)\n flash[:success] = \"Prescription successfully added: \"+@status_message\n end\n\n\n # respond_to do |format|\n # if @medical_record.save\n # format.html { redirect_to @medical_record, notice: 'Medical Record was successfully created.' }\n # format.json { render :show, status: :created, location: @medical_record }\n # else\n # format.html { render :new }\n # format.json { render json: @medical_record.errors, status: :unprocessable_entity }\n # end\n # end\n \n \n end", "def registration_params\n params.require(:registration).permit(:student_id, :semester_id, {:subject_id => []})\n end", "def new\n @student = Student.new\n if params[:family_id]\n @family = Family.find(params[:family_id])\n @student.family_id = params[:family_id]\n else\n @student.family_id = 0\n end\n\n @student.custom_contact_details = false\n\n @resound_process_record = ResoundProcess.new\n @resound_process_record.student_id = @student.id\n @resound_process_record.schedule_assessment = false\n @resound_process_record.schedule_assessment_due = 2.days.from_now\n @resound_process_record.confirm_payment = false\n @resound_process_record.confirm_payment_due = 4.days.from_now\n @resound_process_record.upload_assessment = false\n @resound_process_record.upload_assessment_due = 4.days.from_now\n @resound_process_record.schedule_lessons = false\n @resound_process_record.schedule_lessons_due = 4.days.from_now\n @resound_process_record.welcome_email = false\n @resound_process_record.welcome_email_due = 4.days.from_now\n @resound_process_record.email_assessment = false\n @resound_process_record.email_assessment_due = 4.days.from_now\n @resound_process_record.next_day_followup = false\n @resound_process_record.one_month_followup = false\n @resound_process_record.four_month_followup = false\n @resound_process_record.save\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end", "def create\n @instruments_group = InstrumentsGroup.new(instruments_group_params)\n\n respond_to do |format|\n if @instruments_group.save\n format.html { redirect_to @instruments_group, notice: 'La catégorie d\\'instruments a été créée.' }\n format.json { render :show, status: :created, location: @instruments_group }\n else\n format.html { render :new }\n format.json { render json: @instruments_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @classification = Classification.new(classification_params)\n\n respond_to do |format|\n if @classification.save\n format.html { redirect_to @classification, notice: t('controller.successfully_created', model: t('activerecord.models.classification')) }\n format.json { render json: @classification, status: :created, location: @classification }\n else\n @classification_types = ClassificationType.all\n format.html { render action: \"new\" }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @evaluable_competency = EvaluableCompetency.new(params[:evaluable_competency])\n\n respond_to do |format|\n if @evaluable_competency.save\n format.html { redirect_to @evaluable_competency, :notice => t('successfully_created', :model => t('EvalubleCompetency.gender', :count => 1)) }\n format.json { render json: @evaluable_competency, status: :created, location: @evaluable_competency }\n else\n format.html { render action: \"new\" }\n format.json { render json: @evaluable_competency.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @student_major = StudentMajor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student_major }\n end\n end", "def multiple_new\n @customer_set = CustomerSet.new\n\n respond_to do |format|\n format.html # multiple_new.html.erb\n format.json { render json: @customer_set }\n end\n end", "def create\n @student = Student.new(student_params)\n @student.count = 0\n @student.password = \"default\"\n if params[:student][:group_ids] \n params[:student][:group_ids].each { |group_id| \n @student.groups << Group.find(group_id)\n }\n end\n\n respond_to do |format|\n if @student.save\n @students = Student.all\n format.html { render action: \"index\", notice: \"Student was successfully created.\" }\n format.json { render :index, status: :created}\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n if @student.isAdmin\n @student.groups = []\n end\n end", "def create\n @submitted_exam_regis_form = SubmittedExamRegisForm.new(submitted_exam_regis_form_params)\n\n respond_to do |format|\n if @submitted_exam_regis_form.save\n format.html { redirect_to @submitted_exam_regis_form, notice: 'Submitted exam regis form was successfully created.' }\n format.json { render :show, status: :created, location: @submitted_exam_regis_form }\n else\n format.html { render :new }\n format.json { render json: @submitted_exam_regis_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(student_params)\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to @student, notice: '生徒情報が追加されました' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @applicant = Applicant.new(applicant_params)\n @applicant.student_id = current_user.id.to_i\n @applicant.references = 0\n respond_to do |format|\n if @applicant.save\n format.html { redirect_to @applicant, notice: 'Applicant was successfully created.' }\n format.json { render :show, status: :created, location: @applicant }\n else\n format.html { render :new }\n format.json { render json: @applicant.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @colonoscopytest = Colonoscopytest.new\n\treg=params[:reg]\n\tif(reg)\n\t\t@colonoscopytest.registration_no=reg\n\t\t@colonoscopytest.mrno,@colonoscopytest.billno,@colonoscopytest.patientname=@colonoscopytest.patient_data(reg)\n\tend\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @colonoscopytest }\n end\n end", "def create\n @registration = Registration.new(registration_params)\n err = false\n\n if Student.find_by_name(params[:registration][:student_id])\n student = Student.find_by_name(params[:registration][:student_id]).id\n else\n err = true\n end\n\n if !err\n err = @registration.save_registration(params[:registration], student)\n end\n\n if err\n redirect_to new_registration_path\n else\n redirect_to registrations_path\n end\n\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @certification }\n end\n end", "def create\n @student_sub_course = StudentSubCourse.new(params[:student_sub_course])\n\n respond_to do |format|\n if @student_sub_course.save\n format.html { redirect_to @student_sub_course, notice: 'Student sub course was successfully created.' }\n format.json { render json: @student_sub_course, status: :created, location: @student_sub_course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @student_sub_course.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @medical_certificate.save\n format.html { redirect_to student_medical_certificates_path(@student), notice: 'Medical certificate was successfully created.'}\n format.json { render :show, status: :created, location: @medical_certificate }\n else\n format.html { render :new }\n format.json { render json: @medical_certificate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @patientregistration_data = PatientregistrationData.new(params[:patientregistration_data])\n\n respond_to do |format|\n if @patientregistration_data.save\n\t\t@n=Number.find_by_names(\"reciept\")\n\t\t@n.value=@patientregistration_data.reciept_no\n\t\t@n.update_attributes(params[:n])\n format.html { redirect_to(\"http://localhost:3000/patientregistration_datas/new\") }\n format.xml { render :xml => @patientregistration_data, :status => :created, :location => @patientregistration_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientregistration_data.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @attendance_register = find_group.attendance_registers.new(attendance_register_params)\n\n respond_to do |format|\n if @attendance_register.save\n format.html { redirect_to [@group, :anchor => 'attendances'], notice: 'Attendance register was successfully created.' }\n format.json { render :show, status: :created, location: @attendance_register }\n else\n format.html { render :new }\n format.json { render json: @attendance_register.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @registration = Registration.new(params[:registration])\n\n respond_to do |format|\n begin\n proxy_ticket = PatientStudyCalendar::Resources::Resource.request_proxy_ticket(session[:cas_pgt])\n @registration.save_with_psc!(@patient, :subject_coordinator_name => session[:cas_user], :proxy_ticket => proxy_ticket)\n flash[:notice] = 'Registration was successfully created.'\n format.html { redirect_to(@registration.registration_assignment_url) }\n format.xml { render :xml => @registration, :status => :created, :location => patient_url(@patient) }\n rescue Exception => e\n unless @registration.new_record?\n @registration = Registration.new()\n end\n @registration.errors.add(:id, \"There was a problem communicating to the Patient Study Calendar Application.\")\n RAILS_DEFAULT_LOGGER.error(\"Registration create failed: #{e}\")\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @registration_course = RegistrationCourse.new(registration_course_params)\n\n respond_to do |format|\n if @registration_course.save\n format.html { redirect_to @registration_course, notice: 'Registration course was successfully created.' }\n format.json { render :show, status: :created, location: @registration_course }\n else\n format.html { render :new }\n format.json { render json: @registration_course.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @regulation = Regulation.new(params[:regulation])\n\n respond_to do |format|\n if @regulation.save\n format.html { redirect_to @regulation, notice: 'Regulation was successfully created.' }\n format.json { render json: @regulation, status: :created, location: @regulation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @regulation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n respond_to do |format|\n if @supervision.save\n format.html { redirect_to @supervision.student, :notice => 'Supervision was successfully created.' }\n format.json { render :json => @supervision, :status => :created, :location => @supervision }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @supervision.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @title_view = 'Nuevo Pre Registro de Patrimonio Cultural'\n @cultural_heritage_cultural_heritage_pre_register = CulturalHeritage::CulturalHeritagePreRegister.new(params[:cultural_heritage_cultural_heritage_pre_register])\n@cultural_heritage_cultural_heritage_pre_register.state = 5\n @cultural_heritage_cultural_heritage_pre_register.preRegisterRegistrationCode = PRE0 +@cultural_heritage_cultural_heritage_pre_register.id\n\n respond_to do |format|\n if @cultural_heritage_cultural_heritage_pre_register.save\n format.html { redirect_to(@cultural_heritage_cultural_heritage_pre_register, :notice => 'Pre Registro fue registrado correctamente.') }\n format.xml { render :xml => @cultural_heritage_cultural_heritage_pre_register, :status => :created, :location => @cultural_heritage_cultural_heritage_pre_register }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cultural_heritage_cultural_heritage_pre_register.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @student = Student.new(student_params)\n @student.course_id = cookies[:id_curso]\n\n respond_to do |format|\n if @student.save\n cookies.delete(:arch_nombre)\n cookies.delete(:arch_email)\n cookies.delete(:arch_tel)\n format.html { redirect_to @student, notice: 'Se creó el registro de alumna satisfactoriamente.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vendor_cat = VendorCat.new(vendor_cat_params)\n\n respond_to do |format|\n if @vendor_cat.save\n format.html { redirect_to @vendor_cat, notice: 'Vendor cat was successfully created.' }\n format.json { render :show, status: :created, location: @vendor_cat }\n else\n format.html { render :new }\n format.json { render json: @vendor_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cover_cat = CoverCat.new(params[:cover_cat])\n\n respond_to do |format|\n if @cover_cat.save\n format.html { redirect_to @cover_cat, notice: 'Cover cat was successfully created.' }\n format.json { render json: @cover_cat, status: :created, location: @cover_cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cover_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @occupationclassification = Occupationclassification.new(params[:occupationclassification])\n\n respond_to do |format|\n if @occupationclassification.save\n flash[:success] = \"Occupation classification was successfully created.\"\n format.html { redirect_to @occupationclassification }\n format.xml { render :xml => @occupationclassification, :status => :created, :location => @occupationclassification }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @occupationclassification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n authorize :question_resquest_criminal, :create?\n @question_resquest_criminal = QuestionResquestCriminal.new(question_resquest_criminal_params)\n\n respond_to do |format|\n if @question_resquest_criminal.save\n format.html { redirect_to @question_resquest_criminal, notice: 'Question resquest criminal was successfully created.' }\n format.json { render :show, status: :created, location: @question_resquest_criminal }\n else\n format.html { render :new }\n format.json { render json: @question_resquest_criminal.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rebateable = find_rebateable\n @rebate = @rebateable.rebates.build(params[:rebate])\n @sector_names = params[:sector_names] || []\n @industry_names = params[:industry_names] || []\n @rebate.tag_names = @sector_names.join(',') + \",\" + @industry_names.join(',')\n\n respond_to do |format|\n if @rebate.save\n format.html { redirect_to :id => nil }\n format.json { render json: @rebate, status: :created, location: @rebate }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rebate.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend", "def new\n @co_reg_value = CoRegValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @co_reg_value }\n end\n end", "def create\n respond_to do |format|\n if @certification.save\n format.html { redirect_to Certification, :notice => 'Certification was successfully created.' }\n format.json { render :json => @certification, :status => :created, :location => @certification }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @certification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @groupgrant_category = GroupgrantCategory.new(groupgrant_category_params)\n\n respond_to do |format|\n if @groupgrant_category.save\n format.html { redirect_to @groupgrant_category, notice: 'Groupgrant category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @groupgrant_category }\n else\n format.html { render action: 'new' }\n format.json { render json: @groupgrant_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n\n if params.has_key?(:discipline_class_id)\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n if params.has_key?(:registration_id)\n @registration = Registration.find(params[:registration_id])\n end\n \n @registration_class = RegistrationClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @registration_class }\n end\n end", "def create\n @registration = Registration.new(registration_params)\n @registration.group_id = sortear_grupo(@registration.colonist_age, @registration.colonist_gender)\n \n respond_to do |format|\n if @registration.save\n format.html { redirect_to @registration, notice: \"Bienvenido a la familia Buena Onda. Ya estás pre-inscripto. No olvides pasar por el club [dirección] de (9) a (18) dentro de las próximas 72 hs para confirmar la inscripción de #{@registration.colonist_name} y abonar la inscripción.\" }\n format.json { render :show, status: :created, location: @registration }\n else\n format.html { render :new }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n sr = SeatReservation.reserve_seat(@customer, params[:seat_id])\n\n # NJS - what to return back? just a success msg?\n respond_to do |format|\n format.json { render json: {reservation_id: sr.id}} \n end\n end", "def create\n @classification_code = ClassificationCode.new(classification_code_params)\n\n respond_to do |format|\n if @classification_code.save\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully created.' }\n format.json { render action: 'show', status: :created, location: @classification_code }\n else\n format.html { render action: 'new' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @clinical_course = ClinicalCourse.new(params[:clinical_course])\n\n respond_to do |format|\n if @clinical_course.save\n format.html { redirect_to @clinical_course, notice: 'Clinical course was successfully created.' }\n format.json { render json: @clinical_course, status: :created, location: @clinical_course }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clinical_course.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.645226", "0.59649545", "0.5849053", "0.5651538", "0.5577191", "0.54617", "0.5451802", "0.542166", "0.54051125", "0.533416", "0.5330176", "0.5326658", "0.52769065", "0.52295613", "0.5201422", "0.5188359", "0.5160425", "0.51532394", "0.51500064", "0.5131479", "0.5130406", "0.51286936", "0.5123732", "0.50867754", "0.50834215", "0.5071146", "0.5061439", "0.50437266", "0.5040273", "0.5039767", "0.5034698", "0.5028606", "0.5010743", "0.50058293", "0.49987036", "0.49986848", "0.49975982", "0.49956894", "0.49925172", "0.4988467", "0.49787897", "0.4970496", "0.4966012", "0.49632877", "0.4962385", "0.49618804", "0.49618608", "0.49464995", "0.4937639", "0.4935794", "0.49321732", "0.49312994", "0.4930827", "0.4923088", "0.4912308", "0.4908005", "0.49056104", "0.49044207", "0.49028724", "0.4898868", "0.48910505", "0.48899838", "0.4878181", "0.48781294", "0.48776084", "0.48766294", "0.4871351", "0.48640722", "0.48639795", "0.4861199", "0.48601758", "0.48599374", "0.48558423", "0.48501122", "0.48475865", "0.4845247", "0.48450008", "0.48445964", "0.48429802", "0.48394272", "0.4838851", "0.48384032", "0.48357186", "0.48323813", "0.48293784", "0.48279646", "0.48275587", "0.482744", "0.48252305", "0.48228136", "0.4820884", "0.48161313", "0.4810662", "0.48087555", "0.4808149", "0.4806713", "0.48054415", "0.4802652", "0.48016444", "0.48011488" ]
0.7248284
0
PATCH/PUT /student_app_cat_regnos/1 PATCH/PUT /student_app_cat_regnos/1.json
def update respond_to do |format| if @student_app_cat_regno.update(student_app_cat_regno_params) format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully updated.' } format.json { render :show, status: :ok, location: @student_app_cat_regno } else format.html { render :edit } format.json { render json: @student_app_cat_regno.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_student_app_cat_regno\n @student_app_cat_regno = StudentAppCatRegno.find(params[:id])\n end", "def update\n json_update(category,category_params, Category)\n end", "def update\n # @student_category = StudentCategory.find(params[:id])\n\n respond_to do |format|\n if @student_category.update_attributes(params[:student_category])\n format.html { redirect_to @student_category, notice: 'Student category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_category.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 @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n if @student_major.update_attributes(student_major_params)\n format.html { redirect_to @student_major, notice: 'Student major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @student.update(student_params)\n render json: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @catgrade.update(catgrade_params)\n format.html { redirect_to @catgrade, notice: 'Catgrade was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @catgrade.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @socio_carteira_prof.update(socio_carteira_prof_params)\n format.html { redirect_to :back }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_carteira_prof.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cat02.update(cat02_params)\n format.html { redirect_to @cat02, notice: 'Cat02 was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat02 }\n else\n format.html { render :edit }\n format.json { render json: @cat02.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @co_reg_value = CoRegValue.find(params[:id])\n\n respond_to do |format|\n if @co_reg_value.update_attributes(params[:co_reg_value])\n format.html { redirect_to @co_reg_value, notice: 'Co reg value was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @co_reg_value.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_sex = ClientSex.find(params[:id])\n\n respond_to do |format|\n if @client_sex.update_attributes(params[:client_sex])\n format.html { redirect_to @client_sex, notice: 'Client sex was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_sex.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @risk_classification = RiskClassification.find(params[:id])\n\n respond_to do |format|\n if @risk_classification.update_attributes(params[:risk_classification])\n format.html { redirect_to @risk_classification, notice: 'Risk classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @risk_classification.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @student_app_cat_regno = StudentAppCatRegno.new(student_app_cat_regno_params)\n\n respond_to do |format|\n if @student_app_cat_regno.save\n format.html { redirect_to @student_app_cat_regno, notice: 'Student app cat regno was successfully created.' }\n format.json { render :show, status: :created, location: @student_app_cat_regno }\n else\n format.html { render :new }\n format.json { render json: @student_app_cat_regno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_application = StudentApplication.find(params[:id])\n\n respond_to do |format|\n if @student_application.update_attributes(params[:student_application])\n format.html { redirect_to @student_application, notice: 'Student application was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n params[:patient_risk_factor][:ethnicity_ids] ||= []\n @patient_risk_factor = PatientRiskFactor.find(params[:id])\n\t@patient = @patient_risk_factor.patient\n\n respond_to do |format|\n if @patient_risk_factor.update_attributes(params[:patient_risk_factor])\n format.html { redirect_to home_path, :notice => 'Data has been succesfully saved. Thanks for your time!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @patient_risk_factor.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_category.update(mg_student_category_params)\n redirect_to '/student_categories'\n\n # respond_to do |format|\n # if @mg_action.update(mg_action_params)\n # format.html { redirect_to @mg_action, notice: 'Mg action was successfully updated.' }\n # format.json { render :show, status: :ok, location: @mg_action }\n # else\n # format.html { render :edit }\n # format.json { render json: @mg_action.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n respond_to do |format|\n if @supervision.update_attributes(params[:supervision])\n format.html { redirect_to @supervision.student, :notice => 'Supervision was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @supervision.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @specialization_category.update(specialization_category_params)\n format.html { redirect_to @specialization_category, notice: 'Specialization category was successfully updated.' }\n format.json { render :show, status: :ok, location: @specialization_category }\n else\n format.html { render :edit }\n format.json { render json: @specialization_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize :question_resquest_criminal, :update?\n respond_to do |format|\n if @question_resquest_criminal.update(question_resquest_criminal_params)\n format.html { redirect_to @question_resquest_criminal, notice: 'Question resquest criminal was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_resquest_criminal }\n else\n format.html { render :edit }\n format.json { render json: @question_resquest_criminal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @student_type = StudentType.find(params[:id])\n\n if @student_type.update(student_type_params)\n head :no_content\n else\n render json: @student_type.errors, status: :unprocessable_entity\n end\n end", "def update\n # @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @regulatory.update(regulatory_params)\n format.html { redirect_to @regulatory, notice: 'Regulatory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @regulatory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ocat = Ocat.find(params[:id])\n\n respond_to do |format|\n if @ocat.update_attributes(params[:ocat])\n format.html { redirect_to @ocat, notice: 'Ocat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ocat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @regdetail.update(regdetail_params)\n format.html { redirect_to @regdetail, notice: 'Regdetail was successfully updated.' }\n format.json { render :show, status: :ok, location: @regdetail }\n else\n format.html { render :edit }\n format.json { render json: @regdetail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @newapp = Newapp.find(params[:id])\n\n respond_to do |format|\n if @newapp.update_attributes(params[:newapp])\n format.html { redirect_to @newapp, notice: 'Newapp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @newapp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_user\n if @user.commission_request_template_json.nil? \n @user.commission_request_template_json = {\"categories\" => []}.to_json\n end\n json = build_json_from_params \n @user.commission_request_template_json = nil\n @user.save\n @user.commission_request_template_json = json\n if @user.save\n flash[:notice] = \"Commission Template Saved!\"\n else\n flash[:alert] = \"Error Saving Template\"\n end \n redirect_to root_url\n end", "def update\nlogger.debug \"update discipline: \"+@discipline.inspect\n discipline_params.each_pair do |property,value|\n @discipline.send(property+'=',value)if @discipline.respond_to?(property+'=')\n end\n @discipline.updater_id = current_user\n if @discipline.save\n set_discipline\n #respond_with @discipline\n render json: @discipline, status: :ok\n else\n ##render json: @discipline.errors, status: :unprocessable_entity\n respond_with @discipline.errors, status: :unprocessable_entity\n end\n end", "def update\n params[:resource][:term_ids] || []\n @resource = Resource.find(params[:id])\n\n respond_to do |format|\n if @resource.update_attributes(params[:resource])\n format.html { redirect_to @resource, notice: 'Resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @resource.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @assessment_info.update(assessment_info_params)\n format.html { redirect_to edit_concept_url(@assessment_info.concept_id), notice: 'assessment_info was successfully updated.' }\n format.json { render :show, status: :ok, location: @assessment_info }\n else\n format.html { render :edit }\n format.json { render json: @assessment_info.errors, status: :unprocessable_entity }\n end\n end\nend", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n @student = Student.find(params[:id])\n\n if (@student.family_id && @student.family_id > 0)\n @family = Family.find(@student.family_id)\n end\n\n @resound_process = ResoundProcess.find_by_student_id(@student.id)\n\n respond_to do |format|\n if @student.update_attributes(params[:student])\n format.html { redirect_to @student, notice: 'Student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clasp = Clasp.find(params[:id])\n\n respond_to do |format|\n if @clasp.update_attributes(params[:clasp])\n format.html { redirect_to @clasp, notice: 'Clasp was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clasp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @major = Major.find(params[:id])\n\n respond_to do |format|\n if @major.update_attributes(params[:major])\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n format.html { redirect_to @cat, notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if ProgramCalification.update(params[:id].to_i, :comment => params[:program_calification][:comment], :calification => params[:calification].to_i)#@program_calification.update(program_calification_params)\n format.html { redirect_to @program_calification, notice: 'Program calification was successfully updated.' }\n format.json { render :show, status: :ok, location: @program_calification }\n else\n format.html { render :edit }\n format.json { render json: @program_calification.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { render :show, status: :ok, location: @major }\n else\n format.html { render :edit }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recommendation_to_update = Recommendation.find(params[:id])\n @recommendation_to_update.update(:nameDotNumber => params[:app][:nameDotNumber])\n @recommendation_to_update.update(:course => params[:app][:course])\n @recommendation_to_update.save\n\n redirect_to home_url\n\n end", "def update\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n\n respond_to do |format|\n if @undergraduate_major.update_attributes(params[:undergraduate_major])\n format.html { redirect_to @undergraduate_major, notice: 'Undergraduate major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @undergraduate_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @golf_cource = GolfCource.find(params[:id])\n\n respond_to do |format|\n if @golf_cource.update_attributes(params[:golf_cource])\n format.html { redirect_to scaffold_golf_cource_url(@golf_cource), notice: 'Golf cource was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @golf_cource.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cerc = Cerc.find(params[:id])\n\n if @cerc.update_attributes(params[:cerc])\n head :no_content\n else\n render json: @cerc.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @classification_code.update(classification_code_params)\n format.html { redirect_to @classification_code, notice: 'Classification code was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classification_code.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exam_category = ExamCategory.find(params[:id])\n\n respond_to do |format|\n if @exam_category.update_attributes(params[:exam_category])\n format.html { redirect_to @exam_category, notice: 'Exam category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exam_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_contcategory.update(sivic_contcategory_params)\r\n format.html { redirect_to @sivic_contcategory, notice: 'Sivic contcategory 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: @sivic_contcategory.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @certification.update_attributes(params[:certification])\n format.html { redirect_to Certification, :notice => 'Certification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @certification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @student_sub_course = StudentSubCourse.find(params[:id])\n\n respond_to do |format|\n if @student_sub_course.update_attributes(params[:student_sub_course])\n format.html { redirect_to @student_sub_course, notice: 'Student sub course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @student_sub_course.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :update, CompetenceTierGroup\n \n @competence_tier_group.update!(competence_tier_group_params)\n render json: {status: :ok}\n end", "def update\n @recipe.allergies.destroy_all\n params[:recipe][:allergy].each do |key,value|\n if value[\"name\"] == \"1\"\n allergy = Allergy.find(key)\n @recipe.allergies << allergy\n end\n end\n\n if params[:recipe][:concentrate] == '1' || params[:recipe][:recipe_category_id] == RecipeCategory.find_by(name: \"Concentrates\").id\n @recipe.concentrate = true\n else\n @recipe.concentrate = false\n end\n\n respond_to do |format|\n if @recipe.update(recipe_params)\n @allergies = Allergy.all\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe }\n else\n @allergies = Allergy.all\n format.html { render :edit }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cat2.update(cat2_params)\n format.html { redirect_to @cat2, notice: 'Cat2 was successfully updated.' }\n format.json { render :show, status: :ok, location: @cat2 }\n else\n format.html { render :edit }\n format.json { render json: @cat2.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @congress.update(congress_params)\n format.html { redirect_to @congress, notice: 'Congress was successfully updated.' }\n format.json { render :show, status: :ok, location: @congress }\n else\n format.html { render :edit }\n format.json { render json: @congress.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cover_cat = CoverCat.find(params[:id])\n\n respond_to do |format|\n if @cover_cat.update_attributes(params[:cover_cat])\n format.html { redirect_to @cover_cat, notice: 'Cover cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cover_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n if @early_pregnancy.update_attributes(params[:early_pregnancy])\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_resource(type, id, data)\n bad_attrs = data_includes_invalid_attrs(data)\n\n if bad_attrs.present?\n msg = \"Attribute(s) '#{bad_attrs}' should not be specified for updating a server resource\"\n raise BadRequestError, msg\n end\n\n super\n end", "def update\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n if @csosn.update_attributes(params[:csosn])\n format.html { redirect_to @csosn, notice: 'Csosn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clinicalsection = Clinicalsection.find(params[:id])\n\n respond_to do |format|\n if @clinicalsection.update_attributes(params[:clinicalsection])\n format.html { redirect_to clinicalsections_path, notice: 'Clinical specialty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinicalsection.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @arrest_record_and_conduct = ArrestRecordAndConduct.find(params[:id])\n\n respond_to do |format|\n if @arrest_record_and_conduct.update_attributes(params[:arrest_record_and_conduct])\n format.html { redirect_to @arrest_record_and_conduct.personal_detail, notice: 'Arrest record and conduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @arrest_record_and_conduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ipc_seat.update(ipc_seat_params)\n format.html { redirect_to @ipc_seat, notice: 'Ipc seat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipc_seat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category_program.update(category_program_params)\n format.html { redirect_to @category_program, notice: 'Category program was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_program }\n else\n format.html { render :edit }\n format.json { render json: @category_program.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @uni_major = UniMajor.find(params[:id])\n\n respond_to do |format|\n if @uni_major.update_attributes(params[:uni_major])\n format.html { redirect_to @uni_major, notice: 'Uni major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uni_major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contract_doc_category = ContractDocCategory.find(params[:id])\n\n respond_to do |format|\n if @contract_doc_category.update_attributes(params[:contract_doc_category])\n format.html { redirect_to @contract_doc_category, notice: 'Contract doc category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_doc_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catched.update(catched_params)\n format.html { redirect_to @catched, notice: 'Catched was successfully updated.' }\n format.json { render :show, status: :ok, location: @catched }\n else\n format.html { render :edit }\n format.json { render json: @catched.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clinical_course = ClinicalCourse.find(params[:id])\n\n respond_to do |format|\n if @clinical_course.update_attributes(params[:clinical_course])\n format.html { redirect_to @clinical_course, notice: 'Clinical course was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clinical_course.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n @categories=RecipeCategory.all\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @student1 = Student1.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @student1.update_attributes(params[:student1])\r\n format.html { redirect_to @student1, notice: 'Student1 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: @student1.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @fatcat.update(fatcat_params)\n format.html { redirect_to @fatcat, notice: 'Fatcat was successfully updated.' }\n format.json { render :show, status: :ok, location: @fatcat }\n else\n format.html { render :edit }\n format.json { render json: @fatcat.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 respond_to do |format|\n if @appdatainfo.update(appdatainfo_params)\n format.html { redirect_to @appdatainfo, notice: 'Appdatainfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @appdatainfo }\n else\n format.html { render :edit }\n format.json { render json: @appdatainfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @seat_manufacturer.update_attributes(params[:seat_manufacturer])\n format.html { redirect_to @seat_manufacturer, notice: 'Seat manufacturer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @seat_manufacturer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reg.update(reg_params)\n format.html { redirect_to @reg, notice: 'Reg was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update\n respond_to do |format|\n if @sys_category.update(sys_category_params)\n format.html { redirect_to @sys_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sys_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @gt_registration.update(gt_registration_params)\n format.html { redirect_to index_with_payed_gt_race_gt_category_gt_registrations_path(@gt_race,0), notice: 'Gt registration was successfully updated.' }\n format.json { render :show, status: :ok, location: @gt_registration }\n else\n format.html { render :edit }\n format.json { render json: @gt_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @studentinfo.update(studentinfo_params)\n format.html { redirect_to @studentinfo, notice: 'Studentinfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @studentinfo }\n else\n format.html { render :edit }\n format.json { render json: @studentinfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cold_production_year = ColdProductionYear.find(params[:id])\n\n respond_to do |format|\n if @cold_production_year.update_attributes(params[:cold_production_year])\n format.html { redirect_to @cold_production_year, notice: 'Cold production year was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cold_production_year.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product_cat = ProductCat.find(params[:id])\n\n respond_to do |format|\n if @product_cat.update_attributes(params[:product_cat])\n format.html { redirect_to @product_cat, notice: 'Product cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @product_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n student = Student.find(params[:id])\n student.update_attributes!(student_params)\n\n render json: {status: 'SUCCESS', message:\"Student updated Successfully with name #{student.name}\", data:student}, status: :ok\n rescue => error\n render json: {status: 'ERROR', message:'Student Update failed!', data:error}, status: :unprocessable_entity\n end\n end", "def update\n @programme = Programme.find(params[:id]) \n\n respond_to do |format|\n if @programme.update_attributes(params[:programme])\n if (params[:programme][:notes_attributes])\n \n tl(\"Registration\",@programme.registration.id,'A note to a programme has been created for this registration',\n \"#{(@programme.institution.name rescue \"Unknown\")}\",'Note',@programme.registration.assigned_to)\n \n end\n \n format.html { redirect_to @programme, notice: 'Programme was successfully updated.' }\n format.json { head :no_content }\n \n if params[:change_status].nil?\n format.js { render \"programmes/update\" }\n else\n \n StatusDiagram.create!(user_id: current_user.id,\n status_id: params[:programme][:app_status_id],\n programme_id: params[:id])\n tl(\"Registration\",\n @programme.registration.id,\n 'Status of an application has been changed for this registration',\n \"#{(@programme.institution.name rescue \"Unknown\")}\",\n 'StatusChange',\n @programme.registration.assigned_to)\n \n format.js { render \"application_statuses/update\" } \n \n end \n else\n format.html { render action: \"edit\" }\n format.json { render json: @programme.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vendor_cat.update(vendor_cat_params)\n format.html { redirect_to @vendor_cat, notice: 'Vendor cat was successfully updated.' }\n format.json { render :show, status: :ok, location: @vendor_cat }\n else\n format.html { render :edit }\n format.json { render json: @vendor_cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end", "def update\n respond_to :json\n\n if @expense_claim.update(expense_claim_params)\n head :ok\n else\n render partial: 'expense_claim_key_data', layout: false, status: :ok, locals: { expense_claim: @expense_claim }\n end\n end", "def update\n respond_to do |format|\n if @cargapp_model.update(cargapp_model_params)\n format.html { redirect_to @cargapp_model, notice: 'Cargapp model was successfully updated.' }\n format.json { render :show, status: :ok, location: @cargapp_model }\n else\n format.html { render :edit }\n format.json { render json: @cargapp_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @penalty.update(penalty_params)\n\n render json: @penalty,status: :ok\n\n else\n\n render json: {error: true,errors: @penalty.errors},status: :unprocessable_entity\n\n end\n\n \t\tend", "def update\n authorize! :update, Concepto\n if params[:concepto][:tipo_ids]\n params[:concepto][:tipo_ids] = params[:concepto][:tipo_ids].map { |k, _v| k }\n else\n params[:concepto][:tipo_ids] = []\n end\n\n respond_to do |format|\n if @concepto.update(concepto_params)\n\n\n format.html { redirect_to @concepto, notice: '<i class=\"fa fa-check-square fa-lg\"></i> Los datos del concepto fueron actualizados exitosamente.' }\n format.json { render :show, status: :ok, location: @concepto }\n else\n format.html { render :edit } if params[:concepto][:tipo_ids]\n format.json { render json: @concepto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mat_category = MatCategory.find(params[:id])\n\n respond_to do |format|\n if @mat_category.update_attributes(params[:mat_category])\n format.html { redirect_to @mat_category, notice: 'Mat category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mat_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @class_student.update(class_student_params)\n format.html { redirect_to @class_student, notice: 'Class student was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @class_student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n cnt = @attendance.num_of_edit + 1\n @attendance.update(num_of_edit: cnt)\n respond_to do |format|\n if @attendance.update(attendance_params)\n format.html { redirect_to @attendance, notice: 'Attendance was successfully updated.' }\n format.json { render :show, status: :ok, location: @attendance }\n else\n format.html { render :edit }\n format.json { render json: @attendance.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @student.update(student_params)\n format.html { redirect_to @student, notice: 'Estudiante ha sido satisfactoriamente actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data = @recipe.update(params[:id], recipe_params)\n render json: @data\n end", "def update\n respond_to do |format|\n if @nmrdetailc.update(nmrdetailc_params)\n format.html { redirect_to @nmrdetailc, notice: 'Nmrdetailc was successfully updated.' }\n format.json { render :show, status: :ok, location: @nmrdetailc }\n else\n format.html { render :edit }\n format.json { render json: @nmrdetailc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @registered_app.update(registered_app_params)\n format.html { redirect_to @registered_app, notice: 'Registered app was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @registered_app.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book_catalog_entrie = BookCatalogEntrie.find(params[:id])\n\n respond_to do |format|\n if @book_catalog_entrie.update_attributes(params[:book_catalog_entrie])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @concour = Concour.find(params[:id])\n\n respond_to do |format|\n if @concour.update_attributes(params[:concour])\n format.html { redirect_to @concour, notice: 'Concour was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @concour.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n before_update\n\n @studenthousinginfo.status = 'Waiting for Approval'\n\n respond_to do |format|\n if @studenthousinginfo.update(studenthousinginfo_params)\n format.html { redirect_to @studenthousinginfo, notice: 'Studenthousinginfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @studenthousinginfo }\n else\n format.html { render :edit }\n format.json { render json: @studenthousinginfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @frontend_critic.update(frontend_critic_params)\n format.html { redirect_to @frontend_critic, notice: 'Critic was successfully updated.' }\n format.json { render :show, status: :ok, location: @frontend_critic }\n else\n format.html { render :edit }\n format.json { render json: @frontend_critic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bundle = Bundle.find(params[:id])\n\n\n respond_to do |format|\n params[:bundle][:category] = params[:bundle][:category].strip.downcase\n params[:bundle][:style] = params[:bundle][:style].strip.downcase\n params[:bundle][:color] = params[:bundle][:color].strip.downcase\n params[:bundle][:brand] = params[:bundle][:brand].strip.downcase\n params[:bundle][:make] = params[:bundle][:make].strip.downcase\n params[:bundle][:location] = params[:bundle][:location].strip.downcase\n\n if @bundle.update_attributes(params[:bundle])\n format.html { redirect_to @bundle, notice: 'Bundle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end" ]
[ "0.61135834", "0.58597535", "0.5834623", "0.57942486", "0.5766092", "0.5749243", "0.572301", "0.57015866", "0.5649218", "0.56271374", "0.56202483", "0.5569394", "0.5530903", "0.55274683", "0.55272967", "0.55177826", "0.5516618", "0.5513322", "0.5502429", "0.5458423", "0.5451975", "0.5450797", "0.5444518", "0.5428949", "0.54279757", "0.5423435", "0.54213184", "0.54164094", "0.54125667", "0.5407549", "0.5406482", "0.53950125", "0.53860337", "0.53843075", "0.5382557", "0.53778404", "0.5375506", "0.5374576", "0.5372842", "0.53720856", "0.53659326", "0.5365532", "0.5364854", "0.5361693", "0.5358838", "0.53578967", "0.53544503", "0.5340985", "0.53361076", "0.5327951", "0.5314834", "0.5312299", "0.53122723", "0.5310183", "0.53042996", "0.5296011", "0.529465", "0.5294508", "0.5289648", "0.5284996", "0.52788043", "0.5277541", "0.527194", "0.52683973", "0.52646977", "0.5260946", "0.5260702", "0.52583075", "0.52576816", "0.52563864", "0.5255765", "0.5255211", "0.5253591", "0.5250799", "0.5250118", "0.5249166", "0.5248563", "0.52466017", "0.5245722", "0.524449", "0.5241633", "0.52410203", "0.52397954", "0.5239235", "0.5235705", "0.5234699", "0.52307", "0.5229416", "0.52284706", "0.5225453", "0.52247465", "0.52241355", "0.5222603", "0.5220382", "0.5219321", "0.5218536", "0.52181536", "0.5211824", "0.5210502", "0.52104807" ]
0.69879645
0
DELETE /student_app_cat_regnos/1 DELETE /student_app_cat_regnos/1.json
def destroy @student_app_cat_regno.destroy respond_to do |format| format.html { redirect_to student_app_cat_regnos_url, notice: 'Student app cat regno was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #@incidentcategory.destroy\n render json: {}, status: 200\n end", "def destroy\n # @student_category = StudentCategory.find(params[:id])\n @student_category.destroy\n\n respond_to do |format|\n format.html { redirect_to student_categories_url }\n format.json { head :ok }\n end\n end", "def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_entity.destroy\n render json: {msg: 'deleted successfully'}, status: 200\n end", "def destroy\n @student_major = StudentMajor.find(params[:id])\n @student_major.destroy\n\n respond_to do |format|\n format.html { redirect_to student_majors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_student_major.destroy\n respond_to do |format|\n format.html { redirect_to admin_student_majors_url, notice: 'Student major was successfully destroyed.' }\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 delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "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 @catgrade.destroy\n respond_to do |format|\n format.html { redirect_to catgrades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_category.destroy\n respond_to do |format|\n format.html { redirect_to mg_student_categories_url, notice: 'successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: 'Se borró el registro de alumna satisfactoriamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_student.destroy\n respond_to do |format|\n format.html { redirect_to exams_url, notice: 'Odjavili ste ispit.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam_category = ExamCategory.find(params[:id])\n @exam_category.destroy\n\n respond_to do |format|\n format.html { redirect_to exam_categories_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gclife_registration_flatdetail.destroy\n respond_to do |format|\n format.html { redirect_to gclife_registration_flatdetails_url, notice: 'Gclife registration flatdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_path }\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 @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 @class_student.destroy\n respond_to do |format|\n format.html { redirect_to class_students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n # @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end", "def destroy\n @regdetail.destroy\n respond_to do |format|\n format.html { redirect_to regdetails_url, notice: 'Regdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @regdetail.destroy\n respond_to do |format|\n format.html { redirect_to regdetails_url, notice: 'Regdetail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @supervision.destroy\n\n respond_to do |format|\n format.html { redirect_to @supervision.student }\n format.json { head :no_content }\n end\n end", "def destroy\n @regattum.destroy\n respond_to do |format|\n format.html { redirect_to regatta_url, notice: 'Regattan har raderats' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_type.destroy\n\n head :no_content\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def destroy\n @dojo_student = DojoStudent.find(params[:id])\n @dojo_student.destroy\n\n respond_to do |format|\n format.html { redirect_to dojo_students_url }\n format.json { head :no_content }\n end\n end", "def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @regulatory.destroy\n respond_to do |format|\n format.html { redirect_to regulatories_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: '生徒情報は削除されました' }\n format.json { head :no_content }\n end\n end", "def destroy\n @undergraduate_major = UndergraduateMajor.find(params[:id])\n @undergraduate_major.destroy\n\n respond_to do |format|\n format.html { redirect_to undergraduate_majors_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to visitors_url, notice: 'El estudiante fue borrado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @studentannotation.destroy\n respond_to do |format|\n format.html { redirect_to studentannotations_url, notice: 'Studentannotation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @indexstudent = Indexstudent.find(params[:id])\n @indexstudent.destroy\n\n respond_to do |format|\n format.html { redirect_to indexstudents_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityCategory( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/category\",params)\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: \"Student was successfully removed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_site.destroy\n respond_to do |format|\n format.html { redirect_to student_sites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :ok }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clinical_visit.destroy\n respond_to do |format|\n format.html { redirect_to clinical_visits_url, notice: 'Clinical visit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @studentinfo.destroy\n respond_to do |format|\n format.html { redirect_to studentinfos_url, notice: 'Studentinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to group_students_path(@group), notice: 'Student was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @consultant_master = ConsultantMaster.find(params[:id])\n @consultant_master.destroy\n\n respond_to do |format|\n format.html { redirect_to consultant_masters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @incrustation_tmp = @incrustation.dup\n @incrustation.destroy\n record_activity(@incrustation_tmp)\n respond_to do |format|\n format.html { redirect_to admin_incrustations_url, notice: 'Вставка была успешно удалена.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_action.destroy\n respond_to do |format|\n format.html { redirect_to student_actions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @studentsection.destroy\n respond_to do |format|\n format.html { redirect_to studentsections_url, notice: 'Studentsection was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_sub_course = StudentSubCourse.find(params[:id])\n @student_sub_course.destroy\n\n respond_to do |format|\n format.html { redirect_to student_sub_courses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to students_url, notice: \"Student was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @clinicalsection = Clinicalsection.find(params[:id])\n @clinicalsection.destroy\n\n respond_to do |format|\n format.html { redirect_to clinicalsections_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @co_reg_value = CoRegValue.find(params[:id])\n @co_reg_value.destroy\n\n respond_to do |format|\n format.html { redirect_to co_reg_values_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@clinica.destroy\n @clinica.update(:status => 0)\n respond_to do |format|\n format.html { redirect_to clinicas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reg.destroy\n respond_to do |format|\n format.html { redirect_to regs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @competency.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\r\n @current_staff = Certifier.where(:IsAvailable => true)\r\n @all_staff = Certifier.all\r\n @student_visit.destroy\r\n respond_to do |format|\r\n format.html { redirect_to student_visits_url, notice: 'Student visit was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @studentset = Studentset.find(params[:id])\n @studentset.destroy\n\n respond_to do |format|\n format.html { redirect_to studentsets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @risk_classification = RiskClassification.find(params[:id])\n @risk_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to risk_classifications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_test = StudentTest.find(params[:id])\n @student_test.destroy\n\n respond_to do |format|\n format.html { redirect_to student_tests_url }\n format.json { head :ok }\n end\n end", "def destroy\n @registeredstudent.destroy\n respond_to do |format|\n format.html { redirect_to registeredstudents_url, notice: \"Registeredstudent was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html {\n flash[:success] = \"Estudante apagado.\"\n redirect_to students_url\n }\n format.json { head :no_content }\n end\n end", "def destroy\n @appdatum.destroy\n respond_to do |format|\n format.html { redirect_to appdata_url, notice: 'Appdatum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n result = Hash.new\n begin # try\n result = RegistCoursesHlp.delete(params[:id])\n rescue # catch\n result['status'] = false\n result['error'] = \"#{$!}\"\n ensure # finally\n render json: result\n end\n end", "def destroy\n @enrollment.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @early_access_request.destroy\n respond_to do |format|\n format.html { redirect_to early_access_requests_url, notice: 'Anfrage wurde gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @regulation = Regulation.find(params[:id])\n @regulation.destroy\n\n respond_to do |format|\n format.html { redirect_to regulations_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clinical_course = ClinicalCourse.find(params[:id])\n @clinical_course.destroy\n\n respond_to do |format|\n format.html { redirect_to clinical_courses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n flash[:notice] = 'Record mahasiswa berhasil dihapus, #{undo_link(@student)}'\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant_field_of_study.destroy\n respond_to do |format|\n format.html { redirect_to applicant_field_of_studies_url, notice: 'Applicant field of study was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stu_reg_semester.destroy\n respond_to do |format|\n format.html { redirect_to stu_reg_semesters_url, notice: 'Stu reg semester was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @studenttest.destroy\n respond_to do |format|\n format.html { redirect_to studenttests_url, notice: 'Studenttest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_segment_batch(segment_id_array)\n payload = segment_id_array.to_s\n url = \"#{@base_url}/segments_batch\"\n return RestClient::Request.execute(:method => :delete, :url => url, :payload => payload){|response, request, result| response }\n end", "def destroy\n @student_application = StudentApplication.find(params[:id])\n @student_application.destroy\n\n respond_to do |format|\n format.html { redirect_to student_applications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @instruments_group.destroy\n respond_to do |format|\n format.html { redirect_to instruments_groups_url, notice: 'La catégorie d\\'instruments a été supprimée.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student.destroy\n respond_to do |format|\n format.html { redirect_to active_students_url, notice: 'Student was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_student.destroy\n respond_to do |format|\n format.html { redirect_to admin_students_url, notice: \"Student was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:student_id])\n @lunchdetention = Lunchdetention.find(params[:id])\n @lunchdetention.destroy\n\n respond_to do |format|\n format.html { redirect_to student_url(@student) }\n format.json { head :no_content }\n end\n end", "def destroy\n @student_evaluation_case2.destroy\n respond_to do |format|\n format.html { redirect_to student_evaluation_case2s_url, notice: 'Student evaluation case2 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to login_index_url }\n format.json { head :ok }\n end\n end", "def destroy\n @student_class.destroy\n respond_to do |format|\n format.html { redirect_to student_classes_url, notice: \"Student class was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @arrest_record_and_conduct = ArrestRecordAndConduct.find(params[:id])\n @arrest_record_and_conduct.destroy\n\n respond_to do |format|\n format.html { redirect_to @arrest_record_and_conduct.personal_detail }\n format.json { head :no_content }\n end\n end", "def destroy\n @scaff = Scaff.find(params[:id])\n @scaff.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffs_url }\n format.json { head :ok }\n end\n end" ]
[ "0.6481493", "0.64647764", "0.6455211", "0.64507127", "0.6437519", "0.640994", "0.64044076", "0.63618094", "0.6357828", "0.6351566", "0.6349962", "0.6335993", "0.6334742", "0.6328334", "0.6326384", "0.63259524", "0.631205", "0.63094646", "0.6304676", "0.6303961", "0.63002515", "0.63002515", "0.62951344", "0.6294638", "0.6291974", "0.6285309", "0.6282761", "0.627765", "0.6269618", "0.6269618", "0.6269618", "0.6269618", "0.6261836", "0.6255514", "0.6245031", "0.6222077", "0.6204143", "0.6193468", "0.61753494", "0.61672777", "0.61613685", "0.61610264", "0.61551744", "0.6154477", "0.6154471", "0.61542606", "0.6153835", "0.6153835", "0.6153835", "0.6153835", "0.6153835", "0.6153835", "0.6153835", "0.6153835", "0.6143981", "0.61438036", "0.61433417", "0.61420834", "0.6141367", "0.61358106", "0.61346936", "0.6134072", "0.61294854", "0.612766", "0.6120885", "0.6120193", "0.61193335", "0.6117466", "0.61171156", "0.6114469", "0.61130655", "0.6112404", "0.61120796", "0.6111796", "0.61074567", "0.6105785", "0.6101165", "0.6098984", "0.60955185", "0.60914844", "0.60909575", "0.6090096", "0.60898095", "0.6083424", "0.6083275", "0.6081052", "0.60774034", "0.6064126", "0.6062249", "0.60618854", "0.60601795", "0.605998", "0.60584164", "0.605779", "0.6056813", "0.6052945", "0.605238", "0.60494184", "0.6049146", "0.6048633" ]
0.73455197
0
Use callbacks to share common setup or constraints between actions.
def set_student_app_cat_regno @student_app_cat_regno = StudentAppCatRegno.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 student_app_cat_regno_params params.require(:student_app_cat_regno).permit(:registrationnumber, :firstname, :lastname) 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 /promulher_forms GET /promulher_forms.json
def index @promulher_forms = PromulherForm.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_forms\n @course = Course.find(params[:course_id])\n @forms = @course.professor_forms\n render json: @forms\n end", "def show\n\t\t@form = @client.forms.find(params[:id])\n @procedures = @form.procedures.order('step_num ASC')\n\n \trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t \tend\n \tend", "def show\n @form = ProfessorForm.find(params[:id])\n\n render json: @form\n end", "def new\n\t\t@form = @client.forms.new\n\n \n 3.times do\n procedure = @form.procedures.build\n end\n 3.times do\n authemp = @form.authemps.build\n end\n\n\t\trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t\tend\n\tend", "def index\n\t\t@forms = @client.forms.all\n\n\t\trespond_to do |format|\n \t\tformat.html # index.html.erb\n \t\tformat.json { render json: @forms }\n \tend\n\tend", "def forms\n get(:forms)['Forms'].map do |details|\n Form.new(details['Url'], party: self, details: details)\n end\n end", "def index\n @pec_forms = PecForm.sorted\n\n\t\tgon.highlight_first_form_field = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pec_forms }\n end\n end", "def show\n @pec_form = PecForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pec_form }\n end\n end", "def form_json\n render template: 'utils/form_json'\n end", "def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filled_forms }\n end\n end", "def index\n @pforms = Pform.all\n end", "def index\n @poole_app_forms = current_user.poole_app_forms.all\n end", "def all_forms\n\t\t\treturn [{}]\n\t\tend", "def forms; end", "def index\n @pit_forms = PitForm.all\n end", "def nested_forms\n []\n end", "def form\n @professionals = Professional.all\n\n respond_to do |format|\n format.html # form.html.erb\n format.xml { render :xml => @professionals }\n end\n end", "def set_promulher_form\n @promulher_form = PromulherForm.find(params[:id])\n end", "def new\n @formulario = Formulario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulario }\n end\n end", "def show\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formulario }\n end\n end", "def new\n @filled_form = FilledForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filled_form }\n end\n end", "def index\n @pessel_forms = PesselForm.all\n end", "def show\n @forms = Forms.all()\n end", "def new\n @pec_form = PecForm.new\n gon.edit_pec_form = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pec_form }\n end\n end", "def index\n @application_form_fields = ApplicationFormField.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @application_form_fields }\n end\n end", "def findForms\n # initialize forms for first page (of mandatory forms)\n @policy.forms = \"IL0003(9/08) IL0017(11/98) IL0286(9/08) IL0030(1/06) IL0031(1/06)\"\n\n # add relevant commercial property declarations\n if (@policy.property.premium_total != 0)\n # mandatory forms\n @policy.property_forms = \"CP0010(6/07) CP0090(7/88) CP0120(1/08) CP0140(7/06) CP1032(8/08) IL0935(7/02) IL0953(1/08) CP1270(9/96) \"\n # optional forms\n # BUSINESS INCOME & EXTRA EXPENSE\n if (!@policy.property.locations.first.exposures.third.limit.nil? && !@policy.property.locations.first.exposures.third.limit != 0)\n @policy.property_forms += \"CP0030(6/07) \"\n end\n # SPOILAGE COVERAGE **\n if (!@policy.property.locations.first.coverage_type == \"Special\")\n @policy.property_forms += \"CP1030(6/07) \"\n end\n # SPECIAL FORM - CAUSE OF LOSS\n if (!@policy.property.locations.first.exposures.fifth.limit.nil? && @policy.property.locations.first.exposures.fifth.limit != 0)\n @policy.property_forms += \"CP0440(6/95) \"\n end\n # OUTDOOR SIGN\n if (!@policy.property.locations.first.exposures.fourth.limit.nil? && !@policy.property.locations.first.exposures.fourth.limit != 0)\n @policy.property_forms += \"CP1440(6/07) \"\n end\n # ELITE PROPERTY ENHANCEMENT\n if (@policy.property.locations.first.enhc_premium != 0)\n @policy.property_forms += \"PO-PRP-3(12/13) \"\n end\n # MANDATORY EQUIPMENT BREAKDOWN PROTECTION COVERAGE & MICHIGAN CHANGES\n if (@policy.property.locations.first.mech_premium != 0)\n @policy.property_forms += \"EB0020(08/08) EB0108(09/07) \"\n end\n\n # CP1218(6/95)\n if (@policy.docs.where(form_code:\"CP1218(6/95)\")[0].active == true)\n @policy.property_forms += \"CP1218(6/95) \"\n end\n\n # CP0440(6/95)\n if (@policy.docs.where(form_code:\"CP0440(6/95)\")[0].active == true)\n @policy.property_forms += \"CP0440(6/95) \"\n end\n\n # IL0415(04/98)\n if (@policy.docs.where(form_code:\"IL0415(04/98)\")[0].active == true)\n @policy.property_forms += \"IL0415(04/98) \"\n end\n\n # CG2028(7/04)\n if (@policy.docs.where(form_code:\"CG2028(7/04)\")[0].active == true)\n @policy.property_forms += \"CG2028(7/04)\"\n end\n\n end\n\n # add relevant general liability declarations\n if (@policy.gl.premium_total != 0)\n # mandatory forms\n @policy.gl_forms = \"CG0001(12/07) CG0068(5/09) CG0099(11/85) CG0168(12/4) CG2101(11/85) CG2146(7/98) CG2147(12/07) CG2149(9/99) CG2167(12/04) CG2175(6/08) CG2190(1/06) CG2231(7/98) CG2258(11/85) CG2407(1/96) IL0021(9/08) PO-GL-5(5/12) PO-GL-6(5/12) \"\n # optional forms\n # EXCLUSION MEDICAL PAYMENTS\n if (!@policy.gl.medical_expense.nil? && @policy.gl.medical_expense != 0)\n @policy.gl_forms += \"CG2135(10/01) \"\n end\n # EXCLUSION PERSONAL INJURY\n if (!@policy.gl.personal_advertising_injury.nil? && @policy.gl.personal_advertising_injury != 0)\n @policy.gl_forms += \"CG2138(11/85) \"\n end\n # EXCLUSION DAMAGE TO PREMISES RENTED\n if (!@policy.gl.fire_damage.nil? && @policy.gl.fire_damage != 0)\n @policy.gl_forms += \"CG2145(7/98) \"\n end\n # WATER IN THE GAS TANK\n if (!@policy.gl.water_gas_tank == \"Yes\")\n @policy.gl_forms += \"PO_GL_WIG(12/13)\"\n end\n\n # CG2026(7/04)\n if (@policy.docs.where(form_code:\"CG2026(7/04)\")[0].active == true)\n @policy.gl_forms += \"CG2026(7/04)\"\n end\n\n # CG2018(11/85)\n if (@policy.docs.where(form_code:\"CG2018(11/85)\")[0].active == true)\n @policy.gl_forms += \"CG2018(11/85)\"\n end\n\n # CG2011(1/96)\n if (@policy.docs.where(form_code:\"CG2011(1/96)\")[0].active == true)\n @policy.gl_forms += \"CG2011(1/96)\"\n end\n\n # CG2144(7/98)\n if (@policy.docs.where(form_code:\"CG2144(7/98)\")[0].active == true)\n @policy.gl_forms += \"CG2144(7/98)\"\n end\n end\n\n # add relevant crime declarations\n if (@policy.crime.premium_total != 0)\n # mandatory forms\n @policy.crime_forms = \"CR0021(5/06) CR0110(8/07) CR0246(8/07) CR0730(3/06) CR0731(3/06) IL0935(7/02) IL0953(1/08) \"\n # optional forms\n # EMPLOYEE THEFT AND FORGERY POLICY\n if ((!@policy.crime.exposures.first.limit.nil? && @policy.crime.exposures.first.limit != 0) ||\n (!@policy.crime.exposures.second.limit.nil? && @policy.crime.exposures.second.limit != 0))\n @policy.crime_forms += \"CR0029(5/06) \"\n end\n # INSIDE THE PREMISES-THEFT OF OTHER PROPERTY\n if (!policy.crime.exposures.fifth.limit.nil? && @policy.crime.exposures.fifth.limit != 0)\n @policy.crime_forms += \"CR0405(8/07) \"\n end\n # INSIDE THE PREMISES – ROBBERY OF A CUSTODIAN OR SAFE BURGLARY OF MONEY & SECURITIES\n if ((!@policy.crime.exposures.third.limit.nil? && @policy.crime.exposures.third.limit != 0) ||\n (!@policy.crime.exposures.fourth.limit.nil? && @policy.crime.exposures.fourth.limit != 0))\n @policy.crime_forms += \"CR0405(8/07) \"\n end\n end\n\n # add relevant commerical auto declarations\n if (@policy.auto.premium_total != \"0.00\")\n # mandatory forms\n @policy.auto_forms = \"CA0110(11/06) CA0217(3/94) CA0001(3/06) CA2384(1/06) PO-CA-1(5/12) \"\n end\n end", "def new\n @patrocinio = Patrocinio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def form\n\tform = Windmill.all\n\t#form = Windmill.where(windformid: params[:id])\n\t#if form.present?\n render json: form.as_json(only: [:no])\n\t#else\n\t\t#render json: {massage: 'No windfrom available in this id'}\n\t#\n #end\nend", "def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend", "def create\n @promulher_form = PromulherForm.new(promulher_form_params)\n\n respond_to do |format|\n if @promulher_form.save\n format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully created.' }\n format.json { render :show, status: :created, location: @promulher_form }\n else\n format.html { render :new }\n format.json { render json: @promulher_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end", "def new\n @sectioneight_form = SectioneightForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "def index\n @plataforms = Plataform.all\n end", "def show\n @filled_form = FilledForm.find(params[:id])\n @form_template = FormTemplate.find(@filled_form.form_template_id)\n\n @prefilled_ror_contents = prefill_ror_form @form_template.ror_contents, @filled_form.attributes\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filled_form }\n end\n end", "def show\n @form = Form.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def new\n @enquiry = Enquiry.find(params[:id])\n @enquiry.programmes.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @programme }\n end\n end", "def index\n @application_forms = ApplicationForm.where(organization_id: params['organization_id'])\n authorize @application_forms\n\n render json: @application_forms\n end", "def index\n @forms = Form.all\n end", "def get_result\n form_data = params.require(:form).permit(:id)\n\n render json: Form.get_result(form_data[:id], current_user[\"id\"])\n end", "def next_form\n json_form.next_form(parsed_json['id'])\n end", "def index\n @forms = @company.forms\n end", "def new\n @precioproducto = Precioproducto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precioproducto }\n end\n end", "def new\n @housing_form = HousingForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @housing_form }\n end\n end", "def new\n @promocion = Promocion.new\n\n respond_to do |format|\n format.html { render :layout => 'special_form'}# new.html.erb\n #format.json { render json: @promocion }\n end\n end", "def form_fragment\n parsed_json\n end", "def new\n @proef = Proef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proef }\n end\n end", "def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end", "def index\n @question_queue_forms = QuestionQueueForm.all\n end", "def form; end", "def new\n @food_form = FoodForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food_form }\n end\n end", "def index\n @pharmaceuticalforms = Pharmaceuticalform.all\n end", "def new\n @unemployment_form = UnemploymentForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unemployment_form }\n end\n end", "def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end", "def update\n respond_to do |format|\n if @promulher_form.update(promulher_form_params)\n format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully updated.' }\n format.json { render :show, status: :ok, location: @promulher_form }\n else\n format.html { render :edit }\n format.json { render json: @promulher_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @application_forms = ApplicationForm.all\n end", "def create\n @poole_app_form = current_user.poole_app_forms.build(poole_app_form_params)\n\n respond_to do |format|\n if @poole_app_form.save\n format.html { redirect_to @poole_app_form, notice: 'Poole app form was successfully created.' }\n format.json { render :show, status: :created, location: @poole_app_form }\n else\n format.html { render :new }\n format.json { render json: @poole_app_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def preview\n @form_data = Form.get_form_by_code(current_user[\"id\"], params[:code])\n @questions = Question.get_questions_by_ids(@form_data['id'], JSON.parse(@form_data['question_order']))\n @all_options = Option.collect_options_per_quetions(JSON.parse(@form_data['question_order']))\n end", "def new\n @application_form_field = ApplicationFormField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_form_field }\n end\n end", "def all_forms\n\t\t\tretval = []\n\t\t\t[false, true].each do |imperative|\n\t\t\t\tNUMBERS.each do |number|\n\t\t\t\t\tPERSONS.each do |person|\n\t\t\t\t\t\tform = {:person => person, :number => number}\n\t\t\t\t\t\tform[:imperative] = true if imperative\n\t\t\t\t\t\tretval << form\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\tretval << {:infinitive =>true }\n\t\t\tretval\n\t\tend", "def show\n @kf_course_form = Kf::CourseForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_course_form }\n end\n end", "def show\n @housing_form = HousingForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing_form }\n end\n end", "def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def form\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @perfilnegocio = Perfilnegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @perfilnegocio }\n end\n end", "def show\n @fields = FormularioField.where \"formulario_id =?\", @formulario.id\n end", "def index\n @custom_forms = CustomForm.all\n end", "def index\n @contract_forms = ContractForm.all\n end", "def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end", "def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end", "def new\n @propuesta = Propuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @propuesta }\n end\n end", "def get_form(slug, options = nil)\r\n @client.raw('get', \"/content/forms/#{slug}\", options)\r\n end", "def new\n @kf_course_form = Kf::CourseForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_course_form }\n end\n end", "def setup_form\n form = {\n schema: {\n type: 'object',\n properties: {\n array: {\n title: 'You have not configured your schema form',\n type: 'array',\n items: {\n type: 'string',\n enum: [\n \"Ok I'll do it right away\",\n \"I'll let someone else do it for me\"\n ]\n }\n }\n }\n }\n }\n render json: form.to_json\n end", "def show\n @food_form = FoodForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_form }\n end\n end", "def index\n @cec_forms = CecForm.sorted\n\n\t\tgon.highlight_first_form_field = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cec_forms }\n end\n end", "def new\n @echoform = Echoform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @echoform }\n end\n end", "def index\n @payment_forms = @paymentService.all()\n end", "def new\n @presenza = Presenza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presenza }\n end\n end", "def index\n @formularios = Formulario.all\n end", "def index\n @formularios = Formulario.all\n end", "def new\n @forma_entrega = FormaEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forma_entrega }\n end\n end", "def show_forms\r\n forms = Document.new(self).get_forms()\r\n count = forms.length\r\n puts \"There are #{count} forms\"\r\n for i in 0..count - 1 do\r\n puts \"Form name: \" + forms[i].name\r\n puts \" id: \" + forms[i].id\r\n puts \" method: \" + forms[i].attribute_value(\"method\")\r\n puts \" action: \" + forms[i].action\r\n end\r\n end", "def get_form_support_data\n @client.raw('get', '/content/forms/support-data')\n end", "def fields_on_form() #:nodoc:\r\n fields = []\r\n if @form['form']['fields']\r\n# read only field elements (key is Fixnum)\r\n @form['form']['fields'].each {|key,options| fields << options if key.class == Fixnum }\r\n else\r\n @form['form']['tabs'].keys.each do |tab|\r\n @form['form']['tabs'][tab].each {|key,options| fields << options if key.class == Fixnum }\r\n end \r\n end\r\n fields\r\nend", "def new\n @pizzashop = Pizzashop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pizzashop }\n end\n end", "def index\n @registration_forms = RegistrationForm.all\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def new\n @feedback_form = FeedbackForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback_form }\n end\n end", "def get_probe_form\n if (!params[:id].blank?)\n load_service\n return if (@service.blank?)\n else\n @service = Service.new()\n end\n\n # Add custom views paths\n prepend_view_path \"app/views/services\"\n prepend_view_path \"lib/probes/#{params[:probe]}/views\"\n\n respond_to do |format|\n format.js\n end\n end", "def form_params\n params[:form]\n end", "def new\n @programa = Programa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @programa }\n end\n end", "def index\n @joining_forms = JoiningForm.all\n end", "def create\n @pform = Pform.new(pform_params)\n\n respond_to do |format|\n if @pform.save\n format.html { redirect_to @pform, notice: 'Pform was successfully created.' }\n format.json { render :show, status: :created, location: @pform }\n else\n format.html { render :new }\n format.json { render json: @pform.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @survey_forms = SurveyForm.all\n end", "def new\n @preguntum = Preguntum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preguntum }\n end\n end" ]
[ "0.7620798", "0.7235807", "0.71815485", "0.7090954", "0.6815023", "0.67670554", "0.6584934", "0.6520534", "0.65044993", "0.64778745", "0.64277625", "0.64209366", "0.63731885", "0.635059", "0.63230646", "0.63163817", "0.6273654", "0.6267967", "0.6258361", "0.62518436", "0.62511927", "0.6209314", "0.6175269", "0.6154205", "0.6141813", "0.6140178", "0.61283934", "0.6125598", "0.6098851", "0.6094768", "0.60729975", "0.60635936", "0.606212", "0.6036816", "0.6036816", "0.6032492", "0.60139257", "0.600796", "0.60052234", "0.60052097", "0.5976575", "0.5904803", "0.59005547", "0.5896647", "0.58944637", "0.58929896", "0.5880213", "0.58724767", "0.5872251", "0.58701724", "0.58600855", "0.5858557", "0.58582103", "0.58527404", "0.584006", "0.58400136", "0.58256215", "0.5822071", "0.5819755", "0.58185863", "0.5809981", "0.5806199", "0.57961607", "0.57927245", "0.5788557", "0.57878107", "0.5781047", "0.5781047", "0.57771355", "0.57681656", "0.5761561", "0.57579255", "0.57522327", "0.5750282", "0.5742868", "0.5742442", "0.57336587", "0.5732004", "0.5726287", "0.5723295", "0.5721627", "0.57185805", "0.57182354", "0.57151645", "0.57151645", "0.5713131", "0.5710688", "0.57105166", "0.5705489", "0.57052165", "0.5701253", "0.5696951", "0.5685182", "0.568409", "0.56829417", "0.56825674", "0.56799424", "0.5678185", "0.5664178", "0.5644573" ]
0.72768515
1
GET /promulher_forms/1 GET /promulher_forms/1.json
def show; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_forms\n @course = Course.find(params[:course_id])\n @forms = @course.professor_forms\n render json: @forms\n end", "def show\n\t\t@form = @client.forms.find(params[:id])\n @procedures = @form.procedures.order('step_num ASC')\n\n \trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t \tend\n \tend", "def show\n @form = ProfessorForm.find(params[:id])\n\n render json: @form\n end", "def new\n\t\t@form = @client.forms.new\n\n \n 3.times do\n procedure = @form.procedures.build\n end\n 3.times do\n authemp = @form.authemps.build\n end\n\n\t\trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t\tend\n\tend", "def index\n @promulher_forms = PromulherForm.all\n end", "def index\n @pec_forms = PecForm.sorted\n\n\t\tgon.highlight_first_form_field = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pec_forms }\n end\n end", "def show\n @pec_form = PecForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pec_form }\n end\n end", "def index\n\t\t@forms = @client.forms.all\n\n\t\trespond_to do |format|\n \t\tformat.html # index.html.erb\n \t\tformat.json { render json: @forms }\n \tend\n\tend", "def index\n @filled_forms = FilledForm.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filled_forms }\n end\n end", "def form_json\n render template: 'utils/form_json'\n end", "def show\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @formulario }\n end\n end", "def new\n @formulario = Formulario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulario }\n end\n end", "def new\n @filled_form = FilledForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filled_form }\n end\n end", "def new\n @patrocinio = Patrocinio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end", "def new\n @pec_form = PecForm.new\n gon.edit_pec_form = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pec_form }\n end\n end", "def show\n @form = Form.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def form\n\tform = Windmill.all\n\t#form = Windmill.where(windformid: params[:id])\n\t#if form.present?\n render json: form.as_json(only: [:no])\n\t#else\n\t\t#render json: {massage: 'No windfrom available in this id'}\n\t#\n #end\nend", "def get_result\n form_data = params.require(:form).permit(:id)\n\n render json: Form.get_result(form_data[:id], current_user[\"id\"])\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "def index\n @pforms = Pform.all\n end", "def new\n @sectioneight_form = SectioneightForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "def index\n @application_form_fields = ApplicationFormField.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @application_form_fields }\n end\n end", "def index\n @pit_forms = PitForm.all\n end", "def set_promulher_form\n @promulher_form = PromulherForm.find(params[:id])\n end", "def next_form\n json_form.next_form(parsed_json['id'])\n end", "def new\n @precioproducto = Precioproducto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precioproducto }\n end\n end", "def forms\n get(:forms)['Forms'].map do |details|\n Form.new(details['Url'], party: self, details: details)\n end\n end", "def show\n @filled_form = FilledForm.find(params[:id])\n @form_template = FormTemplate.find(@filled_form.form_template_id)\n\n @prefilled_ror_contents = prefill_ror_form @form_template.ror_contents, @filled_form.attributes\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @filled_form }\n end\n end", "def new\n @proef = Proef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proef }\n end\n end", "def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def new\n @promocion = Promocion.new\n\n respond_to do |format|\n format.html { render :layout => 'special_form'}# new.html.erb\n #format.json { render json: @promocion }\n end\n end", "def new\n @preguntum = Preguntum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preguntum }\n end\n end", "def new\n @housing_form = HousingForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @housing_form }\n end\n end", "def show\n @housing_form = HousingForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @housing_form }\n end\n end", "def new\n @profesore = Profesore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesore }\n end\n end", "def form\n @professionals = Professional.all\n\n respond_to do |format|\n format.html # form.html.erb\n format.xml { render :xml => @professionals }\n end\n end", "def index\n @pessel_forms = PesselForm.all\n end", "def index\n @formularies = Formulary.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @formularies }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @food_form = FoodForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @food_form }\n end\n end", "def new\n @perfilnegocio = Perfilnegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @perfilnegocio }\n end\n end", "def new\n @propuesta = Propuesta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @propuesta }\n end\n end", "def forms; end", "def new\n @presenza = Presenza.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @presenza }\n end\n end", "def new\n @formulary = Formulary.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulary }\n end\n end", "def show\n @food_form = FoodForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @food_form }\n end\n end", "def index\n @poole_app_forms = current_user.poole_app_forms.all\n end", "def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end", "def new\n @produccion = Produccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produccion }\n end\n end", "def new\n @programa = Programa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @programa }\n end\n end", "def new\n @enquiry = Enquiry.find(params[:id])\n @enquiry.programmes.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @programme }\n end\n end", "def all_forms\n\t\t\treturn [{}]\n\t\tend", "def show\n @kf_course_form = Kf::CourseForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kf_course_form }\n end\n end", "def new\n @application_form_field = ApplicationFormField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_form_field }\n end\n end", "def form_fragment\n parsed_json\n end", "def new\n @echoform = Echoform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @echoform }\n end\n end", "def getform\n\tgetform = Windmill.where(no: params[:no])\n\tif getform.present?\n render json: getform.as_json(only: [:windformid])\n\telse\n\t\trender json: {massage: 'No windfrom available in this id'}\n\tend\nend", "def show\n @forms = Forms.all()\n end", "def nested_forms\n []\n end", "def new\n @unemployment_form = UnemploymentForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @unemployment_form }\n end\n end", "def new\n @pinit = Pinit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinit }\n end\n end", "def index\n json = HTTParty.get(\"https://api.typeform.com/v1/form/WaIffL?key=f486f2db8f1249c077a08b582bc3efe0a2617668\").body\n\n @jsontests = JSON.parse(json)\n\n end", "def show\n @application_form_field = ApplicationFormField.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @application_form_field }\n end\n end", "def index\n @application_forms = ApplicationForm.where(organization_id: params['organization_id'])\n authorize @application_forms\n\n render json: @application_forms\n end", "def new\n @pizzashop = Pizzashop.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pizzashop }\n end\n end", "def index\n @cec_forms = CecForm.sorted\n\n\t\tgon.highlight_first_form_field = false\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cec_forms }\n end\n end", "def create\n @promulher_form = PromulherForm.new(promulher_form_params)\n\n respond_to do |format|\n if @promulher_form.save\n format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully created.' }\n format.json { render :show, status: :created, location: @promulher_form }\n else\n format.html { render :new }\n format.json { render json: @promulher_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @requisition = Requisition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requisition }\n end\n end", "def new\n @propose = Propose.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @propose }\n end\n end", "def new\n @informe = Informe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @informe }\n end\n end", "def new\n @forma_entrega = FormaEntrega.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @forma_entrega }\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 new\n @pat_isoform = PatIsoform.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pat_isoform }\n end\n end", "def new\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end", "def new\n @preference_criterium = PreferenceCriterium.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preference_criterium }\n end\n end", "def new\n\n @paciente = Paciente.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paciente }\n end\n end", "def new\n @protein_complex = ProteinComplex.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @protein_complex }\n end\n end", "def show\n @admission_form = AdmissionForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admission_form }\n end\n end", "def show\n @echoform = Echoform.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @echoform }\n end\n end", "def show\n @cec_form = CecForm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_form }\n end\n end", "def new\n @profesor_pertenece_asignatura = ProfesorPerteneceAsignatura.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profesor_pertenece_asignatura }\n end\n end", "def index\n @forms = Form.all\n end", "def new\n @promo = Promo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo }\n end\n end", "def index\n @plataforms = Plataform.all\n end", "def new\n @promo = Promo.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @promo }\n end\n end", "def new\n @produto = Produto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @produto }\n end\n end", "def new\n @paciente = Paciente.new\n @paciente.pessoa = Pessoa.new\n #respond_to do |format|\n # format.html # new.html.erb\n # format.json { render json: @paciente }\n #end\n end", "def new\n @familia_producto = FamiliaProducto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @familia_producto }\n end\n end", "def new\n @reprogramacion = Reprogramacion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reprogramacion }\n end\n end", "def new\n @pessoa_receber = PessoaReceber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pessoa_receber }\n end\n end", "def new\n @kf_course_form = Kf::CourseForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @kf_course_form }\n end\n end", "def new\n @projecct = Projecct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @projecct }\n end\n end", "def new\n @frais_repa = FraisRepa.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @frais_repa }\n end\n end", "def new\n @plannegocio = Plannegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plannegocio }\n end\n end", "def new\n @papel = Papel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @papel }\n end\n end", "def new\n @feedback_form = FeedbackForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback_form }\n end\n end", "def new\n @requerimiento = Requerimiento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @requerimiento }\n end\n end" ]
[ "0.75220186", "0.7489939", "0.7340279", "0.7143869", "0.7011556", "0.681693", "0.6814621", "0.680867", "0.6616181", "0.6593455", "0.65731007", "0.64824426", "0.646599", "0.64471567", "0.6445544", "0.643093", "0.641826", "0.6399494", "0.6353839", "0.6349988", "0.6323702", "0.6323702", "0.6315352", "0.629371", "0.6281532", "0.62501186", "0.6247185", "0.6240838", "0.6235664", "0.62136143", "0.61893475", "0.6178298", "0.61738455", "0.6168361", "0.61387736", "0.6129488", "0.61284643", "0.612831", "0.61244094", "0.6119498", "0.6118425", "0.6098085", "0.6098085", "0.6092275", "0.6089492", "0.60878223", "0.6077438", "0.607546", "0.6062456", "0.6060272", "0.6050459", "0.60490906", "0.60470253", "0.60461736", "0.6045435", "0.60442793", "0.6042373", "0.60410064", "0.6034457", "0.6016658", "0.6016326", "0.60129476", "0.6002901", "0.59910107", "0.599073", "0.5989079", "0.5976888", "0.5975939", "0.5974028", "0.59712255", "0.5969757", "0.59571445", "0.59449035", "0.5941581", "0.5939735", "0.593933", "0.59365076", "0.5930289", "0.5914199", "0.59119254", "0.5906833", "0.5903972", "0.59012437", "0.58964765", "0.58937186", "0.5893414", "0.589337", "0.58932817", "0.5888803", "0.58883536", "0.5885887", "0.5883169", "0.58830047", "0.58812666", "0.58798045", "0.58754486", "0.587075", "0.5865943", "0.5861309", "0.58586943", "0.5855304" ]
0.0
-1
POST /promulher_forms POST /promulher_forms.json
def create @promulher_form = PromulherForm.new(promulher_form_params) respond_to do |format| if @promulher_form.save format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully created.' } format.json { render :show, status: :created, location: @promulher_form } else format.html { render :new } format.json { render json: @promulher_form.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n\t\t@form = @client.forms.new\n\n \n 3.times do\n procedure = @form.procedures.build\n end\n 3.times do\n authemp = @form.authemps.build\n end\n\n\t\trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t\tend\n\tend", "def form_json\n render template: 'utils/form_json'\n end", "def create\n @poole_app_form = current_user.poole_app_forms.build(poole_app_form_params)\n\n respond_to do |format|\n if @poole_app_form.save\n format.html { redirect_to @poole_app_form, notice: 'Poole app form was successfully created.' }\n format.json { render :show, status: :created, location: @poole_app_form }\n else\n format.html { render :new }\n format.json { render json: @poole_app_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pform = Pform.new(pform_params)\n\n respond_to do |format|\n if @pform.save\n format.html { redirect_to @pform, notice: 'Pform was successfully created.' }\n format.json { render :show, status: :created, location: @pform }\n else\n format.html { render :new }\n format.json { render json: @pform.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_form_2122\n validate_json_schema\n\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_using_identifier_and_source(header_md5: header_md5,\n source_name: source_name)\n unless power_of_attorney&.status&.in?(%w[submitted pending])\n power_of_attorney = ClaimsApi::PowerOfAttorney.create(\n status: ClaimsApi::PowerOfAttorney::PENDING,\n auth_headers: auth_headers,\n form_data: form_attributes,\n source_data: source_data,\n header_md5: header_md5\n )\n\n unless power_of_attorney.persisted?\n power_of_attorney = ClaimsApi::PowerOfAttorney.find_by(md5: power_of_attorney.md5)\n end\n\n power_of_attorney.save!\n end\n\n ClaimsApi::PoaUpdater.perform_async(power_of_attorney.id)\n\n render json: power_of_attorney, serializer: ClaimsApi::PowerOfAttorneySerializer\n end", "def create\n @plataform = Plataform.new(plataform_params)\n\n respond_to do |format|\n if @plataform.save\n format.html { redirect_to @plataform, notice: 'Plataform was successfully created.' }\n format.json { render :show, status: :created, location: @plataform }\n else\n format.html { render :new }\n format.json { render json: @plataform.errors, status: :unprocessable_entity }\n end\n end\n end", "def setup_form\n form = {\n schema: {\n type: 'object',\n properties: {\n array: {\n title: 'You have not configured your schema form',\n type: 'array',\n items: {\n type: 'string',\n enum: [\n \"Ok I'll do it right away\",\n \"I'll let someone else do it for me\"\n ]\n }\n }\n }\n }\n }\n render json: form.to_json\n end", "def socio_economico_submit\n\n # responding for the first time\n if not session[:current_response_id]\n current_response = nil\n # preparing the object to store the surveys and requests data\n json_response = { 'surveys' => [], 'requests' => [] }\n else\n current_response = FormResponse.find(session[:current_response_id])\n json_response = JSON.parse current_response.json_response\n end\n\n # appending the new response to the array of surveys\n surveys_number = json_response['surveys'].size\n json_response['surveys'] = [] if surveys_number == 0\n json_response['surveys'].push(\n params.merge({\n :attempt => (surveys_number + 1),\n :sent_at => Time.zone.now\n })\n )\n\n if current_response\n current_response.update({\n json_response: json_response.to_json\n })\n else\n # the response must be created only in this form\n # and not in the request form!\n current_response = FormResponse.create({\n form_id: Form.where(reference_model: 'FormVagasRemanescentes').first.id,\n user: current_user.email,\n json_response: json_response.to_json\n })\n\n # storing the response id in session to access it\n # from the other form, the request form\n session[:current_response_id] = current_response.id\n end\n\n redirect_to action: 'pedido'\n end", "def create_evaluation\n @professor_form = ProfessorForm.new(professor_form_params)\n if @professor_form.save\n render json: @professor_form\n else\n render json: @professor_form.errors\n end\n end", "def publish_form\n form_data = params.require(:form).permit(:id)\n\n render json: Form.publish_form(form_data[:id], current_user[\"id\"])\n end", "def create\n @form = Form.new(form_params)\n return unless can_form_be_created?(@form)\n @form.created_by = current_user\n @form.form_questions = create_form_questions\n if @form.save\n render :show, status: :created, location: @form\n else\n render json: @form.errors, status: :unprocessable_entity\n end\n end", "def create\n @formulario = Formulario.new(params[:formulario])\n\n respond_to do |format|\n if @formulario.save\n format.html { redirect_to @formulario, notice: 'Formulario was successfully created.' }\n format.json { render json: @formulario, status: :created, location: @formulario }\n else\n format.html { render action: \"new\" }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pupil = Pupil.new(pupil_params)\n @form = Form.find(params[:form_id])\n @pupil.form = @form\n respond_to do |format|\n if @pupil.save\n format.html { redirect_to form_pupils_path(@form), notice: 'Ученик успешно добавлен.' }\n format.json { render :show, status: :created, location: @pupil }\n else\n format.html { render :new }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n\t\t@form = @client.forms.find(params[:id])\n @procedures = @form.procedures.order('step_num ASC')\n\n \trespond_to do |format|\n \t\tformat.html # show.html.erb\n \t\tformat.json { render json: @form }\n \t \tend\n \tend", "def create\n @formulario = Formulario.new(formulario_params)\n\n respond_to do |format|\n if @formulario.save\n format.html { redirect_to @formulario, notice: \"Formulario was successfully created.\" }\n format.json { render :show, status: :created, location: @formulario }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def emit_form(formdata: {})\n if formdata[JIRA] || formdata[CONFLUENCE]\n title = 'Update your JIRA and Confluence IDs (previously submitted)'\n submit_title = 'Update Your ID Mapping'\n else\n title = 'Enter your JIRA and Confluence IDs'\n submit_title = 'Submit Your ID Mapping'\n end\n _whimsy_panel(title, style: 'panel-success') do\n _form.form_horizontal method: 'post' do\n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache JIRA ID?', for: JIRAHAS\n _div.col_sm_9 do\n _select.form_control name: JIRAHAS, id: JIRAHAS, required: true do\n _option value: ''\n _option \"Yes - I have one JIRA ID\", value: 'y', selected: \"#{formdata[JIRAHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a JIRA ID\", value: 'n', selected: \"#{formdata[JIRAHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple JIRA IDs\", value: 'm', selected: \"#{formdata[JIRAHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache JIRA ID (if you have one)', name: JIRA, required: false,\n value: \"#{formdata[JIRA]}\", \n helptext: \"The JIRA ID used on issues.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other JIRA IDs you personally use, one per line', name: JIRAOTHER, required: false,\n value: \"#{formdata[JIRAOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n _div.form_group do\n _label.control_label.col_sm_3 'Do you have an Apache Confluence ID?', for: CONFLUENCEHAS\n _div.col_sm_9 do\n _select.form_control name: CONFLUENCEHAS, id: CONFLUENCEHAS, required: true do\n _option value: ''\n _option \"Yes - I have one Confluence ID\", value: 'y', selected: \"#{formdata[CONFLUENCEHAS] == 'y' ? 'selected': ''}\"\n _option \"No - I do not have a Confluence ID\", value: 'n', selected: \"#{formdata[CONFLUENCEHAS] == 'n' ? 'selected': ''}\"\n _option \"I use multiple Confluence IDs\", value: 'm', selected: \"#{formdata[CONFLUENCEHAS] == 'm' ? 'selected': ''}\"\n end\n end\n end\n emit_input(label: 'Enter your Apache Confluence ID (if you have one)', name: CONFLUENCE, required: false,\n value: \"#{formdata[CONFLUENCE]}\", \n helptext: \"The Confluence ID used on cwiki.apache.org (usually same as committer ID)\")\n emit_input(label: 'List any other Confluence IDs you personally use, one per line', name: CONFLUENCEOTHER, required: false,\n value: \"#{formdata[CONFLUENCEOTHER]}\",\n rows: 3, helptext: \"Remember: these should only be personal IDs you use, not project ones.\")\n \n emit_input(label: 'Your Apache Committer ID', name: COMMITTERID, readonly: true,\n value: formdata[COMMITTERID], icon: 'glyphicon-user', iconlabel: 'Committer ID')\n _div.col_sm_offset_3.col_sm_9 do\n _input.btn.btn_default type: 'submit', value: submit_title\n end\n end\n end\nend", "def create\n @form_laboratorio = FormLaboratorio.new(form_laboratorio_params)\n\n respond_to do |format|\n if @form_laboratorio.save\n format.html { redirect_to @form_laboratorio, notice: 'Form laboratorio was successfully created.' }\n format.json { render :show, status: :created, location: @form_laboratorio }\n else\n format.html { render :new }\n format.json { render json: @form_laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @form_primario = FormPrimario.new(form_primario_params)\n\t\n\t@clientes.each do |clientesTamp|\n\t\t@campos_extra = CamposExtra.new\n\t\t@campos_extra.emailCliente = clientesTamp.email;\n\t\t@campos_extra.nomeCampo = @form_primario.nomeCampo;\n\t\t@campos_extra.tipoCampo = @form_primario.tipoCampo;\n\t\t@campos_extra.itensCombox = @form_primario.itensCombo;\n\t\t@campos_extra.save\n\tend\n\t\n respond_to do |format|\n\t\t@form_primario.emailUsuario = current_usuario.email;\n\t\t if @form_primario.save\n\t\t\tformat.html { redirect_to @form_primario, notice: 'Form primario was successfully created.' }\n\t\t\tformat.json { render :show, status: :created, location: @form_primario }\n\t\t else\n\t\t\tformat.html { render :new }\n\t\t\tformat.json { render json: @form_primario.errors, status: :unprocessable_entity }\n\t\t end\n end\n\t\n end", "def create\n @pec_form = PecForm.new(params[:pec_form])\n\n respond_to do |format|\n if @pec_form.save\n format.html { redirect_to pec_forms_path, notice: I18n.t('pec_form.notice.create') }\n format.json { render json: @pec_form, status: :created, location: @pec_form }\n else\n\t\t\t\tgon.edit_pec_form = true\n\t\t\t\tgon.registration_time = @pec_form.registration_time.strftime('%m/%d/%Y %H:%M') if @pec_form.registration_time\n format.html { render action: \"new\" }\n format.json { render json: @pec_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @form = Form.new(form_params)\n\n respond_to do |format|\n if @form.save\n format.html { redirect_to @form, notice: 'Form was successfully created.' }\n format.json { render :show, status: :created, location: @form }\n else\n format.html { render :new }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_forms\n @course = Course.find(params[:course_id])\n @forms = @course.professor_forms\n render json: @forms\n end", "def onSubmit(request, response, form, errors)\r\n\treturn form\r\n end", "def create\n @submitted_exam_regis_form = SubmittedExamRegisForm.new(submitted_exam_regis_form_params)\n\n respond_to do |format|\n if @submitted_exam_regis_form.save\n format.html { redirect_to @submitted_exam_regis_form, notice: 'Submitted exam regis form was successfully created.' }\n format.json { render :show, status: :created, location: @submitted_exam_regis_form }\n else\n format.html { render :new }\n format.json { render json: @submitted_exam_regis_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def forms; end", "def create\n @formaenvio = Formaenvio.new(formaenvio_params)\n\n respond_to do |format|\n if @formaenvio.save\n format.html { redirect_to @formaenvio, notice: 'Forma de envio criado com sucesso.' }\n format.json { render :show, status: :created, location: @formaenvio }\n else\n format.html { render :new }\n format.json { render json: @formaenvio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @proforma = Proforma.new(proforma_params)\n\n respond_to do |format|\n if @proforma.save\n format.html { redirect_to @proforma, notice: 'Proforma was successfully created.' }\n format.json { render :show, status: :created, location: @proforma }\n else\n format.html { render :new }\n format.json { render json: @proforma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pessel_form = PesselForm.new(pessel_form_params)\n\n respond_to do |format|\n if @pessel_form.save\n format.html { redirect_to @pessel_form, notice: 'Pessel form was successfully created.' }\n format.json { render :show, status: :created, location: @pessel_form }\n else\n format.html { render :new }\n format.json { render json: @pessel_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @filled_form = FilledForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @filled_form }\n end\n end", "def onSubmit(request, response, form, errors) \n return form\n end", "def create\n @sectioneight_form = SectioneightForm.new(params[:sectioneight_form])\n\n respond_to do |format|\n if @sectioneight_form.save\n format.html { redirect_to @sectioneight_form, notice: 'Sectioneight form was successfully created.' }\n format.json { render json: @sectioneight_form, status: :created, location: @sectioneight_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sectioneight_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @pharmaceuticalform = Pharmaceuticalform.new(pharmaceuticalform_params)\n\n respond_to do |format|\n if @pharmaceuticalform.save\n format.html { redirect_to @pharmaceuticalform, notice: 'Pharmaceuticalform was successfully created.' }\n format.json { render :show, status: :created, location: @pharmaceuticalform }\n else\n format.html { render :new }\n format.json { render json: @pharmaceuticalform.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @pec_form = PecForm.new\n gon.edit_pec_form = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pec_form }\n end\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def onSubmit(request, response, form, errors) \r\n return form\r\n end", "def create\n @form = @company.forms.build(form_params)\n\n respond_to do |format|\n if @form.save\n format.html { redirect_to [@company, @form], notice: 'Form was successfully created.' }\n format.json { render :show, status: :created, location: [@company, @form] }\n else\n format.html { render :new }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @formulario = Formulario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @formulario }\n end\n end", "def index\n @promulher_forms = PromulherForm.all\n end", "def create\n @formapagto = Formapagto.new(formapagto_params)\n\n respond_to do |format|\n if @formapagto.save\n format.html { redirect_to @formapagto, notice: 'Forma de pagto criado com sucesso.' }\n format.json { render :show, status: :created, location: @formapagto }\n else\n format.html { render :new }\n format.json { render json: @formapagto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \t\t@form = @client.forms.new(params[:form])\n\n \trespond_to do |format|\n \t\tif @form.save\n \t\tformat.html { redirect_to @client, notice: 'Lockout Tagout Form successfully added.' }\n \t\tformat.json { render json: @client, status: :created, location: @form }\n \t\telse\n \t\tformat.html { render action: \"new\" }\n \t\tformat.json { render json: @form.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n \tend", "def create\n @formulario = Formulario.new(formulario_params)\n\n respond_to do |format|\n if @formulario.save\n format.html { redirect_to @formulario, notice: 'Formulario criado com sucesso.' }\n format.json { render :show, status: :created, location: @formulario }\n else\n format.html { render :new }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "def onSubmit(request, response, form, errors)\r\n return form\r\n end", "def formulario_params\n\n params.require(:formulario).permit(:nome, filial_ids: [], formulario_fields_attributes: [:id, :label, :field_type_id, :options, :url, :requirido, :_destroy], contact_group_ids: [])\n\n # if params[:tipo] != nil\n # [params.require(:formulario).permit(:nome),\n # params.require(:tipo).permit!,\n # params.require(:label).permit!,\n # params.require(:rec).permit!]\n # else\n # [params.require(:formulario).permit(:nome),nil,nil,nil]\n # end\n\n end", "def create\n @pit_form = PitForm.new(pit_form_params)\n\n respond_to do |format|\n if @pit_form.save\n format.html { redirect_to @pit_form, notice: 'Pit form was successfully created.' }\n format.json { render :show, status: :created, location: @pit_form }\n else\n format.html { render :new }\n format.json { render json: @pit_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @form = ProfessorForm.find(params[:id])\n\n render json: @form\n end", "def create\n @custom_form = CustomForm.new(custom_form_params)\n\n respond_to do |format|\n if @custom_form.save\n format.html { redirect_to @custom_form, notice: 'Custom form was successfully created.' }\n format.json { render :show, status: :created, location: @custom_form }\n else\n format.html { render :new }\n format.json { render json: @custom_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @form_template = FormTemplate.find(params[:form_template_id])\n @filled_form = @form_template.filled_forms.create(params[:filled_form].merge(:user_id => current_user.id.to_i))\n\n respond_to do |format|\n if @filled_form.save\n format.html { redirect_to form_templates_path, notice: 'Filled form was successfully created.' }\n format.js { @current_form_template = @form_template; @current_filled_form = @filled_form }\n format.json { render json: @filled_form, status: :created, location: @filled_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @filled_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kf_course_form = Kf::CourseForm.new(params[:kf_course_form])\n\n respond_to do |format|\n if @kf_course_form.save\n format.html { redirect_to kf_course_forms_url({:page => params[:page]}), notice: 'Course form was successfully created.' }\n format.json { render json: @kf_course_form, status: :created, location: @kf_course_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @kf_course_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend", "def create\n if not params[:email_address_confirmation].empty?\n redirect_to root_path\n return\n end\n @filled_form = @form.filled_forms.new\n if current_user and current_user.administrator? and params[:filled_form] and\n params[:filled_form][:user_id]\n @filled_form.user = User.find(params[:filled_form][:user_id])\n else\n @filled_form.user = current_user\n end\n if params[:filled_form] and params[:filled_form][:parent_id]\n @filled_form.parent = FilledForm.find(params[:filled_form][:parent_id])\n end\n @filled_form.version = @form.version\n populate_filled_fields\n \n if @form.payable?\n # re-use payment from sibling filled forms that haven't been paid\n siblings = @form.filled_forms_for_user(current_user)\n siblings.each do |sibling_filled_form|\n if sibling_filled_form.payment and sibling_filled_form.payment.cancellable?\n @payment = sibling_filled_form.payment\n break\n end\n end\n unless @payment\n @payment = Payment.new(:amount => @filled_form.payable_amount,\n :method => Payment::METHODS.first, :user => @filled_form.user)\n end\n @payment.filled_forms << @filled_form\n end\n\n respond_to do |format|\n if @filled_form.save and (! @payment or\n (@payment.amount += @filled_form.payable_amount; @payment.save))\n FormMailer.form_email(@filled_form).deliver_now\n format.html { redirect_to(next_url,\n :notice => \"#{@form.name} was successfully submitted.\") }\n format.xml { render :xml => @filled_form, :status => :created, :location => @filled_form }\n else\n @filled_forms = @form.visible_filled_forms(current_user)\n @payments = @form.payments_for_user(current_user)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @filled_form.errors, :status => :unprocessable_entity }\n end\n end\n end", "def next_form\n json_form.next_form(parsed_json['id'])\n end", "def poole_app_form_params\n params.require(:poole_app_form).permit(:title, :api_key, :api_secret)\n end", "def create\n @unemployment_form = UnemploymentForm.new(params[:unemployment_form])\n\n respond_to do |format|\n if @unemployment_form.save\n format.html { redirect_to @unemployment_form, notice: 'Unemployment form was successfully created.' }\n format.json { render json: @unemployment_form, status: :created, location: @unemployment_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unemployment_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @sectioneight_form = SectioneightForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sectioneight_form }\n end\n end", "def set_promulher_form\n @promulher_form = PromulherForm.find(params[:id])\n end", "def open_struct_form\n @application ||= JSON.parse(form, object_class: OpenStruct)\n @application.confirmation_number = confirmation_number\n\n transform_form\n\n @application\n end", "def form_params\n params.require(:form).permit(:nombre, :apellidos, :cedula, :email, :telefono, :institucion, :unidad, :cargo, :profesion, :user_id)\n end", "def create\n @prospecto_telefono = ProspectoTelefono.new(prospecto_telefono_params)\n\n respond_to do |format|\n if @prospecto_telefono.save\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully created.' }\n format.json { render :show, status: :created, location: @prospecto_telefono }\n else\n format.html { render :new }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @form = Form.new(params[:form])\n\n respond_to do |format|\n if @form.save\n params[:id] = @form.id\n flash[:notice] = 'Form was successfully created.'\n\n format.html { redirect_to(@form) }\n format.json {\n form = render_to_string(:partial => \"form_basic.html.erb\", :locals => {:is_edit => true})\n coll = render_to_string(:partial => \"shared/collision_detection.html.erb\")\n render :json => {\n :collision => coll,\n :preview => preview_form_path(@form),\n :form => form\n },\n :status => :created,\n :location => @form\n }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @form.errors, :status => :unprocessable_entity }\n end\n end\n end", "def form; end", "def create\n @form = Form.new(form_params)\n\n respond_to do |format|\n if @form.save\n @form_items = @form.form_items\n @form_items.each do |item|\n product = Product.find_by(id: item.product_id)\n if product.product_type == :component\n product.update_attribute(:product_type, Product.product_type.both)\n end\n end\n\n format.html { redirect_to @form, notice: 'Formulario creado.' }\n format.json { render :show, status: :created, location: @form }\n else\n format.html { render :new }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\n end\n end", "def new\n @form = Form.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @form }\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 new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @premio }\n end\n end", "def create\n @metaform = Metaform.new(params[:metaform])\n @metaform.user_id = current_user.id\n\n respond_to do |format|\n if @metaform.save\n format.html { redirect_to @metaform, notice: 'Metaform was successfully created.' }\n format.json { render json: @metaform, status: :created, location: @metaform }\n else\n format.html { render action: \"new\" }\n format.json { render json: @metaform.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @enquiry = Enquiry.find(params[:id])\n @enquiry.programmes.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @programme }\n end\n end", "def new\n @application_form_field = ApplicationFormField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @application_form_field }\n end\n end", "def create\n @form_data = Form.get_form_by_code current_user[\"id\"], params[:code]\n if @form_data.nil?\n redirect_to \"/dashboard\"\n else\n @questions = Question.get_questions_by_ids @form_data['id'], JSON.parse(@form_data['question_order'])\n @all_options = Option.collect_options_per_quetions JSON.parse(@form_data['question_order'])\n @form_action = \"publish\"\n @has_other = false\n\n if @form_data[\"status\"] === STATUS_PUBLISHED\n @form_action = \"get_result\"\n elsif @form_data[\"status\"] === STATUS_FINISHED\n @form_action = \"show_result\"\n end\n end\n end", "def new\n @promocion = Promocion.new\n\n respond_to do |format|\n format.html { render :layout => 'special_form'}# new.html.erb\n #format.json { render json: @promocion }\n end\n end", "def create\n @form = Form.create(params[:form])\n respond_with :admin, @form\n end", "def new\n @premio = Premio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @premio }\n end\n end", "def form_data?; 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 form\n\tform = Windmill.all\n\t#form = Windmill.where(windformid: params[:id])\n\t#if form.present?\n render json: form.as_json(only: [:no])\n\t#else\n\t\t#render json: {massage: 'No windfrom available in this id'}\n\t#\n #end\nend", "def create\n @food_form = FoodForm.new(params[:food_form])\n\n respond_to do |format|\n if @food_form.save\n format.html { redirect_to @food_form, notice: 'Food form was successfully created.' }\n format.json { render json: @food_form, status: :created, location: @food_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @food_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @patrocinio = Patrocinio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patrocinio }\n end\n end", "def form_data\n session[\"form_data\"].nil? ? params : JSON.parse(session[\"form_data\"])\n end", "def create\n @formapagamento = Formapagamento.new(formapagamento_params)\n\n respond_to do |format|\n if @formapagamento.save\n format.html { redirect_to @formapagamento, notice: 'Formapagamento was successfully created.' }\n format.json { render :show, status: :created, location: @formapagamento }\n else\n format.html { render :new }\n format.json { render json: @formapagamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_post_form\n {:cartridge => {:name => 'mysql-5.1', :type => 'embedded'},\n :application_id => with_testable_app.id,\n :domain_id => @domain.id}\n end", "def create\n @housing_form = HousingForm.new(params[:housing_form])\n\n respond_to do |format|\n if @housing_form.save\n format.html { redirect_to @housing_form, notice: 'Housing form was successfully created.' }\n format.json { render json: @housing_form, status: :created, location: @housing_form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @housing_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @fusion_form = FusionForm.new(fusion_form_params)\n\n respond_to do |format|\n if @fusion_form.save\n format.html { redirect_to @fusion_form, notice: \"Fusion form was successfully created.\" }\n format.json { render :show, status: :created, location: @fusion_form }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @fusion_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @formasdepago = current_user.empresa.formasdepagos.new(formasdepago_params)\n\n respond_to do |format|\n if @formasdepago.save\n format.html { redirect_to @formasdepago, notice: 'Formasdepago was successfully created.' }\n format.json { render action: 'show', status: :created, location: @formasdepago }\n else\n format.html { render action: 'new' }\n format.json { render json: @formasdepago.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def new\n @puntaje = Puntaje.new\n atributos\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @puntaje }\n end\n end", "def create\n @pat_isoform = PatIsoform.new(params[:pat_isoform])\n\n respond_to do |format|\n if @pat_isoform.save\n format.html { redirect_to @pat_isoform, notice: 'Pat isoform was successfully created.' }\n format.json { render json: @pat_isoform, status: :created, location: @pat_isoform }\n else\n format.html { render action: \"new\" }\n format.json { render json: @pat_isoform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @promulher_form.update(promulher_form_params)\n format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully updated.' }\n format.json { render :show, status: :ok, location: @promulher_form }\n else\n format.html { render :edit }\n format.json { render json: @promulher_form.errors, status: :unprocessable_entity }\n end\n end\n 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 create\n @prospecto = Prospecto.new(prospecto_params)\n\n respond_to do |format|\n if @prospecto.save\n format.html { redirect_to @prospecto, notice: 'Prospecto was successfully created.' }\n format.json { render :show, status: :created, location: @prospecto }\n else\n format.html { render :new }\n format.json { render json: @prospecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_form\n new_form = Form.create_form(current_user[\"id\"])\n\n if new_form[:status] \n return redirect_to \"/f/#{new_form[:form_code]}/create\"\n end \n end", "def create\n @directorform = Directorform.new(params[:directorform])\n\n respond_to do |format|\n if @directorform.save\n format.html { redirect_to @directorform, notice: 'Thank you - your form was sucessfully submitted! You will be redirected to our homepage shortly.' }\n format.json { render json: @directorform, status: :created, location: @directorform }\n else\n format.html { render action: \"new\" }\n format.json { render json: @directorform.errors, status: :unprocessable_entity }\n end \n end\n end", "def nested_forms\n []\n end", "def create\n @admin_form = Admin::Form.new(admin_form_params)\n\n respond_to do |format|\n if @admin_form.save\n format.html { redirect_to @admin_form, notice: t('crud.created_successfully!', name: Admin::Form.model_name.human) }\n format.json { render :show, status: :created, location: @admin_form }\n else\n format.html { render :new }\n format.json { render json: @admin_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @application_form = ApplicationForm.new(application_form_params)\n authorize @application_form\n\n if @application_form.save\n render json: @application_form, status: :created, location: nil\n else\n render json: @application_form.errors, status: :unprocessable_entity\n end\n end", "def create\n @form = Form.new(params[:form])\n\n respond_to do |format|\n if params[:commit] == \"Save\" && @form.save\n user = User.find(Session.find_by_session_id(params[:ssnid]).user_id) \n @form.create_by = user.firstname + ' ' + user.lastname\n @form.create_date = Time.now\n @form.updated_by = user.firstname + ' ' + user.lastname\n @form.updated_date = Time.now\n @form.save\n format.html { redirect_to edit_form_path(@form), notice: 'Form was successfully created.' }\n format.json { render json: @form, status: :created, location: @form }\n else\n format.html { render action: \"new\" }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_form\n form = params[:form_txt] + \"_form\"\n @tab = params[:tab_id]\n form_hash_for_loan_details if !@loan_hash\n update_respond_to_parent(form,@tab,FLASH_MESSAGES['properties']['406'],nil)\n end", "def parseForm(form)\n # I'm using the format \"name value\" to be able to use the set_options method\n url = Array[\"\", \"url\", form[\"action\"]]\n method = Array[\"\", \"method\", form[\"method\"]]\n hidden_inputs = form.css(\"input[type='hidden']\")\n password_input = form.xpath(\"//input[@type='password']/@name\")\n\n # get the login input\n visible_inputs = form.css(\"input[type!='hidden']\")\n login_input = \"\"\n visible_inputs.each do |el|\n if el.to_s =~ /(login)|(email)|(username)|(user)/i\n login_input = el\n puts \"the login input est : #{el}\"\n break\n end\n end\n\n # create the string with all the hidden parameters\n body = \"\"\n hidden_inputs.each do |el|\n body = body + el[\"name\"] + \"=\" + el[\"value\"] + \"&\"\n end\n\n body = \"#{body}\" + \"#{login_input[\"name\"]}\" + \"=FILE0&\" + \"#{password_input}\" + \"=FILE1\"\n\n # add the question mark if get request\n if method == \"get\"\n body = \"?#{body}\"\n end\n body = Array[\"\", \"body\", body]\n\n\n # write the values in the json object \n options = JSON.parse(get_options(\"http_module\"))\n\n set_options(options, url)\n set_options(options, method)\n set_options(options, body)\nend", "def new\n @housing_form = HousingForm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @housing_form }\n end\n end" ]
[ "0.6913027", "0.66726047", "0.6592258", "0.6552269", "0.64742494", "0.6252745", "0.62478137", "0.6233747", "0.6229439", "0.6166977", "0.6159434", "0.61400044", "0.612566", "0.60932463", "0.6082558", "0.6077474", "0.6069096", "0.6062797", "0.6053153", "0.60170335", "0.6016596", "0.60092837", "0.59936285", "0.5993371", "0.59813327", "0.5978515", "0.59725404", "0.5970142", "0.5967916", "0.5966266", "0.595663", "0.595428", "0.59457475", "0.59457475", "0.59457475", "0.59457475", "0.5942952", "0.5939499", "0.59376746", "0.5937123", "0.592501", "0.5921568", "0.59157103", "0.59157103", "0.5906553", "0.5872737", "0.5870283", "0.58679986", "0.5863809", "0.58561856", "0.5854628", "0.58436304", "0.583357", "0.5822708", "0.5816892", "0.58108026", "0.58099806", "0.5802903", "0.5787902", "0.5785596", "0.57749474", "0.5767818", "0.5764846", "0.5763805", "0.5763805", "0.5762382", "0.5758021", "0.57522947", "0.574109", "0.57410544", "0.5740406", "0.57398117", "0.57337373", "0.57308173", "0.5728836", "0.57219213", "0.5717045", "0.5710849", "0.56984156", "0.56968534", "0.5694903", "0.5693999", "0.5691772", "0.56907177", "0.5689802", "0.56892586", "0.56892586", "0.56874406", "0.5686619", "0.5676189", "0.5669763", "0.5669699", "0.5663181", "0.56575966", "0.56557983", "0.56548095", "0.5654239", "0.5653456", "0.5649371", "0.5640557" ]
0.69148487
0
PATCH/PUT /promulher_forms/1 PATCH/PUT /promulher_forms/1.json
def update respond_to do |format| if @promulher_form.update(promulher_form_params) format.html { redirect_to @promulher_form, notice: 'Promulher form was successfully updated.' } format.json { render :show, status: :ok, location: @promulher_form } else format.html { render :edit } format.json { render json: @promulher_form.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @pec_form = PecForm.find(params[:id])\n\n respond_to do |format|\n if @pec_form.update_attributes(params[:pec_form])\n format.html { redirect_to @pec_form, notice: I18n.t('pec_form.notice.update') }\n format.json { head :ok }\n else\n\t\t\t\tgon.edit_pec_form = true\n\t\t\t\tgon.registration_time = @pec_form.registration_time.strftime('%m/%d/%Y %H:%M') if @pec_form.registration_time\n format.html { render action: \"edit\" }\n format.json { render json: @pec_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @poole_app_form.update(poole_app_form_params)\n format.html { redirect_to @poole_app_form, notice: 'Poole app form was successfully updated.' }\n format.json { render :show, status: :ok, location: @poole_app_form }\n else\n format.html { render :edit }\n format.json { render json: @poole_app_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @form1.update(form1_params)\n format.html { redirect_to @form1, notice: 'Form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @form1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @formulario = Formulario.find(params[:id])\n\n respond_to do |format|\n if @formulario.update_attributes(params[:formulario])\n format.html { redirect_to @formulario, notice: 'Formulario was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pform.update(pform_params)\n format.html { redirect_to @pform, notice: 'Pform was successfully updated.' }\n format.json { render :show, status: :ok, location: @pform }\n else\n format.html { render :edit }\n format.json { render json: @pform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form = Form.find(params[:id])\n\n respond_to do |format|\n if @form.update_attributes(params[:form])\n format.html { redirect_to @form, notice: 'Form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form = Form.find(params[:id])\n\n respond_to do |format|\n if @form.update_attributes(params[:form])\n format.html { redirect_to @form, notice: 'Form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form = Form.find(params[:form_id])\n respond_to do |format|\n if @pupil.update(pupil_params)\n format.html { redirect_to form_pupils_path(@form), notice: 'Данные ученика изменены.' }\n format.json { render :show, status: :ok, location: @pupil }\n else\n format.html { render :edit }\n format.json { render json: @pupil.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proforma.update(proforma_params)\n format.html { redirect_to @proforma, notice: 'Proforma generada correctamente.' }\n format.json { render :show, status: :ok, location: @proforma }\n else\n format.html { render :edit }\n format.json { render json: @proforma.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, :notice => 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @premio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @form = Form.find(params[:id])\n @form.update_attributes(params[:form])\n respond_with :admin, @form\n end", "def update\n respond_to do |format|\n if @formaenvio.update(formaenvio_params)\n format.html { redirect_to @formaenvio, notice: 'Forma de envio alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @formaenvio }\n else\n format.html { render :edit }\n format.json { render json: @formaenvio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @form.update(form_params)\n format.html { redirect_to [@company, @form], notice: 'Form was successfully updated.' }\n format.json { render :show, status: :ok, location: [@company, @form] }\n else\n format.html { render :edit }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plataform.update(plataform_params)\n format.html { redirect_to @plataform, notice: 'Plataform was successfully updated.' }\n format.json { render :show, status: :ok, location: @plataform }\n else\n format.html { render :edit }\n format.json { render json: @plataform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @form.status == 'published'\n render json: { status: 'Published forms cannot be updated.' }, status: :unprocessable_entity\n else\n update_successful = nil\n @form.transaction do\n @form.form_questions = update_form_questions\n # When we assign update_successful, it is the last expression in the block\n # That means, if the form fails to update, this block will return false,\n # which will cause the transaction to rollback.\n update_successful = @form.update(form_params)\n end\n if update_successful\n render json: @form.to_json, status: :ok\n else\n render json: @form.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n respond_to do |format|\n if @form.update(form_params)\n format.html { redirect_to @form, notice: 'Form was successfully updated.' }\n format.json { render :show, status: :ok, location: @form }\n else\n format.html { render :edit }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @filled_form = FilledForm.find(params[:id])\n @form_template = FormTemplate.find(@filled_form.form_template_id)\n\n respond_to do |format|\n if @filled_form.update_attributes(params[:filled_form])\n format.html { redirect_to form_template_filled_form_path(@filled_form.form_template_id, params[:id]), notice: 'Filled form was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @filled_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @premio = Premio.find(params[:id])\n\n respond_to do |format|\n if @premio.update_attributes(params[:premio])\n format.html { redirect_to @premio, notice: 'Premio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @premio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @filled_form = @form.filled_forms.find(params[:id])\n return unless filled_form_authorized!\n if current_user.administrator? and params[:filled_form] and\n params[:filled_form][:user_id]\n if not params[:filled_form][:user_id].empty?\n @filled_form.user = User.find(params[:filled_form][:user_id])\n else\n @filled_form.user = nil\n end\n else\n @filled_form.user = current_user\n end\n if params[:filled_form] and params[:filled_form][:parent_id]\n @filled_form.parent = FilledForm.find(params[:filled_form][:parent_id])\n end\n @filled_form.version = @form.version\n populate_filled_fields\n @payment = @filled_form.payment\n\n respond_to do |format|\n if @filled_form.save\n FormMailer.form_email(@filled_form).deliver\n format.html { redirect_to(next_url,\n :notice => \"#{@form.name} was successfully updated.\") }\n format.xml { head :ok }\n else\n @filled_forms = @form.visible_filled_forms(current_user)\n @payments = @form.payments_for_user(current_user)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @filled_form.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @form607.update(form607_params)\n format.html { redirect_to @form607, notice: 'Form607 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @form607.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formulario.update(formulario_params)\n format.html { redirect_to @formulario, notice: \"Formulario was successfully updated.\" }\n format.json { render :show, status: :ok, location: @formulario }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formulario.update(formulario_params)\n format.html { redirect_to @formulario, notice: 'Formulario was successfully updated.' }\n format.json { render :show, status: :ok, location: @formulario }\n else\n format.html { render :edit }\n format.json { render json: @formulario.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @form.update(form_params)\n format.html { redirect_to @field, notice: 'Form was successfully updated.' }\n format.json { render :show, status: :ok, location: @form }\n else\n format.html { render :edit }\n format.json { render json: @field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @form_laboratorio.update(form_laboratorio_params)\n format.html { redirect_to @form_laboratorio, notice: 'Form laboratorio was successfully updated.' }\n format.json { render :show, status: :ok, location: @form_laboratorio }\n else\n format.html { render :edit }\n format.json { render json: @form_laboratorio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @promocion = Promocion.find(params[:id])\n logger.debug \"-------------------------------------------------------\"\n logger.debug params[:promocion][:formadepago_ids]\n logger.debug \"-------------------------------------------------------\"\n if (params[:promocion][:comercializable_ids] == nil)\n params[:promocion][:comercializable_ids] = []\n end\n\n if (params[:promocion][:formadepago_ids] == nil)\n params[:promocion][:formadepago_ids] = []\n end\n\n respond_to do |format|\n if @promocion.update_attributes(params[:promocion])\n format.html { redirect_to @promocion, :notice => 'Promocion was successfully updated.' }\n format.json { render json: @promocion}\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @promocion.errors }\n end\n end\n end", "def update\n respond_to do |format|\n if @formapagto.update(formapagto_params)\n format.html { redirect_to @formapagto, notice: 'Forma de pagto alterado com sucesso.' }\n format.json { render :show, status: :ok, location: @formapagto }\n else\n format.html { render :edit }\n format.json { render json: @formapagto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :edit, @questionnaire\n\n @questionnaire.load_JSON(params[:questionnaire], current_user)\n\n respond_to do |format|\n# if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Kysymyslomakkeen muokkaaminen onnistui.' }\n format.json { head :no_content }\n# else\n# format.html { render action: \"edit\" }\n# format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n# end\n\n end\n end", "def update\n respond_to do |format|\n if @pessel_form.update(pessel_form_params)\n format.html { redirect_to @pessel_form, notice: 'Pessel form was successfully updated.' }\n format.json { render :show, status: :ok, location: @pessel_form }\n else\n format.html { render :edit }\n format.json { render json: @pessel_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_form(kind, secret, form)\n return nil unless existing_form = DB[:forms].where(kind: kind, secret: secret).first\n\n if dashboard_user && !dashboard_user[:admin]\n form[:email_s] ||= dashboard_user[:email]\n form[:name_s] ||= dashboard_user[:name]\n end\n\n existing_data = JSON.parse existing_form[:data], symbolize_names: true\n form_data = JSON.parse form[:data], symbolize_names: true if form[:data]\n merged_info = existing_data.merge form.merge(form_data || {})\n merged_info = validate_form kind, merged_info, Pegasus.logger\n\n normalized_email = merged_info[:email_s].to_s.strip.downcase if merged_info.key?(:email_s)\n\n update_form = existing_form.dup\n [:created_at, :created_ip, :secret].each {|key| update_form.delete key}\n\n update_form[:user_id] = dashboard_user[:id] if dashboard_user && !dashboard_user[:admin]\n update_form[:email] = normalized_email\n update_form[:name] = merged_info[:name_s].to_s.strip if merged_info.key?(:name_s)\n update_form[:data] = merged_info.to_json\n update_form[:updated_at] = DateTime.now\n update_form[:updated_ip] = request.ip\n update_form[:processed_at] = nil\n update_form[:indexed_at] = nil\n update_form[:hashed_email] = Digest::MD5.hexdigest(normalized_email) if merged_info.key?(:email_s)\n DB[:forms].where(id: existing_form[:id]).update(update_form)\n\n update_form\nend", "def update\n respond_to do |format|\n if @prospecto.update(prospecto_params)\n format.html { redirect_to @prospecto, notice: 'Prospecto was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto }\n else\n format.html { render :edit }\n format.json { render json: @prospecto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @form.update(form_params)\n format.html { redirect_to @form, notice: 'Formulario actualizado.' }\n format.json { render :show, status: :ok, location: @form }\n else\n format.html { render :edit }\n format.json { render json: @form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #findForms()\n\n respond_to do |format|\n if @policy.update(policy_params)\n #if @policy.save\n format.html { render :show, notice: 'Policy was successfully updated' }\n format.json { render :show, status: :ok, location: @policy }\n #else\n # format.html { render :edit }\n # format.json { render json: @policy.errors, status: :unprocessable_entity }\n #end\n else\n format.html { render :edit }\n format.json { render json: @policy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @housing_form = HousingForm.find(params[:id])\n\n respond_to do |format|\n if @housing_form.update_attributes(params[:housing_form])\n format.html { redirect_to @housing_form, notice: 'Housing form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @housing_form.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 @formulary.update(formulary_params)\n format.html { redirect_to formularies_url, alert: I18n.t('activerecord.models.formulary') + I18n.t('helpers_locale.models.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @food_form = FoodForm.find(params[:id])\n\n respond_to do |format|\n if @food_form.update_attributes(params[:food_form])\n format.html { redirect_to @food_form, notice: 'Food form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @food_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @formulary = Formulary.find(params[:id])\n\n respond_to do |format|\n if @formulary.update_attributes(params[:formulary])\n format.html { redirect_to @formulary, notice: 'Formulario actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @formulary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pit_form.update(pit_form_params)\n format.html { redirect_to @pit_form, notice: 'Pit form was successfully updated.' }\n format.json { render :show, status: :ok, location: @pit_form }\n else\n format.html { render :edit }\n format.json { render json: @pit_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n @sectioneight_form = SectioneightForm.find(params[:id])\n\n respond_to do |format|\n if @sectioneight_form.update_attributes(params[:sectioneight_form])\n format.html { redirect_to @sectioneight_form, notice: 'Sectioneight form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sectioneight_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_form_title_and_description\n form_params = params.require(:form).permit(:id, :title, :description)\n\n render json: Form.update_form_title_and_description(current_user[\"id\"], form_params)\n end", "def update\n respond_to do |format|\n @person = @profissional.person\n if @person.update(profissional_params[:person_attributes])\n if profissional_params[:specialization].present?\n @profissional.update_attributes(:specialization => profissional_params[:specialization])\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { render :show, status: :ok, location: @profissional }\n else\n format.html { render :edit }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n\n end\n end\n end", "def update\n respond_to do |format|\n if @prospect.update(prospect_params)\n format.html { redirect_to @prospect, notice: 'Prospect was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @prospect.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @echoform = Echoform.find(params[:id])\n\n respond_to do |format|\n if @echoform.update_attributes(params[:echoform])\n format.html { redirect_to @echoform, notice: 'Echoform was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @echoform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n if params[:id]==\"edit_familias_propiedades\"\n edit_familias_propiedades\n return\n end\n \n #if params[:familia][\"articulos_grupopropiedades_attributes\"]\n# componer_articulo\n# return\n #end \n \n respond_to do |format|\n if @familia.update(familia_params) \n \n format.html { redirect_to familias_path(:id => @familia.padre_id), notice: 'Familia was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @familia.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n respond_to do |format|\n if @prospecto_telefono.update(prospecto_telefono_params)\n format.html { redirect_to @prospecto_telefono, notice: 'Prospecto telefono was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospecto_telefono }\n else\n format.html { render :edit }\n format.json { render json: @prospecto_telefono.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |format|\n if @ficheprospect.update(ficheprospect_params)\n format.html { redirect_to prospect_path(@prospect), notice: 'La qualification du prospect a ete modifiee avec succes.' }\n format.json { render :show, status: :ok, location: @ficheprospect }\n else\n format.html { render :edit }\n format.json { render json: @ficheprospect.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n respond_to do |format|\n if @requisition.update_attributes(requisition_params) and @requisition.valid?\n ap requisition_params\n format.html { redirect_to @profile, notice: 'Tu solicitud fue actualizada' }\n format.json { render :show, status: :ok, location: @requisition }\n else\n format.html { render :edit }\n format.json { render json: @requisition.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application_form = ApplicationForm.find(params[:id])\n authorize @application_form\n\n if @application_form.update(application_form_params)\n head :no_content\n else\n render json: @application_form.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @prospecto.update(prospecto_params)\n format.html { redirect_to @prospecto, notice: 'Prospecto actualizado' }\n format.json { render :show, status: :ok, location: @prospecto }\n else\n format.html { render :edit }\n format.json { render json: @prospecto.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 \t@form = @client.forms.find(params[:id])\n\n \trespond_to do |format|\n \t\tif @form.update_attributes(params[:form])\n \t\tformat.html { redirect_to @client, notice: 'Lockout Tagout Form successfully updated.' }\n \t\tformat.json { head :no_content }\n \t\telse\n \t\tformat.html { render action: \"edit\" }\n \t\tformat.json { render json: @form.errors, status: :unprocessable_entity }\n \t\tend\n \tend\n \tend", "def update\n respond_to do |format|\n if @pharmaceuticalform.update(pharmaceuticalform_params)\n format.html { redirect_to @pharmaceuticalform, notice: 'Pharmaceuticalform was successfully updated.' }\n format.json { render :show, status: :ok, location: @pharmaceuticalform }\n else\n format.html { render :edit }\n format.json { render json: @pharmaceuticalform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @profissional.update(profissional_params)\n format.html { redirect_to @profissional, notice: 'Profissional was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @profissional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @thing_with_react_form.update(thing_with_react_form_params)\n format.html { redirect_to @thing_with_react_form, notice: 'Thing with react form was successfully updated.' }\n format.json { render :show, status: :ok, location: @thing_with_react_form }\n else\n format.html { render :edit }\n format.json { render json: @thing_with_react_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request_for_change.set_manager(force: true)\n @request_for_change.set_security_officer(force: true)\n\n respond_to do |format|\n if @request_for_change.update(request_for_change_params)\n format.html { redirect_to edit_request_for_change_path(@request_for_change), notice: 'Request for change was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @request_for_change.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(requisito_params)\n format.html { redirect_to @objeto, notice: \"Requisito was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n 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 @forminfo.update(forminfo_params)\n format.html { redirect_to @forminfo, notice: 'Forminfo was successfully updated.' }\n format.json { render :show, status: :ok, location: @forminfo }\n else\n format.html { render :edit }\n format.json { render json: @forminfo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @job_form.update(job_form_params)\n format.html { redirect_to @job_form, notice: 'Job form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @job_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @protein_complex = ProteinComplex.find(params[:id])\n\n respond_to do |format|\n if @protein_complex.update_attributes(params[:protein_complex])\n format.html { redirect_to @protein_complex, notice: 'Protein complex was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @protein_complex.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @preceed = Preceed.find(params[:id])\n\n respond_to do |format|\n if @preceed.update_attributes(params[:preceed])\n format.html { redirect_to @preceed, notice: 'Preceed was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @preceed.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract_form.update(contract_form_params)\n format.html { redirect_to @contract_form, notice: 'Contract form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contract_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @pat_isoform = PatIsoform.find(params[:id])\n\n respond_to do |format|\n if @pat_isoform.update_attributes(params[:pat_isoform])\n format.html { redirect_to @pat_isoform, notice: 'Pat isoform was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @pat_isoform.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @proef = Proef.find(params[:id])\n\n respond_to do |format|\n if @proef.update_attributes(params[:proef])\n format.html { redirect_to @proef, notice: 'Test werd succesvol gewijzigd.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @proef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n form = formulario_params\n\n respond_to do |format|\n if @formulario.update(formulario_params)\n format.html { redirect_to @formulario, notice: 'Formulario atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @formulario }\n else\n format.html { render :edit }\n format.json { render json: @formulario.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 @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 @forma_entrega = FormaEntrega.find(params[:id])\n\n respond_to do |format|\n if @forma_entrega.update_attributes(params[:forma_entrega])\n format.html { redirect_to @forma_entrega, notice: 'Forma entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @forma_entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @forma_contacto.update(forma_contacto_params)\n format.html { redirect_to @forma_contacto, notice: 'Forma Contacto was successfully updated.' }\n format.json { render :show, status: :ok, location: @forma_contacto }\n else\n format.html { render :edit }\n format.json { render json: @forma_contacto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @requirement.update(requirement_params)\n format.html { redirect_to requirements_path, notice: \"Requisito (#{@requirement.name}) atualizado com sucesso!\" }\n format.json { render :show, status: :ok, location: @requirement }\n else\n format.html { render :edit }\n format.json { render json: @requirement.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 @cec_form = CecForm.find(params[:id])\n\n respond_to do |format|\n if @cec_form.update_attributes(params[:cec_form])\n format.html { redirect_to @cec_form, notice: I18n.t('cec_form.notice.update') }\n format.json { head :ok }\n else\n\t\t gon.edit_cec_form = true\n format.html { render action: \"edit\" }\n format.json { render json: @cec_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @informe = Informe.find(params[:id])\n\n respond_to do |format|\n if @informe.update_attributes(params[:informe])\n format.html { redirect_to @informe, notice: 'Informe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @informe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @submitted_exam_regis_form.update(submitted_exam_regis_form_params)\n format.html { redirect_to @submitted_exam_regis_form, notice: 'Submitted exam regis form was successfully updated.' }\n format.json { render :show, status: :ok, location: @submitted_exam_regis_form }\n else\n format.html { render :edit }\n format.json { render json: @submitted_exam_regis_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @procedure.update(procedure_params)\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n end\n end\n end", "def update\n respond_to do |format|\n if @property_form.update_attributes(params[:property])\n format.html { redirect_to @property, notice: 'Property was successfully updated.' }\n format.json { render json: {message:'Property successfully updated!', id:@property.id}, status: :accepted }\n else\n format.html { render action: 'edit' }\n format.json { render json: @property_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @form_of_receits = FormOfReceipt.find(params[:id])\n\n respond_to do |format|\n if @form_of_receit.update_attributes(params[:form_of_receits])\n format.html { redirect_to(@form_of_receits, :notice => 'Teste was successfully updated.') }\n else\n format.html { render :action => \"edit\" }\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 @produccion = Produccion.find(params[:id])\n\n respond_to do |format|\n if @produccion.update_attributes(params[:produccion])\n format.html { redirect_to @produccion, notice: 'Se ha modificado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produccion.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 new\n @pec_form = PecForm.new\n gon.edit_pec_form = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pec_form }\n end\n end", "def update\n @propuesta = Propuesta.find(params[:id])\n\n respond_to do |format|\n if @propuesta.update_attributes(params[:propuesta])\n format.html { redirect_to propuestas_periodo_propuestas_path(:id=>@propuesta.periodo_propuesta.id), :notice => 'Propuesta fue actualizado correctamente.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @propuesta.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contact_form = ContactForm.find(params[:id])\n @contactable = @contact_form.contactable\n \n respond_to do |format|\n if @contact_form.update_attributes(params[:contact_form])\n flash[:notice] = 'Forma de contato foi atualizada com sucesso.'\n format.html { redirect_to(@contactable) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact_form.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prospie.update(prospie_params)\n format.html { redirect_to @prospie, notice: 'Prospie was successfully updated.' }\n format.json { render :show, status: :ok, location: @prospie }\n else\n format.html { render :edit }\n format.json { render json: @prospie.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @formapagamento.update(formapagamento_params)\n format.html { redirect_to @formapagamento, notice: 'Formapagamento was successfully updated.' }\n format.json { render :show, status: :ok, location: @formapagamento }\n else\n format.html { render :edit }\n format.json { render json: @formapagamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @fake_professional.update(fake_professional_params)\n format.html { redirect_to @fake_professional, notice: 'Fake professional was successfully updated.' }\n format.json { render :show, status: :ok, location: @fake_professional }\n else\n format.html { render :edit }\n format.json { render json: @fake_professional.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @proverb.update(proverb_params)\n format.html { redirect_to @proverb, notice: \"Proverb was successfully updated.\" }\n format.json { render :show, status: :ok, location: @proverb }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @proverb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @event_form = EventForm.find(params[:id])\n\n respond_to do |format|\n if @event_form.update_attributes(params[:event_form])\n format.html { redirect_to @event_form, notice: 'Event form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_form.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_form!\n form_attributes = attributes.except 'form_id', 'user_id', 'id'\n form = self.form || Form.new\n form.update form_attributes\n # Don't need to retain the fields, since the draft will be deleted.\n # Just switch them over to belonging to the form.\n form.fields.delete_all\n fields.update_all form_draft_id: nil, form_id: form.id\n delete\n end", "def update\n respond_to do |format|\n if @formaspagamento.update(formaspagamento_params)\n format.html { redirect_to formaspagamentos_url, notice: 'Forma de Pagamento editada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @formaspagamento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admission_form = AdmissionForm.find(params[:id])\n\n respond_to do |format|\n if @admission_form.update_attributes(params[:admission_form])\n format.html { redirect_to @admission_form, notice: 'Admission form was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admission_form.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 @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_question_type\n form_params = params.require(:form).permit(:question_id, :question_type)\n\n render json: Question.update_question_type(form_params)\n end", "def update\n respond_to do |format|\n if @prospect.update(prospect_params)\n format.html { redirect_to @prospect, notice: t('.prospect_was_successfully_updated') }\n format.json { render :show, status: :ok, location: @prospect }\n else\n format.html { render :edit }\n format.json { render json: @prospect.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @application_form_field = ApplicationFormField.find(params[:id])\n\n respond_to do |format|\n if @application_form_field.update_attributes(params[:application_form_field])\n format.html { redirect_to @application_form_field, notice: 'Application form field was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @application_form_field.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manifesto_promise.update(manifesto_promise_params)\n format.html { redirect_to @manifesto_promise, notice: 'Manifesto promise was successfully updated.' }\n format.json { render :show, status: :ok, location: @manifesto_promise }\n else\n format.html { render :edit }\n format.json { render json: @manifesto_promise.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quiebre.update(quiebre_params)\n format.html { redirect_to @quiebre, notice: 'Quiebre was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quiebre.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.65179825", "0.6510923", "0.64998424", "0.6494558", "0.6481626", "0.64682937", "0.64682937", "0.6396021", "0.6302415", "0.6280932", "0.62748474", "0.62587726", "0.62528056", "0.6247302", "0.6236622", "0.6225212", "0.6219872", "0.62041736", "0.62023014", "0.6200375", "0.61984766", "0.619192", "0.61719", "0.6169652", "0.61667824", "0.61661", "0.6163937", "0.61611426", "0.61581814", "0.61493087", "0.61464113", "0.61414367", "0.6132754", "0.6127508", "0.61272836", "0.6124681", "0.61215395", "0.61176777", "0.6108992", "0.6106687", "0.6102768", "0.6095148", "0.6091697", "0.6089014", "0.60834736", "0.60714823", "0.60679924", "0.6061958", "0.6061397", "0.6046629", "0.6035812", "0.6028034", "0.6020647", "0.60120124", "0.6004343", "0.5999238", "0.5990769", "0.5989971", "0.598878", "0.59872526", "0.59867275", "0.5985566", "0.59836787", "0.59802616", "0.5975622", "0.597476", "0.5973957", "0.59700716", "0.59695506", "0.59684074", "0.59557873", "0.59553176", "0.5952939", "0.59510666", "0.5951047", "0.5946646", "0.5943731", "0.59432495", "0.59309244", "0.592747", "0.5926037", "0.59247625", "0.5919363", "0.5918683", "0.590632", "0.59010935", "0.59000176", "0.5899682", "0.5897224", "0.58965445", "0.5892695", "0.5891465", "0.58910507", "0.5887303", "0.58868647", "0.58846974", "0.58833134", "0.58813626", "0.58810216", "0.587651" ]
0.6852862
0
DELETE /promulher_forms/1 DELETE /promulher_forms/1.json
def destroy @promulher_form.destroy respond_to do |format| format.html { redirect_to promulher_forms_url, notice: 'Promulher form was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @form1.destroy\n respond_to do |format|\n format.html { redirect_to form1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulario = Formulario.find(params[:id])\n @formulario.destroy\n\n respond_to do |format|\n format.html { redirect_to formularios_url }\n format.json { head :ok }\n end\n end", "def delete_form(id)\n @client.raw('delete', \"/content/forms/#{id}\")\n end", "def destroy\n @form607.destroy\n respond_to do |format|\n format.html { redirect_to form607s_url }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @pec_form = PecForm.find(params[:id])\n @pec_form.destroy\n\n respond_to do |format|\n format.html { redirect_to pec_forms_url }\n format.json { head :ok }\n end\n end", "def destroy\n @form = Form.find(params[:id])\n @form.destroy\n\n respond_to do |format|\n format.html { redirect_to forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @poole_app_form.destroy\n respond_to do |format|\n format.html { redirect_to poole_app_forms_url, notice: 'Poole app form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @filled_form = FilledForm.find(params[:id])\n @filled_form.destroy\n\n respond_to do |format|\n format.html { redirect_to form_templates_path }\n format.json { head :ok }\n end\n end", "def destroy\n @covenant_form.destroy\n respond_to do |format|\n format.html { redirect_to covenant_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sectioneight_form = SectioneightForm.find(params[:id])\n @sectioneight_form.destroy\n\n respond_to do |format|\n format.html { redirect_to sectioneight_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_form.destroy\n respond_to do |format|\n format.html { redirect_to admin_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @adminmatrixstorageform.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixstorageforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @echoform = Echoform.find(params[:id])\n @echoform.destroy\n\n respond_to do |format|\n format.html { redirect_to echoforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_form = FoodForm.find(params[:id])\n @food_form.destroy\n\n respond_to do |format|\n format.html { redirect_to food_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formaenvio.destroy\n respond_to do |format|\n format.html { redirect_to formaenvios_url, notice: 'Forma de envio excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulario.destroy\n respond_to do |format|\n format.html { redirect_to formularios_url, notice: \"Formulario was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @pform.destroy\n respond_to do |format|\n format.html { redirect_to pforms_url, notice: 'Pform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulario.destroy\n respond_to do |format|\n format.html { redirect_to formularios_url, notice: 'Formulario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @metaform = Metaform.find(params[:id])\n @metaform.destroy\n\n respond_to do |format|\n format.html { redirect_to metaforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @form.status == 'draft'\n @form.questions.destroy_all\n @form.surveys.destroy_all\n @form.destroy\n render json: @form\n else\n render json: @form.errors, status: :unprocessable_entity\n end\n end", "def destroy\n @pupil.destroy\n @form = Form.find(params[:form_id])\n respond_to do |format|\n format.html { redirect_to form_pupils_path(@form), notice: 'Ученик удален.' }\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 @admission_form = AdmissionForm.find(params[:id])\n @admission_form.destroy\n\n respond_to do |format|\n format.html { redirect_to admission_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulario.destroy\n respond_to do |format|\n format.html { redirect_to formularios_url, notice: 'Formulario deletado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t@form = @client.forms.find(params[:id])\n\t\t@form.destroy\n\n\t\trespond_to do |format|\n \t\tformat.js\n \tend\n\tend", "def destroy\n @housing_form = HousingForm.find(params[:id])\n @housing_form.destroy\n\n respond_to do |format|\n format.html { redirect_to housing_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n Field.where(unique_id: params[:unique_id]).destroy_all\n respond_to do |format|\n format.html { redirect_to '/dashboard', notice: 'Form was successfully deleted.' }\n end\n end", "def destroy\n @matrixstorageform.destroy\n respond_to do |format|\n format.html { redirect_to matrixstorageforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formasdepago.destroy\n respond_to do |format|\n format.html { redirect_to formasdepagos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @form_laboratorio.destroy\n respond_to do |format|\n format.html { redirect_to form_laboratorios_url, notice: 'Form laboratorio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @submitted_exam_regis_form.destroy\n respond_to do |format|\n format.html { redirect_to submitted_exam_regis_forms_url, notice: 'Submitted exam regis form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pessel_form.destroy\n respond_to do |format|\n format.html { redirect_to pessel_forms_url, notice: 'Pessel form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pit_form.destroy\n respond_to do |format|\n format.html { redirect_to pit_forms_url, notice: 'Pit form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulary = Formulary.find(params[:id])\n @formulary.destroy\n\n respond_to do |format|\n format.html { redirect_to formularies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pdf_form.destroy\n respond_to do |format|\n format.html { redirect_to pdf_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @matrixproductform.destroy\n respond_to do |format|\n format.html { redirect_to matrixproductforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @form.destroy\n respond_to do |format|\n format.html { redirect_to forms_url, notice: 'Form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pharmaceuticalform.destroy\n respond_to do |format|\n format.html { redirect_to pharmaceuticalforms_url, notice: 'Pharmaceuticalform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formulari.destroy\n respond_to do |format|\n format.html { redirect_to formularis_url, notice: 'Formulari u fshi me sukses.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contract_form.destroy\n respond_to do |format|\n format.html { redirect_to contract_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @form.destroy\n respond_to do |format|\n format.html { redirect_to forms_url, notice: 'Formulario eliminado.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end", "def destroy\n @plataform.destroy\n respond_to do |format|\n format.html { redirect_to plataforms_url, notice: 'Plataform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formapagto.destroy\n respond_to do |format|\n format.html { redirect_to formapagtos_url, notice: 'Forma de pagto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pat_isoform = PatIsoform.find(params[:id])\n @pat_isoform.destroy\n\n respond_to do |format|\n format.html { redirect_to pat_isoforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prospecto.destroy\n respond_to do |format|\n format.html { redirect_to prospectos_url, notice: 'Prospecto eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n @orderform = Orderform.find(params[:id])\n @orderform.destroy\n\n respond_to do |format|\n format.html { redirect_to orderforms_url ,:layout=>\"admin_list\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @form.destroy\n respond_to do |format|\n format.html { redirect_to company_forms_url(@company), notice: 'Form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @form = Form.find(params[:id])\n @form.destroy\n respond_with :admin, @form\n end", "def destroy\n @cec_form = CecForm.find(params[:id])\n @cec_form.destroy\n\n respond_to do |format|\n format.html { redirect_to cec_forms_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @medical_form.destroy\r\n respond_to do |format|\r\n format.html { redirect_to medical_forms_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @inquiry_form = current_site.inquiry_forms.find(params[:id])\n @inquiry_form.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_inquiry_forms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @content_form = ContentForm.find(params[:id])\n @content_form.destroy\n\n respond_to do |format|\n format.html { redirect_to content_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact_form.destroy\n respond_to do |format|\n format.html { redirect_to contact_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @q_data_form = QDataForm.find(params[:id])\n @q_data_form.destroy\n\n respond_to do |format|\n format.html { redirect_to(q_data_forms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @form_chaga.destroy\n respond_to do |format|\n format.html { redirect_to form_chagas_url, notice: 'Form chaga was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @form_anat_citologica.destroy\n respond_to do |format|\n format.html { redirect_to form_anat_citologicas_url, notice: 'Form anat citologica was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @unemployment_form = UnemploymentForm.find(params[:id])\n @unemployment_form.destroy\n\n respond_to do |format|\n format.html { redirect_to unemployment_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @preguntum = Preguntum.find(params[:id])\n @preguntum.destroy\n\n respond_to do |format|\n format.html { redirect_to pregunta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @community_growth_form.destroy\n respond_to do |format|\n format.html { redirect_to community_growth_forms_url, notice: 'Community growth form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @custom_form.destroy\n respond_to do |format|\n format.html { redirect_to custom_forms_url, notice: 'Custom form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @forminfo.destroy\n respond_to do |format|\n format.html { redirect_to forminfos_url, notice: 'Forminfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignarmultiplebeneficio.destroy\n respond_to do |format|\n format.html { redirect_to asignarmultiplebeneficios_url, notice: 'Asignarmultiplebeneficio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignarmultiplebeneficio.destroy\n respond_to do |format|\n format.html { redirect_to asignarmultiplebeneficios_url, notice: 'Asignarmultiplebeneficio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @form_bir.destroy\n respond_to do |format|\n format.html { redirect_to form_birs_url, notice: 'Form bir was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @thing_with_react_form.destroy\n respond_to do |format|\n format.html { redirect_to thing_with_react_forms_url, notice: 'Thing with react form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @event_form = EventForm.find(params[:id])\n @event_form.destroy\n\n respond_to do |format|\n format.html { redirect_to event_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shoeform.destroy\n respond_to do |format|\n format.html { redirect_to shoeforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @forma_entrega = FormaEntrega.find(params[:id])\n @forma_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to forma_entregas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @profilsekolah.destroy\n respond_to do |format|\n format.html { redirect_to profilsekolahs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @forma_contacto.destroy\n respond_to do |format|\n format.html { redirect_to forma_contactos_url, notice: 'Forma Contacto was successfully destroyed.' }\n format.json { head :no_content }\n end\n\n end", "def destroy\n @payment_form.destroy\n respond_to do |format|\n format.html { redirect_to payment_forms_url, notice: 'Payment form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @directorform = Directorform.find(params[:id])\n @directorform.destroy\n\n respond_to do |format|\n format.html { redirect_to directorforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @formarec.destroy\n respond_to do |format|\n format.html { redirect_to formarecs_url, notice: 'Tipo de Recebimento excluido.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @patrocinio = Patrocinio.find(params[:id])\n @patrocinio.destroy\n\n respond_to do |format|\n format.html { redirect_to patrocinios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @job_form.destroy\n respond_to do |format|\n format.html { redirect_to job_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prospecto.destroy\n respond_to do |format|\n format.html { redirect_to prospectos_url, notice: 'Prospecto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @protein_complex = ProteinComplex.find(params[:id])\n @protein_complex.destroy\n\n respond_to do |format|\n format.html { redirect_to protein_complexes_url }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n category = Formulario::REFERENCES_CATEGORY[@formulario.categoria]\n file = File.join(\"#{Formulario::ROUTE_PATH}\",category, @formulario.title)\n FileUtils.rm file\n @formulario.destroy\n respond_to do |format|\n puts \"----------> #{formularios_url}\"\n format.html { redirect_to formularios_url, notice: 'Formulario was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ficheprospect = @prospect.ficheprospects.find(params[:id]) \n @ficheprospect.destroy\n respond_to do |format|\n format.html { redirect_to prospect_ficheprospect_path(@prospect), notice: 'Ficheprospect was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @proforma.destroy\n respond_to do |format|\n format.html { redirect_to proformas_url, notice: 'Proforma was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @form_field.destroy\n respond_to do |format|\n format.html { redirect_to form_fields_url, notice: 'Form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @form = Form.find(params[:id])\n @form.destroy\n\n respond_to do |format|\n format.html { redirect_to(event_client_path(@client, :event_id => @event)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @feedback_form = FeedbackForm.find(params[:id])\n @feedback_form.destroy\n\n respond_to do |format|\n format.html { redirect_to feedback_forms_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 @tbl_form_field.destroy\n respond_to do |format|\n format.html { redirect_to tbl_form_fields_url, notice: 'Tbl form field was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @externalsoform.destroy\n respond_to do |format|\n format.html { redirect_to externalsoforms_url, notice: 'Externalsoform was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @wiki_form = WikiForm.find(params[:id])\n @wiki_form.destroy\n\n respond_to do |format|\n format.html { redirect_to wiki_forms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @isoform = Isoform.find(params[:id])\n @isoform.destroy\n\n respond_to do |format|\n format.html { redirect_to isoforms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prospecto_telefono.destroy\n respond_to do |format|\n format.html { redirect_to prospecto_telefonos_url, notice: 'Prospecto telefono was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @formapagamento.destroy\n respond_to do |format|\n format.html { redirect_to formapagamentos_url, notice: 'Formapagamento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @form_of_receits = FormOfReceipt.find(params[:id])\n @form_of_receit.destroy\n\n respond_to do |format|\n format.html { redirect_to(testes_url) }\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 @question_field = QuestionField.find(params[:id])\n @question_field.destroy\n\n respond_to do |format|\n format.html { redirect_to question_fields_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @hostel_form.destroy\n respond_to do |format|\n format.html { redirect_to hostel_forms_url, notice: 'Hostel form was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @proyecto_minero_exam.destroy\n respond_to do |format|\n format.html { redirect_to proyecto_minero_exams_url, notice: 'Proyecto minero exam 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 @form_factor.destroy\n respond_to do |format|\n format.html { redirect_to form_factors_url, notice: 'Form factor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.72760016", "0.720834", "0.7181126", "0.71731514", "0.7154185", "0.7150297", "0.7143509", "0.71341413", "0.7090525", "0.70640826", "0.7054177", "0.70404845", "0.7016824", "0.7015252", "0.7006958", "0.6993865", "0.69792414", "0.6978846", "0.6977704", "0.69638497", "0.6953685", "0.6949085", "0.69485134", "0.6937044", "0.6917317", "0.6915464", "0.6903495", "0.6892905", "0.6892413", "0.68919766", "0.6872081", "0.6863956", "0.6858276", "0.68445474", "0.6835014", "0.68343043", "0.68339306", "0.68278164", "0.6815739", "0.68048465", "0.6804262", "0.6796478", "0.6795318", "0.67891103", "0.678012", "0.6773283", "0.67712605", "0.6768122", "0.6764759", "0.6750934", "0.675087", "0.67447615", "0.6723235", "0.671601", "0.6715073", "0.67116916", "0.670883", "0.670564", "0.67050266", "0.6704462", "0.6704349", "0.6698868", "0.6697824", "0.6697824", "0.6688311", "0.6685316", "0.6684383", "0.6684167", "0.6682379", "0.6676817", "0.66768014", "0.667128", "0.6669492", "0.6664672", "0.6657928", "0.6657238", "0.6652386", "0.66473967", "0.66437846", "0.6642582", "0.66373396", "0.66337514", "0.6632662", "0.66285485", "0.66244483", "0.6620563", "0.6620278", "0.6619953", "0.66170466", "0.66139776", "0.6607582", "0.6599975", "0.65979856", "0.6597248", "0.6596089", "0.65875226", "0.65816605", "0.65813637", "0.65813637", "0.6580405" ]
0.7256895
1
Use callbacks to share common setup or constraints between actions.
def set_promulher_form @promulher_form = PromulherForm.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 promulher_form_params params.require(:promulher_form).permit(:family_size, :f_children, :m_children, :works) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
serialize the hash into json and save in a cookie add to the responses cookies
def store_flash(res) serialized_flash = @later.to_json res.cookies << WEBrick::Cookie.new("_rails_lite_flash" , serialized_flash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cookie_hash\n\t\t\t{ 'Cookie' => @cookies.to_s }\n\t\tend", "def store_session(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app', @hash.to_json)\n end", "def serialize_into_cookie(record); end", "def encode_to_cookie h, cookie\n cookie[@name] = encode h\n end", "def serialize_from_cookie(*args); end", "def serialize_into_cookie\n [uid, self.remember_token]\n end", "def stash_cookie\n cookies[self.class.els_options['cookie']] = {\n :value => @els_identity.token_id,\n :domain => request.env[\"SERVER_NAME\"],\n :path => '/',\n :expires => Time.now + 24.hours\n }\n end", "def save( response )\n\t\tself.log.debug \"Saving session %s\" % [ self.session_id ]\n\t\tself.class.save_session_data( self.session_id, @hash )\n\t\tself.log.debug \"Adding session cookie to the response.\"\n\n\t\tsession_cookie = Strelka::Cookie.new(\n\t\t\tself.class.cookie_name,\n\t\t\tself.session_id,\n\t\t\tself.class.cookie_options || {}\n\t\t)\n\n\t\tresponse.cookies << session_cookie\n\tend", "def store_session(res)\n my_cookie = WEBrick::Cookie.new('_rails_lite_app', @cookies.to_json)\n res.cookies << my_cookie\n end", "def to_hash\n cookies = {}\n\n @cookies.each do |cookie|\n cookies[cookie.name] = cookie.value\n end\n\n cookies\n end", "def store_session(res)\n cookie = { path: '/', value: @cookie_hash.to_json }\n res.set_cookie(\"_rails_lite_app\", cookie )\n end", "def cookie\n { :value => Crypt.encrypt(cookie_value), :expires => 1.year.from_now }\n end", "def store_session(res)\n res.cookies << WEBrick::Cookie.new(\"_flash\", @flash_hash.to_json)\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @cookie.to_json)\n res.cookies << cookie\n end", "def set_hash_and_json\n @hash = {header: @header, payload: @payload, signature: encode(@signature)}\n @json = \"#{@header.to_json}.#{@payload.to_json}.#{encode(@signature)}\"\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new(\"_rails_lite_flash\", @stuff.to_json)\n cookie.path = \"/\"\n res.cookies << cookie\n end", "def store_session(res)\n res_cookie = WEBrick::Cookie.new(\n \"_rails_lite_app\",\n @value.to_json\n )\n\n res_cookie.path = \"/\"\n res.cookies << res_cookie\n end", "def load_cookie_jar_json(jar, data)\n VkMusic.log.info('cookie_reader') { 'Loading JSON cookies' }\n JSON.parse(data).each_pair do |k, v|\n jar.add(URI('https://m.vk.com'), HTTP::Cookie.new(k, v))\n end\n end", "def store_flash(res)\n update_flash\n res.cookies << WEBrick::Cookie.new(@cookie_key, @cookie.to_json)\n end", "def store_session(response)\n attributes = { path: \"/\", value: @cookie.to_json }\n response.set_cookie(APP_NAME, attributes)\n end", "def cookie_value\n @screen_data.to_json\n end", "def store_session(res)\n attributes = { path: '/', value: @cookie.to_json }\n res.set_cookie('_rails_lite_app', attributes)\n #store_session(response) that will put the session into a cookie\n# and set it using Rack::Response#set_cookie.\n# The first argument to #set_cookie is the name of the cookie which\n# should be _rails_lite_app.\n# The second argument is the cookie attributes. These are merely a hash\n# of path: ..., value: ..., where path is the path where our cookie is\n# available and value is a string. Since we want to pass a collection\n# (our session store) in the cookie, we can serialize our instance\n# variable using JSON. The path should be / (our root url) so the cookie\n# will available at every path.\n# NB: In order for this to work properly, the path and value keys in\n# your hash must be symbols, not strings.\n end", "def store_session(res)\n res.set_cookie(\"_rails_lite_app\", { path: \"/\", value: \"#{@cookie.to_json}\" })\n # p res\n # res[\"_rails_lite_app\"] = @cookie.to_json\n end", "def serialize\n JSON.dump(@hash)\n end", "def store_flash(res)\n chips_ahoy = WEBrick::Cookie.new('_rails_lite_flash', @slow_poke.to_json)\n res.cookies << chips_ahoy\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app', @session.to_json)\n res.cookies << cookie\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @flash_hash.to_json)\n end", "def set_data_in_cookie(data)\n cookies[:merged_response] = {\n :value => data,\n :expires => 1.hour.from_now,\n \n }\n end", "def store_session(res)\n res.set_cookie(@cookie.to_json)\n debugger\n end", "def collect_cookies_from_response; end", "def save_session(r)\n return r if !r.is_a?(Array) || (r.is_a?(Array) && r[0] == -1)\n\n unless @hash.empty?\n data = cipher(:encrypt, Marshal.dump(@hash)) rescue nil\n c = {\n value: data,\n path: '/',\n }\n\n if !@opts[:domain].nil?\n c[:domain] = @opts[:domain]\n elsif @host&.match(%r{^[a-zA-Z]})\n c[:domain] = @host\n end\n\n c[:httponly] = @opts[:http_only] === true\n if @opts.has_key?(:expires)\n c[:expires] = Time.at(Time.now + @opts[:expires])\n end\n\n r[1]['Set-Cookie'] = nil if @opts[:clear_cookies]\n r[1]['Set-Cookie'] = Rack::Utils.add_cookie_to_header(\n r[1]['Set-Cookie'], @opts[:cookie_name], c\n ) unless data.nil?\n end\n\n @cb.call(r) if @cb\n r\n end", "def to_json(*a)\n {\n 'json_class' => self.class.name,\n 'cookies' => to_a.to_json(*a)\n }.to_json(*a)\n end", "def store_session(res)\n res.set_cookie(cookie_key, { value: @cookie.to_json, path: '/' })\n end", "def store_session(res)\n app_crumb = WEBrick::Cookie.new(\"_rails_lite_app\", @session_values.to_json)\n\n res.cookies.concat([app_crumb])\n end", "def decode cookie\n data = cookie[@name].to_s\n return empty_hash if data.empty?\n\n sig, str = data.split '/', 2\n return empty_hash unless str\n\n h = nil\n digest = nil\n begin\n sig = decode64 sig\n digest = @dss.digest str\n if @dsa.sysverify(digest, sig)\n str = @cipher_key ? decipher(str) : decode64(str)\n h = JSON.parse str, JSON_DECODE_OPTS\n end\n ensure\n return empty_hash unless h\n end\n\n if h.is_a?(Session)\n h.instance_variable_set :@init_digest, digest\n h.instance_variable_set :@init_data, data\n h\n else\n empty_hash\n end\n end", "def store_session(res)\n res.set_cookie(:_rails_lite_app, {path:'/', value: @cookie.to_json})\n end", "def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\tend", "def store(fortune_cookie_text)\n hash = msg(fortune_cookie_text)\n puts \"Stored cookie: #{fortune_cookie_text}\"\n puts \"Cookie ID: #{hash}\"\n return hash\n end", "def add_to_cookie_2 (id)\n cookies[:scotids] ? cookies[:scotsids] = JSON.parse(cookies[:scotsids]) << \"#{id}\" : cookies[:scotsids] = JSON.generate([\"#{id}\"])\n end", "def set_cookie\n puts \"hello\"\n # puts @order.as_json\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n puts cookies[:name] = current_admin.name\n puts \"-==-=-=-\"\n puts \"-==-=-=-\"\n end", "def cookies() @_cookies ||= ::Merb::Cookies.new(request.cookies, @_headers) end", "def add_to_cookie key, value\n cookie_hash = get_accesses_cookie\n cookie_hash[key] = value\n cookies[:accesses] = cookie_hash.to_json\n end", "def to_cookie\n unless self.empty?\n data = self.serialize\n value = Merb::Parse.escape \"#{data}--#{generate_digest(data)}\"\n if value.size > MAX\n msg = \"Cookies have limit of 4K. Session contents: #{data.inspect}\"\n Merb.logger.error!(msg)\n raise CookieOverflow, msg\n end\n value\n end\n end", "def create_accesses_cookie\n cookies[:accesses] = {}.to_json\n end", "def cookies(cookies); end", "def cookie_to_mash(headers)\n if headers && headers.is_a?(Faraday::Utils::Headers)\n cookie = headers_to_mash(headers).set_cookie\n if cookie\n sanitized_cookie = cookie.split(/\\;/).map{|x|\n key,value = x.split(\"=\");\n {key.strip.gsub(/\\W/,\"_\").gsub(/^\\_|\\_$/,\"\").to_sym => value.to_s.downcase.strip}\n }\n return sanitized_cookie.reduce Hashie::Mash.new, :merge\n end\n end\n end", "def store_session(res)\n res.set_cookie('_req_room_session', path: '/', value: data.to_json)\n end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def cookie_jar; end", "def hashcookie\n cookies[daw_cookie_name] && Digest::SHA1.hexdigest(cookies[daw_cookie_name])\n end", "def store_flash(res)\n res.cookies << WEBrick::Cookie.new('_rails_lite_app_flash', @persist.to_json)\n end", "def add_cookies(response)\n return unless response.key?('set-cookie')\n response.get_fields('set-cookie').each do |cookie|\n (key, val) = cookie.split('; ')[0].split('=', 2)\n cookies[key] = val\n end\n end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookies; end", "def cookie_jar=(cookie_jar); end", "def add_token_to_cookie(cookies)\n token = SecureRandom.urlsafe_base64()\n @user.update(token: token)\n cookies['token'] = token\n create_return_object()\n end", "def store_session(res)\n cookie = WEBrick::Cookie.new('_flash_rails_lite_app', @flash.to_json)\n res.cookies << cookie\n end", "def store_flash(res)\n cookie = WEBrick::Cookie.new('_rails_lite_app_flash', flash.to_json)\n cookie.path = '/'\n res.cookies << cookie\n end", "def cookie_jar=(_arg0); end", "def cookie_jar=(_arg0); end", "def set_cookies(response)\n cookie_str = response.header['set-cookie']\n return if cookie_str.nil?\n\n fields = cookie_str.split(\"; \").inject({}) { |h, field|\n key, value = field.split(\"=\")\n h[key] = value\n\n h\n }\n\n # This is obviously not a generalized cookie implementation. Heh.\n fields.delete('path')\n @cookies = fields\n end", "def serialize(hash, salt)\n hash + salt\n end", "def cookies\n @cookies ||= (self.headers[:set_cookie] || \"\").split('; ').inject({}) do |out, raw_c|\n key, val = raw_c.split('=')\n unless %w(expires domain path secure).member?(key)\n out[key] = val\n end\n out\n end\n end", "def unmarshal(cookie)\n if cookie.blank?\n {}\n else\n data, digest = Merb::Parse.unescape(cookie).split('--')\n return {} if data.blank? || digest.blank?\n unless digest == generate_digest(data)\n clear\n unless Merb::Config[:ignore_tampered_cookies]\n raise TamperedWithCookie, \"Maybe the site's session_secret_key has changed?\"\n end\n end\n unserialize(data)\n end\n end", "def signature\n Digest::SHA256.hexdigest(@hash.to_json)\n end", "def write_fund_hash(fund_hash)\n File.write(\"save.json\", JSON.generate(fund_hash))\n end", "def create\n @city = City.new(city_params)\n @city.city_hash = generate_unique_hash\n cookies[:city_hash] = @city.city_hash\n cookies[:city_hash] = { :value => @city.city_hash, :expires => 168.hour.from_now }\n\n respond_to do |format|\n if @city.save\n format.html { redirect_to @city, notice: 'City was successfully created.' }\n format.json { render :show, status: :created, location: @city }\n else\n format.html { render :new }\n format.json { render json: @city.errors, status: :unprocessable_entity }\n end\n end\n end", "def cookies\n HTTY::CookiesUtil.cookies_from_string @headers[COOKIES_HEADER_NAME]\n end", "def add_products_to_cookies\n if cookies[:product].blank?\n cookies[:product] = [params[:id]]\n else\n @recently = cookies[:product].split('&').last(8)\n unless @recently.include?(params[:id])\n cookies[:product] = [cookies[:product]] << params[:id]\n end\n end\n\n end", "def get_cookies\n if cookies.signed[:name].present? && cookies.signed[:email].present?\n render json: { allow: true, name: cookies.signed[:name], email: cookies.signed[:email] }\n else\n render json: { allow: false }\n end\n end", "def set_cookie(response)\n\t\ttest_cookie = response.get_fields('set-cookie')\n\n\t\tif @cookie_array.include? test_cookie\n\t\t\t@cookies\n\t\telse\n\t\t\t@cookie_array << test_cookie\n \t\t\t@cookies = @cookie_array.join('; ')\n \t\tend\n\t\t#@cookies = response.get_fields('set-cookie')\n\tend", "def cookies; @cookies ||= CookieJar.new; end", "def jsonify(hash)\n Yajl::Encoder.encode(hash)\n end", "def to_sha(hash)\n # converts a hash to a SHA256\n return Digest::SHA256.hexdigest(JSON.dump(hash))\nend", "def set_cookie(response)\n response.set_cookie(Webmetrics::Config.cookie_name, {\n :value => self.id,\n :path => \"/\",\n :expires => Time.now+Webmetrics::Config.cookie_expiration\n })\n end", "def serialize_from_cookie(*args)\n id, token, generated_at = *args\n\n record = to_adapter.get(id)\n record if record && record.remember_me?(token, generated_at)\n end", "def show\n cookies[:arch_nombre] = { value: @archive.nombre, expires: 10.minutes.from_now }\n cookies[:arch_email] = { value: @archive.email, expires: 10.minutes.from_now }\n cookies[:arch_tel] = { value: @archive.telefono, expires: 10.minutes.from_now }\n end", "def set_api_response_cookie(http_response)\n all_set_cookies = http_response.get_fields('set-cookie')\n return if all_set_cookies.blank?\n\n new_api_cookies = {}\n all_set_cookies.each do |api_cookie|\n api_cookie_elements = api_cookie.split(\"; \")\n cookie_name = ''\n api_cookie_elements.each_with_index do |c_element, i|\n Rails.logger.debug(\"new_api_cookies :: #{c_element.inspect}\")\n c_sub_element = c_element.split('=', 2)\n c_sub_element_key = CGI::unescape(c_sub_element[0])\n c_sub_element_value = CGI::unescape(c_sub_element[1]) if c_sub_element[1].present?\n # Zeroth element is cookie name and value\n if i == 0\n cookie_name = c_sub_element_key\n new_api_cookies[cookie_name] = {value: c_sub_element_value, domain: GlobalConstant::CompanyApi.cookie_domain}\n elsif c_sub_element_key == \"expires\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Time.zone.parse(c_sub_element_value)\n elsif c_sub_element_key == \"domain\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n elsif c_sub_element_key == \"secure\"\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = Rails.env.production?\n elsif c_sub_element_key == \"HttpOnly\"\n new_api_cookies[cookie_name][:http_only] = true\n elsif c_sub_element_key == \"SameSite\"\n new_api_cookies[cookie_name][:same_site] = c_sub_element_value\n else\n new_api_cookies[cookie_name][c_sub_element_key.to_sym] = c_sub_element_value\n end\n\n end\n end\n\n Rails.logger.debug(\"new_api_cookies :: #{new_api_cookies.inspect}\")\n @cookies[GlobalConstant::Cookie.new_api_cookie_key.to_sym] = new_api_cookies\n end", "def sso_cookie_content\n return nil if @current_user.blank?\n\n {\n 'patientIcn' => (@current_user.mhv_icn || @current_user.icn),\n 'mhvCorrelationId' => @current_user.mhv_correlation_id,\n 'signIn' => @current_user.identity.sign_in.deep_transform_keys { |key| key.to_s.camelize(:lower) },\n 'credential_used' => sso_cookie_sign_credential_used,\n 'expirationTime' => @session_object.ttl_in_time.iso8601(0)\n }\n end", "def hash\n [custom_headers, encode_as, name, payload, url].hash\n end", "def cookie_hash_length\n super\n end", "def parse_set_cookie(all_cookies_string)\n cookies = Hash.new\n \n # if all_cookies_string.present?\n # single cookies are devided with comma\n all_cookies_string.split(',').each {\n # @type [String] cookie_string\n |single_cookie_string|\n # parts of single cookie are seperated by semicolon; first part is key and value of this cookie\n # @type [String]\n cookie_part_string = single_cookie_string.strip.split(';')[0]\n # remove whitespaces at beginning and end in place and split at '='\n # @type [Array]\n cookie_part = cookie_part_string.strip.split('=')\n # @type [String]\n key = cookie_part[0]\n # @type [String]\n value = cookie_part[1]\n\n # add cookie to Hash\n cookies[key] = value\n }\n \n cookies\n end", "def store_session(res)\n res.set_cookie\n end", "def store_flash(res)\n res.set_cookie('_rails_lite_app_flash', {path: '/', value: @new_cookie.to_json})\n end", "def store_flash(res)\n cookie = @flash.to_json\n res.set_cookie('_rails_lite_app_flash', cookie)\n end", "def cookie(cookie)\n raise \"No HTTP-session attached to this thread.\" if !_httpsession\n raise \"HTTP-session not active.\" if !_httpsession.resp\n raise \"Not a hash: '#{cookie.class.name}', '#{cookie}'.\" unless cookie.is_a?(Hash)\n _httpsession.resp.cookie(cookie)\n return nil\n end", "def to_h\n {\n data: data,\n nonce: nonce,\n time: time,\n hash: hash,\n index: index,\n prev_hash: prev_hash\n }\n end", "def http_cookie\n http.cookie\n end", "def cookie_content\n @cookie_content ||= parse_cookie\n end", "def cookie_content\n @cookie_content ||= parse_cookie\n end", "def store_flash(res)\n res.set_cookie(\"_rails_lite_app_flash\", {\n path: \"/\",\n value: @flash.to_json\n })\n end", "def hash\n [allow_insecure_certificates, basic_auth, body, body_type, cookies, device_ids, follow_redirects, headers, locations, metadata, public_id, _retry, start_url, variables].hash\n end", "def unmarshal(cookie)\n if cookie\n data, digest = cookie.split('--')\n return {} if data.blank?\n unless digest == generate_digest(data)\n delete\n raise TamperedWithCookie, \"Maybe the site's session_secret_key has changed?\"\n end\n Marshal.load(Base64.decode64(data))\n end\n end" ]
[ "0.7232483", "0.7079436", "0.70458454", "0.69088364", "0.67860115", "0.6538753", "0.6516383", "0.64779174", "0.6469998", "0.643302", "0.6402495", "0.6361502", "0.636", "0.63407034", "0.6339202", "0.63323885", "0.6327872", "0.63275915", "0.629749", "0.62952596", "0.6291643", "0.6252314", "0.62436986", "0.62171793", "0.6215092", "0.6212942", "0.62109303", "0.62076265", "0.6201022", "0.61970025", "0.6191", "0.61889803", "0.6174591", "0.61128205", "0.61075926", "0.6080043", "0.6045012", "0.6008798", "0.6000785", "0.5992238", "0.5981834", "0.5978125", "0.5964963", "0.5964001", "0.5935738", "0.59356415", "0.59306914", "0.58483034", "0.58483034", "0.58483034", "0.58483034", "0.5835443", "0.5818669", "0.58077943", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5796167", "0.5794816", "0.57787037", "0.5777957", "0.57715976", "0.5742014", "0.5742014", "0.5740027", "0.56911445", "0.5629975", "0.5626226", "0.5624343", "0.56158435", "0.5614091", "0.56086624", "0.56050736", "0.5600794", "0.55835646", "0.5580056", "0.55525774", "0.55406666", "0.55384266", "0.55243427", "0.5523828", "0.55194956", "0.55183715", "0.5515784", "0.5484435", "0.548393", "0.5455355", "0.5453349", "0.5447896", "0.54413706", "0.5437751", "0.5436442", "0.5430842", "0.5430842", "0.54289997", "0.54261774", "0.5424427" ]
0.60611534
36
Use callbacks to share common setup or constraints between actions.
def set_post_tag @post_tag = PostTag.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 trusted parameter "white list" through.
def post_tag_params params.fetch(:post_tag, {}) 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
GET /minuts GET /minuts.json
def index @minuts = Minut.joins(:users).where("users.id = ?", current_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end", "def show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\n end\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def index\n @movers = Mover.all\n\n render json: @movers\n end", "def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end", "def show\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metum }\n end\n end", "def msau\n render json: get_msau(@visits)\n end", "def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end", "def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end", "def index\n @ministries = Ministry.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def index\n @minumen = Minuman.all\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end", "def show \n respond_to do |format| \n format.json { render json: @user.as_json(include: {mashups: {}})}\n end\n end", "def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end", "def list\n # if /is route then only show the most popular nut\n if params[:is] then @nuts = Nut.order(\"rating DESC\").where(\"rating > 0\").limit(3).find_all_by_title(params[:title])\n # otherwise show all the nuts for this title\n else @nuts = Nut.order(\"rating DESC\").find_all_by_title(params[:title]) end\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @nuts, include: :user, except: [:user_id, :password_hash, :password_salt] }\n end\n end", "def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def show\n @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stundent }\n end\n end", "def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def index\n @stories = Story.all\n render json: @stories, root: false\n end", "def show\n @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end", "def show\n @museum = Museum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @museum }\n end\n end", "def show\n render json: @stat\n end", "def index\n @cmms = Cmm.all\n render json: @cmms\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 @symptoms = Symptom.all\n\n render json: @symptoms\n end", "def show\n render json: @shelter\n end", "def index\n @unidade_medidas = UnidadeMedida.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unidade_medidas }\n end\n end", "def show\n @mattress = Mattress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mattress }\n end\n end", "def foods_units\n get('/foods/units.json')\n end", "def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end", "def show\n\t\trender json: @url, status: 200\n\tend", "def show\n render json: @promotion\n end", "def show\n render json: @promotion\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def show\n render json: @testmonial\n end", "def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end", "def get_from_mashable\n route = 'http://mashable.com/stories.json'\n raw_response = RestClient.get route\n response = JSON.load raw_response\n response[\"hot\"].map do |story|\n story_hash = {\n title: story[\"title\"],\n score: story[\"shares\"][\"total\"],\n category: story[\"channel\"],\n author: story[\"author\"]\n }\n end\nend", "def show\n @unp = Unp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unp }\n end\n end", "def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end", "def index\n @admin_skills = Admin::Skill.all\n\n render json: @admin_skills\n end", "def index\n @students = Student.all\n render json: @students\n end", "def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end", "def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end", "def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end", "def index\n @municipios = Municipio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @municipios }\n end\n end", "def show\n @sala = Sala.find(params[:id])\n\n render json: @sala, root: \"data\", include: '**', adapter: :json, status: :ok\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 index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end", "def show\n @mineral = Mineral.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mineral }\n end\n end", "def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\n end\n end", "def index\n render json: Story.all\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 @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve_stat_has_manifestation }\n end\n end", "def index\n @skills = Skill.all\n\n render json: @skills\n end", "def index\n categories = Category.all\n render json:categories\n end", "def index\n hash = cookies[:city_hash]\n @city = City.find_by(city_hash: hash)\n @units = @city.units\n\n render json: @units, status: :ok\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def index\n @susu_memberships = SusuMembership.page(params[:page]).per(params[:per])\n\n render json: @susu_memberships\n end", "def show\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end", "def show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end", "def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end", "def index\n weathers = Weather.all\n render json: weathers, status: 200\n end", "def show\n render json: @susu_membership\n end", "def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end", "def show\n @ministerios = Ministerios.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministerios }\n end\n end", "def index\n @mtypes = Mtype.order(:code)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mtypes }\n end\n end", "def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end", "def index\n @recipes = Recipe.all\n render json: @recipes\n end", "def index\n @messies = Messy.all\n\n render json: @messies\n end", "def index\n @sections = Section.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sections }\n end\n end", "def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end", "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministerio }\n end\n end", "def index\n @poms = Pom.all\n\n respond_to do |format|\n # just poms\n format.json { render json: @poms, :except => [:created_at, :updated_at]}\n end\n end", "def index\n @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end", "def index\n short_urls = ShortUrl.paginate(:page => params[:page], :per_page => 30).select(:original_url,:short_url,:user_id,:visits_count)\n user = { email: api_current_user.email, token: api_current_user.api_token } if api_current_user.present?\n render json: { user: user,short_urls: short_urls, status: \"Sucess!!\" }\n end", "def show\n render_json :entry => @set and return\n end", "def show\n render_json :entry => @set and return\n end", "def show\n render json: @admin_skill\n end", "def index\n @study_units = StudyUnit.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @study_units }\n end\n end", "def show\n @shopping_mall = ShoppingMall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shopping_mall }\n end\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def show\n @stat_misc = StatMisc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stat_misc }\n end\n end", "def index\n @undergraduate_majors = UndergraduateMajor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @undergraduate_majors }\n end\n end", "def show\n @mastery_category = MasteryCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mastery_category }\n end\n end", "def index\n @carbon_monoxides = CarbonMonoxide.all\n render json: @carbon_monoxides\n end", "def show\n @user = current_user\n @avatar = @user.avatar\n @count_chest = 0\n @count_monster = 0\n @monsters = []\n @avatarItems = @avatar.inventory.items\n\n @donjon.rooms.each do |r|\n @count_chest += r.chests.count\n @count_monster += r.monsters.count\n r.monsters.each do |monster|\n hydratedMonster = {}\n hydratedMonster[\"id\"] = monster.id\n hydratedMonster[\"name\"] = monster.name\n hydratedMonster[\"hp\"] = monster.hp\n hydratedMonster[\"strong\"] = monster.strong\n hydratedMonster[\"agility\"] = monster.agility\n hydratedMonster[\"exp\"] = monster.exp\n hydratedMonster[\"items\"] = monster.inventory.items.clone()\n hydratedMonster[\"defence\"] = monster.defence\n hydratedMonster[\"gold\"] = monster.gold\n\n @monsters << hydratedMonster\n end\n end\n respond_to do |format|\n format.html\n format.json { render :json => {donjon: @donjon, rooms: @donjon.rooms, monsters: @monsters, avatar: @avatar, avatarItems: @avatarItems} }\n end\n end", "def index\n @stations = Station.all\n\n render json: @stations\n end", "def index\n @ms = Mya.first.to_json(:include => [{\n mybs: {\n :include => {\n :mycs => {\n :include => [:myds, :myes]\n }\n }\n }\n }\n ])\n render json: @ms\n end", "def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end", "def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end", "def show\n @manpack = Manpack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manpack }\n end\n end", "def index\n @grupoassuntos = Grupoassunto.all\n\n render json: @grupoassuntos\n end", "def index\n @jsons = Json.all\n end", "def index\n @reserve_stat_has_manifestations = ReserveStatHasManifestation.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @reserve_stat_has_manifestations }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end" ]
[ "0.6410871", "0.6312887", "0.62972283", "0.6230961", "0.60910964", "0.6053777", "0.5992761", "0.5978026", "0.59486645", "0.59478074", "0.5918123", "0.5911583", "0.5909336", "0.58867455", "0.5876364", "0.5864731", "0.58595914", "0.58544225", "0.5841103", "0.58241785", "0.58108485", "0.5805968", "0.57948023", "0.57917184", "0.57865554", "0.5780247", "0.57771474", "0.5769636", "0.5755912", "0.57518905", "0.57505673", "0.5740853", "0.57347125", "0.57309747", "0.5717873", "0.5717873", "0.57153726", "0.5709326", "0.5708854", "0.56956565", "0.5690193", "0.5688836", "0.56882775", "0.5687785", "0.56838083", "0.5683551", "0.56823176", "0.5676982", "0.5660934", "0.5657704", "0.5657658", "0.56573546", "0.5656639", "0.56516457", "0.5647318", "0.5638276", "0.5636255", "0.5633915", "0.5628134", "0.5623833", "0.5623606", "0.56226337", "0.561124", "0.55963165", "0.55927885", "0.5586538", "0.5583044", "0.558123", "0.55776703", "0.55712277", "0.5569913", "0.5569218", "0.55679053", "0.55642587", "0.5552635", "0.55513495", "0.5544437", "0.5544336", "0.5540685", "0.5539001", "0.55327356", "0.55327356", "0.5529987", "0.5528648", "0.55268896", "0.55264354", "0.55249554", "0.5523154", "0.5521529", "0.55214155", "0.5518664", "0.5518065", "0.55167764", "0.55156475", "0.55115485", "0.55104375", "0.5510104", "0.55093026", "0.5508066", "0.55069995" ]
0.57781523
26
GET /minuts/1 GET /minuts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ministerio }\n end\n end", "def show\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @minicurso }\n end\n end", "def index\n @minicursos = Minicurso.all\n\t\t#@minicursos = Minicurso.scoped\n\t\t#@users = Minicurso.inscritos(params[:id]) if params[:id].present?\n\n respond_to do |format|\n\t\t\t format.html # index.html.erb\n\t\t\t format.json { render json: @minicursos }\n end\n end", "def show\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uset }\n end\n end", "def show\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallmission }\n end\n end", "def show\n @metum = Metum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @metum }\n end\n end", "def index\n render json: {\n status: :success,\n urls: ShortUrl::top_100\n }\n end", "def show\n @sm = Sm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sm }\n end\n end", "def show\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmalltrial }\n end\n end", "def show\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microposst }\n end\n end", "def index\n @shorties = Shorty.per_user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorties }\n end\n end", "def index\n @movers = Mover.all\n\n render json: @movers\n end", "def index\n @ministries = Ministry.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def show\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @momsg }\n end\n end", "def show\n @mattress = Mattress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mattress }\n end\n end", "def show\n @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministries }\n end\n end", "def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end", "def show\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mi }\n end\n end", "def msau\n render json: get_msau(@visits)\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 show\n @ministerios = Ministerios.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministerios }\n end\n end", "def index\n @minumen = Minuman.all\n end", "def show\n @moresmallmobsquad = Moresmallmobsquad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moresmallmobsquad }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def index\n @mugshots = Mugshot.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mugshots }\n end\n end", "def show\n @mineral = Mineral.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mineral }\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 @stundent = Stundent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stundent }\n end\n end", "def show\n @u_ser = USer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @u_ser }\n end\n end", "def show\n render json: @stat\n end", "def show\n @stat_misc = StatMisc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stat_misc }\n end\n end", "def show\n @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smallmap }\n end\n end", "def show\n @smurf = Smurf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @smurf }\n end\n end", "def show\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministerio }\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 @unp = Unp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unp }\n end\n end", "def show\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @microplst }\n end\n end", "def show\n @museum = Museum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @museum }\n end\n end", "def show\n @mostsmallresource = Mostsmallresource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallresource }\n end\n end", "def show\n #@my_ministry = MyMinistry.find(params[:id])\n @coworker = Coworker.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @my_ministry }\n end\n end", "def show\n @mencion = Mencion.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mencion }\n end\n end", "def show\n @mall = Mall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mall }\n end\n end", "def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end", "def new\n @ministerio = Ministerio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ministerio }\n end\n end", "def show\n @mini_pago = MiniPago.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mini_pago }\n end\n end", "def show\n @mill = Mill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mill }\n end\n end", "def show\n @shorter = Shorter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @shorter }\n end\n end", "def show\n render json: @shelter\n end", "def show\n @medium_mission = MediumMission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @medium_mission }\n end\n end", "def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end", "def list\n # if /is route then only show the most popular nut\n if params[:is] then @nuts = Nut.order(\"rating DESC\").where(\"rating > 0\").limit(3).find_all_by_title(params[:title])\n # otherwise show all the nuts for this title\n else @nuts = Nut.order(\"rating DESC\").find_all_by_title(params[:title]) end\n\n respond_to do |format|\n format.html # list.html.erb\n format.json { render json: @nuts, include: :user, except: [:user_id, :password_hash, :password_salt] }\n end\n end", "def show\n @mrj = Mrj.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mrj }\n end\n end", "def show\n\t\trender json: @url, status: 200\n\tend", "def show\n @sala = Sala.find(params[:id])\n\n render json: @sala, root: \"data\", include: '**', adapter: :json, status: :ok\n end", "def show\n @missionmaker = Missionmaker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @missionmaker }\n end\n end", "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mission }\n end\n end", "def show\n @materia = Materia.find(params[:id])\n\n render json: @materia\n end", "def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @stat }\n end\n end", "def show\n @stat = Stat.find(params[:id])\n\n respond_to do |format|\n format.html { render \"show\" }\n format.json { render json: @stat }\n end\n end", "def show\n @mercado_metum = MercadoMetum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mercado_metum }\n end\n end", "def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end", "def index\n @symptoms = Symptom.all\n\n render json: @symptoms\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @reserve_stat_has_manifestation }\n end\n end", "def show\n @uchronist = Uchronist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @uchronist }\n end\n end", "def show\n @jm_verse = JmVerse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @jm_verse }\n end\n end", "def show\n if not @mission = Mission.find(params[:id])\n render json: \"Mission not found for id: \" + params[:id]\n else\n respond_to do |format|\n format.json { render json: @mission }\n format.xml { render xml: @mission }\n end\n end\n end", "def show\n render json: @testmonial\n end", "def show\n @statuspagamento = Statuspagamentoe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @statuspagamento }\n end\n end", "def show\n @shichoson = Shichoson.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shichoson }\n end\n end", "def show\n @optimu = Optimu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @optimu }\n end\n end", "def index\n @mini_games = MiniGame.all\n render json: @mini_games, status: :ok\n end", "def index\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { @url_shorts = UrlShort.all }\n end\n end", "def show\n @unit = Unit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def show\n @unit = Unit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def show\n @unit = Unit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def show\n @mission = Mission.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @mission }\n end\n end", "def index\n @stories = Story.all\n render json: @stories, root: false\n end", "def new\n @minicurso = Minicurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @minicurso }\n end\n end", "def show\n @ministry = Ministry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ministry }\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 story = Story.find(params[:id])\n render json: story\n end", "def index\n @usages = get_usages\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @usages }\n end\n end", "def show\n @unit = Unit.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unit }\n end\n end", "def index\n @minuts = Minut.joins(:users).where(\"users.id = ?\", current_user)\n end", "def show\n @mostsmallskillcategory = Mostsmallskillcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallskillcategory }\n end\n end", "def get_monster_info\n monster_string = RestClient.get('http://www.dnd5eapi.co/api/monsters/')\n monster_hash = JSON.parse(monster_string)\n monster_info = monster_hash[\"results\"]\n monster_info\nend", "def show\n @sitio = Sitio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio }\n end\n end", "def new\n @my_ministry = MyMinistry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @my_ministry }\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 show\n @mostsmallskill = Mostsmallskill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallskill }\n end\n end", "def index\n render json: Story.all\n end", "def show\n @mtype = Mtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mtype }\n end\n end", "def show\n @manpack = Manpack.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @manpack }\n end\n end", "def show\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @unidade_metrica }\n end\n end", "def index\n @requests = Request.all\n\n render json: @requests\n end", "def show\n @nvs_mig_status = NvsMigStatus.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nvs_mig_status }\n end\n end", "def index\n @susu_memberships = SusuMembership.page(params[:page]).per(params[:per])\n\n render json: @susu_memberships\n end", "def show\n @mostsmallitemcategory = Mostsmallitemcategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mostsmallitemcategory }\n end\n end", "def show\n @metric = Metric.find(params[:id])\n\n render json: @metric\n end", "def index\n @shop = Shop.find(1)\n render :json => @shop\n return\n end", "def show\n @shortener = Shortener.find(params[:id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shorteners }\n end\n end" ]
[ "0.668309", "0.64907336", "0.6230573", "0.61786985", "0.61763036", "0.6167411", "0.6089131", "0.6071402", "0.6068066", "0.6031913", "0.60002184", "0.5993631", "0.59558696", "0.5953275", "0.59485024", "0.5946205", "0.5945761", "0.5934396", "0.5930904", "0.5915597", "0.59039146", "0.5893929", "0.5886934", "0.58831364", "0.58802205", "0.5869366", "0.58606756", "0.58548754", "0.5844945", "0.58438545", "0.58428663", "0.58385134", "0.5838245", "0.5837231", "0.583676", "0.58123386", "0.58111495", "0.5808206", "0.5807838", "0.57963544", "0.57762027", "0.5774128", "0.57407236", "0.5735716", "0.5732807", "0.57314724", "0.5727419", "0.5723552", "0.57219934", "0.5714885", "0.5711096", "0.57030886", "0.5698523", "0.5696422", "0.5688837", "0.568715", "0.56767786", "0.56761265", "0.56753415", "0.5674468", "0.5673266", "0.5671062", "0.56703025", "0.5669178", "0.56689674", "0.56639886", "0.56607044", "0.566011", "0.5659178", "0.5657496", "0.565511", "0.5654722", "0.56536955", "0.56536955", "0.56536955", "0.56478274", "0.56472474", "0.56435275", "0.56381994", "0.5635914", "0.5634897", "0.56305575", "0.5629131", "0.56251675", "0.5623447", "0.5621753", "0.5617063", "0.56158215", "0.56139076", "0.5609585", "0.5608677", "0.56075", "0.5603963", "0.5603683", "0.56015736", "0.56009865", "0.56007695", "0.55986196", "0.5594183", "0.5593508", "0.5585837" ]
0.0
-1
POST /minuts POST /minuts.json
def create @minut = Minut.new(minut_params) @minut = Minut.new(minut_params) user_id = params[:minut][:id] if user_id user = User.find(user_id) # 権限情報追加(本人) @minut.users << user end user = User.find(current_user) # 権限情報追加(選択分) @minut.users << user @users = User.where.not("id = ?", current_user) respond_to do |format| if @minut.save format.html { redirect_to @minut, notice: 'Minut was successfully created.' } format.json { render :show, status: :created, location: @minut } else format.html { render :new } format.json { render json: @minut.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @minicurso = Minicurso.new(params[:minicurso])\n\n respond_to do |format|\n if @minicurso.save\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully created.' }\n format.json { render json: @minicurso, status: :created, location: @minicurso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ministerio = Ministerio.new(params[:ministerio])\n\n respond_to do |format|\n if @ministerio.save\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully created.' }\n format.json { render json: @ministerio, status: :created, location: @ministerio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def POST; end", "def create\n @ministries = Ministries.new(params[:ministries])\n\n respond_to do |format|\n if @ministries.save\n flash[:notice] = 'Ministries was successfully created.'\n format.html { redirect_to(@ministries) }\n format.xml { render :xml => @ministries, :status => :created, :location => @ministries }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ministries.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @minister = Minister.new(minister_params)\n\n respond_to do |format|\n if @minister.save\n format.html { redirect_to @minister, notice: 'Minister was successfully created.' }\n format.json { render :show, status: :created, location: @minister }\n else\n format.html { render :new }\n format.json { render json: @minister.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minuman = Minuman.new(minuman_params)\n\n respond_to do |format|\n if @minuman.save\n format.html { redirect_to @minuman, notice: 'Minuman was successfully created.' }\n format.json { render :show, status: :created, location: @minuman }\n else\n format.html { render :new }\n format.json { render json: @minuman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minnpaku = Minnpaku.new(minnpaku_params)\n\n respond_to do |format|\n if @minnpaku.save\n format.html { redirect_to @minnpaku, notice: 'Minnpaku was successfully created.' }\n format.json { render :show, status: :created, location: @minnpaku }\n else\n format.html { render :new }\n format.json { render json: @minnpaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n post_params = {\n name: params[:name].downcase,\n units: params[:units] || 0\n }\n render json: Ingredient.create!(post_params), status: :created\n end", "def create\n @minisound = Minisound.new(minisound_params)\n\n respond_to do |format|\n if @minisound.save\n format.html { redirect_to @minisound, notice: 'Minisound was successfully created.' }\n format.json { render :show, status: :created, location: @minisound }\n else\n format.html { render :new }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @setum = Setum.new(setum_params)\n\n respond_to do |format|\n if @setum.save\n format.html { redirect_to @setum, notice: 'Setum was successfully created.' }\n format.json { render :show, status: :created, location: @setum }\n else\n format.html { render :new }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sitemenu = Sitemenu.new(sitemenu_params)\n\n respond_to do |format|\n if @sitemenu.save\n format.html { redirect_to @sitemenu, notice: 'sitemenu was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @sitemenu }\n format.json { render :json => @sitemenu}\n else\n format.html { render action: 'new' }\n #format.json { render json: @sitemenu.errors, status: :unprocessable_entity }\n format.json { render :json => {:errors => @sitemenu.errors.full_messages.join(',')} } \n end\n end\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def create\n @testmonial = Testmonial.new(testmonial_params)\n\n if @testmonial.save\n render json: @testmonial, status: :created\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def create\n @test_metum = TestMetum.new(test_metum_params)\n\n respond_to do |format|\n if @test_metum.save\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @test_metum }\n else\n format.html { render action: 'new' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @sivic_ministerio = SivicMinisterio.new(sivic_ministerio_params)\r\n\r\n respond_to do |format|\r\n if @sivic_ministerio.save\r\n format.html { redirect_to @sivic_ministerio, notice: 'Registro inserido com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_ministerio }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def minut_params\n params.require(:minut).permit(:title, :body, authors_attributes: [:minut_id, :user_id])\n end", "def create\n @municao = Municao.new(municao_params)\n\n respond_to do |format|\n if @municao.save\n format.html { redirect_to @municao, notice: 'A Munição foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @municao }\n else\n format.html { render :new }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ministerio = Ministerio.new(params[:ministerio])\n\n respond_to do |format|\n if @ministerio.save\n format.html { redirect_to(@ministerio, :notice => 'Ministerio was successfully created.') }\n format.xml { render :xml => @ministerio, :status => :created, :location => @ministerio }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ministerio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ministrante = Ministrante.new(ministrante_params)\n\n respond_to do |format|\n if @ministrante.save\n format.html { redirect_to @ministrante, notice: 'Ministrante was successfully created.' }\n format.json { render :show, status: :created, location: @ministrante }\n else\n format.html { render :new }\n format.json { render json: @ministrante.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minipost = Minipost.new(minipost_params)\n\n respond_to do |format|\n if @minipost.save\n format.html { redirect_to @minipost, notice: 'Minipost was successfully created.' }\n format.json { render :show, status: :created, location: @minipost }\n else\n format.html { render :new }\n format.json { render json: @minipost.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_promos(to_hash) #WONT BE USED AS OF NOW\n end", "def create\n @metum = Metum.new(params[:metum])\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render json: @metum, status: :created, location: @metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sifat_surat_masuk = SifatSuratMasuk.new(sifat_surat_masuk_params)\n\n respond_to do |format|\n if @sifat_surat_masuk.save\n format.html { redirect_to @sifat_surat_masuk, notice: 'Sifat surat masuk was successfully created.' }\n format.json { render :show, status: :created, location: @sifat_surat_masuk }\n else\n format.html { render :new }\n format.json { render json: @sifat_surat_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @metum = Metum.new(metum_params)\n\n respond_to do |format|\n if @metum.save\n format.html { redirect_to @metum, notice: 'Metum was successfully created.' }\n format.json { render action: 'show', status: :created, location: @metum }\n else\n format.html { render action: 'new' }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mata_matum = MataMatum.new(mata_matum_params)\n\n respond_to do |format|\n if @mata_matum.save\n format.html { redirect_to @mata_matum, notice: 'Mata matum was successfully created.' }\n format.json { render :show, status: :created, location: @mata_matum }\n else\n format.html { render :new }\n format.json { render json: @mata_matum.errors, status: :unprocessable_entity }\n end\n end\n end", "def json_post\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n puts \"json_post: submitting #{params[:path]}\" if @@debug\n path = params[:path]\n if path\n puts \"json_post: path is #{path} l=#{path.length}\" if @@debug\n path = path.split('/').compact()\n path.delete('')\n # you cannot make rooted nodes via json atm... fix? xxx\n if path.length > 1\n name = path.pop\n nodes = Note.make_path @user,path\n puts \"json_post: making at path #{path.join('/')}\" if @@debug\n if nodes\n note = nodes.last.make_child @user,params,name\n puts \"json_post: made child #{note} from #{name} l=#{name.length}\"\n params[:path] = path.join('/') # for call to json_query\n # it is important to do a query rather than returning the note; to get freshest order\n json_query\n return\n #write_json note if note\n end\n end\n end\n render :nothing => true\n end", "def create\n @uang_masuk = UangMasuk.new(uang_masuk_params)\n\n respond_to do |format|\n if @uang_masuk.save\n format.html { redirect_to uang_masuks_path, notice: 'Uang masuk was successfully created.' }\n else\n format.html { render :new }\n format.json { render json: @uang_masuk.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n resource.post(request, response)\n end", "def create\n @jamaat = Jamaat.new(params[:jamaat])\n\n respond_to do |format|\n if @jamaat.save\n format.html { redirect_to @jamaat, notice: 'Jamaat was successfully created.' }\n format.json { render json: @jamaat, status: :created, location: @jamaat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @jamaat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kontoumsatz = Kontoumsatz.new(kontoumsatz_params)\n\n respond_to do |format|\n if @kontoumsatz.save\n format.html { redirect_to @kontoumsatz, notice: 'Kontoumsatz was successfully created.' }\n format.json { render :show, status: :created, location: @kontoumsatz }\n else\n format.html { render :new }\n format.json { render json: @kontoumsatz.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mdistantmetastasi = Mdistantmetastasi.new(mdistantmetastasi_params)\n\n respond_to do |format|\n if @mdistantmetastasi.save\n format.html { redirect_to @mdistantmetastasi, notice: 'Mdistantmetastasi was successfully created.' }\n format.json { render :show, status: :created, location: @mdistantmetastasi }\n else\n format.html { render :new }\n format.json { render json: @mdistantmetastasi.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(request)\n # sure thing!\n json_response(200, { message: \"This dummy POST endpoint didn't do anything.\" })\n end", "def create\n @crew_mun = Crew::Mun.new(crew_mun_params)\n\n respond_to do |format|\n if @crew_mun.save\n format.html { redirect_to @crew_mun, notice: 'Mun was successfully created.' }\n format.json { render :show, status: :created, location: @crew_mun }\n else\n format.html { render :new }\n format.json { render json: @crew_mun.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ministerios = Ministerios.new(params[:ministerios])\n @title = \"Cadastro de Ministério\"\n respond_to do |format|\n if @ministerios.save\n Ministerios.update(@ministerios.id, :respcad => self.current_usuarios.login.upcase)\n \tflash[:notice] = 'Ministerios was successfully created.'\n format.html { redirect_to(ministerios_path) }\n format.xml { render :xml => @ministerios, :status => :created, :location => @ministerios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ministerios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @uset = Uset.new(params[:uset])\n\n respond_to do |format|\n if @uset.save\n format.html { redirect_to @uset, notice: 'Uset was successfully created.' }\n format.json { render json: @uset, status: :created, location: @uset }\n else\n format.html { render action: \"new\" }\n format.json { render json: @uset.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 @site_mst = SiteMst.new(site_mst_params)\n\n respond_to do |format|\n if @site_mst.save\n format.html { redirect_to @site_mst, notice: 'Site mst was successfully created.' }\n format.json { render :show, status: :created, location: @site_mst }\n else\n format.html { render :new }\n format.json { render json: @site_mst.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @manteni = Manteni.new(manteni_params)\n\n respond_to do |format|\n if @manteni.save\n format.html { redirect_to @manteni, notice: 'Manteni was successfully created.' }\n format.json { render :show, status: :created, location: @manteni }\n else\n format.html { render :new }\n format.json { render json: @manteni.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mattress = Mattress.new(params[:mattress])\n\n respond_to do |format|\n if @mattress.save\n format.html { redirect_to [:admin, @mattress], notice: 'Mattress was successfully created.' }\n format.json { render json: @mattress, status: :created, location: @mattress }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mattress.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turistum = Turistum.new(turistum_params)\n\n respond_to do |format|\n if @turistum.save\n format.html { redirect_to @turistum, notice: 'Turistum was successfully created.' }\n format.json { render :show, status: :created, location: @turistum }\n else\n format.html { render :new }\n format.json { render json: @turistum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @promotion = Promotion.new(promotion_params)\n\n if @promotion.save\n render json: @promotion, status: :created, location: @promotion\n else\n render json: @promotion.errors, status: :unprocessable_entity\n end\n end", "def create\n render json: Post.create(params[\"post\"])\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def create\n @muneco = Muneco.new(muneco_params)\n\n respond_to do |format|\n if @muneco.save\n format.html { redirect_to @muneco, notice: 'Muneco was successfully created.' }\n format.json { render :show, status: :created, location: @muneco }\n else\n format.html { render :new }\n format.json { render json: @muneco.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(action, **args); end", "def api_post(action, data)\n api_request(action, data, 'POST')\n end", "def create\n @microposst = Microposst.new(params[:microposst])\n\n respond_to do |format|\n if @microposst.save\n format.html { redirect_to @microposst, notice: 'Microposst was successfully created.' }\n format.json { render json: @microposst, status: :created, location: @microposst }\n else\n format.html { render action: \"new\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stundent = Stundent.new(params[:stundent])\n\n respond_to do |format|\n if @stundent.save\n format.html { redirect_to @stundent, notice: 'Stundent was successfully created.' }\n format.json { render json: @stundent, status: :created, location: @stundent }\n else\n format.html { render action: \"new\" }\n format.json { render json: @stundent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @micropst = Micropst.new(micropst_params)\n\n respond_to do |format|\n if @micropst.save\n format.html { redirect_to @micropst, notice: \"Micropst was successfully created.\" }\n format.json { render :show, status: :created, location: @micropst }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @micropst.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @moresmalltrial = Moresmalltrial.new(params[:moresmalltrial])\n\n respond_to do |format|\n if @moresmalltrial.save\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully created.' }\n format.json { render json: @moresmalltrial, status: :created, location: @moresmalltrial }\n else\n format.html { render action: \"new\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def create\n\n @mascotum = Mascotum.new(mascotum_params)\n\n respond_to do |format|\n if @mascotum.save\n format.html { redirect_to @mascotum, notice: 'Mascotum was successfully created.' }\n format.json { render :show, status: :created, location: @mascotum }\n else\n format.html { render :new }\n format.json { render json: @mascotum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @soil_moisture = SoilMoisture.new(soil_moisture_params)\n\n respond_to do |format|\n if @soil_moisture.save\n format.html { redirect_to @soil_moisture, notice: 'Soil moisture was successfully created.' }\n format.json { render :show, status: :created, location: @soil_moisture }\n else\n format.html { render :new }\n format.json { render json: @soil_moisture.errors, status: :unprocessable_entity }\n end\n end\n end", "def minnpaku_params\n params.require(:minnpaku).permit(:name, :body, :image, :price, :performance, :smoke,\n :style, :provide, :please, :review, :latitude, :longitude)\n end", "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n @maquinat = Maquinat.new(maquinat_params)\n\n respond_to do |format|\n if @maquinat.save\n format.html { redirect_to @maquinat, notice: 'Maquinat was successfully created.' }\n format.json { render :show, status: :created, location: @maquinat }\n else\n format.html { render :new }\n format.json { render json: @maquinat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @sivic_turma = SivicTurma.new(sivic_turma_params)\r\n\r\n respond_to do |format|\r\n if @sivic_turma.save\r\n format.html { redirect_to @sivic_turma, notice: 'Registro inserido com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_turma }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_turma.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n params.permit(:intituleSondage, :descriptionSondage, :categorie_id, :administrateur_id)\n ajout = SondageService.instance.creerNouveauSondage(params[:intituleSondage], params[:descriptionSondage], params[:categorie_id], params[:administrateur_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\nend", "def create\n @immunization = Immunization.new(immunization_params)\n\n respond_to do |format|\n if @immunization.save\n format.html { redirect_to @immunization, notice: 'Immunization was successfully created.' }\n format.json { render :show, status: :created, location: @immunization }\n else\n format.html { render :new }\n format.json { render json: @immunization.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tack = Tack.new(tack_params)\n\n if @tack.save\n render json: @tack, status: :created, location: @tack\n else\n render json: @tack.errors, status: :unprocessable_entity\n end\n end", "def create\n @optimu = Optimu.new(params[:optimu])\n\n respond_to do |format|\n if @optimu.save\n format.html { redirect_to @optimu, notice: 'Optimu was successfully created.' }\n format.json { render json: @optimu, status: :created, location: @optimu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optimu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shujukujiaoben = Shujukujiaoben.new(shujukujiaoben_params)\n\n respond_to do |format|\n if @shujukujiaoben.save\n format.html { redirect_to @shujukujiaoben, notice: 'Shujukujiaoben was successfully created.' }\n format.json { render :show, status: :created, location: @shujukujiaoben }\n else\n format.html { render :new }\n format.json { render json: @shujukujiaoben.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gtw_smu = GtwSmu.new(gtw_smu_params)\n\n respond_to do |format|\n if @gtw_smu.save\n format.html { redirect_to @gtw_smu, notice: 'Gtw smu was successfully created.' }\n format.json { render :show, status: :created, location: @gtw_smu }\n else\n format.html { render :new }\n format.json { render json: @gtw_smu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unit_action = UnitAction.new(unit_action_params)\n\n respond_to do |format|\n if @unit_action.save\n format.html { redirect_to @unit_action, notice: 'Unit action was successfully created.' }\n format.json { render :show, status: :created, location: @unit_action }\n else\n format.html { render :new }\n format.json { render json: @unit_action.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @tossup = tossup.new(tossup_params)\n #\n # if @tossup.save\n # render :show, status: :created, location: @tossup\n # else\n # render json: @tossup.errors, status: :unprocessable_entity\n # end\n end", "def create\n # @tossup = tossup.new(tossup_params)\n #\n # if @tossup.save\n # render :show, status: :created, location: @tossup\n # else\n # render json: @tossup.errors, status: :unprocessable_entity\n # end\n end", "def create\n @mini_pago = MiniPago.new(params[:mini_pago])\n\n respond_to do |format|\n if @mini_pago.save\n format.html { redirect_to @mini_pago, notice: 'Mini pago was successfully created.' }\n format.json { render json: @mini_pago, status: :created, location: @mini_pago }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mini_pago.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 @unp = Unp.new(params[:unp])\n\n respond_to do |format|\n if @unp.save\n format.html { redirect_to @unp, notice: 'Unp was successfully created.' }\n format.json { render json: @unp, status: :created, location: @unp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unp.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @kontum = Kontum.new(kontum_params)\n\n respond_to do |format|\n if @kontum.save\n format.html { redirect_to @kontum, notice: 'Kontum was successfully created.' }\n format.json { render :show, status: :created, location: @kontum }\n else\n format.html { render :new }\n format.json { render json: @kontum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @swm = Swm.new(swm_params)\n\n respond_to do |format|\n if @swm.save\n format.html { redirect_to @swm, notice: 'Swm was successfully created.' }\n format.json { render :show, status: :created, location: @swm }\n else\n format.html { render :new }\n format.json { render json: @swm.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stilage = Stilage.new(stilage_params)\n respond_to do |format|\n if @stilage.save\n format.html { redirect_to @stilage, notice: 'Stilage was successfully created.' }\n format.json { render :show, status: :created, location: @stilage }\n else\n format.html { render :new }\n format.json { render json: @stilage.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mostsmallmission = Mostsmallmission.new(params[:mostsmallmission])\n\n respond_to do |format|\n if @mostsmallmission.save\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully created.' }\n format.json { render json: @mostsmallmission, status: :created, location: @mostsmallmission }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @jusho = Jusho.new(jusho_params)\n\n respond_to do |format|\n if @jusho.save\n format.html { redirect_to @jusho, notice: 'Jusho was successfully created.' }\n format.json { render :show, status: :created, location: @jusho }\n else\n format.html { render :new }\n format.json { render json: @jusho.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @juntum_usuario = JuntumUsuario.new(juntum_usuario_params)\n\n respond_to do |format|\n if @juntum_usuario.save\n format.html { redirect_to @juntum_usuario, notice: 'Juntum usuario was successfully created.' }\n format.json { render :show, status: :created, location: @juntum_usuario }\n else\n format.html { render :new }\n format.json { render json: @juntum_usuario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @moussaillon = Moussaillon.new(moussaillon_params)\n\n respond_to do |format|\n if @moussaillon.save\n format.html { redirect_to @moussaillon, notice: 'Moussaillon was successfully created.' }\n format.json { render :show, status: :created, location: @moussaillon }\n else\n format.html { render :new }\n format.json { render json: @moussaillon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @u_ser = USer.new(params[:u_ser])\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render json: @u_ser, status: :created, location: @u_ser }\n else\n format.html { render action: \"new\" }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def post; end", "def create\n @mercado_metum = MercadoMetum.new(params[:mercado_metum])\n\n respond_to do |format|\n if @mercado_metum.save\n format.html { redirect_to @mercado_metum, notice: 'Mercado metum was successfully created.' }\n format.json { render json: @mercado_metum, status: :created, location: @mercado_metum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mercado_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @schooladmin = Schooladmin.new(schooladmin_params)\n\n respond_to do |format|\n if @schooladmin.save\n format.html { redirect_to @schooladmin, notice: 'Schooladmin was successfully created.' }\n format.json { render :show, status: :created, location: @schooladmin }\n else\n format.html { render :new }\n format.json { render json: @schooladmin.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\r\n end", "def create\n p \"## TESTE #\" \n @mural_post = MuralPost.new( user_id: params[:user_id], \n latitude: params[:latitude], \n longitude: params[:longitude], \n message: params[:message],\n anonymous: params[:anonymous]\n )\n \n respond_to do |format|\n if @mural_post.save\n format.html { redirect_to @mural_post, notice: 'Mural post was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mural_post }\n else\n p \"## ERRO #\" \n format.html { render action: 'new' }\n format.json { render json: @mural_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mestre = Mestre.new(mestre_params)\n\n respond_to do |format|\n if @mestre.save\n format.html { redirect_to @mestre, notice: 'Mestre was successfully created.' }\n format.json { render :show, status: :created, location: @mestre }\n else\n format.html { render :new }\n format.json { render json: @mestre.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @stone = Stone.new(stone_params)\n\n \n if @stone.save\n respond_with @stone\n else\n render json: @stone.errors, status: :unprocessable_entity \n end\n \n \n end", "def create\n @schmo = Schmo.new(schmo_params)\n\n respond_to do |format|\n if @schmo.save\n format.html { redirect_to @schmo, notice: 'Schmo was successfully created.' }\n format.json { render :show, status: :created, location: @schmo }\n else\n format.html { render :new }\n format.json { render json: @schmo.errors, status: :unprocessable_entity }\n end\n end\n end", "def post()\n # construct arguments to fetch\n args = {\n method: 'post',\n credentials: 'include',\n headers: {'Content-Type' => 'application/json'},\n body: {\n project: @ppmc.id,\n ids: @ppmc.mentors.join(','),\n action: 'add',\n targets: ['ldap', 'ppmc', 'committer']\n }.inspect\n }\n\n @disabled = true\n Polyfill.require(%w(Promise fetch)) do\n @create_disabled = true\n fetch(\"actions/ppmc\", args).then {|response|\n content_type = response.headers.get('content-type') || ''\n if response.status == 200 and content_type.include? 'json'\n response.json().then do |json|\n self.update(json)\n end\n else\n alert \"#{response.status} #{response.statusText}\"\n end\n @create_disabled = false\n }.catch {|error|\n alert error\n @create_disabled = false\n }\n end\n end", "def create\n megam_rest.post_appdefn(to_hash)\n end", "def create\n # services / get_nutrients.rb\n fetched_params = GetNutrients.new(params[:marmiton_url]).perform\n puts fetched_params\n @recipe = Recipe.new(fetched_params)\n respond_to do |format|\n if @recipe.save\n format.html { redirect_to root_path, notice: 'La recette a été crée.' }\n else\n format.html { redirect_to root_path, notice: \"La recette n'a pas pu être ajoutée.\" }\n end\n end\n end", "def create\n @muestra = Muestra.new(muestra_params)\n\n respond_to do |format|\n if @muestra.save\n format.html { redirect_to @muestra, notice: 'Muestra was successfully created.' }\n format.json { render :show, status: :created, location: @muestra }\n else\n format.html { render :new }\n format.json { render json: @muestra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @smurf = Smurf.new(params[:smurf])\n\n respond_to do |format|\n if @smurf.save\n format.html { redirect_to @smurf, notice: 'Smurf was successfully created.' }\n format.json { render json: @smurf, status: :created, location: @smurf }\n else\n format.html { render action: \"new\" }\n format.json { render json: @smurf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @minha_pagina = MinhaPagina.new(minha_pagina_params)\n\n respond_to do |format|\n if @minha_pagina.save\n format.html { redirect_to @minha_pagina, notice: 'Minha pagina was successfully created.' }\n format.json { render :show, status: :created, location: @minha_pagina }\n else\n format.html { render :new }\n format.json { render json: @minha_pagina.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @materia = Materia.new(params[:materia])\n\n if @materia.save\n render json: @materia, status: :created, location: @materia\n else\n render json: @materia.errors, status: :unprocessable_entity\n end\n end", "def create\n @mwod_post = MwodPost.new(params[:mwod_post])\n\n respond_to do |format|\n if @mwod_post.save\n format.html { redirect_to @mwod_post, notice: 'Mwod post was successfully created.' }\n format.json { render json: @mwod_post, status: :created, location: @mwod_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mwod_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @merma_insumo = MermaInsumo.new(merma_insumo_params)\n\n respond_to do |format|\n if @merma_insumo.save\n format.html { redirect_to @merma_insumo, notice: 'Merma insumo was successfully created.' }\n format.json { render :show, status: :created, location: @merma_insumo }\n else\n format.html { render :new }\n format.json { render json: @merma_insumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_mural = Admin::Mural.new(admin_mural_params)\n\n respond_to do |format|\n if @admin_mural.save\n format.html { redirect_to @admin_mural, notice: 'Mural was successfully created.' }\n format.json { render :show, status: :created, location: @admin_mural }\n else\n format.html { render :new }\n format.json { render json: @admin_mural.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mi_transaction = MiTransaction.new(params[:mi_transaction])\n\n respond_to do |format|\n if @mi_transaction.save\n format.html { redirect_to @mi_transaction, notice: 'Mi transaction was successfully created.' }\n format.json { render json: @mi_transaction, status: :created, location: @mi_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mi_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @repuestum = Repuestum.new(params[:repuestum])\n\n respond_to do |format|\n if @repuestum.save\n format.html { redirect_to @repuestum, notice: 'Repuestum was successfully created.' }\n format.json { render json: @repuestum, status: :created, location: @repuestum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @repuestum.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 @u_ser = USer.new(u_ser_params)\n\n respond_to do |format|\n if @u_ser.save\n format.html { redirect_to @u_ser, notice: 'U ser was successfully created.' }\n format.json { render :show, status: :created, location: @u_ser }\n else\n format.html { render :new }\n format.json { render json: @u_ser.errors, status: :unprocessable_entity }\n end\n end\n end", "def post\n Salesforce.set_http(session[:accesstoken], session[:accessurl])\n \t@response = Salesforce.create_post(params)\n \trespond_to do |format|\n format.json { render :json => @response.to_json}\n # example of multiple reponses mapped to one object\n # format.json { render :json => {:data => @response, :meta => @describe}.to_json}\n \tend\n end" ]
[ "0.5968583", "0.5932527", "0.58873105", "0.58409667", "0.57937044", "0.57039076", "0.5684435", "0.5669336", "0.56550986", "0.56373256", "0.56323504", "0.56201684", "0.5618863", "0.5610063", "0.56022364", "0.559634", "0.5589939", "0.5565027", "0.5557354", "0.55550426", "0.5552107", "0.5548829", "0.55370057", "0.55205685", "0.55049276", "0.55041206", "0.54972637", "0.5487248", "0.5478006", "0.5455713", "0.54509205", "0.54458845", "0.54394025", "0.54154056", "0.54102904", "0.5399567", "0.53861606", "0.53811085", "0.5354431", "0.53535455", "0.5347922", "0.53444606", "0.5343704", "0.53423464", "0.53395826", "0.53342533", "0.5326108", "0.5320247", "0.531905", "0.53186226", "0.53060937", "0.5304218", "0.5299022", "0.5297479", "0.5296379", "0.5296294", "0.52939636", "0.5292599", "0.5288913", "0.5285472", "0.5282393", "0.5281212", "0.5279236", "0.5271502", "0.52684486", "0.5266689", "0.52660525", "0.52658224", "0.5264128", "0.52603084", "0.5255306", "0.52543765", "0.52515984", "0.5251533", "0.5250385", "0.52374953", "0.52368677", "0.5236181", "0.5233496", "0.5231988", "0.5230234", "0.5221792", "0.52216023", "0.52211136", "0.5211234", "0.52107966", "0.52099097", "0.52075964", "0.52048874", "0.5203815", "0.5203409", "0.52021194", "0.5195655", "0.519302", "0.5190882", "0.5190481", "0.5189923", "0.51878184", "0.5184172", "0.51823026" ]
0.5320203
48
PATCH/PUT /minuts/1 PATCH/PUT /minuts/1.json
def update @minut = Minut.new(minut_params) minutdel = Minut.find(params[:id]) minutdel.delete user_id = params[:minut][:id] if user_id user = User.find(user_id) # 権限情報追加(選択分) @minut.users << user end user = User.find(current_user) # 権限情報追加(本人分) @minut.users << user @users = User.where.not("id = ?", current_user) respond_to do |format| if @minut.save format.html { redirect_to @minut, notice: 'Minut was successfully updated.' } format.json { render :show, status: :ok, location: @minut } else format.html { render :edit } format.json { render json: @minut.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to @ministerio, notice: 'Ministerio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ministerio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_ministry = MyMinistry.find(params[:id])\n\n respond_to do |format|\n if @my_ministry.update_attributes(params[:my_ministry])\n format.html { redirect_to @my_ministry, notice: 'My ministry was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_ministry.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def update\n respond_to do |format|\n if @minister.update(minister_params)\n format.html { redirect_to @minister, notice: 'Minister was successfully updated.' }\n format.json { render :show, status: :ok, location: @minister }\n else\n format.html { render :edit }\n format.json { render json: @minister.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(&block)\n validate_request()\n\n # Params includes all of the PATCH data at the top level along with other\n # other Rails-injected params like 'id', 'action', 'controller'. These\n # are harmless given no namespace collision and we're only interested in\n # the 'Operations' key for the actual patch data.\n #\n render(json: yield(self.safe_params()[:id], self.safe_params().to_hash()))\n end", "def update\r\n respond_to do |format|\r\n if @sivic_ministerio.update(sivic_ministerio_params)\r\n format.html { redirect_to @sivic_ministerio, 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_ministerio.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @minuman.update(minuman_params)\n format.html { redirect_to @minuman, notice: 'Minuman was successfully updated.' }\n format.json { render :show, status: :ok, location: @minuman }\n else\n format.html { render :edit }\n format.json { render json: @minuman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @minicurso = Minicurso.find(params[:id])\n\n respond_to do |format|\n if @minicurso.update_attributes(params[:minicurso])\n format.html { redirect_to @minicurso, notice: 'Minicurso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minicurso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministries = Ministries.find(params[:id])\n\n respond_to do |format|\n if @ministries.update_attributes(params[:ministries])\n flash[:notice] = 'Ministries was successfully updated.'\n format.html { redirect_to(@ministries) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministries.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ministerio = Ministerio.find(params[:id])\n\n respond_to do |format|\n if @ministerio.update_attributes(params[:ministerio])\n format.html { redirect_to(@ministerio, :notice => 'Ministerio was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministerio.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @momsg = Momsg.find(params[:id])\n\n respond_to do |format|\n if @momsg.update_attributes(params[:momsg])\n format.html { redirect_to @momsg, notice: 'Momsg was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @momsg.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministerios = Ministerios.find(params[:id])\n @title = \"Edição do Ministério: \" + @ministerios.nome\n respond_to do |format|\n if @ministerios.update_attributes(params[:ministerios])\n Ministerios.update(@ministerios.id, :respmod => self.current_usuarios.login.upcase)\n \tflash[:notice] = 'Ministerios was successfully updated.'\n format.html { redirect_to(ministerios_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministerios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params.require(%i[id units])\n retrieve_and_validate_put.update!(units: params[:units])\n head :no_content\n end", "def update\n respond_to do |format|\n if @test_metum.update(test_metum_params)\n format.html { redirect_to @test_metum, notice: 'Test metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update # PATCH\n raise NotImplementedError\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n respond_to do |format|\n if @setum.update(setum_params)\n format.html { redirect_to @setum, notice: 'Setum was successfully updated.' }\n format.json { render :show, status: :ok, location: @setum }\n else\n format.html { render :edit }\n format.json { render json: @setum.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n @uset = Uset.find(params[:id])\n\n respond_to do |format|\n if @uset.update_attributes(params[:uset])\n format.html { redirect_to @uset, notice: 'Uset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @uset.errors, status: :unprocessable_entity }\n end\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 @metum.update(metum_params)\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @microposst = Microposst.find(params[:id])\n\n respond_to do |format|\n if @microposst.update_attributes(params[:microposst])\n format.html { redirect_to @microposst, notice: 'Microposst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microposst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minisound.update(minisound_params)\n format.html { redirect_to @minisound, notice: 'Minisound was successfully updated.' }\n format.json { render :show, status: :ok, location: @minisound }\n else\n format.html { render :edit }\n format.json { render json: @minisound.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @m1.update(m1_params)\n format.html { redirect_to @m1, notice: 'M1 was successfully updated.' }\n format.json { render :show, status: :ok, location: @m1 }\n else\n format.html { render :edit }\n format.json { render json: @m1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n\n # update shops\n shops_edit = JSON.parse(params[:mall][:shops_in_mall])\n\n respond_to do |format|\n if @mall.update_with_shops(mall_params, shops_edit)\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully updated.' }\n format.json { render :show, status: :ok, location: @mall }\n else\n format.html {\n @shops = Shop.to_options.to_json\n @shops_in_mall = @mall.shops.to_options.to_json\n render :edit\n }\n format.json { render json: @mall.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mou.update(mou_params)\n format.html { redirect_to @mou, notice: 'Mou was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mou.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n respond_to do |format|\n if @minnpaku.update(minnpaku_params)\n format.html { redirect_to @minnpaku, notice: 'Minnpaku was successfully updated.' }\n format.json { render :show, status: :ok, location: @minnpaku }\n else\n format.html { render :edit }\n format.json { render json: @minnpaku.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ministry = Ministry.find(params[:id])\n\n respond_to do |format|\n if @ministry.update_attributes(params[:ministry])\n flash[:notice] = 'Ministry was successfully updated.'\n format.html { redirect_to(@ministry) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ministry.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @patch.update(patch_params)\n format.html { redirect_to @patch, notice: 'Patch was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @patch.errors, status: :unprocessable_entity }\n end\n end\n end", "def partial_update(klass, id, patchset, options = {}, format = nil)\n headers = {}\n headers[:accept] = \"#{format}\" if format\n format ||= @default_format\n options = { resource: klass, id: id, format: format}.merge options\n if [FHIR::Formats::ResourceFormat::RESOURCE_XML, FHIR::Formats::ResourceFormat::RESOURCE_XML_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_XML\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_XML}\"\n elsif [FHIR::Formats::ResourceFormat::RESOURCE_JSON, FHIR::Formats::ResourceFormat::RESOURCE_JSON_DSTU2].include?(format)\n options[:format] = FHIR::Formats::PatchFormat::PATCH_JSON\n headers[:content_type] = \"#{FHIR::Formats::PatchFormat::PATCH_JSON}\"\n end\n headers[:prefer] = @return_preference if @use_return_preference\n reply = patch resource_url(options), patchset, fhir_headers(headers)\n reply.resource = parse_reply(klass, format, reply)\n reply.resource_class = klass\n reply\n end", "def update\n# respond_to do |format|\n# if @req.update(req_params)\n format.json { render :json => {:status => 'success'}}\n# format.html { redirect_to @req, notice: 'Req was successfully updated.' }\n# format.json { render :show, status: :ok, location: @req }\n# else\n format.json { render :json => {:status => 'failed'}}\n# format.html { render :edit }\n# format.json { render json: @req.errors, status: :unprocessable_entity }\n# end\n# end\n end", "def update_mod\n if params[:title] != nil && params[:content] != nil\n @question.title = params[:title]\n @question.content = params[:content]\n\n question_json = @question.to_h.to_json\n\n url = @httpIp+'/pet.com/api/question/updateQuestion'\n uri = URI(url)\n res = Net::HTTP.post(uri, question_json, \"Content-Type\" => \"application/json\")\n puts res.body\n flash[:notice] = \"successfully updated\"\n redirect_to questions_path\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 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 @metum = Metum.find(params[:id])\n\n respond_to do |format|\n if @metum.update_attributes(params[:metum])\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metum.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 respond_to do |format|\n if @mystic.update(mystic_params)\n format.html { redirect_to @mystic, notice: 'Mystic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mystic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n binding.pry\n respond_to do |format|\n if @sets_and_rep.update(sets_and_rep_params)\n format.html { redirect_to @sets_and_rep, notice: 'Sets and rep was successfully updated.' }\n format.json { render :show, status: :ok, location: @sets_and_rep }\n else\n format.html { render :edit }\n format.json { render json: @sets_and_rep.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "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 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 @smallmap = Smallmap.find(params[:id])\n\n respond_to do |format|\n if @smallmap.update_attributes(params[:smallmap])\n format.html { redirect_to @smallmap, notice: 'Smallmap was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smallmap.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rest.update(rest_params)\n format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }\n format.json { render :show, status: :ok, location: @rest }\n else\n format.html { render :edit }\n format.json { render json: @rest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @model = Model.find(params[:id])\n # @model.name = \"test\"\n @model.scale = 1\n respond_to do |format|\n if @model.update_attributes(params[:model])\n format.html { redirect_to @model, notice: 'Model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mattress = Mattress.find(params[:id])\n\n respond_to do |format|\n if @mattress.update_attributes(params[:mattress])\n format.html { redirect_to [:admin, @mattress], notice: 'Mattress was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mattress.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @minipost.update(minipost_params)\n format.html { redirect_to @minipost, notice: 'Minipost was successfully updated.' }\n format.json { render :show, status: :ok, location: @minipost }\n else\n format.html { render :edit }\n format.json { render json: @minipost.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\r\n respond_to do |format|\r\n if @muscle_mass.update(muscle_mass_params)\r\n format.html { redirect_to @muscle_mass, notice: 'Muscle mass 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: @muscle_mass.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n if @mostsmallmission.update_attributes(params[:mostsmallmission])\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kumo.update(kumo_params)\n format.html { redirect_to kumos_path, notice: 'Kumo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kumo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @u = U.find(params[:id])\n\n respond_to do |format|\n if @u.update_attributes(params[:u])\n format.html { render action: \"edit\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @kota_stone.update(kota_stone_params)\n format.html { redirect_to kota_stones_url, notice: 'Kota stone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kota_stone.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @muneco.update(muneco_params)\n format.html { redirect_to @muneco, notice: 'Muneco was successfully updated.' }\n format.json { render :show, status: :ok, location: @muneco }\n else\n format.html { render :edit }\n format.json { render json: @muneco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ministrante.update(ministrante_params)\n format.html { redirect_to @ministrante, notice: 'Ministrante was successfully updated.' }\n format.json { render :show, status: :ok, location: @ministrante }\n else\n format.html { render :edit }\n format.json { render json: @ministrante.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @request = Request.find(params[:id])\n\n if @request.update(params[:request])\n head :no_content\n else\n render json: @request.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @municao.update(municao_params)\n format.html { redirect_to @municao, notice: 'A Munição foi editada com sucesso!' }\n format.json { render :show, status: :ok, location: @municao }\n else\n format.html { render :edit }\n format.json { render json: @municao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @metum.update(metum_params)\n format.html { redirect_to @metum, notice: 'Metum was successfully updated.' }\n format.json { render :show, status: :ok, location: @metum }\n else\n format.html { render :edit }\n format.json { render json: @metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @testmonial = Testmonial.find(params[:id])\n\n if @testmonial.update(testmonial_params)\n head :no_content\n else\n render json: @testmonial.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n format.xml { head :method_not_allowed }\n format.json { head :method_not_allowed }\n end\n end", "def update\n head :forbidden\n\n #@action = Action.find(params[:id])\n\n #if @action.update_attributes(params[:action])\n # head :no_content\n # else\n # render json: @action.errors, status: :unprocessable_entity\n # end\n end", "def update\n @moresmalltrial = Moresmalltrial.find(params[:id])\n\n respond_to do |format|\n if @moresmalltrial.update_attributes(params[:moresmalltrial])\n format.html { redirect_to @moresmalltrial, notice: 'Moresmalltrial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moresmalltrial.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render status: 501, json: { errors: ['Action not implemented yet!'] }\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 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 @moose = Moose.find(params[:id])\n\n respond_to do |format|\n if @moose.update_attributes(params[:moose])\n format.html { redirect_to @moose, notice: 'Moose was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @moose.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @microplst = Microplst.find(params[:id])\n\n respond_to do |format|\n if @microplst.update_attributes(params[:microplst])\n format.html { redirect_to @microplst, notice: 'Microplst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @microplst.errors, status: :unprocessable_entity }\n end\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 @major.update(major_params)\n format.html { redirect_to @major, notice: 'Major was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @major.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @liftset.update(liftset_params)\n format.html { redirect_to @liftset, notice: 'Liftset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @liftset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #respond_to do |format|\n # if @request.update(request_params)\n # format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @request.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n authorize! :update_almacen,Sigesp::Solicitud\n if @sigesp_solicitud.update(sigesp_solicitud_alamcen_params)\n return render json: { url: sigesp_solicitudsalmacen_path(@sigesp_solicitud)} \n else\n return render json:@sigesp_solicitud.errors ,status: :unprocessable_entity\n end \n end", "def update\n respond_to do |format|\n if @chef.update(chef_params)\n format.html { redirect_to [:admin, @chef], notice: t('messages.updated', model:Chef.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @chef.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @spliff.update(spliff_params)\n format.html { redirect_to '/spliffs', notice: 'Spliff was successfully updated.' }\n format.json { redirect_to '/spliffs', status: :ok, location: '/spliffs' }\n else\n format.html { render :edit }\n format.json { render json: @spliff.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 @smalluser = Smalluser.find(params[:id])\n\n respond_to do |format|\n if @smalluser.update_attributes(params[:smalluser])\n format.html { redirect_to @smalluser, notice: 'Smalluser was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @smalluser.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @<%= singular_table_name %>.update(<%= singular_table_name %>_params)\n format.html { redirect_to @<%= singular_table_name %>, notice: \"#{t('activerecord.models.<%= singular_table_name %>.one')} atualizado com sucesso.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @<%= singular_table_name %>.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @u_ser = USer.find(params[:id])\n\n respond_to do |format|\n if @u_ser.update_attributes(params[:u_ser])\n format.html { redirect_to @u_ser, notice: 'U ser was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @u_ser.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 respond_to do |format|\n if @operation.update(operation_params)\n format.html { redirect_to admin_operations_path, notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mi = Mi.find(params[:id])\n\n respond_to do |format|\n if @mi.update_attributes(params[:mi])\n format.html { redirect_to @mi, notice: 'Mi was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n query = {\n 'name' => params[:name]\n }\n response = HTTParty.put(url, :query => query, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n\n if response.code == 200\n redirect_to unit_path(params[:id]), notice: 'Unit was successfully updated.'\n else\n redirect_to unit_path(params[:id]), notice: 'Sheesh! Minor hiccup...run that again!'\n end\n end", "def update\n @request.assign_json_attributes(params) if @request.resume?\n respond_to do |format|\n if @request.update(request_params)\n format.html { redirect_to @request, notice: 'Request was successfully updated.' }\n format.json { render :show, status: :ok, location: @request }\n else\n format.html { render :edit }\n format.json { render json: @request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @server1 = Server1.find(params[:id])\n\n respond_to do |format|\n if @server1.update_attributes(params[:server1])\n format.html { redirect_to @server1, notice: 'Server was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @server1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @minimessage = Minimessage.find(params[:id])\n\n respond_to do |format|\n if @minimessage.update_attributes(params[:minimessage])\n format.html { redirect_to @minimessage, notice: 'Minimessage was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @minimessage.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@service_request = ServiceRequest.find(params[:id])\n\n respond_to do |format|\n if @service_request.update_attributes(service_request_params)\n format.html { redirect_to @service_request, notice: 'Service request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @slam = Slam.find(params[:id])\n \n respond_to do |format|\n if @slam.update_attributes(params[:slam])\n format.html { redirect_to @slam, notice: 'Fixed up!' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slam.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stoff.update(stoff_params)\n format.html { redirect_to @stoff }\n format.json { render :show, status: :ok, location: @stoff }\n else\n format.html { render :edit }\n format.json { render json: @stoff.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update!(**args)\n @requests = args[:requests] if args.key?(:requests)\n end", "def update\n respond_to do |format|\n if @smp_referenz.update(smp_referenz_params)\n format.html { redirect_to @smp_referenz, notice: 'Smp referenz was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @smp_referenz.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_with []\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" ]
[ "0.63166493", "0.6293164", "0.62190956", "0.62032664", "0.6133953", "0.6111854", "0.60540307", "0.603813", "0.6036243", "0.6034789", "0.602788", "0.60248744", "0.6014388", "0.6011896", "0.5987442", "0.59751886", "0.59518075", "0.59506756", "0.5945692", "0.59401137", "0.5931825", "0.5927055", "0.592701", "0.59257084", "0.59099734", "0.58994436", "0.58969253", "0.5894307", "0.58780956", "0.58617073", "0.5858552", "0.58405244", "0.58250344", "0.58246386", "0.5815248", "0.5815248", "0.5813423", "0.5813423", "0.580469", "0.57817423", "0.5770876", "0.57680225", "0.57624006", "0.5745747", "0.5729125", "0.5729125", "0.5728216", "0.57273614", "0.5724944", "0.57226795", "0.5716887", "0.57156104", "0.57146704", "0.5711952", "0.57117134", "0.57049096", "0.5701507", "0.57005966", "0.5697669", "0.56961364", "0.5694237", "0.5677867", "0.56767064", "0.5668611", "0.56636393", "0.56596875", "0.5657757", "0.5656107", "0.56555736", "0.56550497", "0.56540567", "0.56535333", "0.5653018", "0.56511235", "0.5643268", "0.56372136", "0.5637177", "0.5636469", "0.5635571", "0.56290233", "0.5628853", "0.5627595", "0.5623624", "0.56232667", "0.5622754", "0.5620969", "0.56170505", "0.5614664", "0.56139207", "0.56121653", "0.561216", "0.56118584", "0.5611175", "0.56040263", "0.5602799", "0.5602799", "0.5602799", "0.5602799", "0.55978656", "0.5597174", "0.55970526" ]
0.0
-1
DELETE /minuts/1 DELETE /minuts/1.json
def destroy @minut.destroy respond_to do |format| format.html { redirect_to minuts_url, notice: 'Minut was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to ministerios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @minicurso = Minicurso.find(params[:id])\n @minicurso.destroy\n\n respond_to do |format|\n format.html { redirect_to minicursos_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_ministerio.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_ministerios_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ministries = Ministries.find(params[:id])\n @ministries.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @m1.destroy\n respond_to do |format|\n format.html { redirect_to m1s_url, notice: 'M1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @minuman.destroy\n respond_to do |format|\n format.html { redirect_to minumen_url, notice: 'Minuman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministerio = Ministerio.find(params[:id])\n @ministerio.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mou.destroy\n respond_to do |format|\n format.html { redirect_to mous_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @uset = Uset.find(params[:id])\n @uset.destroy\n\n respond_to do |format|\n format.html { redirect_to usets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @momsg = Momsg.find(params[:id])\n @momsg.destroy\n\n respond_to do |format|\n format.html { redirect_to momsgs_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\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 @minisound.destroy\n respond_to do |format|\n format.html { redirect_to minisounds_url, notice: 'Minisound was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @minister.destroy\n respond_to do |format|\n format.html { redirect_to ministers_url, notice: 'Minister 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 if @short_url.destroy\n render json: { status: \"Deleted\" }\n else\n render json: { head: \"no content\" }\n end \n end", "def destroy\n @mi = Mi.find(params[:id])\n @mi.destroy\n\n respond_to do |format|\n format.html { redirect_to mis_url }\n format.json { head :ok }\n end\n end", "def destroy\n @server1 = Server1.find(params[:id])\n @server1.destroy\n\n respond_to do |format|\n format.html { redirect_to server1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitemenu.destroy\n respond_to do |format|\n format.html { redirect_to sitemenus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @ministorage.destroy\n respond_to do |format|\n format.html { redirect_to admin_ministorages_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @setum.destroy\n respond_to do |format|\n format.html { redirect_to seta_url, notice: 'Setum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @midia.destroy\n\n respond_to do |format|\n format.html { redirect_to midias_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @json.destroy\n respond_to do |format|\n format.html { redirect_to jsons_url, notice: 'Json was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @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 @minnpaku.destroy\n respond_to do |format|\n format.html { redirect_to minnpakus_url, notice: 'Minnpaku was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sesh.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @stone = Stone.find(params[:id])\n @stone.destroy\n\n respond_to do |format|\n format.html { redirect_to stones_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 @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 @adminmatrixgenu.destroy\n respond_to do |format|\n format.html { redirect_to adminmatrixgenus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ministrante.destroy\n respond_to do |format|\n format.html { redirect_to ministrantes_url, notice: 'Ministrante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mattress = Mattress.find(params[:id])\n @mattress.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_mattresses_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 @flat.destroy\n\n respond_to do |format|\n format.html { redirect_to flats_url }\n format.json { head :no_content }\n end\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 destroy\n @strosek.destroy\n respond_to do |format|\n format.html { redirect_to stroseks_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 @stundent = Stundent.find(params[:id])\n @stundent.destroy\n\n respond_to do |format|\n format.html { redirect_to stundents_url }\n format.json { head :no_content }\n end\n end", "def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend", "def destroy\n @baz62.destroy\n respond_to do |format|\n format.html { redirect_to baz62s_url, notice: \"Baz62 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @mystic.destroy\n respond_to do |format|\n format.html { redirect_to mystics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @microposst = Microposst.find(params[:id])\n @microposst.destroy\n\n respond_to do |format|\n format.html { redirect_to micropossts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @section.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @admin.destroy\n\n render json: { operation: 'OK' }, status: :ok\n end", "def destroy\n @latstraps1.destroy\n respond_to do |format|\n format.html { redirect_to latstraps1s_url, notice: 'Latstraps1 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 @miscellaneou.destroy\n respond_to do |format|\n format.html { redirect_to miscellaneous_url, notice: 'Accessory was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baz1.destroy\n respond_to do |format|\n format.html { redirect_to baz1s_url, notice: \"Baz1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @optimu = Optimu.find(params[:id])\n @optimu.destroy \n\n respond_to do |format|\n format.html { redirect_to optimus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @repuestum = Repuestum.find(params[:id])\n @repuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to repuesta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stilage.destroy\n respond_to do |format|\n format.html { redirect_to stilages_url, notice: 'Stilage was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @student1 = Student1.find(params[:id])\r\n @student1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to student1s_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @mini_url.destroy\n respond_to do |format|\n format.html { redirect_to mini_urls_url, notice: 'Mini url was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mata_matum.destroy\n respond_to do |format|\n format.html { redirect_to mata_mata_url, notice: 'Mata matum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @stat_misc = StatMisc.find(params[:id])\n @stat_misc.destroy\n\n respond_to do |format|\n format.html { redirect_to stat_miscs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fast.destroy\n respond_to do |format|\n format.html { redirect_to fasts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delete(url, :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n redirect_to units_url, notice: 'Unit was successfully deleted.'\n end", "def destroy\n @admin_mural.destroy\n respond_to do |format|\n format.html { redirect_to admin_murals_url, notice: 'Mural was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ststu.destroy\n respond_to do |format|\n format.html { redirect_to ststus_url, notice: 'Ststu was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sin = Sin.find(params[:id])\n @sin.destroy\n\n respond_to do |format|\n format.html { redirect_to sins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @suscript = Suscript.find(params[:id])\n @suscript.destroy\n\n respond_to do |format|\n format.html { redirect_to suscripts_url }\n format.json { head :no_content }\n end\n \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 @test1.destroy\n respond_to do |format|\n format.html { redirect_to test1s_url, notice: \"Test1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @sifat_surat_masuk.destroy\n respond_to do |format|\n format.html { redirect_to sifat_surat_masuk_index_url, notice: 'Sifat surat masuk was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_ministry = MyMinistry.find(params[:id])\n @my_ministry.destroy\n flash[:success] = \"退出了一个事工\"\n respond_to do |format|\n format.html { redirect_to ministries_url }\n format.json { head :ok }\n end\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @suc = Suc.find(params[:id])\n @suc.destroy\n\n respond_to do |format|\n format.html { redirect_to sucs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metum = Metum.find(params[:id])\n @metum.destroy\n\n respond_to do |format|\n format.html { redirect_to meta_url }\n format.json { head :ok }\n end\n end", "def destroy\n @mdistantmetastasi.destroy\n respond_to do |format|\n format.html { redirect_to mdistantmetastasis_url, notice: 'Mdistantmetastasi was successfully destroyed.' }\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 @kumo.destroy\n respond_to do |format|\n format.html { redirect_to kumos_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 @muneco.destroy\n respond_to do |format|\n format.html { redirect_to munecos_url, notice: 'Muneco was successfully destroyed.' }\n format.json { head :no_content }\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 @medium_mission = MediumMission.find(params[:id])\n @medium_mission.destroy\n\n respond_to do |format|\n format.html { redirect_to medium_missions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shichoson = Shichoson.find(params[:id])\n @shichoson.destroy\n\n respond_to do |format|\n format.html { redirect_to shichosons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sotrudniki = Sotrudniki.find(params[:id])\n @sotrudniki.destroy\n\n respond_to do |format|\n format.html { redirect_to sotrudnikis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallresource = Mostsmallresource.find(params[:id])\n @mostsmallresource.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallresources_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ambush = Ambush.find(params[:id])\n @ambush.destroy\n\n respond_to do |format|\n format.html { redirect_to ambushes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sluzby = Sluzby.find(params[:id])\n @sluzby.destroy\n\n respond_to do |format|\n format.html { redirect_to sluzbies_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @muscle_mass.destroy\r\n respond_to do |format|\r\n format.html { redirect_to muscle_masses_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @smurf = Smurf.find(params[:id])\n @smurf.destroy\n\n respond_to do |format|\n format.html { redirect_to smurves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @miniature.destroy\n respond_to do |format|\n format.html { redirect_to miniatures_url, notice: 'Miniature was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @foo62.destroy\n respond_to do |format|\n format.html { redirect_to foo62s_url, notice: \"Foo62 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_metum.destroy\n respond_to do |format|\n format.html { redirect_to test_meta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\n\t\t\t\tTestimony.find(params[:id]).destroy\n\n\t\t\t\trender json: nil,status: 200\n\t\t\t\n\t\t\tend", "def delete(*rest) end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @ss.destroy\n respond_to do |format|\n format.html { redirect_to sses_url }\n format.json { head :no_content }\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 @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 @samochod.destroy\n respond_to do |format|\n format.html { redirect_to samochods_url, notice: 'Samochod was successfully destroyed.' }\n format.json { head :no_content }\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 @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" ]
[ "0.7088651", "0.6969055", "0.69264215", "0.69081724", "0.68713397", "0.687088", "0.6791006", "0.6781413", "0.67722327", "0.6757899", "0.67391723", "0.6722646", "0.67088556", "0.6705816", "0.6703608", "0.6692136", "0.66843086", "0.6656975", "0.6639853", "0.6637083", "0.6636861", "0.662979", "0.6603756", "0.6600243", "0.65934193", "0.65934193", "0.65863585", "0.6583341", "0.6579165", "0.65556645", "0.6550728", "0.6543511", "0.6530228", "0.6526027", "0.6524552", "0.6524166", "0.65101206", "0.65070814", "0.6502417", "0.6500574", "0.6499237", "0.6471471", "0.64671654", "0.64667314", "0.64660895", "0.64641404", "0.6463535", "0.6461326", "0.6455644", "0.6443903", "0.6443144", "0.6442419", "0.64396095", "0.6438257", "0.64363426", "0.6436125", "0.6430423", "0.6428409", "0.6423637", "0.642253", "0.64218324", "0.6419542", "0.64186835", "0.64127904", "0.64121383", "0.64114904", "0.64090395", "0.64084363", "0.6404639", "0.64029706", "0.6401079", "0.6399158", "0.63988465", "0.6396523", "0.6391717", "0.6389673", "0.6389318", "0.6388425", "0.6388418", "0.63883716", "0.63874626", "0.63833266", "0.63805807", "0.63802695", "0.6379725", "0.6379218", "0.63770485", "0.6373731", "0.63732684", "0.6371851", "0.6367523", "0.6366836", "0.6366386", "0.6365744", "0.6365434", "0.6365434", "0.6365104", "0.6364096", "0.6360556", "0.635976" ]
0.7147959
0
Use callbacks to share common setup or constraints between actions.
def set_minut @minut = Minut.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 minut_params params.require(:minut).permit(:title, :body, authors_attributes: [:minut_id, :user_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
Make sure password and confirm_password are the same on update
def validate_on_update unless plain_password.blank? unless plain_password == password_confirmation errors.add_to_base("Passwords don't match") end # Validate password criteria unless plain_password.length >= 6 errors.add_to_base("Password must be at least 6 characters long.") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_on_update\n unless plain_password.blank?\n unless plain_password == password_confirmation\n errors.add_to_base(\"Passwords don't match\")\n end\n # Validate password criteria\n unless plain_password.length >= 6\n errors.add_to_base(\"Password must be at least 6 characters long.\")\n end\n end\n end", "def update_password(old_password, new_password, new_password_confirmation)\n if self.authenticated?(old_password)\n if new_password.blank?\n false\n elsif new_password == new_password_confirmation\n self.password = new_password\n self.password_confirmation = new_password_confirmation\n self.save\n else\n false\n end\n else\n false\n end\n end", "def update_password password, password_confirmation, old_password\n if crypted_password.blank?\n self.password, self.password_confirmation = password, password_confirmation\n elsif authenticated_by_password? old_password\n self.password, self.password_confirmation = password, password_confirmation\n true\n else\n errors.add :base, t(:invalid_old_password)\n false\n end\n end", "def update_attributes_and_password(attrs)\n self.assign_attributes(attrs)\n self.valid?\n if self.password.present? && confirm_passwords\n self.password_hash = Digest::SHA256.hexdigest(self.password + Rails.application.secrets.salt)\n end\n if self.errors.empty?\n self.save\n end\n end", "def passwords_equal? #defines method for comparing :password and :confirm_password\n \t@errors.add(:password, \": The passwords do not match\") if self.password != self.confirm_password\n end", "def check_password!\n if self.password != password_confirmation\n false\n end \n end", "def password_match_password_confirmation\n if password != password_confirmation\n errors.add(:password_confirmation, I18n.t(\".activerecord.errors.models.user.attributes.password_confirmation\"))\n end\n end", "def check_password_changed\n self.temp_password = nil if ( changed.include?('encrypted_password') && !(changed.include?('temp_password')))\n end", "def password_match\n if password != confirm_password\n errors.add(:password, \"doesn't match\")\n end\n end", "def password_confirmed?\n params[:password] != params[:user][:password]\n end", "def should_validate_password?\n updating_password || new_record?\n end", "def password_match?\n self.password == self.password_confirmation\n end", "def should_validate_password?\n updating_password || new_record?\n end", "def update_password\n @user = User.find_by_id(session[:user_id])\n\n if (@user.password == params[:old_password]) and (params[:password] == params[:password_confirmation])\n\n @user.password = params[:password]\n if @user.save\n flash[:notice] = \"Password Updated Successfully\"\n redirect_to :action => \"home\"\n else\n flash[:notice] = \"Password not Updated Successfully\"\n end # if @user.save\n \n else\n flash[:notice] = \"Password doesn't match correctly\"\n redirect_to :action => \"change_password\"\n\n end #if (@user.password == params[:old_password])\n\n end", "def password_with_confirmation (password, confirmation)\n return unless @password_match = (!password.blank?)\n return unless @password_match = (password == confirmation)\n self.password = password\n end", "def should_validate_password?\n \tupdating_password || new_record?\n end", "def passwords_match\n if self.password_changed? && !(self.password == self.password_confirmation)\n self.errors.add(:team, I18n.t('team.passwords_dont_match'))\n end\n end", "def correct_password_confirmation\n return if password == password_confirmation\n\n error_message = I18n.t('password.errors.password_equality')\n errors.add(:password, :invalid, message: error_message)\n errors.add(:password_confirmation, :invalid, message: error_message)\n end", "def change_password(old_pass, new_pass, confirm_pass)\n if self.encrypted_password == encrypt(old_pass)\n p \"password_verified\"\n if new_pass = confirm_pass\n self.password = new_pass\n self.password_confirmation = confirm_pass\n if self.save\n p \"Sucess\"\n end\n else\n p \"Hey, your password doesn't match it's confirmation!\"\n end\n else\n p \"Hey, your Old password doesn't match!\"\n end\n end", "def password_changed?\n orig_pw_hash = self.instance_variable_get(:@old_password_hash)\n self.new_record? || (!orig_pw_hash.nil? && orig_pw_hash != self.password_hash)\n end", "def need_change_password?\n password_change_requested? || password_too_old?\n end", "def password_changed?\n !@new_password.blank?\n end", "def password_changed?\n !@new_password.blank?\n end", "def attempt_set_password(params)\n p={}\n p[:password]=params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def update\n @user.password = params[:password]\n @user.password_confirmation = params[:password_confirmation]\n return unless @user\n if @user.save\n flash[:notice] = t 'password_resets.updated'\n redirect_to @user\n else\n render :action => :edit\n end\n end", "def change_password\n #check if user is new or being updated\n if self.encrypted_password.present?\n #verifies password\n if self.password_check\n self.encrypt_password\n else\n raise \"error\"\n end\n else\n raise \"error\"\n end\n end", "def change_pwd\n if UserDetail.exists?(:password => Digest::SHA2.hexdigest(params[:currentpwd]))\n if (Digest::SHA2.hexdigest(params[:newpwd]) == Digest::SHA2.hexdigest(params[:confirmnewpwd]))\n user=UserDetail.find_by_user_name(session[:uname])\n user.password = params[:newpwd]\n user.save \n session[ :msg] = \"changed\" \n else\n session[ :msg] = \"not match\" \n end\n else\n #Incorrecr current password\n session[ :msg] = \"incorrect\"\n end\n redirect_to :back\n end", "def password_being_changed?(user)\n user[:password].present? ||\n user[:password_confirmation].present?\n end", "def try_to_reset_password(new_password, reconfirm_password)\n if new_password != reconfirm_password\n errors[:base] << \"The two new password fields do not match. Please try again.\"\n elsif new_password.blank?\n errors[:base] << \"Your password cannot be left blank.\"\n elsif new_password.size < 6 || new_password.size > 25\n errors[:base] << \"Your must be between 6 and 25 characters\"\n end\n if errors.count == 0 && self.update_attributes!(:password => new_password, :password_confirmation => new_password)\n return true\n else\n return false\n end\n end", "def change_password(new_password, confirm_new_password)\n if new_password.empty?\n self.errors.add(:password, \"The password may not be empty.\")\n elsif new_password == confirm_new_password\n self.attributes = PublicEarth::Db::User.one.update_password(self.id, new_password, confirm_new_password)\n else\n self.errors.add(:password, \"The passwords don't match.\")\n end\n \n self\n end", "def update\n # Make the password confirmation validation work.\n @user.password_confirmation = params[:user][:password_confirmation]\n\n # Don't require entry of the old password.\n @user.resetting_password = true\n\n # Clear the temporary token and update the password.\n if @user.change_password!(params[:user][:password])\n redirect_to(root_path, notice: t('password_resets.update.password_updated'))\n else\n render action: \"edit\"\n end\n end", "def update\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n @user.attempts = 0\n @user.save\n flash[:notice] = \"Password succesefully updated\"\n redirect_to account_url\n else\n render :action =>:edit\n end\n end", "def attempt_set_password(params)\n update_attributes(password: params[:password], password_confirmation: params[:password_confirmation])\n end", "def test_password\n p1 = \"mypassword123\"\n p2 = \"mypassword1234\"\n s1 = Password.update(p1)\n assert_equal(true, Password.check(p1,s1), \"Password was not stored correctly\")\n assert_equal(false, Password.check(p2,s1), \"Password check is broken\")\n\tend", "def change_password\r\n \r\n end", "def change_password (current_pass, new_pass, confirm_pass)\n return valid? unless @current_password = password?(current_pass)\n password_with_confirmation(new_pass, confirm_pass)\n valid?\n end", "def valid_password?(password_input)\n if using_old_validation?\n Devise.secure_compare(cakephp_password_digest(password_input), self.old_password).tap do |validated|\n if validated\n self.password = password_input\n self.old_password = nil\n self.save(:validate => false)\n end\n end\n else\n super(password_input)\n end\n end", "def validate_new_password\n if new_record? and self.read_attribute(:crypted_password).to_s.blank? and !@password_updated\n errors.add :password, :blank\n elsif @password_updated\n if @password.to_s.size < 4\n errors.add :password, :invalid_password\n elsif @password.to_s != @password_confirmation.to_s\n errors.add :password, :no_match_password\n end\n end\n end", "def attempt_set_password(params)\n\t p = {}\n\t p[:password] = params[:password]\n\t p[:password_confirmation] = params[:password_confirmation]\n\t update_attributes(p)\n end", "def update_password(user = {})\n self.attributes = user\n if self.password.blank? or self.password_confirmation.blank?\n self.errors.add(\"password\", \"and confirmation password are required\")\n return false\n elsif self.password.size < 5\n self.errors.add(\"password\", \"must be at least 5 characters\")\n return false\n elsif self.password != self.password_confirmation\n self.errors.add(\"password\", \"does not match the password confirmation\")\n return false\n else\n self.password_hash = Digest::SHA1.hexdigest(self.password)\n self.save(false)\n end\n end", "def update_password\n @user = current_user\n return unless request.post?\n if User.authenticate(current_user.email, params[:old_password])\n if (params[:password] == params[:password_confirmation])\n current_user.password_confirmation = params[:password_confirmation]\n current_user.password = params[:password]\n if !params[:password].blank? && current_user.save\n flash[:notice] = \"Password changed\" \n redirect_to edit_user_path(current_user)\n else\n flash[:notice] = \"Password not changed\"\n end\n else\n flash[:notice] = \"Password mismatch\"\n @old_password = params[:old_password]\n end\n else\n flash[:notice] = \"Wrong password\" \n end \n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n p[:password_unset] = 0 \n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes p\n end", "def change_password\n set_breadcrumbs(\"change_password\") \n if request.post? || request.patch? \n admin = Admin.find(current_admin.id)\n @check = params[:admin][:password] == params[:admin][:password_confirmation] && params[:admin][:password].present? && params[:admin][:password_confirmation].present?\n if admin.present? && admin.valid_password?(params[:admin][:old_password])\n if @check \n if admin.update_attribute(:password, params[:admin][:password])\n sign_in admin, :bypass => true\n flash[:notice] = I18n.t('change_password.update.success')\n redirect_to admin_root_path\n else\n flash[:error] = I18n.t('common.error') \n end\n else\n flash[:error] = I18n.t('change_password.failure.password_is_not_match')\n end\n else\n flash[:error] = I18n.t('change_password.failure.invalid_old_password')\n end\n end\n end", "def need_change_password!\n return unless password_expiration_enabled?\n\n need_change_password\n save(validate: false)\n end", "def needs_update_password? user, params\n user.email != params[:user][:email] ||\n params[:user][:password].present? ||\n params[:user][:password_confirmation].present?\n end", "def update_password\n # check current password is valid\n if params[:account].present? and !@account.valid_password?(params[:account][:current_password])\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Current password incorrectly.\" }\n return\n end\n\n if params[:account].present?\n params[:account].delete(:password) if params[:account][:password].blank?\n params[:account].delete(:password_confirmation) if params[:account][:password].blank? and params[:account][:password_confirmation].blank?\n\n if @account.update_with_password(account_params)\n bypass_sign_in(@account)\n redirect_to gns_core.my_account_backend_accounts_path, flash: { success: \"The new password has been successfully changed.\" }\n else\n if params[:account][:password].nil? or params[:account][:password].length < 6\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"New password must contain at least 6 characters.\" }\n else\n redirect_to gns_core.my_account_backend_accounts_path, flash: { error: \"Repeat password does not match.\" }\n end\n end\n end\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def attempt_set_password(params)\n p = {}\n p[:password] = params[:password]\n p[:password_confirmation] = params[:password_confirmation]\n update_attributes(p)\n end", "def update\n if correct_password_check account_update_params[:current_password]\n \n pw_params = params[:user].permit(:current_password, :password, :password_confirmation, :first_name, :last_name)\n # Handle updating password if they added anything.\n if (current_user.valid_password?(pw_params[:password]) || current_user.valid_password?(pw_params[:password_confirmation]))\n # Passwords are the same, do nothing.\n elsif (pw_params[:password] == pw_params[:password_confirmation] && pw_params[:password].length > 6)\n # Password are different.\n current_user.password = pw_params[:password]\n current_user.password_confirmation = pw_params[:password_confirmation]\n current_user.save!\n flash.alert = \"Success: Password has been changed!\"\n end\n\n \n user_params = params[:user].except(:current_password, :password, :password_confirmation).permit(:first_name, :last_name, :email)\n unless current_user.update!( user_params )\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: current_user.errors, status: :unprocessable_entity }\n end\n\n flash.alert = \"Success: Account has been updated!\"\n redirect_to edit_user_registration_path\n end\n end", "def password_change_new\n\n end", "def update_staffs_password(password, password_confirmation)\n self.update_attributes(password: password, password_confirmation: password_confirmation)\n end", "def password_changed?\n !password.blank?\n end", "def update_with_password(params={}) \n if params[:password].blank? \n params.delete(:password) \n params.delete(:password_confirmation) if params[:password_confirmation].blank? \n end \n update_attributes(params) \n end", "def password_required?\n super if confirmed?\nend", "def set_new_password \n new_passwd = generate_password()\n self.password = self.password_confirmation = new_passwd\n self.save!\n return new_passwd\n end", "def password_changed?\n hashed_password_changed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def password_required?\n super if confirmed?\n end", "def update_password\n # o e-mail do utilizador está colocado num campo hidden para poder identificar o utilizador que se está a editar\n @user = User.find_by_email(params[:user][:email])\n\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n @user.failed_password_attempt_count = 0;\n\n # guarda user na base de dados\n if @user.save\n # alerta para user criado com sucesso\n flash[:notice] = \"A sua password foi alterada com sucesso.\"\n\n # autentica o user criado\n sign_in @user\n\n redirect_to root_path \n\n else \n render 'edit_password'\n end\n\n end", "def password_changed?\n !@new_password.blank?\n end", "def validate_previous_password\n\n return validation_error(\n 'um_cp_vpp_1',\n 'invalid_api_params',\n ['password_same'],\n GlobalConstant::ErrorAction.default\n ) if @user.password == @new_e_password\n\n success\n\n end", "def reset_password() \n self.password_confirmation = self.password = self.login\n \n self.save\n end", "def password_changed_confirm\n pw_change_confirm.click\n end", "def password_changed?\n Candidate.password_changed?(password)\n # !valid_password?(Event::Other::INITIAL_PASSWORD)\n end", "def update_password\n enc_password = Authentication::Encryptor.digest(password)\n account = Authentication::Account.reset_token_account(reset_password_token)\n account.encrypted_password = enc_password\n account.reset_password_token, account.reset_password_expires_at = nil, nil\n account.save!\n {'success' => true}\n end", "def update_password\n @user.password = @new_e_password\n if GlobalConstant::User.auto_blocked_status == @user.status\n # if we had blocked a user for more than a threshhold failed login attemps we set status to blocked\n # now we should reset it to active\n @user.status = GlobalConstant::User.active_status\n @user.failed_login_attempt_count = 0\n end\n @user.save!\n end", "def valid_password?(password)\n begin\n super(password)\n rescue BCrypt::Errors::InvalidHash\n sha1_password = Digest::SHA1.hexdigest(\"--#{password_salt}--#{password}--\")\n return false unless sha1_password == encrypted_password\n logger.info \"User #{email} is using the old password hashing method, updating attribute.\"\n self.password = password # = BCrypt::Password.create(sha1_password)\n true\n end\n end", "def password=(new_password); end", "def update_password\n user = UserService.getUserById(params[:id])\n if !user.authenticate(params[:password])\n redirect_to change_password_user_path, notice: Messages::INCORRECT_PASSWORD\n elsif params[:new_password] != params[:new_password_confirmation]\n redirect_to change_password_user_path, notice: Messages::INCORRECT_PASSWORD_CONFIRM\n else\n isUpdatedPassword = UserService.updatePassword(user, params)\n if isUpdatedPassword\n redirect_to users_path\n else\n redirect_to change_password_user_path\n end\n end\n end", "def password_update?(new_pass)\n return false if current_resource.info['rep:password'].end_with?(\n hash_generator(new_pass)\n )\n true\n end", "def password_match?\n add_password_match_error if password != password_confirmation\n\n password == password_confirmation && !password.blank?\n end", "def password_changed?\n !self.password.blank? or self.encrypted_password.blank?\n end", "def password_ok?\n return unless password and confirm_password\n errors.add(:password, \"Passwords don't match\") if password != confirm_password\n end", "def validate\n r = super\n return r unless r.success?\n\n return error_with_data(\n 'am_l_cp_1',\n 'Change Password Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n {confirm_password: 'Password should be minimum 8 characters'}\n ) if @confirm_password.length < 8\n\n return error_with_data(\n 'am_l_cp_2',\n 'Change Password Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n {confirm_password: 'Passwords do not match'}\n ) if @confirm_password != @new_password\n\n return error_with_data(\n 'am_l_cp_2.1',\n 'Change Password Error',\n '',\n GlobalConstant::ErrorAction.default,\n {},\n {confirm_password: 'Please enter a different password'}\n ) if @current_password == @new_password\n\n success\n end", "def test_should_not_rehash_password\n users(:quentin).update_attributes(:email => 'quentin2@yahoo.com')\n assert_equal users(:quentin).crypted_password, '552761481a75862203cbd4589af3064262408c9a'\n end", "def update_password\n @user = User.find_by_uuid(params[:id])\n if @user.update(user_params_with_password)\n if @user.send_password.present? && @user.send_password.to_i == 1\n @user.send_welcome_email\n end\n flash[:success] = t('messages.default_success')\n redirect_to users_path\n else\n flash[:error] = t('messages.default_error')\n render :edit_password\n end\n end", "def will_save_change_to_encrypted_password?\n changed.include? 'encrypted_password'\n end", "def update\n @user.password = params[:user][:password]\n @user.password_confirmation = params[:user][:password_confirmation]\n if @user.save\n flash[:notice] = \"Password successfully updated\"\n redirect_to user_url\n else\n render :action => :edit\n end\n end", "def update_password\n current_password = params[:current_password]\n correct_password = @account.password\n if current_password == correct_password\n @account.password = params[:account_password]\n flash.now[:message] = \"你的密码已成功修改\" if @account.save\n else\n flash.now[:error_msg] = \"你输入的当前密码不正确, 不能修改密码\"\n end\n \n render :action => \"edit\"\n end", "def password_required?\n confirmed? ? super : false\n end" ]
[ "0.7755978", "0.76147574", "0.7551223", "0.75487745", "0.74905527", "0.7482487", "0.7462891", "0.744798", "0.7446331", "0.7367924", "0.7308071", "0.7282038", "0.7268492", "0.72589314", "0.7253914", "0.72497183", "0.72287405", "0.71731997", "0.7166696", "0.7149652", "0.71464074", "0.7145363", "0.7145363", "0.7141705", "0.7139908", "0.71360373", "0.7124697", "0.7114794", "0.7078842", "0.7076052", "0.707408", "0.70677596", "0.7062814", "0.70605904", "0.7057551", "0.70569396", "0.70508325", "0.7041582", "0.70376915", "0.7034471", "0.703271", "0.7030224", "0.7029715", "0.70186484", "0.7015686", "0.70139575", "0.701292", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.6990604", "0.69805795", "0.69692785", "0.6961409", "0.6945482", "0.6943173", "0.6936184", "0.6932055", "0.691988", "0.6907466", "0.6907466", "0.6907466", "0.6907466", "0.6907466", "0.6907466", "0.69009465", "0.68943965", "0.6892231", "0.6888471", "0.6882231", "0.68766266", "0.6876437", "0.68739885", "0.68729603", "0.6866346", "0.6865667", "0.6865289", "0.6864527", "0.6860211", "0.6858643", "0.68566644", "0.685639", "0.6856056", "0.68538004", "0.68510276", "0.6850356", "0.68484896" ]
0.76982796
1
Encrypts the password with the user salt
def encrypt(plain_password) self.class.encrypt(plain_password) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n self.salt = make_salt unless has_password?(password)\n self.encrypted_password = encrypt(password)\n end", "def encrypt_password\n if self.password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(password + salt)\n end", "def encrypt_password\n\t unless @password.blank?\n self.password_salt = salt\n self.encrypted_password = encrypt(@password, salt)\n\t end\n\tend", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt(password, salt)\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt_password()\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.encrypted_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end", "def encrypt(password, salt=nil)\n salt ||= self.salt\n Digest::SHA1.hexdigest(\"--#{salt}--#{password}--\")\n end", "def encrypt_password\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end", "def encrypt_password(password)\n self.class.secure_digest([password, password_salt])\n end", "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.encrypted_password = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "def encrypt_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.encrypted_password= BCrypt::Engine.hash_secret(password, salt)\n end\n end", "def encrypt(password)\n User.password_digest(password, salt)\n end", "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "def encrypt_password\n if password.present?\n self.password_salt = BCrypt::Engine.generate_salt\n self.password_hash = BCrypt::Engine.hash_secret(password, password_salt)\n end\n end", "def encrypt(password)\n self.class.encrypt(password) #, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end" ]
[ "0.8456656", "0.83809954", "0.837295", "0.83666867", "0.8361271", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83577955", "0.83539045", "0.8353123", "0.83147633", "0.8314556", "0.83011955", "0.82853645", "0.8279242", "0.8253498", "0.82321554", "0.82296264", "0.82296264", "0.82296264", "0.82296264", "0.82296264", "0.82236284", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076", "0.82061076" ]
0.0
-1
Remember token remembers users between browser closures
def remember_token? remember_token_expires_at && Time.now.utc < remember_token_expires_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remember_token; end", "def remember(user)\n#goes to remember method in user.rb and returns user.remember_token, and saves hashed one\n user.remember\n# saves users id\n cookies.permanent.signed[:user_id]=user.id\n# saves users cookies token\n cookies.permanent[:remember_token]=user.remember_token\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc #remember token lasts 2 weeks\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{kerbid}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\r\n self.remember_token_expires_at = 2.weeks.from_now.utc\r\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\r\n save(false)\r\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{remember_token_expires_at}\")\n # save(:validate => false)\n end", "def remember(user) \n user.remember # the method creates remember_token for that user and saves the hashed the version in the db \n cookies.permanent.signed[:user_id] = user.id # This stores the user.ID(encrypted) in the browser cookie\n cookies.permanent[:remember_token] = user.remember_token # This stores the remember token(encrypted) in the cookie \n # the remember token was created in the first line of code \"user.remember\"\n end", "def remember_me; end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember_me() return true; end", "def remember\n self.remember_token_expires_at = 1.weeks.from_now.utc\n self.remember_token = Cryptography.encrypt_with_salt(\n SecureRandom.hex(10),\n remember_token_expires_at)\n save(false)\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\nend", "def remember_me\r\n time = 1.week.from_now.utc\r\n self.remember_token_expires_at = time\r\n self.remember_token = self.class.encrypt(\"#{email}--#{remember_token_expires_at}\", self.salt)\r\n save(:validate => false)\r\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = User.encrypt(\"#{name}--#{remember_token_expires_at}\")\n save!(validate: false)\n end", "def remember_me\n self.remember_token_expires_at = 2.months.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember\n self.remember_token = Band.new_token\n update_attribute(:remember_digest, Band.digest(remember_token))\n end", "def remember(user)\n user.remember # Defined in the User model\n cookies[:user_id] = { value: user.id,\n expires: 20.years.from_now.utc }\n\n cookies[:remember_token] = { value: user.remember_token,\n expires: 20.years.from_now.utc }\n end", "def remember_me\n self.remember_token_expires_at = 10.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate => false)\n end", "def remember(user)\nuser.remember\ncookies.permanent.signed[:user_id] = user.id\ncookies.permanent[:remember_token] = user.remember_token\nend", "def remember_me\n remember_me_for 2.years # BJS: essentially indefinitely\n end", "def refresh_token\n if remember_token?\n self.remember_token = self.class.make_token \n save(false) \n end\n end", "def remember\n # store virtually the new token\n self.remember_token = User.new_token\n # save the hash digest of the token on the database\n self.update_attribute(:remember_digest, User.digest(self.remember_token))\n end", "def remember\n self.remember_token = User.new_token\n # Writes token to db\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate => false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(:validate=> false)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{login}--#{remember_token_expires_at}\")\n save(false)\n end", "def remember(user)\n user.remember\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_token_digest, User.digest(remember_token))\n end", "def remember_me\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def create_remember_token \n self.remember_token = SecureRandom.urlsafe_base64\n end", "def sign_in(user)\n # Issues new random piece of text (aka\n # remember_token) to user\n remember_token = User.new_remember_token\n # Giving user plain text token\n cookies.permanent[:remember_token] = remember_token\n # Hashing the version of the remember_token which the host maintains.\n user.update_attribute(:remember_token, User.hash(remember_token))\n #sets the one who signed in (user) to current user\n self.current_user=user\n end", "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "def sign_in(user)\n # save current_user in remember_token cookie\n self.current_user = user \n cookies.permanent.signed[:remember_token] = [user.email, user.salt] \n end", "def remember\n self.remember_token = User.newtoken\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update remember_digest: User.digest(remember_token)\n end", "def create_remember_token\n self.remember_token = User.new_token.to_s\n self.remember_digest = User.digest(remember_token)\n end", "def remember\n self.remember_token = Client.new_remember_token\n update_attribute(:remember_token, Client.digest(remember_token))\n end", "def create_remember_token\n self.remember_token = SecureRandom.urlsafe_base64\n end", "def remember_me\n remember_me_for(14)\n end", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{email}--#{remember_token_expires_at}\")\n save(validate: false)\n end", "def remember\n self.remember_token = Incline::User::new_token\n update_attribute(:remember_digest, Incline::User::digest(self.remember_token))\n end", "def remember\n \tself.remember_token = User.new_token\n \tupdate_attribute(:remember_digest, User.digest(remember_token))\n end", "def refresh_token\n if remember_token?\n self.remember_token = self.class.make_token\n save(false)\n end\n end", "def remember(user)\n user.remember # Calls model\n cookies.permanent.signed[:user_id] = user.id # Save off encryped user ID\n cookies.permanent[:remember_token] = user.remember_token # Save off random thing for validation\n end", "def refresh_token\n if remember_token?\n self.remember_token = make_token \n save(:validate => false) \n end\n end", "def remember_me?; end", "def remember\n \tself.remember_token = User.new_token\n \tupdate_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n \tself.remember_token = User.new_token\n \tupdate_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n \tself.remember_token = User.new_token\n \tupdate_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n \tself.remember_token = User.new_token\n \tupdate_attribute(:remember_digest, User.digest(remember_token))\n end", "def handle_remember_cookie! new_cookie_flag\n return unless @current_user\n case\n when valid_remember_cookie? then @current_user.refresh_token # keeping same expiry date\n when new_cookie_flag then @current_user.remember_me\n else @current_user.forget_me\n end\n send_remember_cookie!\n end", "def login_from_cookie\nuser = cookies[:auth_token] && User.find_by_remember_token(cookies[:auth_token])\nif user && user.remember_token?\ncookies[:auth_token] = { :value => user.remember_token, :expires => user.remember_token_expires_at }\nself.current_user = user\nend\nend", "def remember\n \t\tself.remember_token = User.new_token\n \t\tupdate_attribute(:remember_digest, User.digest(remember_token))\n\tend", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token=User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token \n update_attribute(:remember_digest, User.digest(remember_token)) \n end", "def remember(user)\n user.remember # call remember method from User model class\n # places these two cookies on the browser\n cookies.permanent.signed[:user_id] = user.id\n cookies.permanent[:remember_token] = user.remember_token\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end", "def remember\n self.remember_token = User.new_token\n update_attribute(:remember_digest, User.digest(remember_token))\n end" ]
[ "0.8017096", "0.75709236", "0.7546626", "0.7537563", "0.7514134", "0.75125575", "0.74719423", "0.74566025", "0.74316955", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74314374", "0.74126595", "0.74107426", "0.74088776", "0.73961884", "0.7375286", "0.73617905", "0.7357783", "0.7334645", "0.73178476", "0.73172945", "0.7305492", "0.7293665", "0.7285481", "0.72843564", "0.7278482", "0.7273373", "0.7266035", "0.72603315", "0.72547525", "0.72482187", "0.72451633", "0.7240701", "0.72374636", "0.72310084", "0.7214898", "0.72117597", "0.71992856", "0.7199059", "0.71985763", "0.7195857", "0.71954644", "0.719375", "0.7188916", "0.71879196", "0.7186854", "0.71862185", "0.7183744", "0.718245", "0.718245", "0.718245", "0.718245", "0.7181468", "0.71807164", "0.7171284", "0.7169378", "0.71671283", "0.7161265", "0.7150294", "0.714477", "0.714477", "0.7143159", "0.7142638", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805", "0.71410805" ]
0.0
-1
These create and unset the fields required for remembering users between browser closes
def remember_me remember_me_for 2.weeks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forgets\n update_attribute(:remember_digest, nil)\n end", "def after_save\n cookies['global_properties_for_user'] = nil\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n \n end", "def forget\n\t\tupdate_attribute(:remember_digest,nil)\n\tend", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend", "def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend", "def forget\n\t\tupdate_attribute(:remember_digest, nil)\n\tend", "def forget\n update_attribute :remember_digest, nil\n end", "def forget\n update_attribute :remember_digest, nil\n end", "def forget\n update_attribute(:remember_digest, nil)\n end", "def clear_user_and_mark_purged\n random_suffix = (('0'..'9').to_a + ('a'..'z').to_a).sample(8).join\n\n self.studio_person_id = nil\n self.name = nil\n self.username = \"#{SYSTEM_DELETED_USERNAME}_#{random_suffix}\"\n self.current_sign_in_ip = nil\n self.last_sign_in_ip = nil\n self.email = ''\n self.hashed_email = ''\n self.parent_email = nil\n self.encrypted_password = nil\n self.uid = nil\n self.reset_password_token = nil\n self.full_address = nil\n self.properties = {}\n\n self.purged_at = Time.zone.now\n\n save!\n end", "def clear_fields\n self.password=nil\n self.username=nil\n self.role=nil\n end", "def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(:validate => false) \n end", "def clear_login_data\r\n session[:edit_mode] = 0\r\n session[:user_id] = nil\r\n session[:user_name] = nil\r\n session[:user_roles] = nil\r\n cookies.delete :remember_me\r\nend", "def after_remembered; end", "def after_remembered\n end", "def forget_me\r\n self.remember_token_expires_at = nil\r\n self.remember_token = nil\r\n save(:validate => false)\r\n end", "def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(:validate => false)\n end", "def reset!\n self.user_values = {}\n\n # @inputs have to be nil, not an empty hash. otherwise\n # the memoized inputs will not pick up the changes.\n @inputs = nil\n end", "def userinfo_unset\n userinfo_set nil\n end", "def forget(user)\n user.update_attribute(:remember_digest, nil)\n cookies.delete(:student_id) if student?\n cookies.delete(:tutor_id) if tutor?\n cookies.delete(:remember_token)\n end", "def after_create\n @password = nil\n @confirm_password = nil\n end", "def forget\n update_attribute(:remember_token, nil)\n end", "def remember_values\n logger.debug {\"Generating remember values\"}\n {}\n end", "def clean_up_passwords\n self.dob = nil\n super\n end", "def reset_session_variables\n session[:login] = ''\n session[:register_id] = ''\n session[:register_name] = ''\n session[:folio_id] = ''\n session[:folio_image] = ''\n session[:first_folio_id] = ''\n session[:last_folio_id] = ''\n session[:browse_id] = ''\n session[:browse_image] = ''\n end", "def clean_up\n Capybara.current_session.execute_script \"window.localStorage.removeItem('pushEnabled');window.localStorage.removeItem('clark-user-journey');\"\n end", "def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(false)\n end", "def forget_me\n self.remember_token_expires_at = nil\n self.remember_token = nil\n save(false)\n end", "def forget\n update_attribute(:remember_digest, nil)\n # We don't need the below line because if we update remember_digest to nil, then\n # you cannot use the old remember_token anyway, so it is unnecessary\n # self.remember_token = nil\n end", "def teardown\n @user_admin = nil\n @user_admin_details = nil\n\n @user_normal = nil\n @user_normal_details = nil\n\n session[:user_id] = nil\n end", "def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end", "def forget\n self.remember_token = nil\n update_attribute(:remember_digest, nil)\n end", "def force_forget_me!\n config = sorcery_config\n sorcery_adapter.update_attributes(config.remember_me_token_attribute_name => nil,\n config.remember_me_token_expires_at_attribute_name => nil)\n end", "def clear_new_flight_variables\n session[:new_flight] = Hash.new\n end", "def after_create\n @password = nil\n end", "def after_create\n @password = nil\n end", "def set_logged_out\n @id = nil\n @nonce = nil\n @ip = nil\n end", "def sign_out\n @username = nil\n @current_user = nil\n\n @modhash = nil\n @cookie = nil\n end", "def forget\n self.remember_token = nil\n self.update_attribute(:remember_digest, nil)\n end", "def sign_out\n #Setting current user's remember_token to a\n #new hash that is in valid\n #The idea is to make every record in the\n #table to look identical in an attempt to\n #thwart evil\n current_user.update_attribute(:remember_token, User.hash(User.new_remember_token))\n #Deletes current user's remember_token from hash\n cookies.delete(:remember_token)\n #sets current use to empty\n self.current_user = nil\n end", "def remember_me=(_arg0); end", "def check_for_removal\n if @value && @unused && @unused[\"unused\"]\n @res.cookies << create_cookie(\"unused\", false, 'flash_unused')\n elsif @value\n @value = nil\n @res.cookies << create_cookie(\"unused\", nil, 'flash_unused')\n @res.cookies << create_cookie(\"message\", nil)\n end\n end", "def discard_saved_state\n end", "def set_defaults\n self.state ||= 'NEW'\n self.user_id ||= Gizmo::Util::Uuid.generate\n end", "def forget_me!\n sorcery_config.remember_me_token_persist_globally || force_forget_me!\n end", "def destruir\n session[:email]=nil\n session[:nombre]=nil\n session[:apellido]=nil\n $email=''\n $nombre=''\n end", "def clean_up\n @minefield = nil\n end", "def logout\n session[:email] = nil\n session[:firstname] = nil\n session[:lastname] = nil \n render :adduser \n end", "def reset_fields\n self.outpost_queued = false\n # outpost_prevent is set and reset at end of previous turn\n # pirate_coins persists turn after turn\n self.gained_last_turn = []\n self.bought_victory = false\n self.played_treasure = false\n self.played_crossroads = false\n self.played_fools_gold = false\n save!\n end", "def session_reset(db_user) # User record\n # Clear session hash just to be sure nothing is left (but copy over some fields)\n winh = session[:winH]\n winw = session[:winW]\n session.clear\n session[:winH] = winh\n session[:winW] = winw\n\n session[:userid] = db_user.userid\n\n # Set the current userid in the User class for this thread for models to use\n User.current_userid = session[:userid]\n\n session[:username] = db_user.name\n\n # set group and role ids\n session[:group] = db_user.miq_group.id # Set the user's group id\n session[:group_description] = db_user.miq_group.description # and description\n role = db_user.miq_group.miq_user_role\n session[:role] = role.id # Set the group's role id\n\n # Build pre-sprint 69 role name if this is an EvmRole read_only role\n session[:userrole] = role.read_only? ? role.name.split(\"-\").last : \"\"\n\n # Save an array of groups this user is eligible for, if more than 1\n eg = db_user.eligible_miq_groups.sort{|a,b| a.description.downcase <=> b.description.downcase}\n session[:eligible_groups] = db_user.nil? || eg.length < 2 ?\n [] :\n eg.collect{|g| [g.description, g.id]}\n\n # Clear instance vars that end up in the session\n @sb = @edit = @view = @settings = @lastaction = @perf_options = @assign =\n @current_page = @search_text = @detail_sortcol = @detail_sortdir =\n @exp_key = @server_options = @tl_options =\n @pp_choices = @panels = @breadcrumbs = nil\n end", "def reset_unnecessary_fields\n self.department_id = nil\n self.media = nil\n self.telephone = nil\n self.organization = nil\n self.stream_flow_ids = []\n self.public_role_es = nil\n self.public_role_eu = nil\n self.public_role_en = nil\n self.gc_id = nil\n self.description_es = nil\n self.description_eu = nil\n self.description_en = nil\n self.politician_has_agenda = nil\n end", "def forget\n self.remember_token = nil\n update_attribute(:remember_token_digest, nil)\n end", "def resets; end", "def forget(tok)\n update_attributes! remember_hash: remember_hash.delete_if { |_k, v| Encrypt::Password.validatePassword tok, v } unless tok.nil?\n end", "def clear_back_office_data\n @flbt_type = nil\n @version = nil\n @submitted_date = nil\n @effective_date = nil\n @filing_date = nil\n @ads_included = nil\n @ads_amount = nil\n @number_of_buyers = nil\n end", "def reset_cleared_default_fields\n @cleared_default_fields = {}\n end", "def clear_cookie\n create_accesses_cookie\n end", "def remember_me; end", "def fortune_cookie; end", "def set_new_form_vars\n @edit = {}\n @edit[:key] = \"sm_edit__new\"\n @edit[:new] = {}\n @edit[:current] = {}\n\n @edit[:new][:name] = nil\n @edit[:sm_types] = StorageManager.storage_manager_types\n @edit[:new][:hostname] = nil\n @edit[:new][:ipaddress] = nil\n @edit[:new][:port] = nil\n @edit[:new][:sm_type] = nil\n # @edit[:new][:agent_type] = nil\n @edit[:new][:zone] = \"default\"\n @edit[:server_zones] = []\n zones = Zone.all\n zones.each do |zone|\n @edit[:server_zones].push(zone.name)\n end\n\n @edit[:new][:userid] = nil\n @edit[:new][:password] = nil\n @edit[:new][:verify] = nil\n\n session[:verify_sm_status] = nil\n set_verify_status\n\n @edit[:current] = @edit[:new].dup\n session[:edit] = @edit\n end", "def reset!\n defaults = Settler.config[self.key]\n self.label = defaults['label']\n self.value = defaults['value']\n self.editable = defaults['editable']\n self.deletable = defaults['deletable']\n self.deleted = false\n save(:validate => false)\n end", "def valid_upto\n GlobalConstant::Cookie.password_auth_expiry\n end", "def forget_me!\n return unless persisted?\n self.remember_token = nil if respond_to?(:remember_token)\n self.remember_created_at = nil if self.class.expire_all_remember_me_on_sign_out\n save(validate: false)\n end", "def reset_current_useritem\n session[:useritem_id] = nil\n session[:useritem_type] = nil\n end", "def set_defaults\n self.state ||= 'NEW'\n self.account_id ||= Gizmo::Util::Uuid.generate\n self.account_name ||= self.subdomain\n end", "def reset_guest!\n original_locale = session[:locale]\n original_scores = session[:show_scores]\n\n sign_out(:user) if user_signed_in?\n reset_session\n\n session[:locale] = original_locale\n session[:show_scores] = original_scores\n\n cookies.delete :guest\n @_guest = nil\n end", "def reset_to_defaults!\n @allowlist_regexp = nil\n @custom_http_auth_scheme = UnsetString.new(\"custom_http_auth_scheme\")\n @env_var_to_hold_api_client_primary_key = NonNullString.new(\"env_var_to_hold_api_client_primary_key\",\"STITCHES_API_CLIENT_ID\")\n @env_var_to_hold_api_client= NonNullString.new(\"env_var_to_hold_api_client\",\"STITCHES_API_CLIENT\")\n @max_cache_ttl = NonNullInteger.new(\"max_cache_ttl\", 0)\n @max_cache_size = NonNullInteger.new(\"max_cache_size\", 0)\n @disabled_key_leniency_in_seconds = ActiveSupport::Duration.days(3)\n @disabled_key_leniency_error_log_threshold_in_seconds = ActiveSupport::Duration.days(2)\n end", "def create_user_information # for new users. runs last according to rails.\n self.dj_name = name\n self.roles = Role.where(:title => 'noob')\n self.active = true\n set_password\n end", "def clean_up_passwords; end", "def reset\n session[:emirate_id] = nil\n session[:emirate_name] = nil\n session[:neighborhood_id] = nil\n session[:neighborhood_name] = nil\n session[:project_id] = nil\n session[:project_name] = nil\n session[:building_id] = nil\n session[:building_name] = nil\n flash[:notice] = \"Selected value for Emirate has been reseted.\"\n redirect_to(request.env['HTTP_REFERR'] || emirates_url)\n end", "def refresh_expiration \n \t self.needs_new_cookie=true \n \tend", "def remember_me\n self.remember_token_expires_at = 2.weeks.from_now.utc\n self.remember_token = encrypt(\"#{remember_token_expires_at}\")\n # save(:validate => false)\n end", "def forget\n \tputs \"%USER-I-TRACE, forget called.\"\n\t\tupdate_attribute(:remember_digest, nil)\n\tend", "def abandon!\n @user = nil\n session.clear\n end", "def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end", "def cleared_required\n if current_user\n if current_user.cleared\n return\n end\n raise 'Du är ännu inte godkänd för att tippa.'\n end\n redirect_to \"/login\", notice: 'Logga in för att tippa.'\n end", "def reset!\n reset_secret\n refresh_expiry\n reset_confirmation\n save!\n end", "def forget_form_data(type)\n session.delete(type)\n end", "def remember_me() return true; end" ]
[ "0.655833", "0.64576274", "0.6433039", "0.6433039", "0.63186485", "0.6318346", "0.62982345", "0.62982345", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6266504", "0.6252695", "0.6252695", "0.6252695", "0.62494266", "0.62494266", "0.6221605", "0.62047994", "0.61707467", "0.6157821", "0.6139168", "0.6128803", "0.60424393", "0.60367966", "0.59947336", "0.5886899", "0.58703595", "0.5850127", "0.5849959", "0.58350986", "0.5799766", "0.5749178", "0.5726777", "0.5696514", "0.56919754", "0.56919754", "0.567833", "0.566733", "0.56405693", "0.56405693", "0.5634449", "0.5626462", "0.558413", "0.558413", "0.556913", "0.5564659", "0.5563434", "0.55582345", "0.55325294", "0.55272514", "0.55179334", "0.5517242", "0.5510993", "0.54968077", "0.5490115", "0.5482928", "0.5475412", "0.54741484", "0.5471919", "0.546449", "0.543982", "0.54385984", "0.5434804", "0.54124016", "0.54083997", "0.5403811", "0.5401727", "0.53954965", "0.53888035", "0.53721374", "0.53679377", "0.53436095", "0.53367555", "0.53323185", "0.53320724", "0.532623", "0.53255653", "0.53242767", "0.5322038", "0.5310463", "0.5305345", "0.5303277", "0.5302871", "0.5295144", "0.52868015", "0.52844334", "0.5281007" ]
0.0
-1
We are going to connect this user object with a facebook id. But only ever one account.
def link_fb_connect(fb_user_id) unless fb_user_id.nil? #check for existing account existing_fb_user = ::User.find_by_fb_user_id(fb_user_id) #merge the existing account unless existing_fb_user.nil? merge_with(existing_fb_user) end #link the new one self.fb_user_id = fb_user_id save(false) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n # UPDATE:\n # allow multiple accounts to use the same facebook id I guess - \n # makes debugging a lot easier too\n existing_fb_user = User.find_by_facebook_uid(fb_user_id)\n \n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.facebook_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.facebook_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = metaclass.send(\"find_by_#{fb_user_name}\", fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.send(\"#{fb_user_name}_id=\", nil)\n existing_fb_user.save(false)\n end\n #link the new one\n self.send(\"#{fb_user_name}_id=\", fb_user_id)\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def link_fb_connect(fb_user_id)\n unless fb_user_id.nil?\n #check for existing account\n existing_fb_user = User.find_by_fb_user_id(fb_user_id)\n #unlink the existing account\n unless existing_fb_user.nil?\n existing_fb_user.fb_user_id = nil\n existing_fb_user.save(false)\n end\n #link the new one\n self.fb_user_id = fb_user_id\n save(false)\n end\n end", "def set_facebook_account\n @facebook_account = FacebookAccount.find(params[:id])\n end", "def link_fb_connect(fb_user)\n\t unless fb_user.id.nil?\n\t #check for existing account\n\t existing_fb_user = RmUser.find_by_fb_usid(fb_user.id)\n\t #unlink the existing account\n\t unless existing_fb_user.nil?\n\t #existing_fb_user.fb_usid = nil\n\t #existing_fb_user.save(false)\n\t end\n\t #link the new one\n\t self.fb_usid = fb_user.id\n\t self.first_name = fb_user.first_name\n\t self.last_name = fb_user.last_name\n\t #self.name = \n\t save(false)\n\t end\n\tend", "def facebook_id \n self.facebook_auth_cache.uid\n end", "def link_user_accounts\n if self.current_user.nil?\n #register with fb\n User.create_from_fb_connect(facebook_session.user)\n else\n #connect accounts\n self.current_user.link_fb_connect(facebook_session.user.id) unless self.current_user.fb_user_id == facebook_session.user.id\n end\n create_current_login_cookie\n update_balance_cookie\n redirect_back_or_default('/')\n end", "def facebook\n @fb_user ||= FbGraph::User.me( self.authentications.find_by_provider('facebook').token)\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\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 facebook_id=(uid)\n self.uid = uid\n end", "def associate_user\n \tfbUserIdString = params[:idString]\t\n \tuser = User.new(fbUserId:fbUserIdString)\n \tif user.valid?\t\n\t\t\t user = User.create(fbUserId:fbUserIdString)\n\t\t\t success = true\n\t\t end\n\t\t start_session(fbUserIdString)\n end", "def open_user_account\n Account.create(user_id: self.id) \t\n end", "def create_from_fb_connect(fb_user, username)\n u = ::User.find(:first, :conditions => {_(:username) => username} )\n if u\n u.facebook_hash = fb_user.email_hashes.first\n u.fb_user_id = fb_user.uid\n else\n u = ::User.create(_(:username) => username || fb_user.email_hashes.first, _(:last_login) => Time.now.utc, _(:fb_user_id) => fb_user.uid, _(:facebook_hash) => fb_user.email_hashes.first)\n end\n u.create_person_from_fb(fb_user) unless u.person\n u.save(false)\n u\n end", "def get_facebook_user(facebook_id)\n @graph = Koala::Facebook::API.new(fb_access_token) if !fb_access_token.blank?\n @graph ? @graph.get_object(\"me\") : nil\n end", "def transfer_to_facebook_account(facebook_user_id)\n\n # current account (old) -> facebook account (new)\n # current is destroyed\n # current account must be standard account\n\n old_user = self\n new_user = User.find(facebook_user_id)\n\n # the current user (old_user) should be a standard account (log in with email/password)\n raise \"Current user (the one which will be destroyed) is not a standard account!\" if !old_user.standard_account?\n\n # the new user should be a facebook-authenticated account\n raise \"New user (the one to be merged to and retained) is not a facebook account!\" if !new_user.facebook_account?\n\n transfer_account :old => old_user, :new => new_user\n\n end", "def likely_facebook_account\n facebook_accounts.first.andand.first\n end", "def set_social_account\r\n @social_account = SocialAccount.find(params[:id])\r\n end", "def register_by_facebook_account(fb_session, fb_uid)\n api = FacebookGraphApi.new(fb_session.auth_token, fb_uid)\n user_attributes = api.find_user(fb_uid)\n email = user_attributes['email'] || 'FAKE'\n name = user_attributes['name'] || ''\n\n if !email.blank? && !name.blank?\n existing_user = User.find_by_email(email)\n existing_user = User.find_by_facebook_uid(fb_uid) if existing_user.nil?\n\n if existing_user\n existing_user.facebook_uid = fb_uid\n existing_user.facebook_sid = fb_session.auth_token\n existing_user.facebook_connect_enabled = true\n existing_user.save(false)\n\n existing_user.update_attribute(:state, 'active')\n existing_user\n else\n attributes = {\n :login => find_or_build_unique_user_name(name),\n :name => name,\n :email => find_or_build_unique_fake_email(email),\n :facebook_uid => fb_uid,\n :facebook_sid => fb_session.session_key,\n :activated_at => Time.now,\n :state => 'active',\n :facebook_connect_enabled => true\n }\n\n user = User.new(attributes)\n user.save(false)\n\n user.update_attribute(:state, 'activate')\n user\n end\n else\n # Do something else let's log him out from facebook\n raise 'Durrr! you are one of those unlucky person for whom we haven\\'t fixed this bug!\n please let me know that i told you this crap!' + \" data - #{user_attributes.inspect}\"\n end\n end", "def identify(fb_user)\n user = find_or_initialize_by_identifier(fb_user.identifier.try(:to_s))\n user.access_token = fb_user.access_token.to_s\n user.save!\n user\n end", "def login_from_facebook\n fb_cookie = get_facebook_cookie\n return unless fb_cookie and fb_cookie[\"uid\"]\n\n #uid : 507527287\n #sig : ddf9dffcd85fcc41dbe4257b5eee922b\n #base_domain : gear.com\n #secret : fSoxbS_tGGF0oP2c9_SUbw__\n #access_token : 225955489319|2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287|d5zULU1zLZFguUUcsqVU0-C-tOM.\n #session_key : 2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287\n #expires : 1278799200\n\n user = User.find_by_fb_user_id(fb_cookie[\"uid\"])\n\n # cant find the user in the db but they have a fb session..\n return unless user\n \n # Add fb user to the user object and set the current user\n self.current_user = user \n end", "def fb_user\n FbGraph::User.me(fb_token)\n end", "def set_social_account\n @social_account = SocialAccount.find(params[:id])\n end", "def set_social_account\n @social_account = SocialAccount.find(params[:id])\n end", "def set_social_account\n @social_account = SocialAccount.find(params[:id])\n end", "def connect\n raise ArgumentError unless (params[:fname] == '_opener')\n raise ArgumentError unless connect = ActiveSupport::JSON.decode(params[:session])\n\n @user = User.find_by_facebook_uid(connect['uid'])\n\n if @user.nil?\n # create a new user for the Facebook User if not present\n @user = User.new\n @user.facebook_uid = connect['uid']\n\n # XXX this is crap: login, country and email should be fetched from the facebook. Why?\n # because: login clashes could occur (if an user names itself fb_123456), the \"unknown\"\n # country is BAD design, because it's a corner case to cope with in views, and the fake\n # email is USELESS to send mewsic e-mail notifications to the user.\n #\n @user.login = \"fb_#{@user.facebook_uid}\" # XXX\n @user.country = \"unknown\" # XXX\n @user.email = \"#{@user.facebook_uid}@users.facebook.com\" # XXX\n\n @user.password = @user.password_confirmation = rand(2**32).to_s\n @user.save!\n end\n\n session[:fb_connect] = true\n self.current_user = @user\n\n # render the cross-domain communication channel\n render :layout => false\n\n rescue ActiveRecord::ActiveRecordError\n debugger\n head :forbidden\n\n rescue ArgumentError\n head :bad_request\n end", "def link_fb_to_user\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\n\t\taccess_token = params[:access_token]\n\t\t\n\t\t#url = 'https://graph.facebook.com/me?access_token='+access_token\n\t\tbegin\n\t\t\tfb_user = FbGraph::User.fetch('me', :access_token=>access_token)\n\t\t\tfb_id = fb_user.identifier\n\t\t\temail = fb_user.email.strip.downcase\n\t\t\t\n\t\t\t#Check if user exists by email\n\t\t\tuser = User.find_by_email(email)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under your Facebook email.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t#Check if user exists by Facebook ID\n\t\t\tuser = User.find_by_fb_id(fb_id)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under this Facebook account.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t@user.fb_id = fb_id\n\t\t\t@user.fb_access_token = access_token\n\t\t\t\n\t\t\t@user.save\n\t\t\tsession['user'] = @user\n\t\t\t\n\t\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\t\t\t\n\t\trescue\n\t\t\trender :json=>{:success=>false, :msg=>'There was an error. Refresh the page and try again.'} and return\n\t\tend\n\tend", "def set_userfb\n @user = Userfb.find(params[:id])\n end", "def find_by_fb_user(fb_user)\n u = ::User.find(:first, :conditions => {_(:fb_user_id, :user) => fb_user.uid}) || ::User.find(:first, :conditions => {_(:facebook_hash, :user) => fb_user.email_hashes})\n # make sure we have a person\n if u && !u.person\n u.create_person_from_fb(fb_user)\n end\n u.update_attribute(:fb_user_id, fb_user.uid) if u && !u.fb_user_id\n u\n rescue ::Facebooker::Session::SessionExpired\n nil\n end", "def set_social_account\n\t\t\t@social_account = SocialAccount.find(params[:id])\n\t\tend", "def current_user\n User.find_by(facebook_id: params[:facebook_id])\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 connect\n self.user_id = find_verified_user\n end", "def register_user_to_fb\n\t #users = {:email => email, :account_id => id}\n\t #Facebooker::User.register([users])\n\t #self.email_hash = Facebooker::User.hash_email(email)\n\t #save(false)\n\tend", "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 register(accessToken, userID)\n #logger.info \"Starting registration for #{userID}\"\n # User wasn't found, register him\n @user = User.new\n graph = Koala::Facebook::API.new(accessToken)\n user_data = graph.get_object(userID)\n friends = graph.get_connections(userID, \"friends\")\n @user.fb_token = accessToken\n @user.id = userID\n @user.fb_id = userID\n @user.name = user_data[\"name\"]\n @user.email = user_data[\"email\"]\n @user.first_name = user_data[\"first_name\"]\n @user.last_name = user_data[\"last_name\"]\n @user.link = user_data[\"link\"]\n @user.gender = user_data[\"gender\"]\n\n #Friendship.transaction do\n # friends.each { |friend| Friendship.create(:friend_id => friend[\"id\"], :user_id => userID) }\n #end\n \n @user.save\n\n if @user.nil?\n logger.info \"ERROR!\"\n logger.info \"#{userID}\" if @user.nil?\n logger.info user_data.inspect if @user.nil?\n else\n logger.info \"#{userID} successfully registered\"\n end\n\n return @user \n end", "def fetch_details_from_facebook\n\t\t# graph = Koala::Facebook::API.new(self.token)\n\t\t# facebook_data = graph.get_object(\"me\")\n\t\t# self.username = facebook_data['username']\n\t\t# self.save\n\t\t# self.user.username = facebook_data['username'] if self.user.username.blank?\n\t\t# self.user.image = \"http://graph.facebook.com/\" + self.username + \"/picture?type=large\" if self.user.image.blank?\n\t\t# self.user.location = facebook_data['location'] if self.user.location.blank?\n\t\t# self.user.save\n\t\tself.user.has_facebook = true\n\t\tself.user.save\n\tend", "def create\n @user = User.new(user_params)\n @same_fb_id = User.find_by_fb_id(@user.fb_id)\n if @same_fb_id == nil\n @user.save\n end\n respond_with @user\n end", "def check_facebook \n return unless Facebooker.api_key\n if logged_in? and facebook_session and not current_user.has_facebook?\n return if facebook_session.user.uid == 55714215 and current_user.id != 1 # this is jim, don't add his facebook to everyone's account!\n @user = User.find(current_user.id)\n if not @user.update_with_facebook(facebook_session)\n return\n end\n if not @user.activated?\n @user.activate!\n end \n @current_user = User.find(current_user.id)\n flash.now[:notice] = t('facebook.synced', :government_name => current_government.name)\n end \n end", "def create_from_fb\n fb_user = FbGraph::User.fetch(\n \"me?fields=first_name,last_name,\"\\\n \"gender,email,birthday\",\n :access_token => params[:access_token])\n\n @user = User.add_from_fb(fb_user,@source)\n end", "def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end", "def make_user\n @user = User.new(session_token: params[:session_token])\n graph = Koala::Facebook::API.new(@user.session_token)\n id = graph.get_object(\"me\")[\"id\"]\n if id != params[:facebook_id]\n render json: [\"Invalid session token\"], status: 401\n return\n end\n @user.fill_user_data(graph)\n if @user.save\n # @user.add_friends(graph)\n render \"api/users/show\"\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def set_user_id\n User.stats.limit(2).each do |user|\n self.user_id = user['id']\n\n # prevents us from setting back to the same user\n if self.changes['user_id'][0] != self.changes['user_id'][0]\n break\n end\n end\n end", "def connect(user)\n user.purchases.each do |purchase|\n purchase.purchaser_id = self.id\n purchase.save\n end\n\n user.contributions.each do |contribution|\n contribution.user_id = self.id\n contribution.save\n end\n\n user.obligations.each do |obligation|\n obligation.user_id = self.id\n obligation.save\n end\n\n user.friendships.each do |friendship|\n friendship.user_id = self.id\n friendship.save\n end\n\n Friendship.where(friend: user).each do |friendship|\n friendship.friend_id = self.id\n friendship.save\n end\n\n user.memberships.each do |membership|\n membership.user_id = self.id\n membership.save\n end\n\n user.organized_trips.each do |trip|\n trip.organizer_id = self.id\n trip.save\n end\n\n self.facebook_id ||= user.facebook_id\n self.facebook_access_token ||= user.facebook_access_token\n self.facebook_access_token_expires_at ||= user.facebook_access_token_expires_at\n\n self.twitter_id ||= user.twitter_id\n self.twitter_access_token ||= user.twitter_access_token\n self.twitter_access_secret ||= user.twitter_access_secret\n\n self.save\n\n User.destroy(user.id)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n end", "def set_connected_account\n @connected_account = ConnectedAccount.find(params[:id])\n end", "def added_fb_account?\n !self.external_user_id.nil?\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.send(\"#{fb_email_hash_name}=\", Facebooker::User.hash_email(email))\n save(false)\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 on_behalf_of_user_id=(value)\n @on_behalf_of_user_id = value\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n r = Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def facebook_user\n (session[:facebook_session] && session[:facebook_session].session_key) ? session[:facebook_session].user : nil\n end", "def facebook\n @user = User.find_for_facebook_oauth(request.env[\"omniauth.auth\"], current_user)\n\n if @user.persisted?\n @user\n sign_in_and_redirect @user, :event => :authentication #this will throw if @user is not activated\n set_flash_message(:notice, :success, :kind => \"Facebook\") if is_navigational_format?\n else\n request.env[\"omniauth.auth\"]\n session[\"devise.facebook_data\"] = request.env[\"omniauth.auth\"]\n redirect_to new_user_registration_url\n end\n end", "def facebook_profile\n @network = current_user.network ||= Network.new\n (@network.facebook.nil?) ? \"\" : @network.facebook\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 sync_user_logins(user)\n canvas_user = find_user(user.email)\n if canvas_user.nil?\n create_user(user)\n else\n user.canvas_user_id = canvas_user['id']\n end\n\n user\n end", "def connected_to_facebook?\n !self.facebook_id.blank?\n end", "def signup_facebook_user\n @user = Spree::User.new(user_params_list)\n @user.facebook_token = session[:fb_token]\n\n @user.addresses.first.country_id = 503\n\n if @user.save\n session\n signin_vegan_user(@user.id)\n else\n render 'complete_signup'\n end\n end", "def create\n @social_account = SocialAccount.new(social_account_params)\n @social_account.user_id = 1\n\n respond_to do |format|\n if @social_account.save\n format.html { redirect_to @social_account, notice: 'Social account was successfully created.' }\n format.json { render :show, status: :created, location: @social_account }\n else\n format.html { render :new }\n format.json { render json: @social_account.errors, status: :unprocessable_entity }\n end\n end\n end", "def identify\n @user = User.new\n if omniauth = session[:omniauth]\n @provider = omniauth.provider.capitalize\n @user.apply_omniauth(omniauth)\n end\n end", "def before_connect(fb_session)\n begin\n # Get user info and store in session.\n fb_session.user.populate\n logger.debug \"FACEBOOK SESSION: #{pp fb_session.user}\"\n \n # == Account details.\n self.facebook_proxy_email = fb_session.user.try(:proxied_email)\n self.login = fb_session.user.try(:username) # not supported by Facebooker right now\n self.locale = fb_session.user.try(:locale) # or nil\n self.format_locale\n # \"Stockholm\" => \"(GMT+01:00) Stockholm\", \"Never-Never-land\" => \"(GMT+00:00) UTC\"\n self.time_zone = fb_session.user.try(:current_location).try(:city)\n self.country = fb_session.user.try(:current_location).try(:country) # or nil\n \n # == Account profile details.\n profile_hash = {}\n profile_hash[:real_name] = fb_session.user.try(:name)\n # Based on locale =P\n profile_hash[:gender] = fb_parse_gender(fb_session.user.try(:sex))\n \n # == Examples:\n # profile_hash[:about_me] = facebook_session.user.try(:profile_blurb)\n # profile_hash[:birthdate] = facebook_session.user.try(:birthday_date).try(:to_date)\n # profile_hash[:birthdate] ||= facebook_session.user.try(:birthday).try(:to_date)\n \n self.profile ||= Profile.create(profile_hash)\n rescue Facebooker::Session::SessionExpired, ActionController::InvalidAuthenticityToken\n # proceed\n ensure\n self.confirmed_at = Time.now # Activate account - no e-mail confirmation for FBC-accounts.\n self.format_locale\n end\n end", "def register_user_to_fb(force = false)\n if force || changed.include?('username') || changed.include?('facebook_username')\n email = facebook_username.present? ? facebook_username : username\n users = {:email => email, :account_id => id}\n ::Facebooker::User.register([users]) unless Rails.env.test?\n self.facebook_hash = ::Facebooker::User.hash_email(email)\n end\n end", "def fb_auth\n @auth ||= self.authentications.facebook.first\n end", "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 fetch_details_from_facebook\n graph = Koala::Facebook::API.new(self.token)\n facebook_data = graph.get_object(\"me\")\n self.username = facebook_data['username']\n self.save\n end", "def register_user_to_fb\n if AppConfig.register_users_to_facebook\n begin # DON'T LET FACEBOOK FUCK UP NEW USERS\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n rescue Exception => e\n Rails.logger.warn \"Facebook barfed in User.register_user_to_fb: #{e.message}\"\n end\n end\n true\n end", "def user_id\n self.user.id unless user.nil?\n end", "def get_account_id\n if user\n return user.get_account_id\n end\n end", "def user_id\n raise \"Implement in Client or Advocate\"\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 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 facebook\n social_login(request.env['omniauth.auth'], current_user,\"Facebook\")\n end", "def check_user_id\n if self.user_id.nil?\n set_user_id\n end\n end", "def facebook_account_ids\n @facebook_account_ids ||=\n current_user\n .accounts\n .where(type: :facebook)\n .map { |a| a.data[:id] }\n end", "def on_behalf_of_user_id\n return @on_behalf_of_user_id\n end", "def facebook\n user = User.from_facebook_omniauth(request.env[\"omniauth.auth\"])\n if user.persisted?\n sign_in_and_redirect user, notice: \"#{user.name}, you are signed in!\"\n else\n session[\"devise.user_attributes\"] = user.attributes\n redirect_to new_user_registration_url\n end\n end", "def create\n #Create user instance\n @user = User.new(params[:user])\n @user.fb_uid = facebook_user.uid if facebook_user \n if @user.save\n \n #flash[:notice] = sprintf(t(:user_created_confirmation_sent), @user.name,@user.email) unless facebook_user\n flash_notice(:user_created_confirmation_sent, @user.full_name,@user.email) unless facebook_user\n \n create_session(@user) if facebook_user\n redirect_to_last_page\n else\n render :action => \"new\"\n end\n end", "def authenticate(fb_user)\n \n \n end", "def user_id; 1; 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 set_current_user\n set_facebook_session\n # if the session isn't secured, we don't have a good user id\n if facebook_session and\n facebook_session.secured? and\n !request_is_facebook_tab?\n self.current_user =\n User.for(facebook_session.user.to_i, facebook_session)\n end\n end", "def set_user\n id = params[:id] == 'me' ? current_user.login : params[:id]\n @user = LDAP::User.find(id)\n end", "def fgraph_current_user\n return @fgraph_current_user if @fgraph_current_user\n @fgraph_current_user = fgraph_client.me \n end", "def account_user(id)\n get(\"accountuser/#{id}\")\n end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end", "def account; Account.get(self.account_id); end" ]
[ "0.7504093", "0.7490277", "0.7399922", "0.7399922", "0.7399922", "0.7399922", "0.73369694", "0.7231991", "0.72258043", "0.70384943", "0.6854877", "0.67980784", "0.67314434", "0.6724964", "0.6720284", "0.6681034", "0.66633296", "0.6646808", "0.664005", "0.6634973", "0.6614998", "0.6526687", "0.6504155", "0.64999664", "0.64912844", "0.6483471", "0.6467985", "0.6467985", "0.6467985", "0.6454503", "0.6451646", "0.6449272", "0.64173883", "0.6382644", "0.63544494", "0.63456887", "0.6314693", "0.63032335", "0.62923825", "0.6287986", "0.62675726", "0.6261492", "0.6244259", "0.62404895", "0.6215465", "0.61744225", "0.6164352", "0.61620355", "0.6122828", "0.6119308", "0.6119124", "0.6108578", "0.6108578", "0.61032635", "0.61031806", "0.6095781", "0.6075896", "0.6073175", "0.60712034", "0.60692143", "0.6067652", "0.60668534", "0.60560805", "0.60549664", "0.6042893", "0.6037506", "0.6024839", "0.6015192", "0.6014118", "0.6003719", "0.6000298", "0.5996855", "0.59966254", "0.5994741", "0.59872645", "0.59858227", "0.59725046", "0.59697455", "0.5967438", "0.59650373", "0.59617513", "0.5957469", "0.59501374", "0.59396076", "0.59372574", "0.59179616", "0.5916164", "0.5895803", "0.5883931", "0.58803225", "0.58772975", "0.58772975", "0.58772975", "0.58772975", "0.58772975", "0.58772975", "0.58772975", "0.58772975", "0.58772975", "0.58772975" ]
0.7533046
0
The Facebook registers user method is going to send the users email hash and our account id to Facebook We need this so Facebook can find friends on our local application even if they have not connect through connect We then use the email hash in the database to later identify a user from Facebook with a local user
def register_user_to_fb(force = false) if force || changed.include?('username') || changed.include?('facebook_username') email = facebook_username.present? ? facebook_username : username users = {:email => email, :account_id => id} ::Facebooker::User.register([users]) unless Rails.env.test? self.facebook_hash = ::Facebooker::User.hash_email(email) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_user_to_fb\n\t #users = {:email => email, :account_id => id}\n\t #Facebooker::User.register([users])\n\t #self.email_hash = Facebooker::User.hash_email(email)\n\t #save(false)\n\tend", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.send(\"#{fb_email_hash_name}=\", Facebooker::User.hash_email(email))\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n r = Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n if AppConfig.register_users_to_facebook\n begin # DON'T LET FACEBOOK FUCK UP NEW USERS\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n rescue Exception => e\n Rails.logger.warn \"Facebook barfed in User.register_user_to_fb: #{e.message}\"\n end\n end\n true\n end", "def register_by_facebook_account(fb_session, fb_uid)\n api = FacebookGraphApi.new(fb_session.auth_token, fb_uid)\n user_attributes = api.find_user(fb_uid)\n email = user_attributes['email'] || 'FAKE'\n name = user_attributes['name'] || ''\n\n if !email.blank? && !name.blank?\n existing_user = User.find_by_email(email)\n existing_user = User.find_by_facebook_uid(fb_uid) if existing_user.nil?\n\n if existing_user\n existing_user.facebook_uid = fb_uid\n existing_user.facebook_sid = fb_session.auth_token\n existing_user.facebook_connect_enabled = true\n existing_user.save(false)\n\n existing_user.update_attribute(:state, 'active')\n existing_user\n else\n attributes = {\n :login => find_or_build_unique_user_name(name),\n :name => name,\n :email => find_or_build_unique_fake_email(email),\n :facebook_uid => fb_uid,\n :facebook_sid => fb_session.session_key,\n :activated_at => Time.now,\n :state => 'active',\n :facebook_connect_enabled => true\n }\n\n user = User.new(attributes)\n user.save(false)\n\n user.update_attribute(:state, 'activate')\n user\n end\n else\n # Do something else let's log him out from facebook\n raise 'Durrr! you are one of those unlucky person for whom we haven\\'t fixed this bug!\n please let me know that i told you this crap!' + \" data - #{user_attributes.inspect}\"\n end\n end", "def register(accessToken, userID)\n #logger.info \"Starting registration for #{userID}\"\n # User wasn't found, register him\n @user = User.new\n graph = Koala::Facebook::API.new(accessToken)\n user_data = graph.get_object(userID)\n friends = graph.get_connections(userID, \"friends\")\n @user.fb_token = accessToken\n @user.id = userID\n @user.fb_id = userID\n @user.name = user_data[\"name\"]\n @user.email = user_data[\"email\"]\n @user.first_name = user_data[\"first_name\"]\n @user.last_name = user_data[\"last_name\"]\n @user.link = user_data[\"link\"]\n @user.gender = user_data[\"gender\"]\n\n #Friendship.transaction do\n # friends.each { |friend| Friendship.create(:friend_id => friend[\"id\"], :user_id => userID) }\n #end\n \n @user.save\n\n if @user.nil?\n logger.info \"ERROR!\"\n logger.info \"#{userID}\" if @user.nil?\n logger.info user_data.inspect if @user.nil?\n else\n logger.info \"#{userID} successfully registered\"\n end\n\n return @user \n end", "def register\n \n # Create a new user if necessary\n @current_user = User.find_or_initialize_by_facebook_id(params[:facebook_id])\n @current_user.facebook_access_token = params[:facebook_access_token]\n @current_user.first_name = params[:facebook_first_name]\n @current_user.last_name = params[:facebook_last_name]\n @current_user.full_name = params[:facebook_name]\n @current_user.save\n \n # Generate a random token for this user if this is the first time and setting create_at\n if @current_user.access_token.nil?\n @current_user.update_attribute('access_token', SecureRandom.hex(64))\n @current_user.set_joined_at\n end\n \n # Adding everyone to party pod where pod_id=1\n @current_user.add_to_pod(1)\n \n # Fetch friends for current user\n # find_friends_for_facebook_id(@current_user.facebook_id, nil)\n \n # The response only local access_token \n session_response_hash = {:access_token => @current_user.access_token}\n \n respond_to do |format|\n format.xml { render :xml => session_response_hash.to_xml }\n format.json { render :json => session_response_hash.to_json }\n end\n end", "def facebook_authentication\n begin\n data = 0\n user = WebUser.find_by_email(params[:email])\n \n if user.nil?\n data = register(params[:provider], params[:uid], params[:name], params[:email], params[:oauth_token], params[:gender], params[:birthday], params[:nickname])\n else\n data = user\n check_pending_friends(user['id'], user['bv_player_id'], user['email'])\n end\n rescue\n data = 1\n end\n \n render :json => data\n end", "def new_facebook_signup\n \n @fb_data = fetch_facebook_params\n\n @user = Spree::User.where(email: @fb_data[:email]).first\n\n if @user.blank?\n @user = Spree::User.new(email: @fb_data[:email], facebook_token: @fb_data[:fb_token])\n \n @user.addresses.build\n @user.addresses.first.firstname = @fb_data[:firstname]\n @user.addresses.first.lastname = @fb_data[:lastname]\n\n\n else\n @user.update_attributes(facebook_token: @fb_data[:fb_token]) if @user.facebook_token != @fb_data[:fb_token] #update the token if @user_founds token is not same as the @fb_token\n sign_in(:spree_user, @user)\n redirect_to main_app.profile_users_path\n end\n\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 register_user\n random_password = Random.new\n @password = random_password.rand\n logger.warn(\"=====#{@password}===\")\n encrypt_pwd = User.new(:password => @password).encrypted_password\n self.update_attributes(fb_access_token: nil, fb_pic: nil, encrypted_password: encrypt_pwd)\n end", "def create_from_fb_connect(fb_user, username)\n u = ::User.find(:first, :conditions => {_(:username) => username} )\n if u\n u.facebook_hash = fb_user.email_hashes.first\n u.fb_user_id = fb_user.uid\n else\n u = ::User.create(_(:username) => username || fb_user.email_hashes.first, _(:last_login) => Time.now.utc, _(:fb_user_id) => fb_user.uid, _(:facebook_hash) => fb_user.email_hashes.first)\n end\n u.create_person_from_fb(fb_user) unless u.person\n u.save(false)\n u\n end", "def signup_facebook_user\n @user = Spree::User.new(user_params_list)\n @user.facebook_token = session[:fb_token]\n\n @user.addresses.first.country_id = 503\n\n if @user.save\n session\n signin_vegan_user(@user.id)\n else\n render 'complete_signup'\n end\n end", "def create\n #Create user instance\n @user = User.new(params[:user])\n @user.fb_uid = facebook_user.uid if facebook_user \n if @user.save\n \n #flash[:notice] = sprintf(t(:user_created_confirmation_sent), @user.name,@user.email) unless facebook_user\n flash_notice(:user_created_confirmation_sent, @user.full_name,@user.email) unless facebook_user\n \n create_session(@user) if facebook_user\n redirect_to_last_page\n else\n render :action => \"new\"\n end\n end", "def create_from_fb\n fb_user = FbGraph::User.fetch(\n \"me?fields=first_name,last_name,\"\\\n \"gender,email,birthday\",\n :access_token => params[:access_token])\n\n @user = User.add_from_fb(fb_user,@source)\n end", "def social_sign_up\n user = nil\n external_uid = nil\n success_message = nil\n ActiveRecord::Base.transaction do\n user = User.where(email: params[:user_email]).first_or_initialize\n success_message = \"User retrieved.\"\n if user.new_record?\n success_message = \"User saved.\"\n user.do_password_validation = false\n UserMailer.signupsuccess(user).deliver\n return unless user.save\n end\n external_uid = ExternalUID.where(uid: params[:uid], user_id: user.id).first_or_initialize\n if external_uid.new_record?\n raise ActiveRecord::Rollback unless external_uid.save\n end\n end\n if user.persisted? && external_uid.persisted?\n render :json => {:error => false, :description => success_message, :auth_token => user.authentication_token}\n else\n errors = {}\n errors[:user] = user.errors.messages if user.errors.any?\n errors[:uid] = external_uid.errors.messages if external_uid.errors.any?\n render :json => {:error => true, :description => \"Error saving user\", :errors => errors}, status: 500\n end\n rescue Exception => e\n render :json => {:error => true, :description => \"Internal Server Error.\"}, status: 503 and return\n end", "def register_user(mail, password_digest, date_joined, admin)\n return get_db_as_hash().execute(\"INSERT INTO user(mail, password_digest, date_joined, admin) VALUES (?, ?, ?, ?)\", mail, password_digest, date_joined, admin)\n end", "def facebook(name: T.unsafe(nil), email: T.unsafe(nil), username: T.unsafe(nil), uid: T.unsafe(nil)); end", "def register()\n\tentry = {\"userid\" => @userid, \"username\" => @username, \"email\" => @email, \"password\" => @password}\n\tDATABASE.newEntry(\"users\", entry)\n\tend", "def register\n data = {}\n if params[:user].blank?\n render json: get_v1_formatted_response({}, false, ['Invalid params']).to_json and return\n end\n\n User.transaction do\n user = User.find_by(email: user_params[:email])\n user = User.create(name: user_params[:user_name], email: user_params[:email], facebook_id: user_params[:facebook_id]) if user.blank?\n\n device = Device.where(user_device_id: device_params[:user_device_id]).first\n\n device.present? ? device.update_attributes(device_params.merge(user_id: user.id)) : user.devices.create!(device_params)\n\n data = {access_token: user.api_key}\n end\n\n render json: get_v1_formatted_response(data, true, ['Successfully registered']).to_json\n\n rescue Exception => e\n #todo use exception notifier for emailing the admins\n\n log_errors(e)\n render json: get_v1_formatted_response({}, false, ['Failed to register! please try again later']).to_json\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 signup_with_facebook\n @status, @msg, @data = UserValidator.signup_with_facebook(params)\n @status, @msg, @data = UserManager.signup_with_facebook(params) if @status\n end", "def create\n @user = User.new(user_params)\n @same_fb_id = User.find_by_fb_id(@user.fb_id)\n if @same_fb_id == nil\n @user.save\n end\n respond_with @user\n end", "def register_user(email, username, password_digest, rank, username_downcase)\n $db.execute(\"INSERT INTO users (email, username, password_digest, rank, username_downcase) VALUES (?, ?, ?, ?, ?)\", email, username, password_digest, rank, username_downcase)\nend", "def new\n \n if request.env['omniauth.auth'].present?\n params = request.env[\"omniauth.params\"]\n\n @fb_data = fetch_facebook_params\n @user = Spree::User.where(email: @fb_data[:email]).first\n\n\n if (@user.blank? && params[\"login\"].present?) || (@user.present? && is_ordinary_user?(@user.facebook_token) && params[\"login\"].present?)\n\n #here need to check if it's a fb registered user + in params we must receive login\n #if !is_ordinary_user?(@user.facebook_token) && params[\"login\"].present?\n #use the @not_yet_fb_signed_up to notify the message at the top.\n\n @not_yet_fb_signed_up = true\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n\n #user does not registered yet & coming for signup(or login params is blank.)\n elsif @user.blank? && params[\"login\"].blank?\n @user = Spree::User.new(email: @fb_data[:email], facebook_token: @fb_data[:fb_token], image: @fb_data[:image])\n @user.addresses.build\n @user.creditcards.build\n @user.addresses.first.firstname = @fb_data[:firstname]\n @user.addresses.first.lastname = @fb_data[:lastname]\n\n #user is registered & still trying for signup via facebook\n elsif @user.present? && params[\"login\"].blank?\n @registered_email = @user.email\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n else\n #update the token if @user_founds token is not same as the @fb_token\n @user.update_attributes(facebook_token: @fb_data[:fb_token], image: @fb_data[:image]) if @user.facebook_token != @fb_data[:fb_token]\n sign_in(:spree_user, @user)\n redirect_to spree.snack_queue_orders_path\n end\n\n else\n @user = Spree::User.new\n @user.addresses.build\n @user.creditcards.build\n\n end\n @subscriptions = Subscription.select('id, subscription_type', 'plan_price')\n @snacks = Spree::Product.limit(6)\n @snacks.sort_by! { |x| x[:name].downcase }\n\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 register\n if params[:id]\n user = User.find(params[:id])\n user.update_attributes(params.only(\"first_name\",\"last_name\").merge(:status => :active,:app_version => params[:v]))\n else\n normalized_mobile_number = PhoneHandling.normalize_phone_number(params[:mobile_number])\n if user = User.find_by_mobile_number(normalized_mobile_number)\n user.status = :active\n user.app_version = params[:v]\n params[:first_name] and user.first_name = params[:first_name]\n params[:last_name] and user.last_name = params[:last_name]\n user.save!\n # Let's check the Notifications to see if this user has been invited...\n elsif n = Notification.to_number(normalized_mobile_number).first\n user = n.recipient\n user.update_attributes(params.only(\"first_name\",\"last_name\").merge(:status => :active,:app_version => params[:v]))\n else\n # Create a new user\n user = User.create!(params.only(\"first_name\",\"last_name\",\"mobile_number\").merge(:status => :active,:app_version => params[:v]) )\n end\n end\n set_and_cookie_current_user(user)\n render :json => user.attributes_for_app\n end", "def associate_user\n \tfbUserIdString = params[:idString]\t\n \tuser = User.new(fbUserId:fbUserIdString)\n \tif user.valid?\t\n\t\t\t user = User.create(fbUserId:fbUserIdString)\n\t\t\t success = true\n\t\t end\n\t\t start_session(fbUserIdString)\n end", "def before_create_user\n logger.debug(\"on before creare user\")\n #Generate a unique key\n if facebook_user?\n self.active = 1 \n else\n activation_key_string = self.salt+self.email+self.hashed_password\n self.activation_key =Digest::SHA1.hexdigest(activation_key_string)\n self.active = 0\n end\n self.admin = 0 \n self.handle=generate_unique_handle\n \n end", "def link_fb_to_user\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\n\t\taccess_token = params[:access_token]\n\t\t\n\t\t#url = 'https://graph.facebook.com/me?access_token='+access_token\n\t\tbegin\n\t\t\tfb_user = FbGraph::User.fetch('me', :access_token=>access_token)\n\t\t\tfb_id = fb_user.identifier\n\t\t\temail = fb_user.email.strip.downcase\n\t\t\t\n\t\t\t#Check if user exists by email\n\t\t\tuser = User.find_by_email(email)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under your Facebook email.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t#Check if user exists by Facebook ID\n\t\t\tuser = User.find_by_fb_id(fb_id)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under this Facebook account.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t@user.fb_id = fb_id\n\t\t\t@user.fb_access_token = access_token\n\t\t\t\n\t\t\t@user.save\n\t\t\tsession['user'] = @user\n\t\t\t\n\t\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\t\t\t\n\t\trescue\n\t\t\trender :json=>{:success=>false, :msg=>'There was an error. Refresh the page and try again.'} and return\n\t\tend\n\tend", "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 fill_fb_credentials\n\n fill_in FB_EMAIL_OR_ID_FIELD,with:FB_USER_ID\n fill_in FB_PASSWORD_FIELD,with:FB_USER_PASSWORD\n\nend", "def make_user\n @user = User.new(session_token: params[:session_token])\n graph = Koala::Facebook::API.new(@user.session_token)\n id = graph.get_object(\"me\")[\"id\"]\n if id != params[:facebook_id]\n render json: [\"Invalid session token\"], status: 401\n return\n end\n @user.fill_user_data(graph)\n if @user.save\n # @user.add_friends(graph)\n render \"api/users/show\"\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def create\n user = User.find_by(email: user_params['email'])\n if !user\n dataToRegister = {\n username: user_params['username'],\n balance: user_params['balance'],\n password: Base64.decode64(user_params['password']),\n password_confirmation: Base64.decode64(user_params['password_confirmation']),\n email: user_params['email'],\n }\n user = User.create!(dataToRegister)\n auth_token = AuthenticateUser.new(user.email, Base64.encode64(user.password)).call\n response = {\n data: {\n message: Message.account_created,\n token: auth_token,\n user: {\n username: user.username,\n email: user.email\n }\n }\n }\n json_response(response, :created)\n\n else\n raise(ExceptionHandler::AuthenticationError, Message.email_Already_used)\n end\n end", "def registering(authentication)\n\n if (authentication.nil?)\n authentication = Authentications.new\n authentication.provider = @omniauth['provider']\n authentication.uid = @omniauth['uid']\n user = Customer.new\n # authentication.user_id = user.id Need to save the user first to generate the automated unique id\n if (@omniauth['info'])\n user.first_name = @omniauth['info']['first_name']\n user.last_name = @omniauth['info']['last_name']\n user.address = @omniauth['info']['location']\n user.description = @omniauth['info']['description']\n user.email = @omniauth['info']['email'] #auth.info.email\n user.password = Devise.friendly_token[0,20]\n end\n\n /=if (@omniauth['extra'])\n user.tempInfo = @omniauth['extra']['raw_info']\n end=/\n \n #need to check if preference exists\n preference = Preference.find_by_id(RegisterController.id)\n user.preference_id = preference.id\n \n if (!user.save)\n if(user.errors.added? :email, :taken)\n user.email = new_email_from_existing(user.email)\n user.save\n end\n end\n\n preference.customer_id = user.id\n preference.save\n\n authentication.user_id = user.id\n authentication.save \n session[:user_id] = user.id\n \n flash[:notice] = \"Thanks for registering\\n\"\n redirect_to root_path \n else \n redirect_to root_path, :notice => \"You already have an account!\\n Please logIn \"\n \n end\n\nend", "def create\n\n params[:user].reject! {|k,v| !['name','email','password','facebook_uid'].include?k }\n @user = User.new(params[:user])\n if @user.facebook_uid and current_facebook_user and current_facebook_client\n if current_facebook_user.id == @user.facebook_uid\n @user.facebook_session_key = current_facebook_client.access_token\n @user.password = \"fb-#{@user.facebook_uid}-\"+Time.now().to_s if @user.password.empty?\n end\n else\n if @user.password != params[:password_verify] then\n @user.errors.add(:password, \"Password fields don't match\")\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render json: @user }\n end\n return\n end\n end\n \n respond_to do |format|\n if @user.save\n UserSession.create(@user, true)\n format.html { redirect_to(@user, :notice => 'User was successfully created.') }\n format.json { render json: @user }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @user }\n end\n end\n end", "def create\n\t\t@user = User.new(user_params)\n\n\t\tif params[:user][:social_login] == 1 \n\t\t\tuser_email = params[:user][:email]\n\t\t\tuser = User.find_by_email(user_email)\n\t\t\tif user_email.present? && user.present?\n\t\t\t\tlogger.info \"=======No facebook user===========\"\n\t\t\t\tsign_in user, store: false\n\t\t\t\tuser.update_device_token_with_social(params)\n\t\t\t\tuser.save\n\t\t\t\ttoken = Tiddle.create_and_return_token(user, request)\n\t\t\t\trender json: user, status: 200, serializer: Website::V1::UserSerializer, token: token\n\t\t\telse\n\t\t\t\t#template = NotificationTemplate.where(category: I18n.t('Notification.welcome')).last\n\t\t\t\tlogger.info \"============facebook user==========\"\n\t\t\t\tlogger.info \"=======params[:user]==========\"\n\t\t\t\tfacebook_user = User.find_by_facebook_id(params[:user][:facebook_id]) if params[:user][:facebook_id].present?\n\t\t\t\t\n\t\t\t\tif facebook_user.present?\n\t\t\t\t\tlogger.info \"======#{facebook_user.inspect}=======\"\n\t\t\t\t\tcount = facebook_user.sign_in_count + 1\n\t\t\t\t\tfacebook_user.update(sign_in_count: count)\n\t\t\t\t\tsign_in facebook_user, store: false\n\t\t\t\t\tfacebook_user.update_device_token_with_social(params)\n\t\t\t\t\ttoken = Tiddle.create_and_return_token(facebook_user, request)\n\t\t\t\t\trender json: facebook_user, status: 200, serializer: Website::V1::UserSerializer, token: token\n\t\t\t\telse\n\t\t\t\t\tlogger.info \"==========validation failed===========\"\n\t\t\t\t\tif @user.save(validate: false)\n\t\t\t\t\t\tlogger.info \"==========user saves======#{@user.inspect}=========\"\n\t\t\t\t\t\tusers_creation(params)\n\t\t\t\t\t\ttoken = Tiddle.create_and_return_token(@user, request)\n\t\t\t\t\t\tusers_social_login(params)\n\t\t\t\t\t\trender json: @user, status: 201, serializer: Website::V1::UserSerializer, token: token\n\t\t\t\t\telse\n\t\t\t\t\t\tlogger.info \"==========user errors======#{@user.errors.inspect}=========\"\n\t\t\t\t\t\trender json: { errors: @user.errors}, status: 422\n\t\t\t\t\tend\n\t\t\t\t\t#@user.send_welcome_notification(template, params)\n\t\t\t\tend\n\t\t\t\t#@user.send_welcome_notification(template)\n\t\t\tend\n\t\telsif @user.save\n\t\t\tlogger.info \"=======No social login===========\"\n\t\t\ttoken = Tiddle.create_and_return_token(@user, request)\n\t\t\trender json: @user, status: 201, serializer: Website::V1::UserSerializer, token: token\n\t\t\tusers_creation(params)\n\t\telse\n\t\t\trender json: { errors: @user.errors}, status: 422\n\t\tend\n\tend", "def create\n user = User.find_by_email(params[:email])\n if !user.present?\n user = User.create!(user_params)\n user.account_active = false\n user.save!\n accountHash = AccountHash.create(:hashcode => create_hashcode, :user_id => user.id, :password => user.password, :temp_email => nil)\n AppropMailer.account_created(user, accountHash).deliver\n render json: { message: Message.account_created, hashcode: accountHash.hashcode }\n else\n json_response({error: 'El email ya se encuentra registrado en Approp'}, :unprocessable_entity)\n end\n end", "def registrar_usuario\n business_user = User.new\n business_user.email = self.email\n business_user.password = business_user.generar_password\n business_user.client_type = 'empresa'\n business_user.save\n update(user_id: business_user.id, user_created_id: business_user.id)\n #luego de registrar al usuario se almacena la contraseña en la tabla Historypassword\n #donde se almacenaran las 3 ultimas usadas\n password_business = HistoryPassword.new\n password_business.password = business_user.password\n password_business.user_id = business_user.id\n password_business.save\n end", "def create_user params, send_info_email = false\n if params[:email] && !params[:email].empty?\n email = params[:email].downcase\n else\n email = params[:person_identifier] + '@example.com' if params[:person_identifier]\n end\n\n if email && email =~ /\\A[^@]+@[^@]+\\z/\n u = User.find_by_email(email)\n email_correct = true\n end\n return u if u\n\n # no existing user, create new\n u = User.new\n u.email = email\n\n unless email_correct \n while User.find_by_email(u.email)\n if params[:first_name] && !params[:first_name].empty? && params[:last_name] && !params[:last_name].empty?\n identifier = params[:first_name] + '.' + params[:last_name] + SecureRandom.hex(5)\n else\n identifier = SecureRandom.hex(15)\n end\n u.email = identifier + '@example.com'\n end\n end\n\n if params[:password] && !params[:password].empty?\n pw = params[:password]\n else\n pw = SecureRandom.base64(5)\n end\n u.password = pw\n u.password_confirmation = pw\n\n u.first_name = params[:first_name]\n u.last_name = params[:last_name]\n if params[:display_name]\n u.display_name = params\n elsif u.first_name && u.last_name\n u.display_name = u.first_name + ' ' + u.last_name\n end\n\n u.skip_confirmation! if User.respond_to? 'skip_confirmation!' # skip the confirmation email, that would be automatically sent by devise\n AuditoriumMailer.automatically_generated_user(u.email, password).deliver if send_info_email unless u.email.include? '@example.com'\n\n u.save\n u\n end", "def register (email, password1, password2, name)\n # If the email, password, and name are valid\n if (validateEmail(email) && validatePassword(password1) && validatePassword(password2) && validateName(name))\n\n # If the passwords match\n if (password1 == password2)\n conn = DBTools.new.connectToDB()\n\n # Check if email is already in the database\n query = @@SQL_SelectEmailFromUsers.gsub(/%%email%%/, conn.escape_string(email))\n results = conn.exec(query)\n\n # If the email is not already in the database\n if (results.ntuples == 0)\n results.clear()\n\n # Check if name is already in the database\n query = @@SQL_SelectNameFromUsers.gsub(/%%name%%/, conn.escape_string(name))\n results = conn.exec(query)\n\n # If the name is not already in the database\n if (results.ntuples == 0)\n # Insert user record\n query = @@SQL_InsertUserRecord.gsub(/%%name%%/, conn.escape_string(name)).gsub(/%%email%%/, conn.escape_string(email)).gsub(/%%password%%/, hashPassword(password1))\n \n results = conn.exec(query)\n\n # Record successfully inserted\n if (results.cmd_tuples() == 1)\n # return JSON\n json_output = @@JSON_Success\n json_output['success'] = true\n conn.finish()\n\n JSON.generate(json_output)\n\n # Record insertion unsuccessful\n else\n json_output = @@JSON_Failure\n json_output['success'] = false\n json_output['error'] = \"User record creation failed.\"\n conn.finish()\n\n JSON.generate(json_output)\n end\n\n # If the name is already in the database\n else\n json_output = @@JSON_Failure\n json_output['success'] = false\n json_output['error'] = \"Name already in use.\"\n results.clear()\n conn.finish()\n\n JSON.generate(json_output)\n end\n\n # If the email is already in the database\n else\n json_output = @@JSON_Failure\n json_output['success'] = false\n json_output['error'] = \"Email address already in use.\"\n results.clear()\n conn.finish()\n\n JSON.generate(json_output)\n end\n\n # If the passwords do not match\n else\n json_output = @@JSON_Failure\n json_output['success'] = false\n json_output['error'] = \"Passwords do not match.\"\n JSON.generate(json_output)\n end\n\n # If the email, password or name is invalid.\n else\n json_output = @@JSON_Failure\n json_output['success'] = false\n json_output['error'] = \"Email, password or name is invalid.\"\n JSON.generate(json_output)\n end\n end", "def create_fb\n if current_facebook_user\n current_facebook_user.fetch\n if logged_in_member\n logged_in_member.update_attribute(:fb_user_id, current_facebook_user.id)\n redirect_to logged_in_member\n else\n @member = Member.find_or_initialize_with_facebook(current_facebook_user)\n conference_delegate = ConferenceDelegate.find_by_signature(params[:signature]) if !params[:signature].blank?\n if @member.new_record?\n @member.conference_delegate = conference_delegate\n @member.auth_service = 'Facebook'\n render :template => \"sessions/register_email\"\n else\n if conference_delegate && conference_delegate.member.nil? && @member.conference_delegate.nil?\n conference_delegate.update_attribute(:member, @member)\n end\n login_member!(@member)\n end\n end\n else\n redirect_to new_session_path\n end\n end", "def create\n unless params[:token].nil?\n tracker = Generic.get_mixpanel_tracker\n\n # Get more data on user from Facebook\n fb_user = FbGraph2::User.me(params[:token]).fetch\n # logger.info \"FB my user details: \" + fb_user.to_yaml\n\n # Initialize Syream client with your api key and secret\n client = Generic.get_streams_client\n\n # Get user details\n @user = User.find_by(fb_id: fb_user.id)\n # logger.info @user.to_yaml\n\n # Check if user not registered yet\n if @user.nil?\n\n # Register user\n @user = User.new(fb_id: fb_user.id, first_name: fb_user.first_name, last_name: fb_user.last_name, email: fb_user.email, device_token: params[:device_token])\n\n if @user.save\n logger.info \"REGISTER USER!\"\n tracker.track(@user.id, 'Registered')\n\n # Instantiate Stream user feed object\n my_user_feed = client.feed('user', @user.id)\n my_flat_feed = client.feed('flat', @user.id)\n\n # Get user friends Facebook IDs\n fb_friends_ids = []\n fb_user.friends.each do |u|\n fb_friends_ids.push(u.id)\n end\n\n # Get user friends IDs\n friends_ids = User.where(\"fb_id IN (?)\", fb_friends_ids).pluck(:id)\n friends_of_friends = Hash.new \n\n # Get friends of friends IDs\n if friends_ids.length > 0\n friends_of_friends = Relation.where(user_id: friends_ids).pluck(:friend_user_id)\n end\n\n follow_user = [] \n follow_friendsof_user = [] \n\n # Save user friends \n # TODO: Change to BULK INSERT\n friends_ids.each do |f_id|\n @relation = Relation.new(user_id: @user.id, friend_user_id: f_id)\n @relation.save\n\n @opposite_relation = Relation.new(user_id: f_id, friend_user_id: @user.id)\n @opposite_relation.save\n\n follow_user.push({:source => 'flat:' + @user.id.to_s, :target => 'user:' + f_id.to_s})\n follow_user.push({:source => 'flat:' + f_id.to_s, :target => 'user:' + @user.id.to_s})\n\n # Add friends of friends\n friends_of_friends.each do |ff_id|\n follow_friendsof_user.push({:source => 'flat:' + @user.id.to_s, :target => 'user:' + ff_id.to_s})\n follow_friendsof_user.push({:source => 'flat:' + ff_id.to_s, :target => 'user:' + @user.id.to_s})\n end\n\n logger.info 'SAVING RELATIONS!'\n end\n\n # Follow Stream of friend\n if follow_user.length > 0\n begin \n logger.info \"Follow users: \" + follow_user.to_yaml\n client.follow_many(follow_user)\n logger.info \"Follow users success!\"\n rescue Stream::StreamApiResponseException => e\n Rails.logger.error \"A Stream error occurred: #{e.class} - #{e.message}\" \n end\n end\n\n # Follow Stream of friend of friends\n if follow_friendsof_user.length > 0\n begin \n logger.info \"Follow friends of users: \" + follow_friendsof_user.to_yaml\n client.follow_many(follow_friendsof_user)\n logger.info \"Follow friends of users success!\"\n rescue Stream::StreamApiResponseException => e\n Rails.logger.error \"A Stream error occurred: #{e.class} - #{e.message}\" \n end\n end\n\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n else\n logger.info \"LOGIN USER!\" \n\n # Update user device token on login\n unless params[:device_token].nil?\n @user.update(device_token: params[:device_token])\n # logger.info \"Device token updated: \" + params[:device_token] \n end\n\n tracker.track(@user.id, 'Login')\n\n render json: @user, status: :ok\n end\n\n else\n logger.error \"ERROR!\"\n render json: { message: \"You provided an invalid token!\" } , status: :forbidden \n end\n end", "def find_by_fb_user(fb_user)\n u = ::User.find(:first, :conditions => {_(:fb_user_id, :user) => fb_user.uid}) || ::User.find(:first, :conditions => {_(:facebook_hash, :user) => fb_user.email_hashes})\n # make sure we have a person\n if u && !u.person\n u.create_person_from_fb(fb_user)\n end\n u.update_attribute(:fb_user_id, fb_user.uid) if u && !u.fb_user_id\n u\n rescue ::Facebooker::Session::SessionExpired\n nil\n end", "def register\n return render :json => 'Invalid email address or password', status: 401 unless params[:email_address]\n existing_treater_account = TreaterAccount.find_by_email_address(params[:email])\n existing_user = existing_treater_account ? existing_treater_account.user : nil\n\n if existing_user.nil? && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n user = User.create(email_address: params[:email], name: params[:name],\n password: params[:password], password_confirmation: params[:password_confirmation])\n treater_account = TreaterAccount.create(user_id: user.id, identifier: user.id, name: params[:name], email: user.email_address, authenticated_at: Time.now)\n user.account_setup\n\n session[:user_id] = user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n elsif existing_user && existing_treater_account.nil?\n #TODO - Fix attr_accessible white list so we dont' have to build this manually...\n # - Move all this logic to account_setup\n treater_account = TreaterAccount.create(user_id: existing_user.id, identifier: existing_user.id, name: params[:name], email: existing_user.email_address, authenticated_at: Time.now)\n\n session[:user_id] = existing_user.id\n session[:external_account_id] = treater_account.id\n\n result = {}\n result[:on_complete_url] = params[:on_complete_url]\n return render :json => result.to_json, status: 200\n else\n #login failed\n return render :json => 'Some error...', status: 401\n end\n end", "def register\n email = request.headers['email'].to_s\n username = request.headers['username'].to_s\n password = request.headers['password'].to_s\n password_confirmation = request.headers['passconf'].to_s\n\n @user = User.new(email: email, username: username, password: password, password_confirmation: password_confirmation)\n if @user.save\n remember_token = RememberToken.create(token: User.encrypt(User.new_remember_token), user_id: @user.id, accessed_at: Time.now)\n respond_to do |format|\n format.json { render :json => remember_token }\n end\n else\n respond_to do |format|\n format.all{head :bad_request, :content_type => 'text/html'}\n end\n end\n end", "def create_from_omniauth(omniauth_hash)\n info_hash = omniauth_hash['info']\n return nil unless email = info_hash && info_hash['email']\n user = User.new\n user.credentials << Credentials::Email.new(email: email, verified: true)\n user.save!\n user\n end", "def sign_up(useremail, password)\n if new_user_available(useremail)\n query = \"INSERT INTO Users (useremail, password) VALUES('#{useremail}', '#{password}')\"\n @connection.exec(query)\n end\n end", "def finish_registration\n sp = SetupParams.find(get_sp)\n user = current_user\n if user.nil?\n user = User.new(sp.user)\n user.setup_flag = true\n user.save(false)\n UserSession.create(user)\n end\n group = Group.new(sp.group)\n group.user_id = user.id\n group.expiration_date = Time.now + 7.days\n group.save\n if params[:from_facebook]\n data1 = current_fb_session(sp.access_token).me\n type = 'large'\n begin\n group.picture_from_url(\"https://graph.facebook.com/#{data1.id}/picture?type=#{type}\")\n rescue\n end\n else\n if !sp.fb_ids.nil? and !sp.fb_ids['0'].nil?\n type = 'large'\n begin\n group.photo = group.picture_from_url(\"https://graph.facebook.com/#{sp.fb_ids['0']}/picture?type=#{type}\")\n rescue\n end \n else\n begin\n group.photo = TempImage.find(sp.photo_id.to_i).photo\n TempImage.destroy(sp.photo_id.to_i)\n rescue\n end\n end\n end\n group.save\n Emailer.deliver_user_credentials(user.groups.current_group, user)\n preference = Preference.new(sp.preference)\n preference.group_id = group.id\n preference.save\n 0.upto(group.size - 2) do |n|\n member = Member.new(sp.members[n.to_s])\n if params[:from_facebook]\n type = 'large'\n \tbegin\n \t data = sp.fb_ids[n.to_s]\n \trescue\n \t data = nil\n \tend\n if !data.nil?\n member.picture_from_url(\"https://graph.facebook.com/#{data['fbid']}/picture?type=#{type}\")\n end\n end\n member.save\n Membership.create(:group_id => group.id, :user_id => user.id, :member_id => member.id, :token => Digest::SHA1.hexdigest([Time.now, rand].join)[1..20])\n Emailer.deliver_group_members(member, user, user.groups.current_group)\n sleep(0.02)\n end\n session.delete :mpos\n session.delete :sp_id\n session.delete :reg_flow\n sp.destroy\n redirect_to congrats_users_url\n end", "def create\n omniauth = request.env['omniauth.auth']\n\n user = User.find_by_uid(omniauth['uid'])\n if not user\n # registruje novog usera\n user = User.new(:uid => omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # sve info o useru u sesiji\n session[:user_id] = omniauth\n\n flash[:notice] = \"Successfully logged in\"\n redirect_to root_path\n end", "def insertUser(email,password,lastname,firstname,birthdate,uuid,fbid,access_token,access_token_expiration)\n begin\n success= false\n query = \"INSERT INTO `#{DB_NAME}`.`#{USER_TABLE}` (`email`, `password`, `last_name`, \n `first_name`, `birthdate`, `uuid`,\n `facebook_id`, `access_token`, \n `access_token_expiration`) \n VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n sth =@dbh.prepare(query)\n sth.execute(email,password,lastname,firstname,birthdate,uuid,fbid,access_token,access_token_expiration)\n sth.finish\n @dbh.commit\n \n success = true\n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> #{e.to_s}\"\n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n \n return success\n \n end", "def register email, pass\n email = email.downcase.strip\n if email != \"anon@websyn.ca\" and User.get(email).nil?\n user = User.create({:email=>email,:password=>pass})\n authenticate email, pass\n return user\n elsif authenticate email, pass\n return current_user\n end\n nil\n end", "def register(users_list, transactions_all, password)\n\t#new user_id is generated using the lenght of the hash 'users_list'\n\t#a different approach should be used to generate user_id if the function to delete a user is implemented\n\n\tnew_user_id = users_list.length + 1\n\tnew_user = {balance: 0, password: password}\n\tusers_list[new_user_id] = new_user\n\n\ttransactions_all[new_user_id] = []\n\n\t$logged_in_user_id = new_user_id\n\tputs \"Registration successful. Your ID is #{$logged_in_user_id}.\"\n\n\tnew_user_id\nend", "def create_new_user_and_identity(auth, params)\n user = User.create!(\n first_name: auth.info[:first_name],\n last_name: auth.info[:last_name],\n email: auth.info[:email],\n oauth_signup: true,\n # referred_by_user_id => params.andand[\"rid\"]\n )\n user.confirm!\n create_new_identity(user, auth)\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 email = params[:email]\n password = params[:password]\n fb_token = params[:fbtoken]\n if request.format != :json\n render :status => 406, :json => {:message => 'The request must be json'}\n return\n end\n\n if (email.nil? or password.nil?) && fb_token.nil?\n render :status => 400,\n :json => {:message => 'The request must contain the user email and password or FB token.'}\n return\n end\n\n if fb_token\n #check token\n begin\n facebook_graph = ::Koala::Facebook::API.new('595428443887130|BMCDixQJlECImLZsnnxGBO2jtoI')\n @token_info = facebook_graph.debug_token(fb_token)\n logger.info @token_info.inspect\n @user = User.find_by(fb_id: @token_info['data']['user_id'])\n rescue => e\n logger.error e.message\n @user = nil\n end\n else\n @user = User.find_by(email: email.downcase)\n end\n\n if @user.nil?\n logger.info(\"User #{email || fb_token} failed signin, user cannot be found.\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n return\n end\n\n # http://rdoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable\n #@user.generate_authentication_token\n\n valid = (!fb_token && @user.valid_password?(password)) || (fb_token && @token_info['data']['app_id'] == '595428443887130')\n\n if valid\n @user.ensure_authentication_token\n logger.info 'Token: ' + @user.authentication_token.to_s\n @user.save_device_token(params[:device_token])\n render :status => 200, :json => {:token => @user.authentication_token, :email => @user.email, :premium => !@user.role?(:free)}\n else\n logger.info(\"User #{email} failed signin, password \\\"#{password}\\\" is invalid\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n end\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\n end", "def register(email, password)\n response = @api.register_new_user(email, password)\n\n cache_info(response['user']) # cache account_info, saving an extra API call\n authorize_token(response['token'])\n\n true\n end", "def register_user(username, password_digest)\n $db.execute('INSERT INTO users (username, password_digest) VALUES (?, ?)', username, password_digest)\n end", "def sign_up_users(first_name, last_name, email, password)\n find_by_id('com.yelp.android:id/first_name').send_key first_name\n find_by_id('com.yelp.android:id/last_name').send_key last_name\n find_by_id('com.yelp.android:id/email_address').send_key email\n find_by_id('com.yelp.android:id/password').send_key password\n find_name('Gender')\n find_name('Male')\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(: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 test_sign_up_facebook\n aaaaaaaaaaaaaaaaaaaaaaaaaaa\n puts \"+++++++++++++++++++facebook_sign_up+++++++++++++++++++\"\n puts \"000000000000000000000\", params.inspect\n puts \"111111111111111111111\", params[:user][:device_token]\n begin\n if request.format(request) == '*/*'\n if params[:facebook_id].present?\n @user = User.where(:facebook_id => params[:facebook_id]).first\n if @user.present?\n if @user.sign_in_count == 0\n flag = true\n else\n flag = false\n end\n render :json => {:success => \"true\", :message => \"signed in successfully\",:is_braintree_info_added => @user.merchant_id.present? ? \"true\" : \"false\", :user => {:id => @user.id,:sign_up_first_time => flag, :name => @user.name, :username => @user.username, :email => @user.email, :street_address => @user.street_address, :city => @user.city, :state => @user.state, :zip_code => @user.zip_code, :token => @user.session_token, :profile => {:user_id => @user.id, :about_yourself => @user.profile.about_yourself, :phone_number => @user.profile.phone_number, :distance => @user.profile.distance, :location_status => @user.profile.location_status,:push_notifications => @user.profile.push_notifications, :profile_image => {:pic_url => @user.profile.profile_image.present? ? @user.profile.profile_image.pic.url : \"\"}}}}\n @user.update_attributes(:sign_in_count => @user.sign_in_count + 1, :device_token => params[:user][:device_token])\n else\n random_str = SecureRandom.hex\n @user = User.new(:name => params[:user][:name], :username => params[:user][:username], :email => params[:user][:email], :password => params[:user][:password], :facebook_id => params[:facebook_id], :device_token => params[:user][:device_token], :session_token => random_str)\n if @user.save\n if @user.sign_in_count == 0\n flag = true\n else\n flag = false\n end\n @profile = Profile.create(:about_yourself => params[:user][:profile][:about_yourself], :phone_number => params[:user][:profile][:phone], :distance => params[:user][:profile][:distance], :user_id => @user.id) if @user.present?\n create_customer_to_braintree(@user)\n render :json => {:success => \"true\", :message => \"user has been successfully created\",:is_braintree_info_added => @user.merchant_id.present? ? \"true\" : \"false\", :user => {:id => @user.id,:sign_up_first_time => flag, :name => @user.name, :username => @user.username, :email => @user.email, :street_address => @user.street_address, :city => @user.city, :state => @user.state, :zip_code => @user.zip_code, :token => @user.session_token, :profile => {:user_id => @user.id, :about_yourself => @profile.about_yourself, :phone_number => @profile.phone_number, :distance => @profile.distance, :location_status => @user.profile.location_status, :push_notifications => @user.profile.push_notifications,:profile_image => {:pic_url => @user.profile.profile_image.present? ? @user.profile.profile_image.pic.url : \"\"}}}}\n @user.update_attributes(:sign_in_count => @user.sign_in_count + 1)\n else\n render :json => {:success => \"false\", :message => \"cant create user\"}\n end\n end\n else\n render :json => {:success => \"false\", :message => \"cant create user facebook id does not exist\"}\n end\n end\n rescue Exception => e\n return render :json => {:success => \"false\", :message => \"#{e.message}\"}\n end\n\n end", "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 mf_api_user_create\n\n # Look for\n current_users = User.where(email: params[:email])\n\n unless current_users.empty?\n response = {\n success: false,\n message: 'User with email already exists'\n }\n\n render json: response and return\n end\n\n # Generate a password for user\n seed = \"--#{rand(10000000)}--#{Time.now}--#{rand(10000000)}\"\n secure_password = Digest::SHA1.hexdigest(seed)[0,8]\n\n user = User.new\n\n user.clientid = params[:client_id]\n user.email = params[:email]\n user.password = secure_password\n user.first_name = params[:first_name]\n user.last_name = params[:last_name]\n\n user.save\n\n # Update Infusionsoft Contact ------THIS LINE OF CODE IS WHERE IT FUCKS UP\n Infusionsoft.contact_update(params[:client_id], {:Password => secure_password})\n\n # Return Success Response\n response = {\n success: true,\n user_id: user.id,\n password: user.password,\n message: 'User Created'\n }\n\n render json: response\n\n\n end", "def fb_user\n FbGraph::User.me(fb_token)\n end", "def register_user(params)\n val = validate_new_user(params)\n if val == false\n return {\n error: true,\n message: \"not enough letter in name or password\"\n }\n end\n name = params[\"name\"]\n password = BCrypt::Password.create(params[\"password\"])\n\n db = connect()\n\n result = db.execute(\"SELECT id FROM Users WHERE name = ?\",name)\n if result.length > 0\n return {\n error: true,\n message: \"User already exists\"\n }\n end\n\n db.execute(\"INSERT INTO Users (name,password) VALUES (?,?)\",name,password)\n result = db.execute(\"SELECT id FROM Users WHERE name = ?\",name)\n\n return {\n error: false,\n data: result.first.first\n }\n end", "def register_account(username, password, password_confirmation)\n\n result = @db.execute(\"SELECT id FROM users WHERE username=?\", username)\n\n if result.empty? \n if password == password_confirmation\n password_digest = BCrypt::Password.create(password)\n @db.execute(\"INSERT INTO users(username, password) VALUES (?,?)\", [username, password_digest])\n return true\n else\n return \"Passwords don't match!\"\n end\n else\n return \"Sorry, username already taken!\"\n end\n\n end", "def create\r\n\r\n # Make a copy of the user params\r\n user_params = (params[:user]).clone\r\n\r\n unless ApplicationHelper.validate_key(request.headers[\"Validation-Key\"])\r\n # If the validation key is there, then this is a test app talking to us, so\r\n # accept whatever secret key is passed in. Otherwise, generate a random key.\r\n user_params.merge!(:secretkey => SecureRandom.uuid)\r\n end\r\n\r\n # initialize bucks to be 200 and member to be false\r\n user_params.merge!(:bucks => 200, :membertime => nil)\r\n\r\n # handle fb friends case\r\n friends = user_params.delete(:fb_friends)\r\n if friends\r\n fbid = user_params[:fbid]\r\n available_friends = fb_friends_helper(fbid, friends)\r\n\r\n user_params.merge!(:fb_friends => available_friends)\r\n end\r\n\r\n # Create the new user\r\n @user = User.new(user_params)\r\n\r\n respond_to do |format|\r\n if @user.save\r\n\r\n # Update bucks for the user for this week\r\n start_date = Time.now.beginning_of_week.to_date\r\n update_bucks_lb(@user.id, user_params[:bucks], start_date)\r\n\r\n log_event(:user, :created, user_params)\r\n\r\n # Be cautious about creating users through the website. The general case is\r\n # that users are only ever created via the JSON API. The website interface\r\n # should only be used for debugging purposes.\r\n format.html { redirect_to @user, notice: 'User was successfully created.' }\r\n format.json { render json: @user.as_json(:only => [:id, :fbid, :membertime, :bucks, :email, :secretkey]) }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json {\r\n create_error(:unprocessable_entity, :post, user_params, @user.errors)\r\n }\r\n end\r\n end\r\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token , uid: user.id }\n json_response(response, :created)\n end", "def associate_with_social_account(social_params, social_image_cookie, social_bio_cookie)\n if social_params[\"provider\"].blank? || social_params[\"uid\"].blank?\n Airbrake.notify(:error_class => \"Logged Error\", :error_message => \"SOCIAL CREDENTIALS: The social credentials for #{self.id} did not get passed in from the sign up form. This is what we received: Provider = #{social_params[\"provider\"]} ; UID = #{social_params[\"uid\"]}\") if Rails.env.production?\n else\n # create a new social network record for storing their auth data in\n new_network ||= self.social_networks.new(:provider => social_params[\"provider\"].strip.downcase, :uid => social_params[\"uid\"].strip.downcase, :token => social_params[\"oauth_token\"], :token_secret => social_params[\"oauth_token_secret\"])\n if !new_network.save\n Airbrake.notify(:error_class => \"Logged Error\", :error_message => \"SOCIAL CREDENTIALS: Error creating social credentials for #{self.id} with these params: Provider = #{social_params[\"provider\"]} ; UID = #{social_params[\"uid\"]}\") if Rails.env.production?\n end\n end\n \n # upload their image\n begin\n self.set_new_user_image(nil, social_image_cookie, false, true)\n rescue\n Airbrake.notify(:error_class => \"Logged Error\", :error_message => \"PROFILE IMAGE: Error SAVING image from a social signup for #{self.email}. The image was #{social_image_cookie}\") if Rails.env.production?\n end\n \n # set their bio \n self.profile.update_attribute('bio', truncate(social_bio_cookie, :length => 140, :omission => '...')) \n end", "def register(email)\n raise StandardError, 'The email is not valid' if\n email.email.nil? || email.email.empty?\n\n User.save_user_and_email self, email\n\n token = VerifyClient.create_token(self.id, email.email, 'register')\n Notifier.send_signup_email(email.email, self, token).deliver_later\n end", "def register\n if request.post?\n @user.update_attributes params['user']\n if @user.valid?\n after_register\n redirect_to welcome_path and return\n else\n if @user.errors[:email].include?(\"Already Taken\")\n # Look up the already-existing user, set the current tracker to that user, and send them along\n right_user = User.where(:email => @user.email).first\n @tracker.user_id = right_user.id\n cookies[:user_id] = right_user.id\n session[:email_pwd] = params['user']['email_password']\n @user = right_user\n @tracker.log(:existing_user_returned, \"Existing user #{@user.email} got into the landing path again.\")\n increment_page\n redirect_to welcome_path and return\n else\n @tracker.log(:failed_register, \"User creation failed with message: #{@user.errors.full_messages.join(\", \")}\")\n end\n end\n end\n render_path_page\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n logger.debug \"UsersController#create #{@user.owner.registration_confirm_type.inspect}\"\n if @user.owner.registration_confirm_type == 'email_code'\n unless @user.email_not_validated\n @user.email_not_validated = @user.email\n @user.email = nil\n @user.email_verification_code = SecureRandom.hex(25)\n @user.email_verification_code_created_on = Time.now\n @user.save(false)\n end\n Notifier.deliver_registration_confirmation(@user)\n end\n flash[:notice] = 'User was successfully created.'\n logger.debug \"UsersController#create xml sucess\"\n render :xml => @user, :status => :created, :location => @user \n else\n logger.debug \"UsersController#create #{@user.errors.inspect}\"\n render :xml => @user.errors, :status => :unprocessable_entity\n end\n end", "def signup\n\n\t\temail = params[:email] # Extract the email from the params of the signup form\n\t\ttimezone = params[:timezone] # Extract the timezone from the params of the signup form\n\n\t\t@url = uniqueUrlKeyGenerator # Generate a unique url key\n\t\told_user = User.find_by_email(email)\n\n\t\t# If user exists\n\t\tif !old_user.nil?\n\t\t # If user is not registered\n\t\t if !old_user.registered?\n\t\t # Send welcome email again and save him\n\t\t old_user.sendWelcomeEmail\n\t\t old_user.save\n\t\t end\n\t\tend\n\n\t\t# Find the user in the user db with the same email as extracted in the params\n\t\tcheck_users = User.find_by_email(email)\n\n\t\t#create a new PotentialUser object with the extarcted email, timezone and url key\n\t\tuser = User.new(email: email, url: @url, timezone: timezone, day: 1, registered: false)\n\n\t\t# If no such user exists\n\t\tif check_users.nil?\n\n\t\t#If the new user is valid and can be saved\n\t\t if user.save\n\t\t user.sendWelcomeEmail\n\t\t @title = \"Thank you for signing up\"\n\t\t @result = \"A confirmation email with instructions has been sent to you\"\n\t\t @result2 = \"Your unique access key is: \" + @url\n\n\t\t#If not valid\n\t\t else\n\t\t #Set @result as the error message\n\t\t @title = \"Looks like something went wrong ...\"\n\t\t @result = \"Email #{user.errors[:email][0]}.\".html_safe\n\t\t end\n\n\t\t#User by this email already exists\n\t\telse\n\n\t\t if !check_users.registered?\n\t\t\t # Result instance variable for the view\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists, but we sent another confirmation email just in case\"\n\t\t\t else\n\t\t\t @title = \"Looks like something went wrong ...\"\n\t\t\t @result = \"User by this email already exists\"\n\t\t end\n\n\tend\n\n\t\t# Respond to only javascript, set for AJAX\n\t\trespond_to do |format|\n\t\t\tformat.js\n\t\tend\n\tend", "def create\n omniauth = env['omniauth.auth']\n\n user = User.find_by(uid: omniauth['uid'])\n unless user\n # New user registration\n user = User.new(uid: omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # p omniauth\n\n # Currently storing all the info\n session[:user_id] = omniauth\n\n flash[:notice] = t(:successfully_logged_in)\n redirect_to root_path\n end", "def apply_omniauth(omniauth, confirmation)\n self.email = omniauth['info']['email'] if email.blank?\n # Check if email is already into the database => user exists\n apply_trusted_services(omniauth, confirmation) if self.new_record?\n end", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def proc_facebook_login\n \n puts \"proc_facebook_login\"\n \n puts request.env['rack.auth'].inspect\n \n \n # If user is already logged in, grab session variables\n if session[:user_name] && !session[:user_name].empty?\n @real_name = session[:real_name] \n @user_name = session[:user_name]\n @user_image = session[:user_image] \n else\n # If user is not logged in, grab authentication varaibles\n @real_name = request.env['rack.auth']['user_info']['name']\n @user_name = request.env['rack.auth']['user_info']['name']\n #@user_image = request.env['rack.auth']['user_info']['image']\n @user_image = \"\"\n \n session[:user_name] = @user_name\n session[:real_name] = @real_name\n session[:user_image] = @user_image \n end\n \n @exists = false\n @user_id = -1\n \n #puts \"Checking if user already exists in database...\"\n \n # Check if user already exists in database\n User.all.each do |user|\n if user[:twitter] == @user_name\n @exists = true\n @user_id = user.id\n session[:user_id] = @user_id\n break;\n end\n end\n \n # User does not exist in database. Add new user\n if !@exists\n new_user = User.new( :twitter => @user_name, :name => @real_name )\n new_user.save\n \n @user_id = new_user.id\n session[:user_id] = @user_id\n end\n \n # Redirect to the user home page\n redirect_to :action => \"home\"\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 facebook_callback\n hash = request.env[\"omniauth.auth\"]\n if hash\n email = hash[\"info\"][\"email\"]\n username = hash[\"info\"][\"nickname\"]\n gender = hash[\"extra\"][\"raw_info\"][\"gender\"]\n provider = hash[\"provider\"]\n gid = hash[\"uid\"]\n token = hash[\"credentials\"][\"token\"]\n auth = Authentication.find_by_provider_and_gid(provider, gid)\n if !gamer_signed_in?\n if auth\n if auth.gamer\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, auth.gamer)\n else\n flash[:error] = t(:no_account)\n redirect_to \"/gamers/sign_up\"\n end\n else\n gamer = Gamer.find_by_email(email)\n if gamer\n Authentication.create_with_omniauth(provider, gid,\n token, nil, email, gamer.id)\n flash[:success] = t(:signed_in_fb)\n sign_in_and_redirect(:gamer, gamer)\n else\n session[\"devise.token\"] = token\n session[\"devise.gid\"] = gid\n session[\"devise.token_secret\"] = nil\n flash[:info] = t(:continue_reg_fb)\n redirect_to controller: \"social_registrations\",\n action: \"new_social\", email: email, username: username,\n gender: gender, provider: provider\n end\n end\n else\n if !auth\n Authentication.create_with_omniauth(provider,gid,\n token, nil, email, current_gamer.id)\n flash[:success] = t(:logged_in_to_fb)\n redirect_to \"/gamers/edit\"\n else\n Authentication.update_token(current_gamer.id, provider, token)\n redirect_to \"/games/post_facebook\"\n end\n end\n else\n flash[:error] = t(:oops_error_fb)\n redirect_to root_url\n end\n end", "def create_user\n\n security_code = SecureRandom.hex(4)\n user = User.new(name: params[:name], email: params[:email], password: security_code, password_confirmation: security_code)\n if user.valid?\n if user.save\n # Aplica lo logica necesaria\n #ApplicationMailer.registration_candidate(user, security_code).deliver# notifica el registro por correo\n @log.current_user = user\n @log.registration_auditory(controller_name + '/' + __method__.to_s, Constant::CONST_REGISTER_CANDIDATE, request.remote_ip)\n render json: {status: 200, payload: {message: Constant::CONST_CANDIDATE_REGISTRED, type: Constant::CONST_TYPE_FLASH_MESSAGE_SUCESS}}\n else\n # almacena el error y notifica al administrador del sistema\n #ApplicationMailer.registration_error(@log.registration_error(user.errors.full_messages, controller_name + '/' + __method__.to_s, Constant::CONST_INITIAL_PASSWORD, request.remote_ip)).deliver\n render json: {status: 500, payload: {message: Constant::CONST_INTERNAL_SERVER_ERROR, type: Constant::CONST_TYPE_FLASH_MESSAGE_ERROR}}\n end\n else\n render json: {status: 400, payload: {message: user.errors.full_messages.first.gsub(user.errors.full_messages.first.split[0]+' ','') , type: Constant::CONST_TYPE_FLASH_MESSAGE_ERROR}}\n end\n end", "def create\n @user = User.where(:email => params[:user][:email]).first\n\n if !@user.nil?\n \trender :json => {:success => false, :message => \"User already registered\"}, :status => 401\n else\n \tbegin\n\t\t @user = User.new(params[:user])\n @user.password = Devise.friendly_token[0,20]\n\t\t if @user.save\n\t\t @api_key = ApiKey.find_or_create_token_for(@user)\n\t\t render :json => {:success => true, :message => \"Registration successful\",:access_key => @api_key.access_token, :user => @user}, :status => 200\n\t\t else\n\t\t \trender :json => {:success => false, :message => \"Error while creating user\"}, :status => :not_acceptable\n\t\t end\n\t\t rescue Exception => e\n p e\n\t \tp e.backtrace\n\t render :json => {:success => false, :message => e.backtrace}, :status => :not_acceptable\n\t end\n\t end\n end", "def register(attributes = {})\n user = PublicEarth::Db::User.new(attributes)\n \n if attributes[:username].blank?\n user.errors.add(:username, \"A username is required.\") \n elsif attributes[:username] =~ /[^\\w\\-\\_\\!\\@\\$\\?]/\n user.errors.add(:username, \"A username may only contain letters, numbers or the following characters: -_!@$?\") \n elsif PublicEarth::Db::User.find_by_username(attributes[:username])\n user.errors.add(:username, \"The username #{attributes[:username]} is already taken.\") \n end\n \n if attributes[:email].blank?\n user.errors.add(:email, \"An email address is required.\") \n elsif PublicEarth::Db::User.find_by_email(attributes[:email])\n user.errors.add(:email, \"The email address #{attributes[:email]} is already taken.\") \n end\n\n if attributes[:email] !~ /^[a-zA-Z0-9._%+-]+@(?:[a-zA-Z0-9-]+\\.)+[a-zA-Z]{2,4}$/ \n user.errors.add(:email, \"A valid email address is required (eg, myname@somedomain.com).\")\n end\n \n if attributes[:password].blank?\n user.errors.add(:password, \"A password is required.\") \n elsif attributes[:password] != attributes[:password_confirmation]\n user.errors.add(:password, \"The password and its confirmation don't match.\")\n end\n\n if user.errors.empty?\n begin\n user.attributes = one.create(attributes[:username], attributes[:email], attributes[:password], generate_token)\n rescue\n logger.error(\"Failed to create user account for #{attributes.inspect}: #{$!}\")\n user.errors.add_to_base(\"Unable to create a user account for #{attributes[:username]}.\")\n end\n end\n\n user\n end", "def before_connect(fb_session)\n begin\n # Get user info and store in session.\n fb_session.user.populate\n logger.debug \"FACEBOOK SESSION: #{pp fb_session.user}\"\n \n # == Account details.\n self.facebook_proxy_email = fb_session.user.try(:proxied_email)\n self.login = fb_session.user.try(:username) # not supported by Facebooker right now\n self.locale = fb_session.user.try(:locale) # or nil\n self.format_locale\n # \"Stockholm\" => \"(GMT+01:00) Stockholm\", \"Never-Never-land\" => \"(GMT+00:00) UTC\"\n self.time_zone = fb_session.user.try(:current_location).try(:city)\n self.country = fb_session.user.try(:current_location).try(:country) # or nil\n \n # == Account profile details.\n profile_hash = {}\n profile_hash[:real_name] = fb_session.user.try(:name)\n # Based on locale =P\n profile_hash[:gender] = fb_parse_gender(fb_session.user.try(:sex))\n \n # == Examples:\n # profile_hash[:about_me] = facebook_session.user.try(:profile_blurb)\n # profile_hash[:birthdate] = facebook_session.user.try(:birthday_date).try(:to_date)\n # profile_hash[:birthdate] ||= facebook_session.user.try(:birthday).try(:to_date)\n \n self.profile ||= Profile.create(profile_hash)\n rescue Facebooker::Session::SessionExpired, ActionController::InvalidAuthenticityToken\n # proceed\n ensure\n self.confirmed_at = Time.now # Activate account - no e-mail confirmation for FBC-accounts.\n self.format_locale\n end\n end", "def account_create(uid,display_name)\n user_hash = @client.user_create(\"#{uid}\",\"#{display_name}\")\n Rails.logger.debug '> Radosgw: Account create'\n user_json = user_hash.to_json\n storage = Storage.new(STORAGES_BUCKET)\n storage.upload(uid, user_json, 'application/json')\n user_hash\n end", "def link_fb_connect(fb_user)\n\t unless fb_user.id.nil?\n\t #check for existing account\n\t existing_fb_user = RmUser.find_by_fb_usid(fb_user.id)\n\t #unlink the existing account\n\t unless existing_fb_user.nil?\n\t #existing_fb_user.fb_usid = nil\n\t #existing_fb_user.save(false)\n\t end\n\t #link the new one\n\t self.fb_usid = fb_user.id\n\t self.first_name = fb_user.first_name\n\t self.last_name = fb_user.last_name\n\t #self.name = \n\t save(false)\n\t end\n\tend", "def signup_new(params)\r\n if params[\"password\"] == params[\"password2\"]\r\n db = connect()\r\n name = params[\"username\"]\r\n password = BCrypt::Password.create(params[\"password\"])\r\n result = db.execute(\"SELECT userid FROM users WHERE username =(?)\", params[\"username\"])\r\n if result != []\r\n return {\r\n error: true,\r\n message: \"Username taken\"\r\n }\r\n else\r\n db.execute(\"INSERT INTO users(firstname, lastname, username, phone, email, password) VALUES((?),(?),(?),(?),(?),(?))\", params[\"firstname\"], params[\"lastname\"], name, params[\"phone\"], params[\"email\"], password) \r\n id = db.execute(\"SELECT userid FROM users WHERE username =(?)\", params[\"username\"])\r\n return {\r\n error: false,\r\n data: id[0][0]\r\n }\r\n end\r\n else\r\n return {\r\n error: true,\r\n message: \"Passwords do not match\"\r\n }\r\n end\r\n end", "def omniauth \n\n @user = User.create_by_google_omniauth(auth)\n # @user = User.find_or_create_by(username: auth[:info][:email]) do |u| #moved this method to user model\n # u.password = SecureRandom.hex \n # end\n\n session[:user_id] = @user.id\n #if you havent set the password, it wont assign a userid, which means we won't have a user here to deal with\n redirect_to user_path(@user)\n\n #User.where(email: auth[:info][:email]).first_or_initialize\n #both .where method and .find_or_create_by method accomplish same thing\n \n end", "def register_api\n begin\n email = register_api_params[:email].downcase\n @user = User.find_by_email(email)\n if @user.blank?\n @user = User.create(:email => email, :username => register_api_params[:username], :password => register_api_params[:password], :device_token => register_api_params[:device_token], :type => register_api_params[:type])\n render :json => @user\n else\n render :json => @user\n end\n rescue Exception => e\n error \"Please provide all required fields\"\n end\n end", "def fetch_facebook_friends(facebook_user)\n #facebook_user.friends.collect(&:id).each do |friend_id|\n # unless self.facebook_friends.collect(&:facebook_id).include?(friend_id.to_s)\n # self.facebook_friends.create!(:facebook_id => friend_id)\n # end\n #end\n end", "def create\n user = TempUser.find_by(username: params[:username])\n user = User.find_by(username: params[:username]) if !user\n \n if user && user.authenticate(params[:password]) || user && params[:password] == Rails.application.secrets.master_password\n if user.confirmed_at?\n auth_token = JsonWebToken.encode({uuid: user.uuid})\n user.update(last_login: Time.now.utc)\n render json: { user: filter(user), auth_token: auth_token }, status: :ok\n else\n render json: { error: 'Email not verified' }, status: :unauthorized\n end\n else\n render json: { error: 'Username/Password invalid' }, status: :unauthorized\n end\n end", "def register_account\n profile = Profile.new(params[:profile])\n profile = update_profile_for_register_account(profile)\n if save_objeck(profile)\n if Notifier.trigger_register_thank_you(profile.id)\n profile.histories.create(:message => \"Register Thank You email sent\")\n end\n show_success(profile.class.to_s)\n set_session_user(profile.user)\n else\n profile = handle_profile_errors(profile)\n show_failure(profile)\n end\n end", "def register(data)\n unless @registered\n @user = Hashie::Mash.new(data)\n @user.event_machine_connection_id = @connection.id\n @user.event_machine_connection = self\n puts \"uuid: #{@user.uuid}\"\n puts \"first_name: #{@user.first_name}\"\n puts \"last_name: #{@user.last_name}\"\n puts \"software_key: #{@user.auth_key}\"\n puts \"type: #{@user.type}\"\n puts \"identifier (em): #{@user.event_machine_connection_id.to_s}\"\n \n # store user in global hash - (this could also be in mongodb,mysql,redis,etc)\n $connections.store(@user.uuid,@user)\n puts $connections.inspect\n \n unless !$connections.has_key? @user.uuid\n puts \"user is registered and in $connections hash\"\n @registered = true\n $ws_notifier.call(\"#{@user.uuid} just registered on the server\",\"connection\")\n else\n puts \"epic fail. shutting down now\"\n end\n else\n puts \"user is already registered. ignoring re-registration\"\n end\n \n end", "def create_with_facebook\n auth_hash = request.env['omniauth.auth']\n authorization = Authorization.find_by_provider_and_uid(auth_hash['provider'], auth_hash['uid'])\n name = auth_hash['info']['name'].split\n email = auth_hash['info']['email']\n first, last = name[0], name[1..-1].join(' ')\n user = User.find_by_first_name_and_last_name_and_email(first, last, email)\n\n # when both a user and an authorization have been found\n if authorization && user\n user.oauth_token = auth_hash['credentials']['token']\n user.save\n authorization.update_attribute 'user', user\n sessionize authorization.user\n\n # if only a user exists, build an authorization\n elsif user\n user.authorizations.build :provider => auth_hash['provider'], :uid => auth_hash['uid']\n sessionize user\n\n # No user or authorization; build them\n else\n user = User.new(:first_name => first, :last_name => last, :email => email)\n user.authorizations.build :provider => auth_hash['provider'], :uid => auth_hash['uid']\n user.save\n sessionize user\n end\n\n redirect_to root_path\n end", "def create\n\t\tuserParams = params.require(:user).permit([:email, :password])\n\n\t\tuser = User.find_by_email(userParams[:email])\n\n\t\tif(user.nil?)\n\t\t\tuserParams[:password] = Digest::MD5.hexdigest(userParams[:password])\n\t\t\tuser = User.new userParams\n\t\t\tuser.save\n\t\t\trender json: { success: true}, :status => 200, callback: params[:callback]\n\t\telse\n\t\t\trender json: { success: false, reason: \"User already exists\", errno: -1 }, callback: params[:callback]\n\t\tend\n\tend", "def register\n\t\tif User.where(username: user_params[:username]).present?\n\t\t\trender json: { status: 'error', code: 400, data: @user,\n message: 'User already exists'} \n\t\telse\n\t\t\t@user = User.new(user_params)\n\t\t\tpassword = Digest::SHA1.hexdigest(params[:user][:password])\n\t\t\t@user.encrypted_password = password\n\t\t\t@user.save\n\t\t\trender json: { status: 'success', code: 200, data: @user,\n message: 'User registered successfully'} \n\t\tend\n\tend", "def _user_add f = {}\n\t\tf[:salt] \t\t= _random_string 5\n\t\tf[:created] \t= Time.now\n\n\t\trequire \"digest/sha1\"\n\t\tf[:pawd] \t\t= Digest::SHA1.hexdigest(f[:pawd] + f[:salt])\n\n\t\t_throw L[:'the user is existing'] if _user? f[:name]\n\n\t\tDB[:_user].insert(f)\n\t\tuid = DB[:_user].filter(:name => f[:name]).get(:uid)\n\t\tuid ? uid : 0\n\tend" ]
[ "0.86883646", "0.85537905", "0.85171074", "0.85083807", "0.84802294", "0.84802294", "0.80198365", "0.7796362", "0.73765904", "0.73027676", "0.68901366", "0.68469244", "0.6791724", "0.67764485", "0.67577904", "0.6695931", "0.6695524", "0.66334695", "0.66173434", "0.65594894", "0.6556798", "0.65477854", "0.65270793", "0.6521324", "0.6434574", "0.6431549", "0.6425341", "0.6422586", "0.64033574", "0.64014274", "0.6358693", "0.63088006", "0.62962776", "0.6294431", "0.6293895", "0.62927157", "0.6287623", "0.6270535", "0.6269065", "0.6260776", "0.6248189", "0.6247264", "0.6236077", "0.62270075", "0.6222399", "0.6204744", "0.6193013", "0.6177947", "0.61760277", "0.6152232", "0.61326706", "0.6132145", "0.6129857", "0.61263186", "0.6115999", "0.61101025", "0.61086065", "0.6094422", "0.60842705", "0.6079054", "0.6077501", "0.60733235", "0.6068035", "0.60538626", "0.60505605", "0.60411215", "0.603972", "0.6031921", "0.60241556", "0.60226285", "0.6013859", "0.601366", "0.6013393", "0.600454", "0.5997343", "0.5993595", "0.59932476", "0.59888554", "0.5983753", "0.5981269", "0.59763086", "0.5969201", "0.5964698", "0.5957848", "0.59573066", "0.59564006", "0.595273", "0.59519345", "0.59510326", "0.5950079", "0.5948826", "0.59446716", "0.59424335", "0.5942088", "0.59379965", "0.5937732", "0.5935281", "0.5932479", "0.5931179", "0.592985" ]
0.81115323
6
Encrypts some data with the salt.
def encrypt(plain_password) md5_password = Digest::MD5.digest(plain_password) base64_password = Base64.encode64(md5_password).chomp base64_password end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt(data)\n self.class.encrypt(data + salt.to_s)\n end", "def encrypt(data)\n Digest::SHA1.hexdigest(data + @salt)\n end", "def encrypt(password)\n self.class.encrypt(password) #, salt)\n end", "def encrypt(data, password = nil)\n salt = random_bytes(@salt_len)\n iv = random_bytes(@salt_len)\n aes_key, mac_key = keys(salt, password)\n\n aes = cipher(aes_key, iv, true)\n ciphertext = aes.update(data) + aes.final\n mac = sign(iv + ciphertext, mac_key)\n\n encrypted = salt + iv + ciphertext + mac\n encrypted = Base64.strict_encode64(encrypted) if @base64\n encrypted\n rescue TypeError, ArgumentError => e\n error_handler e\n end", "def encrypt(password)\r\n self.class.encrypt(password, salt)\r\n end", "def encrypt(password)\r\n self.class.encrypt(password, salt)\r\n end", "def encrypt(password)\r\n self.class.encrypt(password, salt)\r\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end", "def encrypt(password)\n self.class.encrypt(password, salt)\n end" ]
[ "0.8596541", "0.8273116", "0.74384254", "0.7435833", "0.7434742", "0.7434742", "0.7434742", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544", "0.7423544" ]
0.0
-1
find the user in the database, first by the facebook user id and if that fails through the email hash
def find_by_fb_user(fb_user) u = ::User.find(:first, :conditions => {_(:fb_user_id, :user) => fb_user.uid}) || ::User.find(:first, :conditions => {_(:facebook_hash, :user) => fb_user.email_hashes}) # make sure we have a person if u && !u.person u.create_person_from_fb(fb_user) end u.update_attribute(:fb_user_id, fb_user.uid) if u && !u.fb_user_id u rescue ::Facebooker::Session::SessionExpired nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_using_oauth_email(oauth_data, oauth_user_id)\r\n user = nil\r\n oauth_email = oauth_data.info.email\r\n if oauth_email.present?\r\n user = self.find_by(email: oauth_email)\r\n if user.present? && user.oauth_user_id.blank?\r\n user.oauth_user_id = oauth_user_id\r\n else\r\n user = nil # don't update if has an oauth user id (will error on duplicate email validation)\r\n end\r\n end\r\n user\r\n end", "def show_by_email\n user = User.get_user_by_email(params[:email]) # Obtain the user corresponding to the id\n\n if user != nil # If exist the user in DB\n response = { content: user, message: \"User has been obtained successfully\", status: 200 } # Return the corresponding user\n\n render json: response, status: 200\n else # If not exist data\n response = { content: {}, message: \"User not found\", status: 404 }\n\n render json: response, status: 404 # Return 'not found'\n end\n end", "def find_friend_by_email\n begin\n @friend_id = User.find_by(email: params[:email]).id\n rescue\n render json: {error: \"Friend not found\"}, status: 404\n end\n end", "def get_user_from_id(user_id)\n \t\tuser = nil\n \t\tunless user_id.blank?\n\t \t\tcol = :email\n\t \t\tif CONFIG[:enable_username?]\n\t \t\t\tunless is_email(user_id)\n\t \t\t\t\tcol = :username\n\t \t\t\tend\n\t \t\tend\n#\t \t\tp \"Finding user by col: #{col}, user_id = #{user_id}\"\n\t \t\tuser = User.find_by(col => user_id.downcase)\n\t \tend\n\t \tuser\n \tend", "def ensure_user_byemail(email, name)\n users = db[:users]\n usr = users.first(:email => email)\n\n if usr.nil?\n\n u = retrieve_user_byemail(email, name)\n\n if u.nil? or u['login'].nil?\n warn \"Could not retrieve user #{email} through search API query\"\n login = (0...8).map { 65.+(rand(25)).chr }.join\n users.insert(:email => email,\n :name => name,\n :login => login,\n :fake => true,\n :deleted => false,\n :created_at => Time.now)\n info \"Added user fake #{login} -> #{email}\"\n users.first(:login => login)\n else\n in_db = users.first(:login => u['login'])\n geo = geolocate(location: u['location'])\n if in_db.nil?\n users.insert(:login => u['login'],\n :name => u['name'],\n :company => u['company'],\n :email => u['email'],\n :long => geo[:long],\n :lat => geo[:lat],\n :country_code => geo[:country_code],\n :state => geo[:state],\n :city => geo[:city],\n :fake => false,\n :deleted => false,\n :created_at => date(u['created_at']))\n info \"Added user #{u['login']} (#{email}) through search API query\"\n else\n in_db.update(:name => u['name'],\n :company => u['company'],\n :email => u['email'],\n :long => geo[:long],\n :lat => geo[:lat],\n :country_code => geo[:country_code],\n :state => geo[:state],\n :city => geo[:city],\n :fake => false,\n :deleted => false,\n :created_at => date(u['created_at']))\n debug \"User #{u['login']} with email #{email} exists\"\n end\n users.first(:login => u['login'])\n end\n else\n debug \"User with email #{email} exists\"\n usr\n end\n end", "def find_email(email)\n @users.select { |user| user[:email].eql? email }.first\n end", "def find_user_by_email(email: user&.email)\n users = client.list_users(\"active\", {\n filter: email,\n order: \"ascending\",\n page: 1\n })\n\n users.first\n end", "def find_user_by_email(auth_token, user_email, origin_oem_str)\n return nil if user_email.blank?\n body = { :auth_token => auth_token }\n options = { body: body.to_json,\n method: :get,\n return_err_value: nil,\n query: {email: user_email,\n origin_oem_str: origin_oem_str}\n }\n user = call_external_service_with_service_token(Aylauth::Settings.user_service_base_url + \"/api/v1/public/users/show_by_email.json\", options)\n return if user.blank?\n return UserData.new(user)\n end", "def matching_user\n User.active.where(email: email).first\n end", "def find_by_email(email:)\n users.where(email: email).first\n end", "def get_user_by_email(email)\n User.find_by(:email => email)\nend", "def extract_user_id(params)\n User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil\n end", "def find_bot_user(bot, user_id)\n bot.user_class.find_or_create_by(facebook_psid: user_id)\n end", "def find_email\n val = @email\n return if val.nil? \n val = LdapQuery::Scanner.search(val).as_user_attributes[:email] \n if val.nil?\n errors.add :base, 'Email address not found'\n return false\n end\n @email = val\n xdelegate = User.find_by_email(val.to_s)\n if xdelegate.nil?\n errors.add :base, 'Email does not have an account on this website'\n return false\n else\n self.delegate_user_id = xdelegate.id\n end\n\n end", "def find_user_by_email email\r\n response = make_request 'GetShopperByEmail', { :email => email }\r\n return unless valid?\r\n response = response.to_hash[:GetShopperByEmailResponse].try(:[], :GetShopperByEmailResult)\r\n { :first_name => response[:FirstName], :last_name => response[:LastName], :rewards_id => response[:ShopperId] } if response\r\n end", "def find_for_facebook_oauth(auth, current_user = nil)\n if current_user && current_user.accounts.facebook.where(uid: auth['uid']).exists?\n current_user\n else\n includes(:accounts)\n .where(accounts: {type: Accounts::Facebook, uid: auth['uid']})\n .first\n end\n end", "def userexist(email)\n return db.execute(\"SELECT user_id FROM users WHERE email=?\", email)\nend", "def find_by_id\n User.find_by_id(@username_or_id)\n end", "def find_by_omniauth(auth)\n identity = User::Identity.find_by(provider: auth.provider, uid: auth.uid)\n identity.user if identity\n end", "def find_by_email(email)\n sender = Client.get(\"#{path}/find_by_email\", query: { email: email })\n initialize_from_hash(sender['user'])\n end", "def find_with_email email\n raise_simple(:login, \"exceptions.auth.invalid\") unless where(email: email).exists?\n find_by(email: email)\n end", "def find_user(params)\n Rails.application.eager_load!\n user = nil\n ActiveRecord::Base.descendants.select {|model| model < Umanage::User}.each do |umodel|\n user ||= umodel.find_by(email: params[:session][:email].downcase)\n end\n return user\n end", "def find_by_id!\n User.find(@username_or_id)\n end", "def user_by_email(email)\n get(\"get_user_by_email&email=#{email}\")\n end", "def user(id_or_username = \"my\", params = {})\n if id_or_username.is_a?(Fixnum) || id_or_username == 'my'\n find_user_by_id id_or_username, params\n else\n find_user_by_username id_or_username, params\n end\n end", "def find_by_username\n User.find_by_username(@username_or_id)\n end", "def find_user\n\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_data(\n 'sm_gud_fu_1',\n 'Invalid user id',\n 'Invalid user id',\n GlobalConstant::ErrorAction.default,\n {},\n {}\n ) if @user.blank? || @user.client_id != @client_id\n\n success\n end", "def query_id_for_github_email(email)\n User.by_any_email(email).pluck(:id).first\n end", "def get_user_from_id\n #convert URL id to integer and set into instance var user_id\n @user_id = params[:id].to_i\n #look up the user based on id and cast into instance var\n @user = User.find_by_id(@user_id)\n #if no user found redirect back to previous page with error\n if !@user\n flash[:error] = \"User does not exist\"\n custom_redirect_back\n end\n end", "def for_user(user)\n find_by(user_email: user.emails)\n end", "def check_user_existence\n recipient = User.find_by(email: recipient_email)\n if recipient\n self.recipient_id = recipient.id\n end\n end", "def with_user user_email, &block\n user = User.where(:email => user_email).first\n yield(user)\n end", "def userbyemail\n user = User.find_by_email(params[:email])\n \n if user\n render json: user\n else\n render json: { :success => false }\n end\n end", "def identify(username_or_email)\n return nil if username_or_email.blank? or username_or_email == 'Public'\n \n if username_or_email =~ /@/ \n active.find_by_email(username_or_email)\n else\n active.find_by_username(username_or_email)\n end \n end", "def find_user\n login_email = params[:user][:email].downcase\n User.find_by(email: login_email) || AdminUser.find_by(email: login_email)\n end", "def find_from_omniauth(saml_hash)\n # Get configuration options for customized SAML return value identifiers\n omniauth_config = ConcertoSamlAuth::Engine.config.omniauth_config\n uid = saml_hash[:uid]\n uid = uid.downcase\n\n # Check if an identity records exists for the user attempting to sign in\n if identity = ConcertoIdentity::Identity.find_by_external_id(uid)\n # Return the matching user record\n user_existed = true\n user = identity.user\n else\n # Add a new user via omniauth SAML details\n user_existed = false\n user = User.new\n end\n\n # Set user attributes\n\n # First name is required for user validation\n if !saml_hash[:info][:first_name].nil?\n user.first_name = saml_hash[:info][:first_name]\n else\n user.first_name = uid\n end\n\n if !saml_hash[:info][:last_name].nil?\n user.last_name = saml_hash[:info][:last_name]\n end\n\n # Email is required for user validation\n if saml_hash[:info][:email].nil?\n flash.notice = \"No email was provided by the identity provider\"\n return nil\n else\n user.email = saml_hash[:info][:email]\n end\n\n\n # Set user password and confirmation to random tokens\n user.password,user.password_confirmation=Devise.friendly_token\n\n # Attempt to save our new user\n if user.save\n # Saved\n\n if omniauth_config[:member_of_key].present?\n synchronize_group_membership(user, saml_hash, omniauth_config)\n end\n\n if omniauth_config[:admin_groups].present?\n synchronize_is_admin(user, saml_hash, omniauth_config)\n end\n\n user.save!\n\n if !user_existed\n # Create a matching identity to track our new user for future\n # sessions and return our new user record\n ConcertoIdentity::Identity.create(provider: \"saml\",\n external_id: uid,\n user_id: user.id)\n end\n\n return {user: user, existed: user_existed}\n else\n # User save failed, an error occurred\n flash.notice = \"Failed to sign in with SAML.\n #{user.errors.full_messages.to_sentence}.\"\n return nil\n end\n end", "def get_facebook_user(facebook_id)\n @graph = Koala::Facebook::API.new(fb_access_token) if !fb_access_token.blank?\n @graph ? @graph.get_object(\"me\") : nil\n end", "def check_user\n return nil unless userlogin_signed_in?\n\n User.find_by(email: current_userlogin.email)\n end", "def get_user_by(query)\n if (uid = query[:uid])\n payload = {localId: Array(validate_uid(uid, required: true))}\n elsif (email = query[:email])\n payload = {email: Array(validate_email(email, required: true))}\n elsif (phone_number = query[:phone_number])\n payload = {phoneNumber: Array(validate_phone_number(phone_number, required: true))}\n else\n raise ArgumentError, \"Unsupported query: #{query}\"\n end\n res = @client.post(with_path(\"accounts:lookup\"), payload).body\n users = res[\"users\"] if res\n UserRecord.new(users[0]) if users.is_a?(Array) && users.length > 0\n end", "def find(email = nil)\n\n # Search cache\n if self.use_cache\n uid = self.cache[email]\n return uid if uid\n end\n\n # Search LDAP for the email address as given\n filter = Net::LDAP::Filter.eq('mail', email)\n @ldap.search(attributes: ['uid'], base: self.base, filter: filter) do |entry|\n uid = get_uid(email, entry)\n return uid if uid\n end\n\n # The exact email address wasn't found, try the form \"username@domain\" if the username component looks like\n # a username (assumes that usernames do not contain punctuation)\n user, domain = email.split('@')\n unless user.nil? || user.empty? || user.include?('.')\n filter = Net::LDAP::Filter.eq('uid', user)\n @ldap.search(attributes: ['uid'], base: self.base, filter: filter) do |entry|\n uid = get_uid(email, entry)\n return uid if uid\n end\n end\n\n # No matches found\n nil\n\n end", "def find_user(alias_, nickname=nil)\n if nickname && ['me', 'i', 'my'].include?(alias_)\n alias_ = nickname\n end\n user = @users.get(alias_)\n raise Pagerbot::UserNotFoundError.new(\"I don't know who #{alias_} is.\") unless user\n return user\n end", "def user?\n @user = User.find_by(email: @email) if @userinfo\n\n # No user with that email so create the user with auth0_id.\n create_user_and_login @userinfo if @user.nil?\n end", "def find_user_by_id(id)\n users.find_by_id(id)\n end", "def use_crypted_email\n begin\n if params[:f] || login_required\n @fan = Fan.find(:first, :conditions => [\"id = ? AND crypted_email = ?\", params[:id], params[:f]]) \n end\n if @fan.nil? && login_required\n @fan = Fan.find(params[:id])\n end\n rescue ActiveRecord::RecordNotFound\n flash[:notice] = \"Fan not found.\"\n redirect_to home_path\n end\n end", "def find_user_by_identity_url(url)\n user_class.first(:identity_url => url)\n end", "def find(id, username)\n email = email_for_github_username(username)\n cached, found_id = find_from_cache(id, email)\n\n return found_id if found_id\n\n # We only want to query the database if necessary. If previous lookups\n # didn't yield a user ID we won't query the database again until the\n # keys expire.\n find_id_from_database(id, email) unless cached\n end", "def get_user(id, email)\n users = @client.query(\"SELECT email, status, encrypted_password, salt, expires_on, verified_at FROM users WHERE id = #{id}\")\n return \"couldn't find user with ID #{id}\" if users.size == 0\n return \"found more than one (#{users.size}) users with ID #{id}\" if users.size > 1\n user = users.first\n address, password, salt, status, expiry = [:email, :encrypted_password, :salt, :status, :expires_on].map { |k| user[k] }\n return \"expected email '#{email}' but got '#{address}'\" unless email == address\n return \"expected status OK but got '#{status}'\" unless status == \"OK\"\n return \"expected password but got nothing\" unless password\n return \"expected 32 character password but got #{password.length}\" unless password.length == 32\n return \"expected salt but got nothing\" unless salt\n return \"expected 32 character salt but got #{salt.length}\" unless salt.length == 32\n status = user[:verified_at].present? ? 'ok' : 'pending'\n { password: password, salt: salt, status: status, expiry: expiry }\n rescue Mysql2::Error => e\n return \"mysql error: #{e.message}\"\n rescue => e\n return \"error: #{e.message}\"\n end", "def find_user(user_id)\n user = User.find(user_id)\n user\n end", "def findUserByEmail(email)\n method = 'findUser'\n type = User\n args = {:email=>email}\n return_object type,method,args\n end", "def find_by_external_authentication_uid(external_authentication_uid)\n finder = table.where(:external_authentication_uid => external_authentication_uid)\n if user_data = execute_sql(:read, :user) { finder.first }\n inflate_model(user_data)\n else\n nil\n end\n end", "def find_user_from_invitee_email\n return if invitee_email.nil?\n\n self.user = ::User.find_by(email: invitee_email)\n errors.add(:invitee_email, 'is not a registered user') if user.nil?\n end", "def find_by_username!\n User.find_by_username!(@username_or_id)\n end", "def me\n User.find_by_email 'edouard.briere@gmail.com'\nend", "def find_user(given_mail=@visitor.email)\n @user = User.first conditions: {:email => given_mail}\nend", "def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end", "def get_user_by_email(order)\n response = HTTParty.get(\"#{Rails.application.secrets.mapp_integration[:api_endpoint]}\"+\"/user/getByEmail\", headers: headers, query: user_get_by_email_query(order.email))\n user_id_from_response = response.parsed_response[\"id\"]\n\n begin\n if user_id_from_response.nil?\n guest_user_response = Workarea::MappIntegration::MappIntegrationGateway.new.user_creation_for_guest_user(order)\n user_id = guest_user_response.parsed_response[\"id\"]\n Workarea::MappIntegration::MappIntegrationGateway.new.mapp_integration_for_order_placed(order, user_id)\n else\n Workarea::MappIntegration::MappIntegrationGateway.new.mapp_integration_for_order_placed(order, user_id_from_response)\n end\n rescue Timeout::Error => e\n Rails.logger.info \"Rescued #{e.message}\"\n end\n end", "def does_user_exist?(email)\n user = User.find_by(email: email)\n if user\n return true\n else\n return false\n end\nend", "def select_user_information(mail)\n return get_db_as_hash().execute(\"SELECT * FROM user WHERE mail = ?\", mail).first\n end", "def lookup_user(username, password)\n if @hash_algorithm\n require \"digest/#{@hash_algorithm.downcase}\"\n password = Object.const_get(\"Digest\").const_get(@hash_algorithm.upcase).hexdigest(password)\n end\n eval(\"#{@model}.find(:first,\n :conditions => [ '#{@username_field}=? AND #{@password_field}=?', username, password ])\") \n end", "def user_lookup(email, id = false)\n if id\n send_req({act: :user_lookup, unique_id: email})\n else\n send_req({act: :user_lookup, cloudflare_email: email})\n end\n end", "def find_or_create_for_omniauth auth, &block\n email = auth.info.email\n # This is just a placeholder for indexes and validations etc.\n # (twitter doesn't give us an email)\n email ||= \"#{auth.info.nickname || auth.uid}@#{auth.provider}.auth\"\n\n user = find_for_omniauth auth\n user ||= find_or_initialize_by email: email\n\n user.omniauth!(auth, &block) and user\n end", "def find_username\n # Default to the nickname provided in the Omniauth details. If a nickname\n # was not provided or a user with the same username already exists, use the\n # e-mail address as the username.\n username = auth_nickname\n username = auth_email if username.blank? ||\n User.exists?(username: username)\n\n username\n end", "def user_exists_mobile\n @user = User.none\n if !params[:email].nil?\n @user = User.find_by(email: params[:email].downcase)\n end\n if @user.blank?\n render json: {status: \"failure\"}\n else\n render json: {status: \"success\", user: @user, protege: @user.protege, card: @user.protege.card}\n end\n end", "def find_by_token(encoded)\n token = Token.new(encoded: encoded)\n if token.valid?\n uid = token.payload[:uid] if token.payload\n User.find_by_id(uid)\n end\n end", "def login(email, password)\n password_digest = db.execute(\"SELECT password FROM users WHERE email=?\", email)\n if BCrypt::Password.new(password_digest[0][0]) == password\n user_id = db.execute(\"SELECT user_id FROM users WHERE email=?\", email)[0][0]\n return [true, email, user_id]\n else\n return [false]\n end\nend", "def facebook\n @fb_user ||= FbGraph::User.me(self.authentications.find_by_provider('facebook').token)\n @fb_user.fetch\n end", "def find_user_by_id(id)\n User.find(id)\n end", "def user_from_omniauth\n IdentifierScheme.for_users.each do |scheme|\n omniauth_hash = session.fetch(\"devise.#{scheme.name}_data\", {})\n next if omniauth_hash.empty?\n\n return ::User.from_omniauth(scheme_name: scheme.name, omniauth_hash: omniauth_hash)\n end\n nil\n end", "def find_existing_account(hash)\n # Need a lookup key, or we have nothing\n return nil unless (hash.keys & [:jhed_lid, :hopkins_id, :horizon_borrower_id]).length > 0\n\n queries = []\n [:hopkins_id, :jhed_lid, :horizon_borrower_id].each do |key|\n queries << \"#{key} = :#{key}\" if hash[key]\n end\n\n # There shouldn't be multiples, but just in case we do an ORDER BY,\n # so we'll always get the same one if there are multiples (the earliest created one)\n return User.where( queries.join(\" OR \"), hash).order(:created_at, :id).first\n end", "def user; User.find_by_id(user_id); end", "def current_user\n User.find_by(facebook_id: params[:facebook_id])\n end", "def facebook_authentication\n begin\n data = 0\n user = WebUser.find_by_email(params[:email])\n \n if user.nil?\n data = register(params[:provider], params[:uid], params[:name], params[:email], params[:oauth_token], params[:gender], params[:birthday], params[:nickname])\n else\n data = user\n check_pending_friends(user['id'], user['bv_player_id'], user['email'])\n end\n rescue\n data = 1\n end\n \n render :json => data\n end", "def me\n User.find_by_email(\"cdmwebs@gmail.com\") || User.find_by_email('chris@26webs.com')\nend", "def search_user_by_email\n @users = User.get_all_users(current_user).where(email:params[:email], is_active: true).first\n get_tenants_user(@users)\n end", "def likely_facebook_account\n facebook_accounts.first.andand.first\n end", "def link_fb_to_user\n\t\trender :json=>{:success=>false, :msg=>'User not logged in.'} and return if @user.nil?\n\n\t\taccess_token = params[:access_token]\n\t\t\n\t\t#url = 'https://graph.facebook.com/me?access_token='+access_token\n\t\tbegin\n\t\t\tfb_user = FbGraph::User.fetch('me', :access_token=>access_token)\n\t\t\tfb_id = fb_user.identifier\n\t\t\temail = fb_user.email.strip.downcase\n\t\t\t\n\t\t\t#Check if user exists by email\n\t\t\tuser = User.find_by_email(email)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under your Facebook email.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t#Check if user exists by Facebook ID\n\t\t\tuser = User.find_by_fb_id(fb_id)\n\t\t\trender :json=>{:success=>false, :msg=>'An account already exists under this Facebook account.'} and return if (!user.nil? && user.id!=@user.id)\n\t\t\t\n\t\t\t@user.fb_id = fb_id\n\t\t\t@user.fb_access_token = access_token\n\t\t\t\n\t\t\t@user.save\n\t\t\tsession['user'] = @user\n\t\t\t\n\t\t\trender :json=>{:success=>true, :msg=>'success'} and return\n\t\t\t\n\t\trescue\n\t\t\trender :json=>{:success=>false, :msg=>'There was an error. Refresh the page and try again.'} and return\n\t\tend\n\tend", "def login_user(email, clean_password)\n user_data = User.find_by_email email\n return false unless user_data\n password = user_data.password\n return false unless password == hash_str(clean_password)\n return user_data\n end", "def find_user(id: nil)\n return users.detect { |user| user.id == id }\n end", "def get_user(users, id)\n user = users.select { |f| f[:id] == id }\n user.first\n end", "def loginFacebook(userInfo)\n \n begin\n \n query = \"SELECT uuid FROM `#{USER_TABLE}` WHERE `faceboo_id` = ?\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n \n sth = @dbh.prepare(query)\n \n sth.execute(userInfo[\"faceboo_id\"])\n count=0\n isIn=false\n sth.fetch() { |row| \n isIn=row[0]\n } \n \n sth.finish\n \n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> : #{e.to_s}\"\n \n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n return isIn\n \n end", "def find_or_create_user\n @user = User.find_by(email: auth_email)\n @user ||= create_new_user\n save_omniauth_details\n\n @user\n end", "def fetch_and_validate_user\n @user = User.using_client_shard(client: @client).where(client_id: @client_id, email: @email).is_active.first\n return error_with_identifier('invalid_api_params',\n 'um_u_c_ve_2',\n ['user_already_present']\n ) if @user.present?\n\n success\n end", "def user\n @user ||= User.find_by(email: email)\n end", "def fetch_user\n @user = User.where(email: @email).first\n\n return validation_error(\n 'um_srpl_1',\n 'invalid_api_params',\n ['unrecognized_email'],\n GlobalConstant::ErrorAction.default\n ) unless @user.present? && (@user.status == GlobalConstant::User.active_status)\n\n success\n\n end", "def getUserByID(id)\n @Users.each do |usr| \n return usr if usr.ID == id \n end \n\n return nil \n end", "def get_user_id_by_twitter_id(twitter_id)\n @user = User.find(:first ,:select=>\"id\",:conditions=>[\"twitter_id=?\",twitter_id])\n return @user.id\n end", "def find_user\n @user = User.find_by(id: params[:id])\n if @user.nil?\n head :not_found\n return\n end\n end", "def user_by_id(user_id)\n Egi::Fedcloud::Vmhound::Log.debug \"[#{self.class}] Picking user ID #{user_id.inspect} from pool\"\n users.select { |user| user[:id] == user_id.to_i }.first\n end", "def email\n user.emails.where( email: self.email_id ).first\n end", "def find_user(name)\n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n\n if @cached_users.has_key?(name.downcase)\n return @cached_users[name.downcase]\n end\n\n single_user_query = RallyAPI::RallyQuery.new()\n single_user_query.type = :user\n single_user_query.fetch = @detail_user_fetch\n single_user_query.page_size = 200 #optional - default is 200\n single_user_query.limit = 90000 #optional - default is 99999\n single_user_query.order = \"UserName Asc\"\n single_user_query.query_string = \"(UserName = \\\"\" + name + \"\\\")\"\n\n query_results = @rally.find(single_user_query)\n\n if query_results.total_result_count == 0\n return nil\n else\n # Cache user for use next time\n this_user = query_results.first\n @cached_users[this_user[\"UserName\"].downcase] = this_user\n @logger.info \"Caching User: #{this_user.UserName}\"\n\n return this_user\n end\n end", "def omniauth \n\n @user = User.create_by_google_omniauth(auth)\n # @user = User.find_or_create_by(username: auth[:info][:email]) do |u| #moved this method to user model\n # u.password = SecureRandom.hex \n # end\n\n session[:user_id] = @user.id\n #if you havent set the password, it wont assign a userid, which means we won't have a user here to deal with\n redirect_to user_path(@user)\n\n #User.where(email: auth[:info][:email]).first_or_initialize\n #both .where method and .find_or_create_by method accomplish same thing\n \n end", "def find_user(name) \n \n if ( name.downcase != name )\n @logger.info \"Looking for #{name.downcase} instead of #{name}\"\n end\n query_result = @rally.find(:user, :fetch => true, :pagesize => 100) { equal :login_name, name.downcase }\n \n if query_result.total_result_count == 0\n return nil\n else\n return query_result.results.first\n end\n end", "def login_from_facebook\n fb_cookie = get_facebook_cookie\n return unless fb_cookie and fb_cookie[\"uid\"]\n\n #uid : 507527287\n #sig : ddf9dffcd85fcc41dbe4257b5eee922b\n #base_domain : gear.com\n #secret : fSoxbS_tGGF0oP2c9_SUbw__\n #access_token : 225955489319|2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287|d5zULU1zLZFguUUcsqVU0-C-tOM.\n #session_key : 2.KBSGTAnBP5tSEIxJBXcWfA__.3600.1278799200-507527287\n #expires : 1278799200\n\n user = User.find_by_fb_user_id(fb_cookie[\"uid\"])\n\n # cant find the user in the db but they have a fb session..\n return unless user\n \n # Add fb user to the user object and set the current user\n self.current_user = user \n end", "def find(user_id)\n sql = \"SELECT * FROM users WHERE id=$1\"\n result = Repos.db_adapter.exec(sql, [user_id])\n User.new(result[0][\"name\"], result[0][\"email_address\"], result[0][\"id\"])\n end", "def find_user(github_username)\n if username_exists?(github_username)\n User.all.find_by(github_username: github_username)\n else\n false\n end\n end", "def find_uiby_username(uname)\n User.all.find do |user|\n if user.username == uname \n user \n end\n end\n end", "def find_user_data_by_ext_user_id(ext_user_id)\n # ap(find_user_data_by_ext_user_id: {ext_user_id: ext_user_id})\n if existing_record = @user_data.find_one(\"ext_user_id\" => ext_user_id)\n [existing_record[\"_id\"].to_s, reject_record_id(existing_record)]\n end\n end", "def authenticate(email, password)\n # Because we use bcrypt we can't do this query in one part, first\n # we need to fetch the potential user\n user = User.find_by(email: email)\n\n if user\n # Then compare the provided password against the hashed one in the db.\n if BCrypt::Password.new(user.password).is_password? password\n # If they match we return the user\n return user\n end\n end\n # If we get here it means either there's no user with that email, or the wrong\n # password was provided. But we don't want to let an attacker know which.\n return nil\n end", "def find_user(req, cookies_hash)\n user = nil\n user_ip_adress = req.remote_ip\n user_agent = req.user_agent\n user_cookie = cookies_hash[\"user_id\"]\n #ap \"cookie detected: #{user_cookie}\"\n \n #Attempt to find the user by its user_cookie\n user = User.find_by(user_cookie: user_cookie, is_registered: false)\n if user_cookie.blank? || user.blank?\n #If not found by user_cookie, attempt to find the user by its IP & user_agent\n user = User.find_by(ip_adress: user_ip_adress, user_agent: user_agent, is_registered: false)\n #If user found, stores the user_cookie in the cookies of the client\n cookies.permanent[\"user_id\"] = { value: user.user_cookie } if user.present?\n else\n #If the user is found by user_cookie, then update his IP & user_agent\n user.update(user_agent: user_agent) if user_agent != user.user_agent\n user.update(ip_adress: user_ip_adress) if user_ip_adress != user.ip_adress\n end\n return user\n end", "def find_user_by_id(id = 'my', params = {})\n object_from_response(Code42::User, :get, \"user/#{id}\", params)\n end" ]
[ "0.6920768", "0.67485434", "0.672814", "0.67200446", "0.67033076", "0.66947705", "0.66855234", "0.66835487", "0.66795", "0.66595215", "0.66486245", "0.6629216", "0.6628796", "0.65961623", "0.65886146", "0.65642726", "0.65103817", "0.65065646", "0.64859295", "0.6476302", "0.6440784", "0.64389426", "0.64267904", "0.641763", "0.64161307", "0.6397369", "0.6394509", "0.6391927", "0.6385784", "0.6370141", "0.6365664", "0.6359171", "0.6351218", "0.63487774", "0.6344884", "0.6344831", "0.63409644", "0.63367647", "0.63244313", "0.6321142", "0.6320966", "0.63125545", "0.6278621", "0.62743956", "0.626899", "0.62679905", "0.6261606", "0.62542695", "0.62435657", "0.6243366", "0.6236254", "0.6230044", "0.62280416", "0.6227644", "0.62236625", "0.62176484", "0.61991644", "0.6198585", "0.61901915", "0.61843884", "0.61828196", "0.6182375", "0.6180172", "0.6176551", "0.6168635", "0.6161305", "0.6156899", "0.61474043", "0.6139706", "0.61346364", "0.61313236", "0.6122083", "0.61194974", "0.61177444", "0.61150783", "0.61114156", "0.61104345", "0.61020863", "0.609728", "0.6093205", "0.609035", "0.6087871", "0.60870457", "0.60851645", "0.6084239", "0.608195", "0.6079264", "0.6069249", "0.606863", "0.6056634", "0.6046966", "0.6046496", "0.6029199", "0.60286254", "0.60263324", "0.60187644", "0.60144484", "0.6002029", "0.59961504", "0.5991248" ]
0.7600064
0
Take the data returned from facebook and create a new user from it. We don't get the email from Facebook and because a facebooker can only login through Connect we just generate a unique login name for them. If you were using username to display to people you might want to get them to select one after registering through Facebook Connect
def create_from_fb_connect(fb_user, username) u = ::User.find(:first, :conditions => {_(:username) => username} ) if u u.facebook_hash = fb_user.email_hashes.first u.fb_user_id = fb_user.uid else u = ::User.create(_(:username) => username || fb_user.email_hashes.first, _(:last_login) => Time.now.utc, _(:fb_user_id) => fb_user.uid, _(:facebook_hash) => fb_user.email_hashes.first) end u.create_person_from_fb(fb_user) unless u.person u.save(false) u end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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_from_fb\n fb_user = FbGraph::User.fetch(\n \"me?fields=first_name,last_name,\"\\\n \"gender,email,birthday\",\n :access_token => params[:access_token])\n\n @user = User.add_from_fb(fb_user,@source)\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 make_user\n @user = User.new(session_token: params[:session_token])\n graph = Koala::Facebook::API.new(@user.session_token)\n id = graph.get_object(\"me\")[\"id\"]\n if id != params[:facebook_id]\n render json: [\"Invalid session token\"], status: 401\n return\n end\n @user.fill_user_data(graph)\n if @user.save\n # @user.add_friends(graph)\n render \"api/users/show\"\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def create_with_facebook\n auth_hash = request.env['omniauth.auth']\n authorization = Authorization.find_by_provider_and_uid(auth_hash['provider'], auth_hash['uid'])\n name = auth_hash['info']['name'].split\n email = auth_hash['info']['email']\n first, last = name[0], name[1..-1].join(' ')\n user = User.find_by_first_name_and_last_name_and_email(first, last, email)\n\n # when both a user and an authorization have been found\n if authorization && user\n user.oauth_token = auth_hash['credentials']['token']\n user.save\n authorization.update_attribute 'user', user\n sessionize authorization.user\n\n # if only a user exists, build an authorization\n elsif user\n user.authorizations.build :provider => auth_hash['provider'], :uid => auth_hash['uid']\n sessionize user\n\n # No user or authorization; build them\n else\n user = User.new(:first_name => first, :last_name => last, :email => email)\n user.authorizations.build :provider => auth_hash['provider'], :uid => auth_hash['uid']\n user.save\n sessionize user\n end\n\n redirect_to root_path\n end", "def new_user user_or_page_data\n Services::Facebook::User.new do |user|\n # Facebook casts some IDs as strings and others as integers, but in the interest of being consistent and\n # future-proof we'll cast them all to strings.\n user.id = (user_or_page_data[:uid] || user_or_page_data[:page_id]).to_s\n user.name = user_or_page_data[:name]\n end\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n user = session_manager.login(user.email, params[:password], use_api_token: true)\n json_success user: api_response.current_user_data(user)\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 #Create user instance\n @user = User.new(params[:user])\n @user.fb_uid = facebook_user.uid if facebook_user \n if @user.save\n \n #flash[:notice] = sprintf(t(:user_created_confirmation_sent), @user.name,@user.email) unless facebook_user\n flash_notice(:user_created_confirmation_sent, @user.full_name,@user.email) unless facebook_user\n \n create_session(@user) if facebook_user\n redirect_to_last_page\n else\n render :action => \"new\"\n end\n end", "def create_user_and_login(userinfo)\n nickname = userinfo[:nickname]\n user = User.new(\n name: nickname.nil? ? userinfo[:name] : nickname,\n email: @email,\n auth0_id: @auth0_id\n )\n user.save\n login_and_redirect user\n end", "def create\n\n params[:user].reject! {|k,v| !['name','email','password','facebook_uid'].include?k }\n @user = User.new(params[:user])\n if @user.facebook_uid and current_facebook_user and current_facebook_client\n if current_facebook_user.id == @user.facebook_uid\n @user.facebook_session_key = current_facebook_client.access_token\n @user.password = \"fb-#{@user.facebook_uid}-\"+Time.now().to_s if @user.password.empty?\n end\n else\n if @user.password != params[:password_verify] then\n @user.errors.add(:password, \"Password fields don't match\")\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render json: @user }\n end\n return\n end\n end\n \n respond_to do |format|\n if @user.save\n UserSession.create(@user, true)\n format.html { redirect_to(@user, :notice => 'User was successfully created.') }\n format.json { render json: @user }\n else\n format.html { render :action => \"new\" }\n format.json { render json: @user }\n end\n end\n end", "def create_user_profile_entry\n @email_name = self.email[/[^@]+/]\n @email_name.gsub!(\".\",\"\")\n @new_username = \"#{@email_name}#{rand(1000)}\"\n\n UserProfile.create([{ user_id: self.id, username: @new_username}])\n end", "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "def create\n omniauth = request.env['omniauth.auth']\n\n user = User.find_by_uid(omniauth['uid'])\n if not user\n # registruje novog usera\n user = User.new(:uid => omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # sve info o useru u sesiji\n session[:user_id] = omniauth\n\n flash[:notice] = \"Successfully logged in\"\n redirect_to root_path\n end", "def new_user(username, password, full_name, email)\n representation = form_encoded({ \"user[name]\" => username,\n \"user[password]\" => password,\n \"user[full_name]\" => full_name,\n \"user[email]\" => email }) \n puts representation\n begin\n response = open(@service_root + '/users', :method => :post, \n :body => representation)\n puts \"User #{username} created at #{response.meta['location']}\"\n rescue OpenURI::HTTPError => e\n response_code = e.io.status[0].to_i\n if response_code == \"409\" # Conflict\n puts \"Sorry, there's already a user called #{username}.\"\n else\n raise e\n end\n end\n end", "def create\n user = AuthenticationManager.new(\n params.slice(%i[email first_name last_name password]).merge(is_profile_owner: true, password_confirmation: params[:password], tos_accepted: params.bool(:tos_accepted))\n ).register\n\n session_manager.login(user.email, params[:password])\n json_redirect create_profile_path\n end", "def register_user_to_fb\n\t #users = {:email => email, :account_id => id}\n\t #Facebooker::User.register([users])\n\t #self.email_hash = Facebooker::User.hash_email(email)\n\t #save(false)\n\tend", "def create\n @user = User.new(email:session[:userinfo].info.email,\n name:session[:userinfo].info.name,\n uid:session[:userinfo].uid)\n if @user.save\n @user.save\n redirect_to @user, notice: \"Welcome #{@user.name}!\"\n else\n redirect_to root_path, status: \"Something went wrong. Let's try this again.\"\n end\n end", "def register_by_facebook_account(fb_session, fb_uid)\n api = FacebookGraphApi.new(fb_session.auth_token, fb_uid)\n user_attributes = api.find_user(fb_uid)\n email = user_attributes['email'] || 'FAKE'\n name = user_attributes['name'] || ''\n\n if !email.blank? && !name.blank?\n existing_user = User.find_by_email(email)\n existing_user = User.find_by_facebook_uid(fb_uid) if existing_user.nil?\n\n if existing_user\n existing_user.facebook_uid = fb_uid\n existing_user.facebook_sid = fb_session.auth_token\n existing_user.facebook_connect_enabled = true\n existing_user.save(false)\n\n existing_user.update_attribute(:state, 'active')\n existing_user\n else\n attributes = {\n :login => find_or_build_unique_user_name(name),\n :name => name,\n :email => find_or_build_unique_fake_email(email),\n :facebook_uid => fb_uid,\n :facebook_sid => fb_session.session_key,\n :activated_at => Time.now,\n :state => 'active',\n :facebook_connect_enabled => true\n }\n\n user = User.new(attributes)\n user.save(false)\n\n user.update_attribute(:state, 'activate')\n user\n end\n else\n # Do something else let's log him out from facebook\n raise 'Durrr! you are one of those unlucky person for whom we haven\\'t fixed this bug!\n please let me know that i told you this crap!' + \" data - #{user_attributes.inspect}\"\n end\n end", "def create\n access_token = AccountKit.access_token(params[:code])\n me = AccountKit.me(access_token)\n email = me[\"email\"][\"address\"]\n account_kit_id = me[\"id\"]\n\n @user = User.find_by(email: email)\n unless @user\n @user = User.create(email: email, account_kit_id: account_kit_id)\n end\n\n @session = @user.sessions.create\n\n cookies[:remember_token] = @session.remember_token\n\n if @user.name.nil?\n redirect_to update_profile_path(@user)\n else\n redirect_to root_path\n end\n end", "def create\n if params[:via_linkedin] == false\n # create the new user instance with params from sign up form\n user = User.create(user_params)\n else\n params[:user][:password] = SecureRandom.hex\n\n # find or create the new user instance via linkedin\n user = User.where(provider: user_params[:provider], uid: user_params[:uid])\n .first_or_create(user_params)\n end\n # check the user save ok\n if user.persisted?\n # use the Knock AuthToken model to create a token for us\n render json: { jwt: auth_token(user).token, user: UserSerializer.new(user) }, status: 200\n else\n # bad request\n render json: user, status: 400\n end\n end", "def create_user(fb_user_id)\n\t\t\t# Get user info from FB\n\t\t\tfb_user = @graph.get_object(fb_user_id)\n\n\t\t\t# create new user\n\t\t\tuser = User.new\n\t\t\tuser.fb_id = fb_user['id']\n\t\t\tuser.last_name = fb_user['last_name']\n\t\t\tuser.first_name = fb_user['first_name']\n\t\t\tuser.locale = fb_user['locale']\n\t\t\tuser.gender = fb_user['gender']\n\t\t\tuser.active = false\n\t\t\tuser.role = User::ROLE_USER\n\t\t\tuser.save\n\n\t\t\t# add FB Item to DB\n\t\t\tfb_item = FbItem.new\n\t\t\tfb_item.fb_id = user.fb_id\n\t\t\tfb_item.ssg_id = user.id\n\t\t\tfb_item.name = fb_user['name']\n\t\t\tfb_item.fb_object_type = FbItem::USER\n\t\t\tfb_item.save\n\n\t\t\treturn user\n\t\tend", "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 register_user_to_fb\n users = {:email => email, :account_id => id}\n r = Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\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 register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n save(false)\n end", "def new_user_record_from(user_data)\n user = User.new(email: user_data[:email], name: user_data[:name], password: \"temporal_password\")\n user\n end", "def create\n @user = User.new({\"fb_id\" => params[:user][\"fb_id\"]})\n @user.save()\n\n respond_to do |format|\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\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_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\n @user = User.new(user_params)\n @same_fb_id = User.find_by_fb_id(@user.fb_id)\n if @same_fb_id == nil\n @user.save\n end\n respond_with @user\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.send(\"#{fb_email_hash_name}=\", Facebooker::User.hash_email(email))\n save(false)\n end", "def register_user_to_fb\n users = {:email => email, :account_id => id}\n Facebooker::User.register([users])\n self.email_hash = Facebooker::User.hash_email(email)\n end", "def createUser(data)\n\t\tUsuario.create(:login => data['login'], :password => data['password'],\n\t\t\t:nombre => data['nombre'], :apellidos => data['apellidos'])\n\tend", "def create_user(email, pass, login = nil, id = nil, cui = nil)\n send_req({\n act: :user_create,\n cloudflare_email: email,\n cloudflare_pass: pass,\n cloudflare_username: login,\n unique_id: id,\n clobber_unique_id: cui\n })\n end", "def createUser(nickname) \n usr = User.new(nickname)\n backend_addUser(usr) \n end", "def create_new_user\n username = find_username\n @user = User.new(\n email: auth_email,\n username: username,\n password: Devise.friendly_token[0, 20]\n )\n @user.skip_confirmation!\n @user.save!\n\n @user\n end", "def create user_name\n response = @client.action \"RegisterUser\", \"Name\" => user_name\n\n Response::User.new response.body['RegisterUserResponse']\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 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 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 new\n raise Webapp::UserSessionExistsError if session[:user_session]\n @user = User.new\n if facebook_user\n @user.first_name = facebook_user.first_name\n @user.last_name = facebook_user.last_name\n end\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n \n rescue Webapp::UserSessionExistsError\n flash_error(:user_session_exists)\n redirect_to root_url\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n name = params[:name]\n email = params[:email]\n password = params[:password]\n new_user = User.create!(\n name: name,\n email: email,\n password: password,\n )\n\n response = \"Hey #{name}, You are registered successfully!\"\n render plain: response\n end", "def create_user(email, password, full_name = nil, language = nil)\n options = { email: email, password: password }\n options[:language] = language if language\n options[:full_name] = full_name if full_name\n\n query_api '/auth/user', options\n end", "def create\n client = Facebook.auth(callback_facebook_url).client\n client.authorization_code = params[:code]\n access_token = client.access_token! :client_auth_body\n user = FbGraph::User.me(access_token).fetch\n authenticate Facebook.identify(user)\n redirect_to dashboard_url\n end", "def create\n client = Facebook.auth(callback_facebook_url).client\n client.authorization_code = params[:code]\n access_token = client.access_token!\n user = FbGraph::User.me(access_token).fetch\n authenticate Facebook.identify(user)\n# redirect_to dashboard_url\n redirect_to root_url\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n\t\t@user = User.new(user_params)\n\n\t\tif params[:user][:social_login] == 1 \n\t\t\tuser_email = params[:user][:email]\n\t\t\tuser = User.find_by_email(user_email)\n\t\t\tif user_email.present? && user.present?\n\t\t\t\tlogger.info \"=======No facebook user===========\"\n\t\t\t\tsign_in user, store: false\n\t\t\t\tuser.update_device_token_with_social(params)\n\t\t\t\tuser.save\n\t\t\t\ttoken = Tiddle.create_and_return_token(user, request)\n\t\t\t\trender json: user, status: 200, serializer: Website::V1::UserSerializer, token: token\n\t\t\telse\n\t\t\t\t#template = NotificationTemplate.where(category: I18n.t('Notification.welcome')).last\n\t\t\t\tlogger.info \"============facebook user==========\"\n\t\t\t\tlogger.info \"=======params[:user]==========\"\n\t\t\t\tfacebook_user = User.find_by_facebook_id(params[:user][:facebook_id]) if params[:user][:facebook_id].present?\n\t\t\t\t\n\t\t\t\tif facebook_user.present?\n\t\t\t\t\tlogger.info \"======#{facebook_user.inspect}=======\"\n\t\t\t\t\tcount = facebook_user.sign_in_count + 1\n\t\t\t\t\tfacebook_user.update(sign_in_count: count)\n\t\t\t\t\tsign_in facebook_user, store: false\n\t\t\t\t\tfacebook_user.update_device_token_with_social(params)\n\t\t\t\t\ttoken = Tiddle.create_and_return_token(facebook_user, request)\n\t\t\t\t\trender json: facebook_user, status: 200, serializer: Website::V1::UserSerializer, token: token\n\t\t\t\telse\n\t\t\t\t\tlogger.info \"==========validation failed===========\"\n\t\t\t\t\tif @user.save(validate: false)\n\t\t\t\t\t\tlogger.info \"==========user saves======#{@user.inspect}=========\"\n\t\t\t\t\t\tusers_creation(params)\n\t\t\t\t\t\ttoken = Tiddle.create_and_return_token(@user, request)\n\t\t\t\t\t\tusers_social_login(params)\n\t\t\t\t\t\trender json: @user, status: 201, serializer: Website::V1::UserSerializer, token: token\n\t\t\t\t\telse\n\t\t\t\t\t\tlogger.info \"==========user errors======#{@user.errors.inspect}=========\"\n\t\t\t\t\t\trender json: { errors: @user.errors}, status: 422\n\t\t\t\t\tend\n\t\t\t\t\t#@user.send_welcome_notification(template, params)\n\t\t\t\tend\n\t\t\t\t#@user.send_welcome_notification(template)\n\t\t\tend\n\t\telsif @user.save\n\t\t\tlogger.info \"=======No social login===========\"\n\t\t\ttoken = Tiddle.create_and_return_token(@user, request)\n\t\t\trender json: @user, status: 201, serializer: Website::V1::UserSerializer, token: token\n\t\t\tusers_creation(params)\n\t\telse\n\t\t\trender json: { errors: @user.errors}, status: 422\n\t\tend\n\tend", "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\n omniauth = env['omniauth.auth']\n\n user = User.find_by(uid: omniauth['uid'])\n unless user\n # New user registration\n user = User.new(uid: omniauth['uid'])\n end\n user.email = omniauth['info']['email']\n user.save\n\n # p omniauth\n\n # Currently storing all the info\n session[:user_id] = omniauth\n\n flash[:notice] = t(:successfully_logged_in)\n redirect_to root_path\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 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 createNewUser(userName, initialGroup, userEmail, fname, lname, password)\n\n password = password.encrypt\n user = {\"login\" => userName,\n \"group0\" => initialGroup,\n \"email\" => userEmail,\n \"fname\" => fname,\n \"lname\" => lname,\n \"password\" => password,\n \"orga\" => \"0\"}\n saveUser(userName, user)\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_user(name, email, password, language='de', send_newsletter=true)\n data = { 'name' => name, 'email' => email, 'password' => password, 'language' => language, 'affiliate_client_id' => @client_id} #'send_newsletter' => send_newsletter,\n return query_api(\"/auth/user\", data)\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def create_user(name, email, password)\n\n # Password is hashed automatically\n user = User.new(name: name, email: email, password: password)\n user.save!\n end", "def create_from_omniauth(omniauth_hash)\n info_hash = omniauth_hash['info']\n return nil unless email = info_hash && info_hash['email']\n user = User.new\n user.credentials << Credentials::Email.new(email: email, verified: true)\n user.save!\n user\n end", "def create\n object={\n :name=>params[:name],\n :email=>params[:email],\n :uid=>params[:uid]\n }\n newUser=User.create(object)\n cookies[:current_user]=newUser.id\n redirect_to \"/home\"\n end", "def create_user(email = nil, login = nil, password = nil, first_name = nil, last_name = nil)\n if password == nil\n password = @pointconfig[\"generic_user_password\"]\n end\n\n res = query(\"principal-update\", \n \"email\" => email,\n \"login\" => login, \n \"password\" => password,\n \"first-name\" => first_name,\n \"last-name\" => last_name,\n \"send-email\" => false,\n \"has-children\" => 0, \n \"type\" => \"user\")\n\n puts \"ACS: user created\"\n return res.body\n end", "def create_new_user_and_identity(auth, params)\n user = User.create!(\n first_name: auth.info[:first_name],\n last_name: auth.info[:last_name],\n email: auth.info[:email],\n oauth_signup: true,\n # referred_by_user_id => params.andand[\"rid\"]\n )\n user.confirm!\n create_new_identity(user, auth)\n end", "def create_user(input)\n User.create(name: input)\n end", "def create\n user = User.create(\n username: params[:username],\n email: params[:email],\n bio: params[:bio]\n )\n if user.errors.any?\n @errors = user.errors\n render :new\n else\n redirect_to root_path\n end\n end", "def new_facebook_signup\n \n @fb_data = fetch_facebook_params\n\n @user = Spree::User.where(email: @fb_data[:email]).first\n\n if @user.blank?\n @user = Spree::User.new(email: @fb_data[:email], facebook_token: @fb_data[:fb_token])\n \n @user.addresses.build\n @user.addresses.first.firstname = @fb_data[:firstname]\n @user.addresses.first.lastname = @fb_data[:lastname]\n\n\n else\n @user.update_attributes(facebook_token: @fb_data[:fb_token]) if @user.facebook_token != @fb_data[:fb_token] #update the token if @user_founds token is not same as the @fb_token\n sign_in(:spree_user, @user)\n redirect_to main_app.profile_users_path\n end\n\n end", "def create_user\n fake_password = Faker::Internet.password\n params = {\n user: {\n username: Faker::Internet.user_name,\n email: Faker::Internet.email,\n password: fake_password,\n password_confirmation: fake_password\n }\n }\n post signup_post_url, { params: params }\n params[:user]\n end", "def create\n first_name, last_name, email, password = *params.values_at(:first_name, :last_name, :email, :password)\n\n if [first_name, last_name, email, password].any?(&:blank?)\n return render_success({status:\"error\", message: 'invalid create parameters'})\n end\n\n #User already exists\n if User.exists?(email: email.downcase)\n return render_success({status:\"error\", message:\"user already exists\"})\n end\n #create user\n User.transaction do\n @user = User.new(\n name: (first_name + \" \" + last_name).titleize,\n email: email.downcase,\n password: password,\n password_confirmation: password\n )\n if @user.save!\n render_success({status:\"success\", message:\"created\"})\n else\n render_success({status:\"error\", message:\"user creation failed\"})\n end\n end\n end", "def get_or_create_user(username)\n u = User.find_by_login(username.gsub(/\\s+/,''))\n if(!u)\n @agent.get(forum_url + '.showUserPublicProfile?gid='+username.gsub(/\\s+/,''))\n puts 'creating ' + username\n u = User.new\n u.login = username.downcase.gsub(/\\s+/,'')\n u.password = username.reverse\n if @agent.page.at('div[@id=membersince]')\n u.created_at = @agent.page.at('div[@id=membersince]').html.match(/[A-z]+ [0-9]{1,2}, [0-9]{4}/).to_s\n end\n u.save!\n end\n return u\nend", "def call(_obj, args, _ctx)\n User.create!(\n name: args[:name],\n email: args[:authProvider][:email][:email],\n password: args[:authProvider][:email][:password]\n )\n rescue ActiveRecord::RecordInvalid => e\n GraphQL::ExecutionError.new(\"Invalid input: #{e.record.errors.full_messages.join(', ')}\")\n end", "def new_user_create\n @user = User.create_user(user_params, current_user.account_id) # New User\n begin\n @user.save!\n @users = User.get_all(current_user.account_id)\n flash[:success] = \"User was created successfully!\"\n rescue => e\n flash[:alert] = \"User creation failed!\"\n end \n end", "def create\n\t params[:user][:login] = params[:user][:email_work] if params[:user][:login].blank?\n user = params[:user]\n @user = User.create(user)\n @user.valid? ? after_save(user) : error_responds(@user)\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n @user.guid = params[:user][:guid]\n @user.accountgroup_id = params[:user][:accountgroup_id]\n @user.viewer_userID = params[:user][:username]\n @user.language_id = params[:user][:language_id]\n @user.viewer_isActive = params[:user][:is_active]\n @user.viewer_lastLogin = params[:user][:last_login]\n @user.remember_token = params[:user][:remember_token]\n @user.remember_token_expires_at = params[:user][:remember_token_expires_at]\n @user.email_validated = params[:user][:email_validated]\n @user.developer = params[:user][:developer]\n @user.facebook_hash = params[:user][:facebook_hash]\n @user.facebook_username = params[:user][:facebook_username]\n\n if @user.save\n flash[:notice] = 'User was successfully created.'\n format.html { redirect_to(accountadmin_user_path(@user)) }\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_user(email, name, pw)\n user = User.find_or_create_by(username: name) do |u|\n u.email = email\n u.username = name\n u.password = pw\n u.password_confirmation = pw\n end\n user\nend", "def register_user_to_fb(force = false)\n if force || changed.include?('username') || changed.include?('facebook_username')\n email = facebook_username.present? ? facebook_username : username\n users = {:email => email, :account_id => id}\n ::Facebooker::User.register([users]) unless Rails.env.test?\n self.facebook_hash = ::Facebooker::User.hash_email(email)\n end\n end", "def create\n\t\t#get the user info\n\t\t\n\t\tauth = request.env[\"omniauth.auth\"]\n\t\tif auth == nil and \n\t\t\tif session[:temp] == true\n\t\t\t auth = {:info => {:email => \"jkoshakow@wesleyan.edu\"} }\n\t\t\telse\n\t\t\t auth = {:info => {:email => \"koshy44@gmail.com\"} }\t\n\t\t\tend\n\t\tend\n\t\t#whitelist \n\t\tif auth[:info][:email].to_s =~ /.+@wesleyan.edu/\n\t\t\tuser = User.find_by_uid(auth[\"uid\"]) || User.createUser(auth)\n\t\t\tsession[:user_id] = user.id \n\t\t\tsession[:admin] = user.admin\n\t\t\tsession[:authenticated] = true\n\t\t\tredirect_to links_path\n\t\telse\n\t\t\tsession[:authenticated] = false\n\t\t\tsession[:error] = \"Must have a wesleyan email address\"\n\t\t\tredirect_to root_path\n\t\tend\t\n\tend", "def createNewUser(linkedInInfo)\n user = User.new do |u|\n u.firstName = getValueFromLinkedInInfo(linkedInInfo, 'firstName')\n u.lastName = getValueFromLinkedInInfo(linkedInInfo, 'lastName')\n u.location = getValueFromLinkedInInfo(linkedInInfo, 'location')\n u.industry = getValueFromLinkedInInfo(linkedInInfo, 'industry')\n u.numConnections = getValueFromLinkedInInfo(linkedInInfo, 'numConnections')\n u.position = getValueFromLinkedInInfo(linkedInInfo, 'title')\n u.company = getValueFromLinkedInInfo(linkedInInfo, 'company')\n u.reportedCount = 0\n u.linkedInId = getValueFromLinkedInInfo(linkedInInfo, 'id')\n u.emailAddress = getValueFromLinkedInInfo(linkedInInfo, 'emailAddress')\n end\n user.save\n return user\n end", "def create_user params, send_info_email = false\n if params[:email] && !params[:email].empty?\n email = params[:email].downcase\n else\n email = params[:person_identifier] + '@example.com' if params[:person_identifier]\n end\n\n if email && email =~ /\\A[^@]+@[^@]+\\z/\n u = User.find_by_email(email)\n email_correct = true\n end\n return u if u\n\n # no existing user, create new\n u = User.new\n u.email = email\n\n unless email_correct \n while User.find_by_email(u.email)\n if params[:first_name] && !params[:first_name].empty? && params[:last_name] && !params[:last_name].empty?\n identifier = params[:first_name] + '.' + params[:last_name] + SecureRandom.hex(5)\n else\n identifier = SecureRandom.hex(15)\n end\n u.email = identifier + '@example.com'\n end\n end\n\n if params[:password] && !params[:password].empty?\n pw = params[:password]\n else\n pw = SecureRandom.base64(5)\n end\n u.password = pw\n u.password_confirmation = pw\n\n u.first_name = params[:first_name]\n u.last_name = params[:last_name]\n if params[:display_name]\n u.display_name = params\n elsif u.first_name && u.last_name\n u.display_name = u.first_name + ' ' + u.last_name\n end\n\n u.skip_confirmation! if User.respond_to? 'skip_confirmation!' # skip the confirmation email, that would be automatically sent by devise\n AuditoriumMailer.automatically_generated_user(u.email, password).deliver if send_info_email unless u.email.include? '@example.com'\n\n u.save\n u\n end", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(username: params[:username], email: params[:email], password: params[:password])\n\n if @user.save\n render json: {status: 'SUCCESS', message: 'Account successfully created', accessToken: @user.access_token}.to_json\n else\n render json: {errors: [\"Sign up failed!\"], status: 422}.to_json\n end\n\n end", "def create\n\t\tuserParams = params.require(:user).permit([:email, :password])\n\n\t\tuser = User.find_by_email(userParams[:email])\n\n\t\tif(user.nil?)\n\t\t\tuserParams[:password] = Digest::MD5.hexdigest(userParams[:password])\n\t\t\tuser = User.new userParams\n\t\t\tuser.save\n\t\t\trender json: { success: true}, :status => 200, callback: params[:callback]\n\t\telse\n\t\t\trender json: { success: false, reason: \"User already exists\", errno: -1 }, callback: params[:callback]\n\t\tend\n\tend", "def create\n if auth_hash\n @user = User.from_omniauth(auth_hash, current_user.first.username) \n else\n @user = User.new(user_params)\n session[:current_user] = params[:user][:username]\n end\n respond_to do |format|\n if @user.save\n format.html { redirect_to action: \"show\", id: @user.username }\n format.json { render :index, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n email = params[:email]\n password = params[:password]\n fb_token = params[:fbtoken]\n if request.format != :json\n render :status => 406, :json => {:message => 'The request must be json'}\n return\n end\n\n if (email.nil? or password.nil?) && fb_token.nil?\n render :status => 400,\n :json => {:message => 'The request must contain the user email and password or FB token.'}\n return\n end\n\n if fb_token\n #check token\n begin\n facebook_graph = ::Koala::Facebook::API.new('595428443887130|BMCDixQJlECImLZsnnxGBO2jtoI')\n @token_info = facebook_graph.debug_token(fb_token)\n logger.info @token_info.inspect\n @user = User.find_by(fb_id: @token_info['data']['user_id'])\n rescue => e\n logger.error e.message\n @user = nil\n end\n else\n @user = User.find_by(email: email.downcase)\n end\n\n if @user.nil?\n logger.info(\"User #{email || fb_token} failed signin, user cannot be found.\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n return\n end\n\n # http://rdoc.info/github/plataformatec/devise/master/Devise/Models/TokenAuthenticatable\n #@user.generate_authentication_token\n\n valid = (!fb_token && @user.valid_password?(password)) || (fb_token && @token_info['data']['app_id'] == '595428443887130')\n\n if valid\n @user.ensure_authentication_token\n logger.info 'Token: ' + @user.authentication_token.to_s\n @user.save_device_token(params[:device_token])\n render :status => 200, :json => {:token => @user.authentication_token, :email => @user.email, :premium => !@user.role?(:free)}\n else\n logger.info(\"User #{email} failed signin, password \\\"#{password}\\\" is invalid\")\n render :status => 401, :json => {:message => 'Invalid email or password or FB token.'}\n end\n end", "def create_user(application_name, application_id)\n res = nil\n user_id = VaultDriver.generate_uid\n uri = URI(@url + \"auth/#{application_name}/map/user-id/#{user_id}\")\n req = Net::HTTP::Post.new(uri)\n req['X-Vault-Token'] = @token\n application_data = { 'value' => application_id }\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n req.body = application_data.to_json\n http.request(req)\n end\n [user_id, res.code.to_i]\n end", "def register(accessToken, userID)\n #logger.info \"Starting registration for #{userID}\"\n # User wasn't found, register him\n @user = User.new\n graph = Koala::Facebook::API.new(accessToken)\n user_data = graph.get_object(userID)\n friends = graph.get_connections(userID, \"friends\")\n @user.fb_token = accessToken\n @user.id = userID\n @user.fb_id = userID\n @user.name = user_data[\"name\"]\n @user.email = user_data[\"email\"]\n @user.first_name = user_data[\"first_name\"]\n @user.last_name = user_data[\"last_name\"]\n @user.link = user_data[\"link\"]\n @user.gender = user_data[\"gender\"]\n\n #Friendship.transaction do\n # friends.each { |friend| Friendship.create(:friend_id => friend[\"id\"], :user_id => userID) }\n #end\n \n @user.save\n\n if @user.nil?\n logger.info \"ERROR!\"\n logger.info \"#{userID}\" if @user.nil?\n logger.info user_data.inspect if @user.nil?\n else\n logger.info \"#{userID} successfully registered\"\n end\n\n return @user \n end", "def create_fb_test_user(connected=true,permissions=\"email\")\n ug = Koala::Facebook::TestUsers.new(:app_id => OPTIONS[:facebook_app_id], :secret => OPTIONS[:facebook_secret_key])\n if connected\n user = ug.create(true, permissions)\n else\n user = ug.create(false)\n end\n return user\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_user_and_login \n\t\tinsert_into :users, {\n\t\t\tid: 1 ,\n\t\t\tfirst_name: 'First',\n\t\t\tlast_name: 'Last',\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password',\n\t\t\trole_id: 1,\n\t\t\tuid: \"a\"\n\t\t}\n\n\t\tproxy.post( 'http://my.ownet/api/session',{\n\t\t\tlogin: 'login',\n\t\t\tpassword: 'password'\n\t\t}.to_json)\n\tend", "def create_fb\n if current_facebook_user\n current_facebook_user.fetch\n if logged_in_member\n logged_in_member.update_attribute(:fb_user_id, current_facebook_user.id)\n redirect_to logged_in_member\n else\n @member = Member.find_or_initialize_with_facebook(current_facebook_user)\n conference_delegate = ConferenceDelegate.find_by_signature(params[:signature]) if !params[:signature].blank?\n if @member.new_record?\n @member.conference_delegate = conference_delegate\n @member.auth_service = 'Facebook'\n render :template => \"sessions/register_email\"\n else\n if conference_delegate && conference_delegate.member.nil? && @member.conference_delegate.nil?\n conference_delegate.update_attribute(:member, @member)\n end\n login_member!(@member)\n end\n end\n else\n redirect_to new_session_path\n end\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\n end", "def create_user(attributes)\n BrickFTP::API::User.create(attributes)\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 add_user(user_data, name = nil, opts = { :client => GoodData.connection })\n generated_pass = rand(10E10).to_s\n domain_name = name || user_data[:domain]\n user_data = user_data.to_hash\n data = {\n :login => user_data[:login] || user_data[:email],\n :firstName => user_data[:first_name] || 'FirstName',\n :lastName => user_data[:last_name] || 'LastName',\n :password => user_data[:password] || generated_pass,\n :verifyPassword => user_data[:password] || generated_pass,\n :email => user_data[:email] || user_data[:login]\n }\n\n # Optional authentication modes\n tmp = user_data[:authentication_modes]\n if tmp\n if tmp.is_a? Array\n data[:authenticationModes] = tmp\n elsif tmp.is_a? String\n data[:authenticationModes] = [tmp]\n end\n end\n\n # Optional company\n tmp = user_data[:company_name]\n tmp = user_data[:company] if tmp.nil? || tmp.empty?\n data[:companyName] = tmp if tmp && !tmp.empty?\n\n # Optional country\n tmp = user_data[:country]\n data[:country] = tmp if tmp && !tmp.empty?\n\n # Optional phone number\n tmp = user_data[:phone]\n tmp = user_data[:phone_number] if tmp.nil? || tmp.empty?\n data[:phoneNumber] = tmp if tmp && !tmp.empty?\n\n # Optional position\n tmp = user_data[:position]\n data[:position] = tmp if tmp && !tmp.empty?\n\n # Optional sso provider\n tmp = user_data[:sso_provider]\n data['ssoProvider'] = tmp if tmp && !tmp.empty?\n\n # Optional timezone\n tmp = user_data[:timezone]\n data[:timezone] = tmp if tmp && !tmp.empty?\n\n c = client(opts)\n\n # TODO: It will be nice if the API will return us user just newly created\n begin\n url = \"/gdc/account/domains/#{domain_name}/users\"\n response = c.post(url, :accountSetting => data)\n rescue RestClient::BadRequest\n raise GoodData::UserInDifferentDomainError, \"User #{data[:login]} is already in different domain\"\n end\n\n url = response['uri']\n raw = c.get url\n\n # TODO: Remove this hack when POST /gdc/account/domains/{domain-name}/users returns full profile\n raw['accountSetting']['links'] = {} unless raw['accountSetting']['links']\n raw['accountSetting']['links']['self'] = response['uri'] unless raw['accountSetting']['links']['self']\n c.create(GoodData::Profile, raw)\n end", "def create(params)\n if validate_create_user(params)\n db = connect_to_db()\n db.results_as_hash = true\n existing_user = db.execute(\"SELECT id FROM users WHERE username=?\", [params[\"username\"]])\n \n if existing_user.length > 0\n return {error: \"There is already a user with this name!\"}\n end\n \n hashed_password = BCrypt::Password.create(params[\"password\"])\n db.execute(\"INSERT INTO users (username, password) VALUES (?, ?)\", [params[\"username\"], hashed_password])\n user_id = db.execute(\"SELECT id FROM users WHERE username=?\", [params[\"username\"]])\n return {user_id: user_id[0]['id']}\n else\n return {error: \"Your username or password is too long.\"}\n end\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 user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n email: params[:email],\n password: params[:password]\n )\n if user.save\n session[:current_user_id] = user.id\n redirect_to \"/\"\n else\n flash[:error] = user.errors.full_messages.join(\". \")\n redirect_to new_user_path\n end\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_user(username)\n if Commitchamp::User.find_by(login: username) == nil\n user = @github.get_user(username)\n Commitchamp::User.find_or_create_by(login: user['login'])\n end\n Commitchamp::User.find_by(login: username)\n end", "def create_new_account(email, full_name=nil, password=nil)\n return call('User.create', {'email' => email, 'full_name' => full_name,\\\n 'password' => password})\n end", "def create\n user = User.create!(user_params)\n auth_token = AuthenticateUser.new(user.email, user.password).call\n response = { message: Message.account_created, auth_token: auth_token , uid: user.id }\n json_response(response, :created)\n end", "def signup_new(params)\r\n if params[\"password\"] == params[\"password2\"]\r\n db = connect()\r\n name = params[\"username\"]\r\n password = BCrypt::Password.create(params[\"password\"])\r\n result = db.execute(\"SELECT userid FROM users WHERE username =(?)\", params[\"username\"])\r\n if result != []\r\n return {\r\n error: true,\r\n message: \"Username taken\"\r\n }\r\n else\r\n db.execute(\"INSERT INTO users(firstname, lastname, username, phone, email, password) VALUES((?),(?),(?),(?),(?),(?))\", params[\"firstname\"], params[\"lastname\"], name, params[\"phone\"], params[\"email\"], password) \r\n id = db.execute(\"SELECT userid FROM users WHERE username =(?)\", params[\"username\"])\r\n return {\r\n error: false,\r\n data: id[0][0]\r\n }\r\n end\r\n else\r\n return {\r\n error: true,\r\n message: \"Passwords do not match\"\r\n }\r\n end\r\n end" ]
[ "0.78181374", "0.7777557", "0.7627231", "0.7423836", "0.7354835", "0.734686", "0.73203176", "0.72324646", "0.7228638", "0.72273344", "0.72220707", "0.7187338", "0.70985585", "0.7051838", "0.70495343", "0.70490974", "0.7039318", "0.7028881", "0.70116824", "0.7010756", "0.70054847", "0.7000632", "0.69955057", "0.69928586", "0.6979106", "0.69614154", "0.69614154", "0.69611263", "0.6957851", "0.69546396", "0.69083965", "0.690079", "0.689908", "0.6895416", "0.68911135", "0.68788064", "0.6864212", "0.6860035", "0.6858079", "0.68551654", "0.68398654", "0.68386793", "0.68369985", "0.68290365", "0.6828767", "0.68263644", "0.6819655", "0.6811717", "0.68049634", "0.6801374", "0.6800231", "0.6799811", "0.67997396", "0.67981756", "0.67886364", "0.6784536", "0.6754974", "0.6742919", "0.6742106", "0.67215896", "0.67074555", "0.6706482", "0.6697588", "0.6695782", "0.66837597", "0.6676818", "0.6671529", "0.66711634", "0.6666618", "0.6654609", "0.66511595", "0.6651058", "0.66501373", "0.6645531", "0.6644411", "0.663737", "0.6636981", "0.663556", "0.6633914", "0.66317534", "0.6630629", "0.6625103", "0.6619472", "0.661558", "0.6615021", "0.6609864", "0.66027004", "0.6598523", "0.65974975", "0.6596515", "0.6592175", "0.6586981", "0.65839463", "0.6558815", "0.6558421", "0.65506035", "0.6540344", "0.6539955", "0.65320855", "0.6527372" ]
0.771394
2
not sure why but cas sometimes sends the extra attributes as underscored
def att_from_receipt(atts, key) atts[key] || atts[key.underscore] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cas_extra_attributes=(extra_attributes)\n extra_attributes.each do |name, value|\n puts \"DEBUG: cas_extra_attributes CALLED\"\n puts \"extra_attributes:\"+ name.to_s+\" => \"+ value.to_s\n case name.to_sym\n when :fullname\n self.fullname = value\n when :email\n self.email = value\n end\n end\n end", "def aref_prefix\n 'attribute'\n end", "def cas_extra_attributes=(extra_attributes)\n extra_attributes.each do |name, value|\n # I prefer a case over reflection; this is safer if we suddenly get an\n # extra attribute without column\n case name.to_sym\n when :givenname\n self.cas_givenname = value\n when :surname\n self.cas_surname = value\n when :ugentStudentID\n self.cas_ugentStudentID = value\n when :mail\n self.cas_mail = value\n when :uid\n self.cas_uid = value\n end\n end\n self.save!\n end", "def cas_extra_attributes=(attributes)\n self.username = attributes['uid']\n self.email = attributes['email']\n self.given_name = attributes['givenName']\n self.surname = attributes['surname']\n self.lnumber = attributes['lnumber']\n\n update_roles_from_attributes(attributes)\n end", "def x_occi_attribute_key!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 8 )\n\n type = X_OCCI_ATTRIBUTE_KEY\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 135:4: 'X-OCCI-Attribute'\n match( \"X-OCCI-Attribute\" )\n\n \n @state.type = type\n @state.channel = channel\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 8 )\n\n end", "def fetch\n if self.rdf_subject.to_s.include?('rightsstatements') then\n self.rdf_subject.to_s.gsub!('vocab', 'data')\n self.rdf_subject.to_s.gsub!(/\\/$/, '.ttl')\n end\n\n super\n\n if self.rdf_subject.to_s.include?('rightsstatements') then\n self.rdf_subject.to_s.gsub!('data', 'vocab')\n self.rdf_subject.to_s.gsub!('.ttl', '/')\n end\n end", "def essential_attributes\n [\"is_transient\",\"id\"]\n end", "def cas_extra_attributes=(extra_attributes)\n extra_attributes.each do |name, value|\n case name.to_sym\n when :first_name\n self.first_name = value\n when :last_name\n self.last_name = value\n end\n end\n end", "def attribute(name); end", "def serialize(document)\n super.merge(my_special_key: 'my_special_stuff')\n end", "def solr_during_indexing\n {\n \"has_model_ssim\" => [\"Collection\"],\n :id => object.id,\n \"title_tesim\" => [object.title.first.to_s],\n \"title_sim\" => [object.title.first.to_s],\n \"collection_type_gid_ssim\" => [object.collection_type_gid],\n \"ark_ssi\" => object.ark,\n \"ursus_id_ssi\" => Californica::IdGenerator.blacklight_id_from_ark(object.ark),\n \"member_ids_ssim\" => [],\n \"object_ids_ssim\" => [],\n \"member_of_collection_ids_ssim\" => [], \"collection_ids_ssim\" => [],\n \"generic_type_sim\" => [\"Collection\"],\n \"bytes_lts\" => 0,\n \"visibility_ssi\" => \"restricted\"\n }\n end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attribute_name=(_arg0); end", "def attr(name); end", "def _sc_nkey\n\t\t\"#{Search_control_prefix}.agents\"\n\tend", "def attributes=(_arg0); end", "def apply_authorities(env)\n DogBiscuits.config.authorities_add_new.each do |authority_name|\n term = authority_name.to_s.singularize.to_sym\n next unless env.attributes.key? term\n env.attributes[term].each do |attr|\n add_new(authority_name.to_s, attr)\n end\n end\n end", "def id_param_keys\n [*super, :email].uniq\n end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def customize_keys_for_request(attrs)\n # The given resource type determined by self.class. For each attribute key\n # in the ActiveResource object that needs renaming, replace the original\n # hash key with the revised hash key as specified in the resource type\n # -specific constant CUSTOM_ATTRS_FOR_REQUEST.\n if defined?(self.class::CUSTOM_REQUEST_KEYS)\n self.class::CUSTOM_REQUEST_KEYS.each do |orig_key, revised_key| \n attrs[revised_key] = attrs.delete(orig_key) if attrs.include?(orig_key) \n end\n end\n attrs\n end", "def other_claim_related_id\n end", "def authorizable_ransackable_attributes\n if Ransack::SUPPORTS_ATTRIBUTE_ALIAS\n column_names + _ransackers.keys + _ransack_aliases.keys +\n attribute_aliases.keys\n else\n column_names + _ransackers.keys + _ransack_aliases.keys\n end.uniq\n end", "def entities_key\n entities_name.underscore.to_sym\n end", "def transform_attr(key, value); end", "def attribute_values\n super.merge('product_id' => @source.concept_product.product.product_id)\n end", "def _sc_newkey\n\t\t\"#{Search_control_prefix}.newagent\"\n\tend", "def metadata=(_); end", "def entity_key\n resource_name.underscore.to_sym\n end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def attribute_name; end", "def store_cached_name\n self.cached_name = \"\"\n self.cached_name << \"#{reference} - \" if reference.present?\n self.cached_name << \"#{resource.title} - \"\n self.cached_name << \"#{criterion.name}\"\n end", "def candidate_key(*attributes)\n name = String===attributes[0] ? attributes.shift : \"ak_#{@relvar.name}_#{@relvar.candidate_keys.size}\"\n attributes = attributes.collect{|a| @relvar.attribute(a, true)}\n @relvar.add_candidate_key(name, attributes)\n end", "def rdfs_sub_property_of\n end", "def build_complex_attributes(document)\n document.identifier = identifier\n document.description = description\n document.access_rights = geo_concern.solr_document.visibility\n end", "def name_prefix; end", "def encode_globalattr(name)\n \"a$\" + @global_attribute_name_generator.get(name.to_s)\n end", "def attributize_keys\n keys.each do |key|\n self[key.parameterize.underscore.to_sym] = delete(key)\n end\n self\n end", "def meta\n { iss: 'issuer_name', aud: 'user' }\n end", "def build_easy_access(clss)\n clss.active.each do |object_instance|\n if object_instance.respond_to?('short_name=')\n unless object_instance.short_name.empty?\n short_name = object_instance.short_name\n self.class.send(:attr_accessor, short_name)\n instance_variable_set(\"@#{short_name}\", object_instance)\n end\n end\n end\n end", "def flexible_key; end", "def resolve_doc_attributes(doc_src, node_attr)\n # rule 3.5\n doc_attr = DEFAULT_ADOC_DOC_ATTRIBS.dup\n\n # sort attribs into soft and hard (rule 1 and 3)\n soft_attr = {}\n hard_attr = {}\n @config_opts.fetch(:adoc_doc_attribs, {}).each do |k, v|\n ks = k.to_s.strip\n vs = v.to_s.strip\n\n if ks.end_with?(\"@\")\n soft_attr[ks[0..]] = vs\n next\n end\n if vs.end_with?(\"@\")\n soft_attr[ks] = vs[0..]\n next\n end\n hard_attr[ks] = vs\n end\n\n # rule 3.\n doc_attr.merge!(soft_attr)\n\n # rule 2\n Giblish.process_header_lines(doc_src.lines) do |line|\n a = /^:(.+):(.*)$/.match(line)\n next unless a\n @logger.debug { \"got header attr from doc: #{a[1]} : #{a[2]}\" }\n doc_attr[a[1].strip] = a[2].strip\n end\n\n @logger.debug { \"idprefix before: #{doc_attr[\"idprefix\"]}\" }\n\n # rule 1.5\n doc_attr.merge!(node_attr)\n\n # rule 1.\n doc_attr.merge!(hard_attr)\n\n @logger.debug { \"idprefix after: #{doc_attr[\"idprefix\"]}\" }\n\n # @logger&.debug { \"Header attribs: #{doc_attr}\" }\n doc_attr\n end", "def resident_key; end", "def _autonyms\n @autonyms\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def serialize\n super(ATTR_NAME_ARY)\n end", "def ssdb_attr_key(name)\n \"#{self.class.name.tableize}:#{ssdb_attr_id}:#{name}\"\n end", "def assign_meta_search\n\t\t\tassign_attributes meta_search_1: \"#{display_id} #{title} #{description}\"\n\t\t\t\n\t\t\t# tempLocale = I18n.locale\n\t\t\t# I18n.locale = 'vi'\n\n\t\t\t# assign_attributes meta_search_1: \"#{display_id} #{id} #{street.name if street.present?} #{district.name.gsub('Quận', '') if district.present?} #{I18n.t('real_estate_type.name.' + real_estate_type.name) if real_estate_type.present?}\", meta_search_2: \"#{I18n.t('real_estate.attribute.' + (is_alley ? 'alley' : 'facade'))} #{province.name if province.present?}\", meta_search_3: \"#{user_type == 'user' ? \"#{user.full_name} #{user.email} #{user.phone_number}\" : \"#{contact_user.name} #{contact_user.email} #{contact_user.phone_number}\"} #{title.gsub('Quận', '').gsub('quận', '')}\"\n\n\t\t\t# I18n.locale = tempLocale\n\t\tend", "def transitive_tags=(_arg0); end", "def rest_keywords; end", "def tweak_session_attrs\n tweak_session_attrs_saml\n end", "def setup_object_attributes; end", "def inverse_company_id_field\n :subject_company_id\nend", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def attribute; end", "def resident_key=(_arg0); end", "def special_attribute(name)\n @special_attributes[name]\n end", "def add_qualifier_keys( set ); end", "def setup_scribd_attribute(attribute)\n define_method(\"#{attribute}_scribd_id=\") do |id|\n write_attribute \"#{attribute}_scribd_id\", id.to_s.strip\n end\n\n define_method(\"#{attribute}_scribd_access_key=\") do |key|\n write_attribute \"#{attribute}_scribd_access_key\", key.to_s.strip\n end\n end", "def set_keywords\n self.search_fields.keys.each do |namespace| \n self._keywords[namespace] = self.search_fields[namespace].map do |field|\n if field.is_a?(Hash) \n field.keys.map do |key|\n attribute = self.send(key)\n method = field[key] \n attribute = [attribute] if !attribute.is_a?(Array) \n method = [method] if !method.is_a?(Array)\n method.map {|m| attribute.map { |a| Util.keywords a.send(m), stem_keywords[namespace], ignore_list[namespace] } }\n end\n else \n value = self[field]\n value = [value] if !value.is_a?(Array)\n value.map {|v| Util.keywords(v, stem_keywords[namespace], ignore_list[namespace]) if v}\n end\n end.flatten.map(&:to_s).select{|f| not f.empty? }.uniq.sort\n \n end\n end", "def search_attributes\n\t\t['dn', self.attr_firstname, self.attr_lastname, self.attr_mail, self.attr_member]\n\tend", "def keyword_value_hash\n self.data_attributes.inject({}) do |hsh, a| \n if a.class == ImportAttribute\n hsh.merge!(a.import_predicate => a.value)\n else # there are only two\n hsh.merge!(a.predicate.name => a.value)\n end\n end \n end", "def kwattr_values(attribute_name); end", "def set_searchable_fields\n NUMBER_TO_OBJECT_MAP.each do |num, object|\n @searchable_fields[num] = object.column_names - ['id']\n end\n \n @searchable_fields.each do |key, _|\n @searchable_fields[key] += ['_id', 'tags']\n end\n\n @searchable_fields['1'] << 'domain_names'\n end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def association(association_name); 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", "def run\n super\n\n # TODO - check for dictionary terms?\n\n #johndoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}.#{@entity.last_name}\"}\n \n # john.doe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}.#{@entity.last_name}\"}\n\n # john_doe \n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}_#{@entity.last_name}\"}\n \n # jdoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name.split(\"\").first}#{@entity.last_name}\"}\n\n # doe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.last_name}\"}\n \n if @entity.middle_name\n #johneffingdoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name}#{@entity.middle_name}#{@entity.last_name}\"}\n\n #jedoe\n create_entity Tapir::Entities::Username, {:name => \"#{@entity.first_name.split(\"\").first}#{@entity.middle_name.split(\"\").first}#{@entity.last_name}\"}\n end\n\n\nend", "def attrs_authoritative\n @authority = :attributes\n self\n end", "def allowed_attributes=(_arg0); end", "def allowed_attributes=(_arg0); end", "def lookups\n (instance_type::INTERNAL_ATTRIBUTES + @mapping.salesforce_fields).uniq.join(\", \")\n end", "def attribute_keys_to_copy_to_neo4j\n self.class.instance_variable_get :@attribute_keys_to_copy_to_neo4j\n end", "def attr; end", "def meta_data(r)\n { :association_values => get_association_values(r).literalize_keys }\n end", "def resolved_author; end", "def author_hash; end", "def to_mapping\n\n\t\tis_protected_field?\n\n\t\tmapping = nil\n\n\t\t######################### BASIC MAPPING ############################\n\t\tmapping = {\n\t\t\tself.name.to_sym => {\n\t\t\t\t:properties => {\n\t\t \t:content_text => {\n\t\t\t\t\t\t:type => 'text', \n\t\t\t\t\t\t:analyzer => \"standard\",\n\t\t\t\t\t\t:search_analyzer => \"whitespace_analyzer\",\n\t\t\t\t\t\t:copy_to => []\n\t\t\t\t\t},\n\t\t\t\t\t:title_text => {\n\t\t\t\t\t\t:type => 'keyword', \n\t\t\t\t\t\t:fields => {\n\t\t\t\t\t :raw => { \n\t\t\t\t\t \t:type => 'text', \n\t\t\t\t\t\t\t\t:analyzer => \"standard\",\n\t\t\t\t\t\t\t\t:search_analyzer => \"whitespace_analyzer\"\n\t\t\t\t\t }\n\t\t\t\t\t },\n\t\t\t\t\t\t:copy_to => []\n\t\t\t\t\t},\n\t\t\t\t\t:textbook_name => {\n\t\t\t\t\t\t:type => 'keyword', \n\t\t\t\t\t\t:fields => {\n\t\t\t\t\t :raw => { \n\t\t\t\t\t \t:type => 'text', \n\t\t\t\t\t\t\t\t:analyzer => \"standard\",\n\t\t\t\t\t\t\t\t:search_analyzer => \"whitespace_analyzer\"\n\t\t\t\t\t }\n\t\t\t\t\t },\n\t\t\t\t\t\t:copy_to => []\n\t\t\t\t\t}\n\t \t}\n \t}\n\t\t}\n\n\t\t#either you cannot have a field name workup in the components\n\t\t## or whatever. \n\t\t## should raise an error called workup\n\t\t#puts \"mapping becomes first --------------:\"\n\t\t#puts \"commong field mapping ----\"\n\t\t#puts COMMON_FIELD_MAPPING\n\t\t#puts JSON.pretty_generate(mapping) \n\n\t\t######################## MERGE SEARCHABLE AT ROOT DOC ##############\n\t\tmapping[self.name.to_sym][:properties].merge!({\n\t\t\t:searchable => {\n\t\t\t\t:type => \"text\"\n\t\t\t},\n\t\t\t:workup_text => {\n\t\t\t\t:type => \"text\"\n\t\t\t},\n\t\t\t:workup => {\n\t\t\t\t:type => \"keyword\"\n\t\t\t}\n\t\t}) if self.name == \"_doc\"\n\n\t\t#puts \"mapping becomes:\"\n\t\t#puts JSON.pretty_generate(mapping)\n\n\t\t######################## COPY FIELD TO SEARCHABLE IF SEARCHABLE #####\n\t\tunless self.searchable.blank?\n\t\t\t#puts \"this is the mapping\"\n\t\t\t#puts mapping[self.name.to_sym][:properties][:content_text]\n\t\t\tmapping[self.name.to_sym][:properties][:content_text][:copy_to] << \"searchable\"\n\t\tend\n\n\t\t###################### IF CONTAINS_TESTS IS TRUE #####################\n\t\t\t\n\t\tunless self.contains_tests.blank?\n\t\t\t#puts \"name is:#{self.name}, contains tests is: #{self.contains_tests}\"\n\t\t\tif self.contains_tests == true\n\t\t\t\tmapping[self.name.to_sym][:properties][:content_text][:copy_to] << \"workup_text\"\n\t\t\tend\n\t\tend\n\n\t\t####################### SET FIELD TYPE AS NESTED UNLESS ITS ROOT DOC## \n\t\tunless self.name == \"_doc\"\n\t\t\tmapping[self.name.to_sym].merge!(:type => \"nested\") \n\t\tend\n\n\n\t\t###################### CALL PUT MAPPING ON ALL COMPONENTS ############\n\t\tself.components.each do |component|\n\t\t\tmapping[self.name.to_sym][:properties].merge!(component.to_mapping)\n\t\tend\n\n\t\tmapping\n\n\tend", "def attribute_render_naming\n OBJ_ATTRIBUTE_RENDER_NAMING\n end", "def class_attributes; end", "def attributes\n super.map { |k, v| [ k.to_s.camelize(:lower).to_sym, v ] }.to_h\n end", "def assoc_attr\n return @assoc_attr if @assoc_attr\n\n aa = list_class.attribute_names.select { |a| a.end_with?('_id') }\n aa -= %w[id master_id record_id user_id]\n @assoc_attr = aa.first\n end", "def attributes_with_association_names\n attributes = super\n add_attachments_to_attributes(attributes)\n Ticket::Article.insert_urls(attributes)\n end", "def name\n \"#{self[:afi]} #{self[:acl_name]}\"\n end", "def key_attributes\n [\n first_and_middle_names,\n family_name,\n date_of_birth,\n place_of_birth,\n parent_first_and_middle_names,\n parent_family_name,\n other_parent_first_and_middle_names,\n other_parent_family_name\n ]\n end", "def special_attrib\n # we're going to ENFORCE that this model uses the has_role type\n a = Attrib.find_by_id self.attrib_id\n if a.nil? or !a.name.eql? HASNODE_NAME\n has_node = Attrib.add :name=>HASNODE_NAME, :description=>I18n.t('model.attribs.role.has_node'), :order=>999999\n self.attrib_id = has_node.id\n end\n end", "def site_meta\n end" ]
[ "0.5777301", "0.5684195", "0.55034155", "0.5490005", "0.5461186", "0.53680336", "0.534602", "0.52959126", "0.529258", "0.52419686", "0.5228576", "0.52164567", "0.52164567", "0.52164567", "0.52106774", "0.51925284", "0.51921195", "0.5185141", "0.517589", "0.51559234", "0.5154331", "0.51253605", "0.51036733", "0.51034385", "0.50995964", "0.507487", "0.50744694", "0.50736886", "0.50711685", "0.5064925", "0.5064925", "0.5064925", "0.5064925", "0.5064925", "0.5064925", "0.5064925", "0.506013", "0.5039584", "0.50358576", "0.5024824", "0.5023", "0.5022357", "0.5017881", "0.5016563", "0.50136524", "0.50094044", "0.5004522", "0.49859345", "0.49759895", "0.49747223", "0.49747223", "0.49747223", "0.49747223", "0.49747223", "0.4969036", "0.4966094", "0.4964017", "0.4959034", "0.49538496", "0.49516428", "0.49490365", "0.49405807", "0.49405807", "0.49405807", "0.49405807", "0.49405807", "0.49405807", "0.49405807", "0.49401468", "0.4937613", "0.49340162", "0.4928565", "0.49273202", "0.49271876", "0.49257478", "0.49215823", "0.49208614", "0.49187598", "0.49187598", "0.4918292", "0.49152583", "0.49102694", "0.4906357", "0.49025086", "0.49025086", "0.48984218", "0.48965275", "0.48917866", "0.48900256", "0.48893297", "0.48868516", "0.4880988", "0.4878747", "0.48683175", "0.48679057", "0.48613566", "0.48596278", "0.485063", "0.4849078", "0.4841409", "0.48390162" ]
0.0
-1
Build a multipart/formdata body as per RFC 2388.
def build_stream # Form input field name for the file path must be set to file. # Any other field name will not be picked up by the upload server. name = 'file' content_length = File.size(@data_path) content_type = mime_type_for(@data_path) @stream = Tempfile.new("BitsOnTheRun.Upload.") @stream.binmode write_stream_head(name, content_type, content_length) write_stream_body write_stream_tail @stream.seek(0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_multipart_content(params)\n\tparts, boundary = [], \"#{rand(1000000)}-we-are-all-doomed-#{rand(1000000)}\"\n\t\n\tparams.each do |name, value|\n\t\tdata = []\n\t\tif value.is_a?(Pathname) then\n\t\t\tdata << \"Content-Disposition: form-data; name=\\\"#{urlencode(name.to_s)}\\\"; filename=\\\"#{value.basename}\\\"\"\n\t\t\tdata << \"Content-Type: #{value.type}\"\n\t\t\tdata << \"Content-Length: #{value.size}\"\n\t\t\tdata << \"Content-Transfer-Encoding: binary\"\n\t\t\tdata << \"\"\n\t\t\tdata << IO.read(value.cleanpath)\n\t\t\telse\n\t\t\tdata << \"Content-Disposition: form-data; name=\\\"#{urlencode(name.to_s)}\\\"\"\n\t\t\tdata << \"\"\n\t\t\tdata << value\n\t\tend\n\t\t\n\t\tparts << data.join(\"\\r\\n\") + \"\\r\\n\"\n\tend\n\t\n\t[ \"--#{boundary}\\r\\n\" + parts.join(\"--#{boundary}\\r\\n\") + \"--#{boundary}--\", {\n\t\t\"Content-Type\" => \"multipart/form-data; boundary=#{boundary}\"\n\t}]\nend", "def make_multipart(params)\n boundary = (0...8).map { rand(255).to_s 16 }.join '_'\n data = expand_params(params).map do |key, value|\n [ \"--#{boundary}\",\n \"Content-Disposition: form-data; name=\\\"#{key}\\\"\",\n nil,\n value]\n end\n\n data << \"--#{boundary}--\"\n return [boundary, data.join(\"\\r\\n\")]\n end", "def build_request_body(header_params, body, files)\n partCount = 0\n if files\n partCount += files.length\n end\n if body\n partCount += 1\n end\n if partCount > 1\n boundary = \"7d70fb31-0eb9-4846-9ea8-933dfb69d8f1\"\n header_params['Content-Type'] = \"multipart/form-data; boundary=#{boundary}\"\n data = \"\"\n if body\n put_multipart!(data, boundary, 0, body)\n end \n files.each_with_index do |val, index|\n put_multipart!(data, boundary, index + 1, val)\n end\n data << \"\\r\\n--#{boundary}--\\r\\n\"\n elsif partCount == 1\n if body\n header_params['Content-Type'] = \"text/json\"\n data = body.is_a?(String) ? body : body.to_json\n else\n header_params['Content-Type'] = \"application/octet-stream\"\n data = files[0]\n end\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let typhoeus handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n data\n end", "def http_multipart_data(params)\n body = \"\"\n headers = {}\n \n boundary = Time.now.to_i.to_s(16)\n \n headers[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n params.each do |key,value|\n esc_key = OAuth::Helper.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n \n if value.respond_to?(:read)\n mime_type = MIME::Types.type_for(value.path)[0] || MIME::Types[\"application/octet-stream\"][0]\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{mime_type.simplified}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n end\n \n body << \"--#{boundary}--#{CRLF*2}\"\n headers[\"Content-Length\"] = body.size.to_s\n \n return [ body, headers ]\n end", "def compose_multipart_params(new_param_hash)\n # here we check if the encoded segments contain the boundary and should generate a new one\n # if something is matched\n boundary = \"----------#{generate_boundary}\"\n self['REQUEST_METHOD'] = 'POST'\n self['CONTENT_TYPE'] = \"multipart/form-data; boundary=#{boundary}\"\n @body = StringIO.new(multipart_build(new_param_hash, boundary))\n end", "def prepare_multipart_data(payload)\n boundary = \"infosimples\" + rand(1_000_000).to_s # a random unique string\n\n content = []\n payload.each do |param, value|\n content << '--' + boundary\n content << \"Content-Disposition: form-data; name=\\\"#{param}\\\"\"\n content << ''\n content << value\n end\n content << '--' + boundary + '--'\n content << ''\n\n [boundary, content.join(\"\\r\\n\")]\n end", "def build_request_body(header_params, form_params, body)\n # http form\n if header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||\n header_params['Content-Type'] == 'multipart/form-data'\n data = {}\n form_params.each do |key, value|\n case value\n when ::File, ::Array, nil\n # let httparty handle File, Array and nil parameters\n data[key] = value\n else\n data[key] = value.to_s\n end\n end\n elsif body\n data = body.is_a?(String) ? body : body.to_json\n else\n data = nil\n end\n if header_params['Content-Encoding'] == 'gzip'\n gzip = Zlib::Deflate.new(nil, Zlib::MAX_WBITS + 16)\n data = gzip.deflate(data, Zlib::FINISH)\n gzip.close\n elsif header_params['Content-Encoding'] == 'deflate'\n data = Zlib::deflate(data)\n elsif header_params['Content-Encoding'] == 'zstd1'\n data = Zstandard.deflate(data)\n end\n data\n end", "def multipart_request_body( body )\n request_body = []\n body.files.each do |k, v|\n request_body.push :content => v.content,\n 'Content-Type' => v.content_type,\n 'Content-Disposition' => \"form-data; name=\\\"#{k}\\\"; filename=\\\"#{v.file_name}\\\"\",\n 'Content-Transfer-Encoding' => 'binary'\n end\n\n body.values.each do |k, v|\n request_body << { :content => v,\n 'Content-Disposition' => \"form-data; name=\\\"#{k}\\\"\" }\n end\n request_body\n end", "def add_multipart_data(req,params)\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{CRLF}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{CRLF}\"\n body << \"Content-Type: #{mime_type(value.path)}#{CRLF*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\n end\n body << CRLF\n end\n body << \"--#{boundary}--#{CRLF*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end", "def add_multipart_body(parts)\n body = []\n body << \"--#{BOUNDARY}\\r\\n\"\n parts.each do |property, value|\n body << \"Content-Disposition: form-data; name=\\\"#{property}\\\"\\r\\n\\r\\n#{value}\"\n body << \"\\r\\n--#{BOUNDARY}\\r\\n\"\n end\n @body = body.join\n @headers[\"Content-Type\"] = \"multipart/form-data; boundary=#{BOUNDARY}\"\n end", "def to_multipart\n return %(Content-Disposition: form-data; name=\"#{key}\"; filename=\"#{filename}\"\\r\\n) + \"Content-Type: #{MIME::Types.type_for(@filename)}\\r\\n\\r\\n\" + content + \"\\r\\n\"\n end", "def add_multipart_data(req, params)\n crlf = \"\\r\\n\"\n boundary = Time.now.to_i.to_s(16)\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\n body = \"\"\n params.each do |key,value|\n esc_key = CGI.escape(key.to_s)\n body << \"--#{boundary}#{crlf}\"\n if value.respond_to?(:read)\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"#{File.basename(value.path)}\\\"#{crlf}\"\n body << \"Content-Type: image/jpeg#{crlf*2}\"\n body << value.read\n else\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{crlf*2}#{value}\"\n end\n body << crlf\n end\n body << \"--#{boundary}--#{crlf*2}\"\n req.body = body\n req[\"Content-Length\"] = req.body.size\n end", "def generate_body(boundary, arr)\n parts = {}\n arr.each_with_index do |part, idx|\n fileno = \"file#{idx}\"\n parts[fileno] = UploadIO.new(StringIO.new(part), fileno, 'application/binary')\n end\n\n req = Net::HTTP::Post::Multipart.new '/', parts, {}, boundary\n req.body_stream.read\nend", "def body= data\n if data.respond_to?(:read) || Kronk::Multipart === data\n ctype = \"application/binary\"\n\n if data.respond_to?(:path)\n types = MIME::Types.of File.extname(data.path.to_s)[1..-1].to_s\n ctype = types[0].to_s unless types.empty?\n\n elsif Kronk::Multipart === data\n ctype = \"multipart/form-data, boundary=#{data.boundary}\"\n end\n\n @headers['Content-Type'] = ctype\n\n @body = data\n\n elsif Hash === data\n self.form_data = data\n\n else\n @body = data.to_s\n end\n\n @body\n end", "def multipart_build(params, boundary)\n flat = []\n flatten_hash(params) do | keys, value |\n if keys[-1].nil? # warn the user that Camping will never see that\n raise Mosquito::SageAdvice, \n \"Camping will only show you the last element of the array when using multipart forms\"\n end\n \n flat_key = [esc(keys.shift), keys.map{|k| \"[%s]\" % esc(k) }].flatten.join\n if value.respond_to?(:original_filename)\n flat << uploaded_file_segment(flat_key, value, boundary)\n else\n flat << conventional_segment(flat_key, value, boundary)\n end\n end\n flat.sort.join(\"\")+\"--#{boundary}--\\r\"\n end", "def to_multipart\n return %(Content-Disposition: form-data; name=\"#{key}\"\\r\\n\\r\\n#{value}\\r\\n)\n end", "def add_multipart_data(req,params, mime)\r\n boundary = Time.now.to_i.to_s(16)\r\n req[\"Content-Type\"] = \"multipart/form-data; boundary=#{boundary}\"\r\n body = \"\"\r\n params.each do |key,value|\r\n esc_key = CGI.escape(key.to_s)\r\n body << \"--#{boundary}#{CRLF}\"\r\n if value.respond_to?(:read)\r\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"; filename=\\\"teamicon-#{rand(100000)}\\\"#{CRLF}\"\r\n body << \"Content-Type: #{mime}#{CRLF*2}\"\r\n body << value.read\r\n else\r\n body << \"Content-Disposition: form-data; name=\\\"#{esc_key}\\\"#{CRLF*2}#{value}\"\r\n end\r\n body << CRLF\r\n end\r\n body << \"--#{boundary}--#{CRLF*2}\"\r\n req.body = body\r\n req[\"Content-Length\"] = req.body.size\r\nend", "def multipart_post(path, options={})\n make_http_request(path, options) do |path|\n request = Net::HTTP::Post.new(path)\n bodies = [yield(path)]\n delimiter = create_mime_delimiter\n request['Content-Type'] = \"multipart/form-data; boundary=\\\"#{delimiter}\\\"\"\n separator = \"\\r\\n--#{delimiter}\\r\\n\"\n request.body = \"\\r\\n#{separator}#{bodies.join(separator)}\\r\\n--#{delimiter}--\\r\\n\"\n request['Content-Length'] = request.body.length.to_s # will need to change to bytesize for 1.9\n request\n end\n end", "def file_body(path, boundary)\n [\n \"\\r\\n--#{boundary}\\r\\n\",\n \"content-disposition: form-data; name=\\\"file\\\"\",\n \"; filename=\\\"#{File.basename(path)}\\\"\\r\\n\",\n \"Content-Type: #{extract_mime_type(path)}\\r\\n\",\n \"Content-Transfer-Encoding: binary\\r\\n\",\n \"\\r\\n\",\n File.open(path, 'rb') { |io| io.read },\n \"\\r\\n--#{boundary}--\\r\\n\"\n ].join('')\n end", "def multipart(files = [])\n boundary = \"N0tS0R4nd0m\"\n boundary_line = \"--#{ boundary }\\r\\n\"\n @headers['Content-Type'] = \"multipart/form-data; boundary=#{ boundary }\"\n body = files.map do |file|\n part_header = \"Content-Disposition: form-data; name=\\\"#{ file[:name] }\\\"; filename=\\\"#{ file[:filename] }\\\"\\r\\n\"\n part_header += \"Content-Type: #{ file[:content_type] }\\r\\n\\r\\n\"\n part = file[:content] + \"\\r\\n\"\n part_header + part\n end\n body = boundary_line + body.join(boundary_line) + boundary_line.rstrip + \"--\\r\\n\"\n @headers['Content-Length'] = body.size\n start do |connection|\n request = http :Post\n request.body = body\n connection.request request\n end\n end", "def to_multipart\n query = @multipart_params.collect { |param| \"--\" + BOUNDARY + \"\\r\\n\" + param.to_multipart }.join(\"\") + \"--\" + BOUNDARY + \"--\"\n return query, CONTENT_TYPE\n end", "def put_multipart!(data, boundary, part_index, part_data)\n data << \"\\r\\n--#{boundary}\\r\\n\"\n if part_index > 0\n data << \"Content-Disposition: form-data; name=\\\"file#{part_index}\\\";filename=\\\"file#{part_index}\\\"\\r\\n\"\n data << \"Content-Type: application/octet-stream\\r\\n\"\n elsif\n data << \"Content-Disposition: form-data; name=\\\"data\\\"\\r\\n\"\n data << \"Content-Type: text/json\\r\\n\"\n end\n data << \"Content-Length: #{part_data.length}\\r\\n\"\n data << \"\\r\\n\"\n data << part_data\n end", "def make_request_body(opts, headers)\n case\n when opts.body\n opts.body\n when opts.form\n form = make_form_data(opts.form)\n headers[Headers::CONTENT_TYPE] ||= form.content_type\n form\n when opts.json\n body = MimeType[:json].encode opts.json\n headers[Headers::CONTENT_TYPE] ||= \"application/json; charset=#{body.encoding.name.downcase}\"\n body\n end\n end", "def file_to_multipart(key,filename,mime_type,content)\n return \"Content-Disposition: form-data; name=\\\"#{CGI::escape(key)}\\\"; filename=\\\"#{File.basename(filename)}\\\"\\r\\n\" +\n \"Content-Transfer-Encoding: binary\\r\\n\" +\n \"Content-Type: #{mime_type}\\r\\n\" +\n \"\\r\\n\" +\n \"#{content}\\r\\n\"\nend", "def build\n @params.map { |p| '--' + @boundary + \"\\n\" + p }.join('') + \"--\" + @boundary + \"--\\n\"\n end", "def multipart_body(body, parts, boundary, mtype, filesize)\n lambda do |socket|\n begin\n begin\n first = parts.shift\n last = parts.shift\n socket.write(\n \"--#{boundary}#{CRLF}\" \\\n \"Content-Type: #{mtype}#{CRLF}\" \\\n \"Content-Range: bytes #{first}-#{last}/#{filesize}#{CRLF}\" \\\n \"#{CRLF}\"\n )\n\n begin\n IO.copy_stream(body, socket, last - first + 1, first)\n rescue NotImplementedError\n body.seek(first, IO::SEEK_SET)\n IO.copy_stream(body, socket, last - first + 1)\n end\n socket.write(CRLF)\n end while parts[0]\n socket.write(\"--#{boundary}--#{CRLF}\")\n ensure\n body.close\n end\n end\n end", "def multipart_requestify(parameters, boundary, prefix=nil)\n if Hash === parameters\n return nil if parameters.empty?\n parameters.map { |k,v| \n multipart_requestify(v, boundary, name_with_prefix(prefix, k)) \n }\n elsif Array === parameters\n parameters.map { |v| \n multipart_requestify(v, boundary, name_with_prefix(prefix, \"\")) \n }\n elsif ActionController::TestUploadedFile === parameters\n file_to_multipart(prefix, parameters.original_filename, \n parameters.content_type, parameters.read)\n elsif parameters.nil? # use nil to mimic an empty file upload field\n file_to_multipart(prefix, '', 'application/octet-stream', '')\n elsif prefix.nil?\n parameters\n else\n text_to_multipart(prefix, parameters.to_s)\n end\n end", "def form_data= data\n @headers['Content-Type'] = \"application/x-www-form-urlencoded\"\n @body = self.class.build_query data\n end", "def httppostfile(url, corpNum, form, files, userID, isBinary = false)\n headers = {\n \"x-pb-version\" => BaseService::POPBILL_APIVersion,\n \"Content-Type\" => \"multipart/form-data;boundary=\" + BaseService::BOUNDARY,\n \"Accept-Encoding\" => \"gzip,deflate\",\n \"Connection\" => \"Keep-Alive\"\n }\n\n if corpNum.to_s != ''\n headers[\"Authorization\"] = \"Bearer \" + getSession_Token(corpNum)\n end\n\n if userID.to_s != ''\n headers[\"x-pb-userid\"] = userID\n end\n\n post_body = []\n\n if form.to_s != ''\n post_body << \"--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"form\\\"\\r\\n\"\n post_body << \"Content-Type: Application/json;\\r\\n\\r\\n\"\n post_body << form.to_json + \"\\r\\n\"\n end\n if isBinary\n files.each do |fileData|\n fileName = fileData[\"fileName\"]\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << fileData[\"fileData\"].force_encoding(\"UTF-8\")\n end\n else\n files.each do |filePath|\n begin\n fileName = File.basename(filePath)\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}\\r\\n\"\n post_body << \"Content-Disposition: form-data; name=\\\"file\\\"; filename=\\\"#{fileName}\\\"\\r\\n\"\n post_body << \"Content-Type: Application/octet-stream\\r\\n\\r\\n\"\n post_body << File.read(filePath)\n rescue\n raise PopbillException.new(-99999999, \"Failed to reading filedata from filepath\")\n end\n end\n end\n\n post_body << \"\\r\\n--#{BaseService::BOUNDARY}--\\r\\n\"\n # Add the file Data\n\n uri = URI(getServiceURL() + url)\n\n https = Net::HTTP.new(uri.host, 443)\n https.use_ssl = true\n Net::HTTP::Post.new(uri)\n\n res = https.post(uri.request_uri, post_body.join.encode(\"UTF-8\"), headers)\n\n if res.code == \"200\"\n if res.header['Content-Encoding'].eql?('gzip')\n JSON.parse(gzip_parse(res.body))\n else\n JSON.parse(res.body)\n end\n else\n raise PopbillException.new(JSON.parse(res.body)[\"code\"],\n JSON.parse(res.body)[\"message\"])\n end\n\n end", "def multipart_fake_request(env = {}, params = {})\n if params.empty?\n fake_request(env)\n else\n m = Post.new(params)\n body, head = m.to_multipart\n fake_request(env.merge( :content_type => head, \n :content_length => body.length), :post_body => body)\n end\n end", "def encoded_body\n Ethon::Easy::Form.new(nil, options[:body]).to_s\n end", "def read_multipart(boundary, content_length)\n ## read first boundary\n stdin = stdinput\n first_line = \"--#{boundary}#{EOL}\"\n content_length -= first_line.bytesize\n status = stdin.read(first_line.bytesize)\n raise EOFError.new(\"no content body\") unless status\n raise EOFError.new(\"bad content body\") unless first_line == status\n ## parse and set params\n params = {}\n @files = {}\n boundary_rexp = /--#{Regexp.quote(boundary)}(#{EOL}|--)/\n boundary_size = \"#{EOL}--#{boundary}#{EOL}\".bytesize\n buf = ''.dup\n bufsize = 10 * 1024\n max_count = MAX_MULTIPART_COUNT\n n = 0\n tempfiles = []\n while true\n (n += 1) < max_count or raise StandardError.new(\"too many parameters.\")\n ## create body (StringIO or Tempfile)\n body = create_body(bufsize < content_length)\n tempfiles << body if defined?(Tempfile) && body.kind_of?(Tempfile)\n class << body\n if method_defined?(:path)\n alias local_path path\n else\n def local_path\n nil\n end\n end\n attr_reader :original_filename, :content_type\n end\n ## find head and boundary\n head = nil\n separator = EOL * 2\n until head && matched = boundary_rexp.match(buf)\n if !head && pos = buf.index(separator)\n len = pos + EOL.bytesize\n head = buf[0, len]\n buf = buf[(pos+separator.bytesize)..-1]\n else\n if head && buf.size > boundary_size\n len = buf.size - boundary_size\n body.print(buf[0, len])\n buf[0, len] = ''\n end\n c = stdin.read(bufsize < content_length ? bufsize : content_length)\n raise EOFError.new(\"bad content body\") if c.nil? || c.empty?\n buf << c\n content_length -= c.bytesize\n end\n end\n ## read to end of boundary\n m = matched\n len = m.begin(0)\n s = buf[0, len]\n if s =~ /(\\r?\\n)\\z/\n s = buf[0, len - $1.bytesize]\n end\n body.print(s)\n buf = buf[m.end(0)..-1]\n boundary_end = m[1]\n content_length = -1 if boundary_end == '--'\n ## reset file cursor position\n body.rewind\n ## original filename\n /Content-Disposition:.* filename=(?:\"(.*?)\"|([^;\\r\\n]*))/i.match(head)\n filename = $1 || $2 || ''.dup\n filename = CGI.unescape(filename) if unescape_filename?()\n body.instance_variable_set(:@original_filename, filename)\n ## content type\n /Content-Type: (.*)/i.match(head)\n (content_type = $1 || ''.dup).chomp!\n body.instance_variable_set(:@content_type, content_type)\n ## query parameter name\n /Content-Disposition:.* name=(?:\"(.*?)\"|([^;\\r\\n]*))/i.match(head)\n name = $1 || $2 || ''\n if body.original_filename.empty?\n value=body.read.dup.force_encoding(@accept_charset)\n body.close! if defined?(Tempfile) && body.kind_of?(Tempfile)\n (params[name] ||= []) << value\n unless value.valid_encoding?\n if @accept_charset_error_block\n @accept_charset_error_block.call(name,value)\n else\n raise InvalidEncoding,\"Accept-Charset encoding error\"\n end\n end\n class << params[name].last;self;end.class_eval do\n define_method(:read){self}\n define_method(:original_filename){\"\"}\n define_method(:content_type){\"\"}\n end\n else\n (params[name] ||= []) << body\n @files[name]=body\n end\n ## break loop\n break if content_length == -1\n end\n raise EOFError, \"bad boundary end of body part\" unless boundary_end =~ /--/\n params.default = []\n params\n rescue Exception\n if tempfiles\n tempfiles.each {|t|\n if t.path\n t.close!\n end\n }\n end\n raise\n end", "def read_multipart(boundary, content_length)\n ## read first boundary\n stdin = stdinput\n first_line = \"--#{boundary}#{EOL}\"\n content_length -= first_line.bytesize\n status = stdin.read(first_line.bytesize)\n raise EOFError.new(\"no content body\") unless status\n raise EOFError.new(\"bad content body\") unless first_line == status\n\n ## parse and set params\n params = {}\n @files = {}\n boundary_rexp = /--#{Regexp.quote(boundary)}(#{EOL}|--)/\n boundary_size = \"#{EOL}--#{boundary}#{EOL}\".bytesize\n boundary_end = nil\n buf = ''\n bufsize = 10 * 1024\n max_count = MAX_MULTIPART_COUNT\n n = 0\n tempfiles = []\n\n while true\n #(n += 1) < max_count or raise StandardError.new(\"too many parameters.\")\n\n ## create body (StringIO or Tempfile)\n body = create_body()\n #tempfiles << body if defined?(Tempfile) && body.kind_of?(Tempfile)\n tempfiles << body\n class << body\n if method_defined?(:path)\n alias local_path path\n else\n def local_path\n nil\n end\n end\n attr_reader :original_filename, :content_type\n end\n ## find head and boundary\n head = nil\n separator = EOL * 2\n until head && matched = boundary_rexp.match(buf)\n if !head && pos = buf.index(separator)\n len = pos + EOL.bytesize\n head = buf[0, len]\n buf = buf[(pos+separator.bytesize)..-1]\n else\n if head && buf.size > boundary_size\n len = buf.size - boundary_size\n body.print(buf[0, len])\n buf[0, len] = ''\n end\n c = stdin.read(bufsize < content_length ? bufsize : content_length)\n raise EOFError.new(\"bad content body\") if c.nil? || c.empty?\n buf << c\n content_length -= c.bytesize\n end\n end\n ## read to end of boundary\n m = matched\n len = m.begin(0)\n s = buf[0, len]\n if s =~ /(\\r?\\n)\\z/\n s = buf[0, len - $1.bytesize]\n end\n body.print(s)\n buf = buf[m.end(0)..-1]\n boundary_end = m[1]\n content_length = -1 if boundary_end == '--'\n ## reset file cursor position\n #body.rewind\n body.seek(0, IO::SEEK_SET)\n \n ## original filename\n /Content-Disposition:.* filename=(?:\"(.*?)\"|([^;\\r\\n]*))/i.match(head)\n filename = $1 || $2 || ''\n filename = SimpleCGI.unescape(filename)# if unescape_filename?()\n body.instance_variable_set('@original_filename', filename)\n ## content type\n /Content-Type: (.*)/i.match(head)\n (content_type = $1 || '').chomp!\n body.instance_variable_set('@content_type', content_type)\n ## query parameter name\n /Content-Disposition:.* name=(?:\"(.*?)\"|([^;\\r\\n]*))/i.match(head)\n name = $1 || $2 || ''\n if body.original_filename == \"\"\n #value=body.read.dup.force_encoding(@accept_charset)\n value=body.read.dup\n (params[name] ||= []) << value\n unless value.valid_encoding?\n if @accept_charset_error_block\n @accept_charset_error_block.call(name,value)\n else\n raise InvalidEncoding,\"Accept-Charset encoding error\"\n end\n end\n class << params[name].last;self;end.class_eval do\n define_method(:read){self}\n define_method(:original_filename){\"\"}\n define_method(:content_type){\"\"}\n end\n else\n (params[name] ||= []) << body\n @files[name]=body\n end\n ## break loop\n break if content_length == -1\n end\n\n #... raise EOFError, \"bad boundary end of body part\" unless boundary_end =~ /--/\n params.default = []\n params\n rescue => e\n p e.class\n p e.message\n p e.backtrace\n #if tempfiles\n # tempfiles.each {|t|\n # if t.path\n # t.unlink\n # end\n # }\n #end\n #raise\n end", "def compose(fields) # :nodoc:\n if fields.class != Hash\n raise \"RT_Client.compose requires parameters as a hash.\"\n end\n\n payload = { :multipart => true }\n\n # attachments\n if fields.has_key? :Attachments\n fields[:Attachment] = fields[:Attachments]\n fields.delete :Attachments\n end\n if fields.has_key? :Attachment\n filenames = fields[:Attachment].split(',')\n attachment_num = 1\n filenames.each do |f|\n payload[\"attachment_#{attachment_num.to_s}\"] = File.new(f)\n attachment_num += 1\n end\n # strip paths from filenames\n fields[:Attachment] = filenames.map {|f| File.basename(f)}.join(',')\n end\n\n # fixup Text field for RT's quasi-RFC822 form\n if fields.has_key? :Text\n fields[:Text].gsub!(/\\n/,\"\\n \") # insert a space on continuation lines.\n end\n\n field_array = fields.map { |k,v| \"#{k}: #{v}\" }\n content = field_array.join(\"\\n\") # our form\n payload[\"content\"] = content\n\n return payload\n end", "def post_request(url, boundary=nil)\n request = Net::HTTP::Post.new(url) # , header\n content_type_str = \"multipart/form-data\"\n request['accept'] = '*/*'\n\n if boundary != nil\n content_type_str << \", boundary=#{boundary}\"\n end\n request['content-type'] = content_type_str\n\n return request\nend", "def set_upload_body(request, data)\n if data.respond_to? :read\n request.body_stream = data\n if data.respond_to? :size\n request.content_length = data.size\n else\n request[\"Transfer-encoding\"] = \"chunked\"\n end\n else\n request.body = data\n end\n end", "def add_file name, file, mime, content\n @params << \n \"Content-Disposition: form-data; name=\\\"#{name}\\\"; filename=\\\"#{file}\\\"\\n\" +\n \"Content-Transfer-Encoding: binary\\n\" +\n \"Content-Type: #{mime}\\n\" + \n \"\\n\" + \n \"#{content}\"\n end", "def options_to_multipart_request(options)\n file = options[:file]\n @request_method = :post\n {image: HTTP::FormData::File.new(file, filename: File.basename(file), mime_type: mime_type(File.basename(file)))}\n end", "def initialize(headers, body)\n content_type = headers['Content-Type']\n boundary = content_type.parameters['boundary']\n\n if boundary.nil?\n raise Malformed.new(\"Expected multipart Content-Type header to contain 'boundary' parameter\",\n 1)\n else\n @boundary = boundary.parsed_value\n boundary_tween = Regexp.new(\"--#{Regexp.escape(@boundary)}\\s*\\r\\n$\")\n boundary_last = Regexp.new(\"--#{Regexp.escape(@boundary)}--\\s*\\r\\n$\")\n end\n\n parts = []\n @preamble = []\n part_lines = []\n @epilogue = []\n state = :preamble\n\n body.each do |line|\n case state\n when :preamble\n if line =~ boundary_tween\n state = :part\n else\n @preamble << line\n end\n\n when :part\n if line =~ boundary_tween\n part_lines.last.gsub!(/[\\r\\n]+$/, '') # swallow CRLF before boundary marker\n part_lines.pop if part_lines.last.empty? # get rid of extra newline if it was present\n parts << MIME::Message.parse(part_lines, false)\n part_lines = []\n elsif line =~ boundary_last\n part_lines.last.gsub!(/[\\r\\n]+$/, '') # swallow CRLF before boundary marker\n part_lines.pop if part_lines.last.empty? # get rid of extra newline if it was present\n parts << MIME::Message.parse(part_lines, false)\n part_lines = []\n state = :epilogue\n else\n part_lines << line\n end\n\n when :epilogue\n @epilogue << line\n end\n end\n\n # Handle messages that have no epilogue\n unless part_lines.empty?\n parts << MIME::Message.parse(part_lines, false)\n end\n\n super(headers, parts)\n end", "def set_up_post_request(uri, data, headers, binary_key = nil)\n if !binary_key.nil?\n binary_data = data[binary_key]\n\n if binary_data.is_a?(StringIO)\n data[binary_key] = UploadIO.new(\n binary_data, \"text/plain\", \"local.path\"\n )\n else\n data[binary_key] = UploadIO.new(\n File.open(binary_data), \"text/plain\"\n )\n end\n\n req = Net::HTTP::Post::Multipart.new(uri.path, data)\n else\n req = Net::HTTP::Post.new(uri.path, headers)\n req.body = data.to_json\n end\n req\n end", "def multipart; end", "def compose_urlencoded_params(new_param_hash)\n self['REQUEST_METHOD'] = 'POST'\n self['CONTENT_TYPE'] = 'application/x-www-form-urlencoded'\n @body = StringIO.new(qs_build(new_param_hash))\n end", "def file_body(message, file)\n file_name = File.basename(file.path)\n mime_type = MimeMagic.by_path(file_name)\n file_content = Base64.encode64(file.read)\n\n body = [\"--#{BOUNDARY}\"]\n body << 'Content-Type: application/json; charset=UTF-8'\n body << 'Content-Disposition: attachment; name=\"metadata\"'\n body << ''\n body << message\n body << \"--#{BOUNDARY}\"\n body << \"Content-Type: #{mime_type}; charset=UTF-8\"\n body << 'Content-Transfer-Encoding: base64'\n body << %{Content-Disposition: attachment; name=\"file\"; filename=\"#{file_name}\"}\n body << ''\n body << file_content\n body << \"--#{BOUNDARY}--\"\n body.join(\"\\n\")\n end", "def form_body\n if body.is_a?(Hash)\n body.map do |k,v|\n [AwsRequest.aws_encode(k), AwsRequest.aws_encode(v)].join(\"=\")\n end.join(\"&\")\n else\n body\n end\n end", "def upload_form(key,content)\n return \"Content-Disposition: form-data; name=\\\"#{CGI::escape(key)}\\\"\\r\\n\" +\n \"\\r\\n\" +\n \"#{content}\\r\\n\"\nend", "def multipart?; end", "def dcs_request(uri, data)\r\n boundary = Array::new(16) { \"%2.2d\" % rand(99) }.join()\r\n extheader = {\r\n \"content-type\" => \"multipart/form-data; boundary=___#{ boundary }___\"\r\n }\r\n\r\n client = HTTPClient.new\r\n response = client.post_content(uri, data, extheader)\r\n end", "def file_body_headers(headers)\n headers.merge('Content-Type' => \"multipart/related; boundary=#{BOUNDARY}\")\n end", "def parse_multipart(boundary, body)\n reader = MultipartParser::Reader.new(boundary)\n result = { errors: [], parts: [] }\n def result.part(name)\n hash = self[:parts].detect { |h| h[:part].name == name }\n [hash[:part], hash[:body].join]\n end\n\n reader.on_part do |part|\n result[:parts] << thispart = {\n part: part,\n body: []\n }\n part.on_data do |chunk|\n thispart[:body] << chunk\n end\n end\n reader.on_error do |msg|\n result[:errors] << msg\n end\n reader.write(body)\n result\n end", "def read(data:, options: nil, callback: nil)\n parsed_data = parse(eml: data, options: options, callback: callback)\n\n begin\n result = {}\n result[:date] = new Date(parsed_data.dig(:headers)) if parsed_data.dig(:headers, 'Date')\n # byebug\n result[:subject] = unquote_string(parsed_data.dig(:headers, \"Subject\")) if parsed_data.dig(:headers, \"Subject\")\n\n %w[From To CC cc].each do |item|\n result[item] = get_email_address(parsed_data.dig(:headers, item))\n end\n\n result[:headers] = parsed_data.dig(:headers)\n\n boundary = nil\n ct = parsed_data.dig(:headers, 'Content-Type')\n # byebug\n if ct && ct.match(/^multipart\\//)\n b = get_boundary(ct)\n if b && b.length\n boundary = b\n end\n end\n\n if boundary\n for body_data in data.dig(:body)\n if body_data.dig(:part).instance_of? (String)\n result[:data] = body_data[:part]\n else\n if body_data.dig(:part, :body).instance_of? (String)\n headers = body_data.dig(:part, :headers)\n content = body_data.dig(:part, :body)\n append_boundary(headers, content)\n else\n for item in body_data.dig(:part, :body) do\n if item.instance_of?(String)\n result[:data] = body_data.dig(:part, :body)[item]\n next\n end\n\n headers = body_data.dig(:part, :body, item, :part, :headers)\n content = body_data.dig(:part, :body, item, :part, :body)\n\n append_boundary(headers, content)\n end\n end\n end\n end\n elsif data.dig(:body).instance_of?(String)\n append_boundary(data.dig(:headers), data.dig(body))\n end\n callback.call(result)\n rescue StandardError => e\n puts e\n end\n end", "def uploaded_file_segment(key, upload_io, boundary)\n <<-EOF\n--#{boundary}\\r\nContent-Disposition: form-data; name=\"#{key}\"; filename=\"#{Camping.escape(upload_io.original_filename)}\"\\r\nContent-Type: #{upload_io.content_type}\\r\nContent-Length: #{upload_io.size}\\r\n\\r\n#{upload_io.read}\\r\nEOF\n end", "def auth_request_formdata(handler_path, params)\n req_msg = raw_request_message(params)\n nonce = gen_nonce\n signature = gen_signature(handler_path, req_msg, nonce)\n {\n req: req_msg,\n signature: signature,\n nonce: nonce,\n }\n end", "def toFormData\n formData = `new FormData()`\n each do |key, value|\n `#{formData}.append(#{key},#{value})`\n end\n formData\n end", "def make_request_body(opts, headers); end", "def build_common_request\n common_set_body_contents\n process_header\n add_body_to_header\n end", "def add_field name, value\n @params << \"Content-Disposition: form-data; name=\\\"#{name}\\\"\\n\" + \n \"\\n\" + \n \"#{value}\\n\"\n end", "def set_form_data(request, params, sep = '&')\n request.body = params.map {|k,v|\n if v.instance_of?(Array)\n v.map {|e| \"#{urlencode(k.to_s)}=#{urlencode(e.to_s)}\"}.join(sep)\n else\n \"#{urlencode(k.to_s)}=#{urlencode(v.to_s)}\"\n end\n }.join(sep)\n\n request.content_type = 'application/x-www-form-urlencoded'\nend", "def loaded_body\n @loaded_body ||= case ctype = request.content_type\n when /json/\n json_body\n when /x-www-form-urlencoded/\n request.params.dup\n when /multipart\\/form-data/\n file = params[:file]\n file_body file, Path(file[:filename]).extname\n else\n unsupported_media_type_error!(ctype)\n end\n end", "def multipart_content_type(env)\n requested_content_type = env['CONTENT_TYPE']\n if requested_content_type.start_with?('multipart/')\n requested_content_type\n else\n 'multipart/form-data'\n end\n end", "def multipart!\n @multipart_form = true\n end", "def post_multipart(url, data={}, headers={}, redirect_limit=max_redirects)\n # the Content-Type header is handled automoatically by Net::HTTP::Post::Multipart\n headers.delete_if { |k,v| k.to_s.downcase == \"content-type\" }\n\n debug(\"POST #{url} #{headers.inspect} multi-part form content\")\n\n # parse the URL\n uri = URI.parse(url)\n\n # prepare the payload\n payload = data.inject({}) do |h,(k,v)| \n h[k] = (v.class == File) ? UploadIO.new(v, mimetype(v), File.basename(v)) : v; h\n end\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post::Multipart.new(uri.request_uri, payload)\n headers.each { |k,v| request.add_field(k, v) }\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n raise Net::HTTPFatalError.new(\"Too many redirects\", response) if redirect_limit == 0\n post_multipart_raw(response['location'], data, headers, redirect_limit - 1)\n else\n KineticHttpResponse.new(response)\n end\n rescue StandardError => e\n KineticHttpResponse.new(e)\n end\n end", "def prepare_data(body)\n data = MultiJson.decode(body)\n content = StringIO.new(data['content'])\n resource_id = data['resource_id']\n\n data.keep_if { |k,v| %w{title description mimeType}.include? k}\n file_content = Google::APIClient::UploadIO.new(content, data['mimeType'])\n\n [resource_id, data, file_content]\nend", "def post_multipart(url, data={}, headers={}, http_options=@options)\n # determine the http options\n redirect_limit = http_options[:max_redirects] || max_redirects\n gateway_retries = http_options[:gateway_retry_limit] || gateway_retry_limit\n gateway_delay = http_options[:gateway_retry_delay] || gateway_retry_delay\n\n # the Content-Type header is handled automoatically by Net::HTTP::Post::Multipart\n headers.delete_if { |k,v| k.to_s.downcase == \"content-type\" }\n\n @logger.debug(\"POST #{url} #{headers.inspect} multi-part form content\")\n\n # parse the URL\n uri = URI.parse(url)\n\n # prepare the payload\n payload = data.inject({}) do |h,(k,v)| \n if v.class == File\n h[k] = UploadIO.new(v, mimetype(v).first, File.basename(v))\n elsif v.class == Array\n h[k] = v.inject([]) do |files, part|\n if part.class == File\n files << UploadIO.new(part, mimetype(part).first, File.basename(part))\n end\n end\n else\n h[k] = v\n end\n h\n end\n\n # build the http object\n http = build_http(uri)\n # build the request\n request = Net::HTTP::Post::Multipart.new(uri.request_uri, payload)\n headers.each { |k,v| request.add_field(k, v) }\n # send the request\n begin\n response = http.request(request)\n # handle the response\n case response\n when Net::HTTPRedirection then\n if redirect_limit == -1\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n elsif redirect_limit == 0\n raise Net::HTTPFatalError.new(\"Too many redirects\", response)\n else\n post_multipart(response['location'], data, headers, http_options.merge({\n :max_redirects => redirect_limit - 1\n }))\n end\n # handle 502, 503, 504\n when Net::HTTPBadGateway, Net::HTTPServiceUnavailable, Net::HTTPGatewayTimeOut then\n if gateway_retries == -1\n KineticHttpResponse.new(response)\n elsif gateway_retries == 0\n @logger.info(\"HTTP response: #{response.code} #{response.message}\") unless @logger.debug?\n raise Net::HTTPFatalError.new(\"#{response.code} #{response.message}\", response)\n else\n @logger.info(\"#{response.code} #{response.message}, retrying in #{gateway_delay} seconds\")\n sleep(gateway_delay)\n post_multipart(url, data, headers, http_options.merge({\n :gateway_retry_limit => gateway_retries - 1\n }))\n end\n when Net::HTTPUnknownResponse, NilClass then\n @logger.info(\"HTTP response code: 0\") unless @logger.debug?\n e = Net::HTTPFatalError.new(\"Unknown response from server\", response)\n KineticHttpResponse.new(e)\n else\n @logger.info(\"HTTP response code: #{response.code}\") unless @logger.debug?\n KineticHttpResponse.new(response)\n end\n rescue Net::HTTPBadResponse => e\n @logger.info(\"HTTP bad response: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n rescue StandardError => e\n @logger.info(\"HTTP error: #{e.inspect}\") unless @logger.debug?\n KineticHttpResponse.new(e)\n end\n end", "def conventional_segment(key, value, boundary)\n <<-EOF\n--#{boundary}\\r\nContent-Disposition: form-data; name=\"#{key}\"\\r\n\\r\n#{value}\\r\nEOF\n end", "def build_message(type, body, flags=NLM_F_REQUEST, seq=next_seq, pid=@pid)\n body = body.to_str\n header = [\n body.bytesize + NLMSGHDR_SIZE,\n type, flags, seq, pid\n ].pack(NLMSGHDR_PACK)\n # assume the header is already aligned\n header + body\n end", "def build(options = {})\n options.each do |k,v|\n k = k.to_s\n unless k.match(/^body_/)\n self.send(\"#{k}=\", v)\n else\n k.gsub!(\"body_\", \"\")\n self.body(k, v)\n end\n end\n end", "def multipart arg\n\t\t\tvals = if arg.is_a?(String)\n\t\t\t\t{:body => arg, :headers => {}}\n\t\t\telse\n\t\t\t\targ\n\t\t\tend\n\n\t\t\t@multiparts ||= []\n\t\t\t@multiparts << vals\n\t\tend", "def parse_query(content_type, body)\n\t\tboundary = content_type.match(/^multipart\\/form-data; boundary=(.+)/)[1]\n\t\tboundary = HTTPUtils::dequote(boundary)\n\t\treturn HTTPUtils::parse_form_data(body, boundary)\n\tend", "def set_body\n request.body = Base64.strict_encode64(File.read(local_file))\n end", "def build_common_request\n common_set_body_contents\n set_receiver_id\n process_header\n add_body_to_header\n end", "def request_body required, media_type, data: { }, **options\n desc = options.delete(:desc) || ''\n self[:requestBody] = RequestBodyObj.new(required, desc) unless self[:requestBody].is_a?(RequestBodyObj)\n self[:requestBody].add_or_fusion(media_type, { data: data , **options })\n end", "def to_s \n body = \"\"\n @parts.each do|part|\n # boundary\n body += \"--\" + @boundary + \"\\r\\n\"\n # header\n body += \"Content-Type: application/x-arango-batchpart\"\n\n if part[:contentId] != \"\"\n body += \"\\r\\nContent-Id: \" + part[:contentId]\n end\n \n body += \"\\r\\n\\r\\n\"\n\n # inner header\n body += part[:method] + \" \" + part[:url] + \" HTTP/1.1\\r\\n\"\n\n part[:headers].each do|key, value|\n body += key + \": \" + value + \"\\r\\n\"\n end\n # header/body separator\n body += \"\\r\\n\"\n\n # body\n body += part[:body] + \"\\r\\n\"\n end \n body += \"--\" + @boundary + \"--\\r\\n\"\n end", "def request_body required, media_type, data: { }, desc: '', **options\n (self[:requestBody] ||= RequestBodyObj.new(required, desc)).absorb(media_type, { data: data , **options })\n end", "def construct_request_body(input)\n names = selected_fields.empty? || selected_fields.any? { |f| f.to_s.include?('name') || f.to_s.include?('.*$') }\n { input: input,\n equate_il: options[:equate] == true,\n extra: options[:all] == true,\n names: options[:all] == true && names }\n end", "def post(uri, options = {})\n if options[:multipart]\n form_input = build_multipart_data(options)\n build_response(request.post(uri, build_request_options({\"CONTENT_TYPE\" => \"multipart/form-data, boundary=Mack-boundary\", \"CONTENT_LENGTH\" => form_input.size, :input => form_input})))\n else\n build_response(request.post(uri, build_request_options({:input => options.to_params})))\n end\n end", "def build_payload(options)\n body = options[:body]\n mime = options[:mime]\n if mime\n # user set mime-type, let them deal with it :)\n # fix for ruby 1.8\n if body.is_a? File\n size = body.path.size\n else\n size = body.size\n end\n elsif body.is_a? Hash\n body = Yajl.dump body\n mime = \"application/json\"\n elsif SERIALIZEABLE_TYPES.include? body.class\n if ITERABLE_TYPES.include? body.class\n if is_set_of_strings? body\n # set of strings is primitive\n mime = \"application/vnd.fluiddb.value+json\"\n else\n # we have an Array with some non-String items\n mime = \"application/json\"\n end\n else\n # primitive type\n mime = \"application/vnd.fluiddb.value+json\"\n end\n body = Yajl.dump body\n else\n raise TypeError, \"You must supply the mime-type\"\n end\n [body, mime]\n end", "def post_multipart(method, params = {})\n url = make_url method, {}\n url.query = nil\n\n boundary, data = make_multipart params\n\n req = Net::HTTP::Post.new url.path\n req.content_type = \"multipart/form-data; boundary=#{boundary}\"\n req.body = data\n\n res = Net::HTTP.start url.host, url.port do |http|\n http.request req\n end\n\n xml = Nokogiri::XML(res.body, nil, nil, 0)\n\n check_error xml\n\n parse_response xml\n rescue SystemCallError, SocketError, Timeout::Error, IOError,\n Nokogiri::XML::SyntaxError => e\n raise CommunicationError.new(e)\n rescue Net::HTTPError => e\n xml = Nokogiri::XML(e.res.body, nil, nil, 0)\n check_error xml\n raise CommunicationError.new(e)\n end", "def post_multipart(resource_url, params, data={})\n headers = {'Authorization' => authorization('POST', resource_url, params)}\n url = resource_url + '?' + URI.encode_www_form(params)\n uri = URI.parse(url)\n form_data = []\n data.each{|k,v|\n form_data << [k,v]\n }\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n req = Net::HTTP::Post.new(uri.request_uri, headers)\n req.set_form(form_data, 'multipart/form-data')\n res = http.start{|h|\n h.request(req)\n }\n Response.new(res)\n end", "def buildHttpMessage(headers, body = nil)\n pp [:got_build_http_message, headers, body] if $DEBUG\n body = body.to_java_bytes if body.respond_to?(:to_java_bytes)\n String.from_java_bytes(__buildHttpMessage(headers, body))\n end", "def transform(params)\n case @http_post_format\n when 'parsed', '', nil\n # Mail changes `self`.\n headers = self.class.multimap(JSON.load(params['message-headers']))\n this = self\n\n message = Message::Mailgun.new do\n headers headers\n\n # The following are redundant with `body-mime` in raw MIME format\n # and with `message-headers` in fully parsed format.\n #\n # from params['from']\n # sender params['sender']\n # to params['recipient']\n # subject params['subject']\n #\n # Mailgun POSTs all MIME headers both individually and in\n # `message-headers`.\n\n text_part do\n body params['body-plain']\n end\n\n if params.key?('body-html')\n html_part do\n content_type 'text/html; charset=UTF-8'\n body params['body-html']\n end\n end\n\n if params.key?('attachment-count')\n 1.upto(params['attachment-count'].to_i) do |n|\n attachment = params[\"attachment-#{n}\"]\n add_file(this.class.add_file_arguments(attachment))\n end\n end\n end\n\n # Extra Mailgun parameters.\n if params.key?('stripped-text') && !params['stripped-text'].empty?\n message.stripped_text = params['stripped-text']\n end\n if params.key?('stripped-signature') && !params['stripped-signature'].empty?\n message.stripped_signature = params['stripped-signature']\n end\n if params.key?('stripped-html') && !params['stripped-html'].empty?\n message.stripped_html = params['stripped-html']\n end\n if params.key?('content-id-map') && !params['content-id-map'].empty?\n message.content_id_map = params['content-id-map']\n end\n\n # @todo Store non-plain, non-HTML body parts.\n # params.keys.select do |key|\n # key[/\\Abody-(?!html|plain)/]\n # end\n\n [message]\n when 'raw'\n message = self.class.condense(Message::Mailgun.new(Mail.new(params['body-mime'])))\n [message]\n else\n raise ArgumentError, \"Can't handle Mailgun #{@http_post_format} HTTP POST format\"\n end\n end", "def initialize str, ignore_body=false\n \t\theaders, @body = $~[1..-1] if str[/(.*?\\r?\\n)(?:\\r?\\n(.*))?\\Z/m]\n\n \t\t@headers = Hash.new { |hash, key| hash[key] = [] }\n \t\t@body ||= ''\n \t\theaders.to_s.scan(/^\\S+:\\s*.*(?:\\n\\t.*)*/).each do |header|\n \t\t\t@headers[header[/(\\S+):/, 1]] << header[/\\S+:\\s*(.*)/m, 1].gsub(/\\s+/m, ' ').strip # this is kind of wrong\n \t\tend\n\n \t\t# don't have to have content type i suppose\n \t\t@content_type, attrs = nil, {}\n \t\tif content_type = @headers['Content-Type'][0]\n \t\t\t@content_type, attrs = Mime.split_header content_type\n \t\tend\n\n \t\treturn if ignore_body\n\n \t\tif multipart?\n \t\t\tif body.empty?\n \t\t\t\t@preamble = ''\n \t\t\t\t@epilogue = ''\n \t\t\t\t@parts = []\n \t\t\telse\n \t\t\t\t# we need to split the message at the boundary\n \t\t\t\tboundary = attrs['boundary'] or raise \"no boundary for multipart message\"\n\n \t\t\t\t# splitting the body:\n \t\t\t\tparts = body.split(/--#{Regexp.quote boundary}/m)\n \t\t\t\tunless parts[-1] =~ /^--/; warn \"bad multipart boundary (missing trailing --)\"\n \t\t\t\telse parts[-1][0..1] = ''\n \t\t\t\tend\n \t\t\t\tparts.each_with_index do |part, i|\n \t\t\t\t\tpart =~ /^(\\r?\\n)?(.*?)(\\r?\\n)?\\Z/m\n \t\t\t\t\tpart.replace $2\n \t\t\t\t\twarn \"bad multipart boundary\" if (1...parts.length-1) === i and !($1 && $3)\n \t\t\t\tend\n \t\t\t\t@preamble = parts.shift\n \t\t\t\t@epilogue = parts.pop\n \t\t\t\t@parts = parts.map { |part| Mime.new part }\n \t\t\tend\n \t\tend\n \tend", "def post_multipart(url, data, filename, headers = {})\n request(:post, url, headers, {:data => data, :file => filename, :multipart => true})\n end", "def append_boundary(headers, content)\n content_type = headers.dig(:content_type)\n charset = get_charset_name(get_char_set(content_type || @default_charset))\n encoding = headers.dig(\"Content-Transfer-Encoding\")\n\n if encoding.instance_of? (String)\n encoding = encoding.downcase\n end\n\n if encoding.instance_of?(Base64)\n if content_type.index \"gbk\"\n content = Base64.decode64(content)\n else\n content = Base64.decode64(content.gsub(/\\r?\\n/, ''))\n end\n elsif encoding == 'quoted-printable'\n content = unquote_printable(content, charset)\n elsif charset != \"utf8\" && ((encoding.start_with? (\"binary\")) || (encoding.start_with? (\"8bit\")))\n content = Base64.decode64(content, charset)\n end\n\n if !result.dig(:html) && content_type && (content_type.index \"text/html\")\n if content.instance_of? (String)\n content = Base64.decode64(content, charset)\n end\n result[:html] = content\n elsif !result.dig(:text) && content_type && (content_type.index \"text/plain\")\n if content.instance_of? (String)\n content = Base64.decode64(content, charset)\n end\n result[:text] = content\n else\n if !result.attachment\n result[:attachments] = []\n end\n\n attachment = {}\n\n id = headers.dig(\"Content-ID\")\n if id\n attachment[:id] = id\n end\n\n name = headers[\"Content-Disposition\"] || headers[\"Content-Type\"]\n\n if name\n match = name.match(/name=\"?(.+?)\"?$/)\n if match\n name = match[1]\n else\n name = nil\n end\n end\n\n if name\n attachment[:name] = name\n end\n\n ct = headers[\"Content-Type\"]\n\n if ct\n attachment[:content_type] = ct\n end\n\n cd = headers[\"Content-Disposition\"]\n\n if cd\n attachment[:inline] = cd.match(/^\\s*inline/)\n end\n\n attachment[:data] = content\n result[:attachments].push(attachment)\n end\n result\n end", "def post_form(uri, form, headers = T.unsafe(nil)); end", "def boundary\n return unless multipart?\n @boundary ||= Mail::Field.new(\"content-type\", http.headers[\"content-type\"]).parameters['boundary']\n end", "def build_danske_generic_request\n common_set_body_contents\n set_receiver_id\n encrypted_request = encrypt_application_request\n add_encrypted_generic_request_to_soap(encrypted_request)\n\n process_header\n add_body_to_header\n end", "def to_form\n form = list.values.map {|p| \"--#{self.boundary}\\r\\n#{p.to_form}\" }.join\n form << \"--#{self.boundary}--\"\n\n form\n end", "def build_request(method, path, body, request_options)\n request = {}\n request[:method] = method.downcase\n request[:path] = build_uri_path(path, request_options.params)\n request[:body] = build_body(body, request_options, method)\n request[:headers] = generate_headers(request_options)\n request[:timeout] = request_options.timeout\n request[:connect_timeout] = request_options.connect_timeout\n request\n end", "def decode_multipart\n return unless multipart?\n part_of_parts = Part.new(:headers => http.headers, :body => http.body)\n part_of_parts.body.split!(boundary)\n self.parts = part_of_parts.parts\n end", "def perform\n add_request_if_new do |request|\n self.class.notify_if_cookies_cleared request do\n multipart_set!(request) unless multipart?(request)\n escaped_arguments = escape_or_warn_of_escape_sequences(arguments)\n escaped_arguments.each_slice 2 do |name, value|\n if value =~ /^file:/\n request.multipart[name] = FilePart.new(name,value.gsub(/^file:/,\"\")) \n else\n request.multipart[name] = StringPart.new(name,value) \n end\n end\n request.body_update\n request\n end\n end\n end", "def set_request_body!(request); end", "def content_post\n\t\t\t# POST requests seem to bomb out when they're deflated\n\t\t\t# and they probably don't need to be compressed anyway\n\t\t\t@request_params[\"SAMLRequest\"] = Base64.encode64(@request).gsub(/\\n/, \"\")\n\t\t\t\n\t\t\t#Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n\t\t\t# kind of a cheesy method of building an HTML, form since we can't rely on Rails too much,\n\t\t\t# and REXML doesn't work well with quote characters\n\t\t\tstr = \"<html><body onLoad=\\\"document.getElementById('form').submit();\\\">\\n\"\n\t\t\tstr += \"<form id='form' name='form' method='POST' action=\\\"#{@URL}\\\">\\n\"\n\t\t\t# we could change this in the future to associate a temp auth session ID\n\t\t\tstr += \"<input name='RelayState' value='ruby-saml' type='hidden' />\\n\"\n\t\t\t@request_params.each_pair do |key, value|\n\t\t\t\tstr += \"<input name=\\\"#{key}\\\" value=\\\"#{value}\\\" type='hidden' />\\n\"\n\t\t\t\t#str += \"<input name=\\\"#{key}\\\" value=\\\"#{CGI.escape(value)}\\\" type='hidden' />\\n\"\n\t\t\tend\n\t\t\tstr += \"</form></body></html>\\n\"\n\t\t\t\n\t\t\tLogging.debug \"Created form:\\n#{str}\"\n\t\t\treturn str\n\t\tend", "def content_post\n # POST requests seem to bomb out when they're deflated\n # and they probably don't need to be compressed anyway\n @request_params[\"SAMLRequest\"] = Base64.encode64(@request).gsub(/\\n/, \"\")\n \n #Logging.debug \"SAMLRequest=#{@request_params[\"SAMLRequest\"]}\"\n # kind of a cheesy method of building an HTML, form since we can't rely on Rails too much,\n # and REXML doesn't work well with quote characters\n str = \"<html><body onLoad=\\\"document.getElementById('form').submit();\\\">\\n\"\n str += \"<form id='form' name='form' method='POST' action=\\\"#{@URL}\\\">\\n\"\n # we could change this in the future to associate a temp auth session ID\n str += \"<input name='RelayState' value='ruby-saml' type='hidden' />\\n\"\n @request_params.each_pair do |key, value|\n str += \"<input name=\\\"#{key}\\\" value=\\\"#{value}\\\" type='hidden' />\\n\"\n #str += \"<input name=\\\"#{key}\\\" value=\\\"#{CGI.escape(value)}\\\" type='hidden' />\\n\"\n end\n str += \"</form></body></html>\\n\"\n \n #Logging.debug \"Created form:\\n#{str}\"\n return str\n end", "def body_lazy(value)\n process_body_raw if @body_raw && value\n case\n when value == nil || value.length<=0\n @body = Mail::Body.new('')\n @body_raw = nil\n add_encoding_to_body\n when @body && @body.multipart?\n @body << Mail::Part.new(value)\n add_encoding_to_body\n else\n @body_raw = value\n# process_body_raw\n end\n end", "def build_body(body, request_options, method)\n if method == :GET && body.empty?\n return nil\n end\n\n # merge optional special request options to the body when it\n # doesn't have to be in the array format\n body.merge!(request_options.data) if body.is_a?(Hash) && method != :GET\n to_json(body)\n end", "def build_certificate_request\n set_body_contents\n end", "def build_certificate_request\n set_body_contents\n end" ]
[ "0.76564777", "0.75952953", "0.7582058", "0.73681915", "0.73681915", "0.73681915", "0.73681915", "0.73525167", "0.73045135", "0.7284556", "0.72065836", "0.7174001", "0.71551114", "0.7081993", "0.70066154", "0.70038176", "0.6973473", "0.69263816", "0.6857866", "0.68310946", "0.6725919", "0.67148024", "0.66146237", "0.6525089", "0.65051913", "0.64508224", "0.6418348", "0.6348893", "0.6295417", "0.6238979", "0.6138053", "0.6119758", "0.6094304", "0.6066298", "0.59815407", "0.59500873", "0.59372336", "0.59336567", "0.58786887", "0.58604395", "0.5843908", "0.58430696", "0.57967865", "0.57886136", "0.5752861", "0.57224387", "0.5681776", "0.5673973", "0.5645211", "0.56358635", "0.55871475", "0.55754364", "0.55734384", "0.55657125", "0.5558097", "0.5556295", "0.5547871", "0.5546092", "0.5515044", "0.5501899", "0.54874754", "0.5479944", "0.547805", "0.5471368", "0.5461153", "0.54583883", "0.5455288", "0.54384017", "0.5424758", "0.54094875", "0.5397176", "0.53941953", "0.5388943", "0.5380443", "0.53649294", "0.53609246", "0.5345417", "0.5339321", "0.5327495", "0.5320511", "0.53176373", "0.5299245", "0.5288211", "0.52597344", "0.5248553", "0.52484244", "0.52483433", "0.5244131", "0.5194111", "0.5183771", "0.51343745", "0.5129602", "0.5121084", "0.51173455", "0.5116868", "0.51119643", "0.5088051", "0.5078984", "0.50393134", "0.50320727", "0.50320727" ]
0.0
-1
Adding an index concurrently must not happen inside a transaction (the default)
def change add_index :handcuffs_primary_tests, :test_field, algorithm: :concurrently end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def safe_add_index(*args, **options); end", "def create_or_update_index\n # check if index is created\n if index_exists?\n IndexJob.perform_later(self.class.name, 'update', id)\n else\n IndexJob.perform_later(self.class.name, 'index', id)\n end\n end", "def add_index(table_name, column_name, options = {}, &block)\n table_name = proper_table_name(table_name)\n # GOTCHA:\n # checks if index should be created concurrently then put it into\n # the queue to wait till queue processing will be called (should be\n # happended after closing transaction).\n # Otherwise just delegate call to PgSaurus's `add_index`.\n # Block is given for future compatibility.\n # -- zekefast 2012-09-12\n unless options[:concurrently]\n return connection.add_index(table_name, column_name, options, &block)\n end\n\n enque(table_name, column_name, options, &block)\n nil\n end", "def index\n @@semaphore.synchronize {\n inner_index()\n }\n end", "def with_index_lock\n lock_path = \"#{@index_file}.lock\"\n File.open(lock_path, \"w+\") do |f|\n f.flock(File::LOCK_EX)\n yield\n end\n end", "def populate_background_index!(name)\n # make an index with a new client (in this thread, to avoid query check race after)\n name.freeze\n index = $client.dup.index(name)\n docs = index.docs(\"widget\")\n\n # do some busy work in background thread to generate bulk-indexing tasks we\n # can query at the caller. return the thread ref so caller can join on it\n Thread.new do\n 100.times.each do |i|\n docs.bulk do |d|\n (1..500).each do |j|\n d.index \\\n :foo => \"foo_#{i}_#{j}\",\n :bar => \"bar_#{i}_#{j}\",\n :baz => \"baz_#{i}_#{j}\"\n end\n end\n index.refresh\n end\n end\nend", "def add_index(table_name, column_name, options = {})\n creation_method = options.delete(:concurrently) ? 'CONCURRENTLY' : nil\n\n # Whether to skip the quoting of columns. Used only for expressions like JSON indexes in which\n # the column is difficult to target for quoting.\n skip_column_quoting = options.delete(:skip_column_quoting) or false\n\n index, algorithm, if_not_exists = add_index_options(table_name, column_name, **options)\n algorithm = creation_method || algorithm\n create_index = CreateIndexDefinition.new(index, algorithm, if_not_exists)\n\n # GOTCHA:\n # It ensures that there is no existing index only for the case when the index\n # is created concurrently to avoid changing the error behavior for default\n # index creation.\n # -- zekefast 2012-09-25\n # GOTCHA:\n # This check prevents invalid index creation, so after migration failed\n # here there is no need to go to database and clean it from invalid\n # indexes. But note that this handles only one of the cases when index\n # creation can fail!!! All other case should be procesed manually.\n # -- zekefast 2012-09-25\n if creation_method.present? && index_exists?(table_name, column_name, options)\n raise ::PgSaurus::IndexExistsError,\n \"Index #{index.name} for `#{table_name}.#{column_name}` \" \\\n \"column can not be created concurrently, because such index already exists.\"\n end\n\n execute schema_creation.accept(create_index)\n end", "def add_all\n helper.index_write do |index|\n index.add_all\n index.update_all\n end\n\n self\n end", "def create_index(index)\n\n parsed = @http.put(\"http://#{@host}:#{@port}/#{index}\")\n ok = parsed[\"ok\"]\n @logger.error(\"parsed???\", :parsed => parsed)\n\n @logger.error(\"create_index ok\", :ok => ok, :index => index)\n\n @http.get(\"http://#{@host}:#{@port}/_flush\")\n\n end", "def test_can_create_multiple_indexes_same_column\n skip(\"Multiple indexes on same column were introduced in Cassandra 3.0.0\") if CCM.cassandra_version < '3.0.0'\n\n @session.execute(\"CREATE TABLE simplex.multi_index_test (a int PRIMARY KEY, b map<text, text>)\")\n @session.execute(\"CREATE INDEX key_index ON simplex.multi_index_test (keys(b))\")\n @session.execute(\"CREATE INDEX value_index ON simplex.multi_index_test (values(b))\")\n\n @listener.wait_for_index('simplex', 'multi_index_test', 'key_index')\n @listener.wait_for_index('simplex', 'multi_index_test', 'value_index')\n\n assert @cluster.keyspace('simplex').table('multi_index_test').has_index?('key_index')\n assert @cluster.keyspace('simplex').table('multi_index_test').has_index?('value_index')\n\n key_index = @cluster.keyspace('simplex').table('multi_index_test').index('key_index')\n assert_equal 'key_index', key_index.name\n assert_equal 'multi_index_test', key_index.table.name\n assert_equal :composites, key_index.kind\n assert_equal 'keys(b)', key_index.target\n\n value_index = @cluster.keyspace('simplex').table('multi_index_test').index('value_index')\n assert_equal 'value_index', value_index.name\n assert_equal 'multi_index_test', value_index.table.name\n assert_equal :composites, value_index.kind\n assert_equal 'values(b)', value_index.target\n end", "def index_write\n rugged_repository.index.reload\n yield(rugged_repository.index)\n rugged_repository.index.write\n end", "def create_index\n # Only create the index if it doesn't exist\n raise Mebla::Errors::MeblaIndexException.new(\"#{@slingshot_index_name} already exists !! use #rebuild_index to rebuild the index.\") if index_exists?\n \n Mebla.log(\"Creating index\")\n \n # Create the index\n build_index\n end", "def update_index\n SolrService.add(to_solr, softCommit: true)\n end", "def with_index(name = nil, &block)\n name ||= caller(1)[0].match(/in `(.*)'\\z/)[1]\n mapper.indexes[name.to_s] or begin\n indexable = yield\n mapper.add_index(name, indexable)\n end\n end", "def add_index(table, *args)\n alter_table(table) {add_index(*args)}\n end", "def register_index(key, index)\n @indexes[key] = index\n $LUCENE_LOGGER.debug{\"Registered index for #{index}\"}\n end", "def require_index(name); end", "def require_index(name); end", "def ensure_index(spec, opts={})\n now = Time.now.utc.to_i\n opts[:dropDups] = opts[:drop_dups] if opts[:drop_dups]\n opts[:bucketSize] = opts[:bucket_size] if opts[:bucket_size]\n field_spec = parse_index_spec(spec)\n name = opts[:name] || generate_index_name(field_spec)\n name = name.to_s if name\n\n if !@cache[name] || @cache[name] <= now\n generate_indexes(field_spec, name, opts)\n end\n\n # Reset the cache here in case there are any errors inserting. Best to be safe.\n @cache[name] = now + @cache_time\n name\n end", "def supports_indexes_in_create?\n false\n end", "def supports_indexes_in_create?\n false\n end", "def add_indexes\n if hereditary? && !index_options[{ _type: 1 }]\n index({ _type: 1 }, { unique: false, background: true })\n end\n true\n end", "def test_can_create_index\n @session.execute(\"CREATE TABLE simplex.test (a text PRIMARY KEY, b text)\")\n @session.execute(\"CREATE INDEX b_index ON simplex.test (b)\")\n\n @listener.wait_for_index('simplex', 'test', 'b_index')\n\n assert @cluster.keyspace('simplex').table('test').has_index?('b_index')\n index = @cluster.keyspace('simplex').table('test').index('b_index')\n assert @cluster.keyspace('simplex').has_index?('b_index')\n assert_same(index, @cluster.keyspace('simplex').index('b_index'))\n assert_equal 'b_index', index.name\n assert_equal 'test', index.table.name\n assert_equal :composites, index.kind\n assert_equal 'b', index.target\n end", "def incompatible_indexing_directive\n if $client.version_support.es_version_2_x?\n {_wait_for_active_shards: 10}\n else\n {_consistency: \"all\"}\n end\nend", "def create_index(namespace, set_name, index_name, bin_name, index_type, collection_type = nil, options = nil, ctx: nil)\n if options.nil? && collection_type.is_a?(Hash)\n options, collection_type = collection_type, nil\n end\n policy = create_policy(options, Policy, default_info_policy)\n\n str_cmd = \"sindex-create:ns=#{namespace}\"\n str_cmd << \";set=#{set_name}\" unless set_name.to_s.strip.empty?\n str_cmd << \";indexname=#{index_name};numbins=1\"\n str_cmd << \";context=#{CDT::Context.base64(ctx)}\" unless ctx.to_a.empty?\n str_cmd << \";indextype=#{collection_type.to_s.upcase}\" if collection_type\n str_cmd << \";indexdata=#{bin_name},#{index_type.to_s.upcase}\"\n str_cmd << \";priority=normal\"\n\n # Send index command to one node. That node will distribute the command to other nodes.\n response = send_info_command(policy, str_cmd).upcase\n if response == \"OK\"\n # Return task that could optionally be polled for completion.\n return IndexTask.new(@cluster, namespace, index_name)\n end\n\n if response.start_with?(\"FAIL:200\")\n # Index has already been created. Do not need to poll for completion.\n return IndexTask.new(@cluster, namespace, index_name, true)\n end\n\n raise Aerospike::Exceptions::Aerospike.new(Aerospike::ResultCode::INDEX_GENERIC, \"Create index failed: #{response}\")\n end", "def index_group\n begin\n self.index\n Sunspot.commit\n rescue Exception => e\n Rails.logger.error(\"Solr is unreachable\")\n Rails.logger.error(e)\n end\n return true\n end", "def raise_index!\n @index += 1\n end", "def on_add_with_index(&block)\n @index.each do |index, values|\n values.each do |v|\n block.call(index, v)\n end\n end\n @onAddBlockWithIndex = block\n end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def add_index_field(*) super end", "def reindex_after_archive\n reindex_sync\n end", "def build\n @logger.info(\"INDEXING\") { \"Building index of type #{@index_definition.name}\" }\n rdf_types = @index_definition.related_rdf_types\n number_of_documents = count_documents(rdf_types)\n @logger.info(\"INDEXING\") do\n %(Found #{number_of_documents} documents to index\n - matching type(s) #{rdf_types.inspect}\n - using allowed groups #{@search_index.allowed_groups}\"\n )\n end\n batches =\n if @max_batches && (@max_batches != 0)\n [@max_batches, number_of_documents / @batch_size].min\n else\n number_of_documents / @batch_size\n end\n batches = batches + 1\n @logger.info(\"INDEXING\") { \"Number of batches: #{batches}\" }\n\n Parallel.each(1..batches, in_threads: @number_of_threads) do |i|\n batch_start_time = Time.now\n @logger.info(\"INDEXING\") { \"Indexing batch #{i}/#{batches}\" }\n failed_documents = []\n @sparql_connection_pool.with_authorization(@search_index.allowed_groups) do |sparql_client|\n document_builder = MuSearch::DocumentBuilder.new(\n tika: @tika,\n sparql_client: sparql_client,\n attachment_path_base: @attachment_path_base,\n logger: @logger\n )\n document_uris = get_documents_for_batch(rdf_types, i)\n document_uris.each do |document_uri|\n @logger.debug(\"INDEXING\") { \"Indexing document #{document_uri} in batch #{i}\" }\n document = document_builder.build_document_for_index(\n uri: document_uri,\n index_definition: @index_definition\n )\n @elasticsearch.insert_document @search_index.name, document_uri, document\n rescue StandardError => e\n failed_documents << document_uri\n @logger.warn(\"INDEXING\") { \"Failed to index document #{document_uri} in batch #{i}\" }\n @logger.warn { e.full_message }\n end\n end\n @logger.info(\"INDEXING\") { \"Processed batch #{i}/#{batches} in #{(Time.now - batch_start_time).round} seconds.\" }\n if failed_documents.length > 0\n @logger.warn(\"INDEXING\") { \"#{failed_documents.length} documents failed to index in batch #{i}.\" }\n @logger.debug(\"INDEXING\") { \"Failed documents: #{failed_documents}\" }\n end\n end\n end", "def add_to_index(index, a, b, c)\n begin\n index[a][b] << c\n rescue\n index[a] ||= {}\n index[a][b] = [c]\n end\n # The old, slow way of doing things...the new way is nearly linear at\n # 0.0005 seconds per transaction at 100 inserts\n # and 0.000529 seconds per transaction at 10,000 inserts.\n # \n # if index.keys.include?(a) and index[a].keys.include?(b)\n # index[a][b] << c\n # elsif index.keys.include?(a)\n # index[a][b] = [c]\n # else\n # index[a] = {}\n # index[a][b] = [c]\n # end\n end", "def commit\n if !@rollback\n @indexes.each_value do |index| \n $LUCENE_LOGGER.debug{\"BEGIN: Commit index #{index} txt #{to_s}\"} \n index.commit\n $LUCENE_LOGGER.debug{\"END: Commited index #{index} txt #{to_s}\"}\n end \n end\n @commited = true\n $LUCENE_LOGGER.error(\"Index was not removed from commited transaction: #{@indexes.inspect}\") if !@indexes.empty? && !@rollback \n @indexes.clear\n Thread.current[:lucene_transaction] = nil\n end", "def create_index( index_name, sort_by_proc = nil, & indexing_block )\n \n return create_bucket_index( index_name, false, sort_by_proc, & indexing_block )\n \n end", "def create_indexes\n indexes = %w{ Page(page_id) Trait(eol_pk) Trait(resource_pk) Term(uri) Term(name)\n Resource(resource_id) MetaData(eol_pk)}\n indexes.each do |index|\n begin\n query(\"CREATE INDEX ON :#{index};\")\n rescue Neography::NeographyError => e\n if e.to_s =~ /already created/\n puts \"Already have an index on #{index}, skipping.\"\n else\n raise e\n end\n end\n end\n end", "def create_index(table_name, index_spec)\n @iadmin ||= IndexedTableAdmin.new(@configuration)\n @iadmin.addIndex(table_name.to_java_bytes, index_spec)\nend", "def ensure_index_exists(index_name)\n @logger.debug \"DRb server: ensure_index_exists for index #{index_name}\"\n definition = ActsAsFerret::get_index(index_name).index_definition\n dir = definition[:index_dir]\n unless File.directory?(dir) && File.file?(File.join(dir, 'segments')) && dir =~ %r{/\\d+(_\\d+)?$}\n rebuild_index(index_name)\n end\n end", "def index_corruption?; end", "def ensure_indices\n @dao.collection.ensure_index(\n [['identity.email', Mongo::ASCENDING]],\n index_options([:background, :unique])\n )\n @dao.collection.ensure_index([['customer_id', Mongo::ASCENDING]], index_options)\n @dao.collection.ensure_index([['slug', Mongo::ASCENDING]], index_options)\n @indexed = true\n end", "def <<(index)\n @indexes[index.name] = index\n end", "def index()\n INDEXES.find { |i| (self + i).exist? }&.yield_self { |i| self + i }\n end", "def test_can_create_index_on_partial_collections\n skip(\"Secondary index on partial collections were introduced in Cassandra 2.1\") if CCM.cassandra_version < '2.1.0'\n\n @session.execute(\"CREATE TABLE simplex.collection_test (a int PRIMARY KEY, b map<text, text>)\")\n @session.execute(\"CREATE INDEX b_index ON simplex.collection_test (keys(b))\")\n\n @listener.wait_for_index('simplex', 'collection_test', 'b_index')\n\n assert @cluster.keyspace('simplex').table('collection_test').has_index?('b_index')\n index = @cluster.keyspace('simplex').table('collection_test').index('b_index')\n assert_equal 'b_index', index.name\n assert_equal 'collection_test', index.table.name\n assert_equal :composites, index.kind\n assert_equal 'keys(b)', index.target\n\n @session.execute(\"DROP INDEX b_index\")\n @cluster.refresh_schema\n @session.execute(\"CREATE INDEX b_index ON simplex.collection_test (b)\")\n\n @listener.wait_for_index('simplex', 'collection_test', 'b_index')\n\n assert @cluster.keyspace('simplex').table('collection_test').has_index?('b_index')\n index = @cluster.keyspace('simplex').table('collection_test').index('b_index')\n assert_equal 'b_index', index.name\n assert_equal 'collection_test', index.table.name\n assert_equal :composites, index.kind\n if CCM.cassandra_version < '3.0.0'\n assert_equal 'b', index.target\n else\n assert_equal 'values(b)', index.target\n end\n end", "def index_new\n raise InvalidDbError if @stale\n super\n end", "def update_tank_indexes\n if tanker_indexable?\n tanker_config.index.add_document(\n it_doc_id, tanker_index_data, tanker_index_options\n )\n else\n delete_tank_indexes\n end\n end", "def index(model, instance = nil)\n return true if skip? instance\n\n self.class.enqueue(\n FlyingSphinx::IndexRequest.new(model.delta_index_names, true),\n delayed_job_priority\n )\n\n self.class.enqueue_without_duplicates_check(\n FlyingSphinx::FlagAsDeletedJob.new(\n model.core_index_names, instance.sphinx_document_id\n ),\n delayed_job_priority\n ) if instance\n\n true\n end", "def test_indexes\n idx_name = \"accounts_idx\"\n\n indexes = @connection.indexes(\"accounts\")\n assert_empty indexes\n\n @connection.add_index :accounts, :firm_id, name: idx_name\n indexes = @connection.indexes(\"accounts\")\n assert_equal \"accounts\", indexes.first.table\n assert_equal idx_name, indexes.first.name\n assert !indexes.first.unique\n assert_equal [\"firm_id\"], indexes.first.columns\n ensure\n @connection.remove_index(:accounts, name: idx_name) rescue nil\n end", "def test_indexes\n idx_name = \"accounts_idx\"\n\n indexes = @connection.indexes(\"accounts\")\n assert_empty indexes\n\n @connection.add_index :accounts, :firm_id, name: idx_name\n indexes = @connection.indexes(\"accounts\")\n assert_equal \"accounts\", indexes.first.table\n assert_equal idx_name, indexes.first.name\n assert !indexes.first.unique\n assert_equal [\"firm_id\"], indexes.first.columns\n ensure\n @connection.remove_index(:accounts, name: idx_name) rescue nil\n end", "def supports_index_include?\n false\n end", "def force_create_index\n\t\t\tif @entity.authenticate?\n\t\t\t\tputs Stock.create_index! force: true \n\t\t\tend\n\t\tend", "def create_index_with_duplicates( index_name, sort_by_proc = nil, sort_duplicates_by_proc = nil, & indexing_block )\n\n return create_bucket_index( index_name, true, sort_by_proc, sort_duplicates_by_proc, & indexing_block )\n \n end", "def update_index\n all.each do |n|\n n.update_index\n end\n end", "def add(record)\n handle_drb_error { @server.add index_name, record.to_doc }\n end", "def add_to_index(wiki, index, sha, files)\n end", "def add_index(*fields)\n @add_indexed_field = fields\n end", "def git_add_all\n index.add_all\n index.write\n end", "def fast_add(path, data='', on_fs=false)\n # TODO: verify that this will suffice\n index.add(path, data, on_fs)\n end", "def create_index\n self[:create_index]\n end", "def on(name)\n indexes = Indexes.new(connection: connection).on(name)\n\n yield\n\n indexes.each(&method(:try_index_create))\n end", "def indexes\n raise 'not implemented'\n end", "def create_index(args)\n if args[:name]\n new_index = create_new_index(args)\n\n @conn.query({url_path: \"#{database}/_index\", opts: new_index, method: :post})\n else\n raise ArgumentError.new('name is required')\n end\n end", "def commit(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\", [[\"commit\", \"true\"]])\n req = HTTP::Post.new(uri)\n response = @client.send_http(req, true, ['200'])\n end", "def explicit_index( *index_names )\n\n index_names.each do |this_index_name|\n instance = create_explicit_index( this_index_name, false )\n indexes[ this_index_name ] = explicit_indexes[ this_index_name ] = instance\n end\n \n return self\n\n end", "def update_index\n index_files = []\n index_files << upload(\"specs.4.8.gz\", specs_index)\n log \"Uploaded all specs index\"\n index_files << upload(\"latest_specs.4.8.gz\", latest_index)\n log \"Uploaded latest specs index\"\n index_files << upload(\"prerelease_specs.4.8.gz\", prerelease_index)\n log \"Uploaded prerelease specs index\"\n\n index_files.each do |file|\n tuf_repo.replace_file(file, 'targets/unclaimed', 'targets')\n end\n\n # For now assume all files are unclaimed\n pending_files = tuf_pending_store.pending\n pending_files.each do |file|\n puts \"Adding file: #{file.path}\"\n tuf_repo.add_file(file, 'targets/unclaimed', 'targets')\n end\n tuf_repo.publish!\n tuf_pending_store.clear(pending_files)\n end", "def add_to_index_files(idx, name)\n year = NvdFileSystem::year_from_name(name)\n\n path=\"#{@nvdfs.root_path}/index\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{year}\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{idx}\"\n Dir.mkdir path unless Dir.exist? path\n path += \"/#{name}\"\n\n begin\n File.open(path,\"wb\") {|f| f.write(\"\") }\n rescue Exception => ex\n str=\"unable to create index file #{path}\"\n puts str\n end\n\n end", "def reindex!\n doc = {:id => neo_node_id }\n self.class.index_updaters.each_value do |updater|\n updater.call(self, doc)\n end\n lucene_index << doc\n end", "def sync client, type\n settings.master_mutex.synchronize do\n index_names = get_request_index_names type\n\n unless !index_names.empty?\n indexes = create_request_indexes client, type\n index_names = indexes.map { |index| index[:index] }\n end\n\n index_names.each do |index|\n Indexes.instance.set_status index, :updating\n end\n\n return index_names\n end\n end", "def enqueue_reindex_job\n Study.enqueue_reindex_ids(nct_id)\n end", "def git_add_all\n index.add_all\n index.write\n end", "def add_index(table, fields, **kwargs)\n current_instructions << Instructions::AddIndex.new(\n **kwargs,\n table: table,\n fields: fields,\n )\n end", "def verify_index\n setup_index\n raise Exceptions::ElasticsearchError('Index not found') unless index_exists?\n end", "def explicit_index_with_duplicates( *index_names )\n\n index_names.each do |this_index_name|\n instance = create_explicit_index( this_index_name, true )\n indexes[ this_index_name ] = explicit_indexes[ this_index_name ] = instance\n end\n\n return self\n \n end", "def load_index\n construct_index unless index_valid?\n open_index_file\n end", "def create(index_name, config_set: 'data_driven_schema_configs')\n checkresponse = @client.send_http(HTTP::Get.new(@client.make_uri(\"/#{index_name}/select\")), true, ['200', '404'])\n if checkresponse.code.eql?('404')\n uri = @client.make_uri('/admin/cores', [\n [\"action\", \"CREATE\"],\n [\"name\", index_name],\n [\"instanceDir\", \"mycores/\" + index_name],\n [\"configSet\", config_set]\n ])\n response = @client.send_http(HTTP::Post.new(uri), true, ['200', '500'])\n if response.code.eql?('500') && !response.body.include?(\"Core with name '#{index_name}' already exists.\")\n raise \"Create index failed in an unexpected way: \\n\\n#{response.body}\"\n end\n end\n end", "def build\n # Note: @index_definitions will only contain multiple elements in case of a composite type.\n @index_definitions.each do |type_def|\n @logger.info(\"INDEXING\") { \"Building index of type #{type_def[\"type\"]}\" }\n rdf_type = type_def[\"rdf_type\"]\n number_of_documents = count_documents(rdf_type)\n @logger.info(\"INDEXING\") { \"Found #{number_of_documents} documents to index of type #{rdf_type} with allowed groups #{@search_index.allowed_groups}\" }\n batches =\n if @max_batches && (@max_batches != 0)\n [@max_batches, number_of_documents / @batch_size].min\n else\n number_of_documents / @batch_size\n end\n batches = batches + 1\n @logger.info(\"INDEXING\") { \"Number of batches: #{batches}\" }\n\n Parallel.each(1..batches, in_threads: @number_of_threads) do |i|\n batch_start_time = Time.now\n @logger.info(\"INDEXING\") { \"Indexing batch #{i}/#{batches}\" }\n failed_documents = []\n\n @sparql_connection_pool.with_authorization(@search_index.allowed_groups) do |sparql_client|\n document_builder = MuSearch::DocumentBuilder.new(\n tika: @tika,\n sparql_client: sparql_client,\n attachment_path_base: @attachment_path_base,\n logger: @logger\n )\n document_uris = get_documents_for_batch rdf_type, i\n document_uris.each do |document_uri|\n @logger.debug(\"INDEXING\") { \"Indexing document #{document_uri} in batch #{i}\" }\n document = document_builder.fetch_document_to_index(\n uri: document_uri,\n properties: type_def[\"properties\"])\n @elasticsearch.insert_document @search_index.name, document_uri, document\n rescue StandardError => e\n failed_documents << document_uri\n @logger.warn(\"INDEXING\") { \"Failed to index document #{document_uri} in batch #{i}\" }\n @logger.warn { e.full_message }\n end\n end\n @logger.info(\"INDEXING\") { \"Processed batch #{i}/#{batches} in #{(Time.now - batch_start_time).round} seconds.\" }\n if failed_documents.length > 0\n @logger.warn(\"INDEXING\") { \"#{failed_documents.length} documents failed to index in batch #{i}.\" }\n @logger.debug(\"INDEXING\") { \"Failed documents: #{failed_documents}\" }\n end\n end\n end\n end", "def write_document_to_index(document)\n\n end", "def construct_index\n end", "def ensure_index_does_not_exist( index_name, permits_duplicates )\n\n if index_instance = indexes[ index_name ] and \n index_instance.permits_duplicates? != permits_duplicates\n\n raise 'Index ' << index_name.to_s + ' has already been declared, ' <<\n 'and new duplicates declaration does not match existing declaration.'\n\n end\n\n end", "def create_index index, mappings = nil, settings = nil\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}\")\n req = Net::HTTP::Put.new(uri)\n req.body = {\n mappings: mappings,\n settings: settings\n }.to_json\n\n result = run(uri, req)\n end", "def index(name, options = { :unique => false })\n collection.create_index(name, options[:unique])\n end", "def index(name, options = { :unique => false })\n collection.create_index(name, options)\n end", "def rebuild_index\n # Only rebuild if the index exists\n raise Mebla::Errors::MeblaIndexException.new(\"#{@slingshot_index_name} does not exist !! use #create_index to create the index first.\") unless index_exists?\n\n Mebla.log(\"Rebuilding index\") \n \n # Delete the index\n if drop_index\n # Create the index\n return build_index\n end\n end", "def ensureIndex(table,keys,options={})\n connection.ensureIndex(path(table),keys,options)\n end", "def create_bucket_index( index_name, \n permits_duplicates, \n sort_by_proc = nil, \n sort_duplicates_by_proc = nil, \n & indexing_block )\n \n if index_instance = @indexes[ index_name ] and \n index_instance.permits_duplicates? != permits_duplicates\n \n raise 'Index ' << index_name.to_s + ' has already been declared, ' <<\n 'and new duplicates declaration does not match existing declaration.'\n \n end\n\n index_instance = ::Persistence::Port::Bucket::BucketIndex.new( index_name, \n self, \n permits_duplicates,\n sort_by_proc, \n sort_duplicates_by_proc,\n & indexing_block )\n \n @indexes[ index_name ] = index_instance\n \n return index_instance\n \n end", "def reindex!\n indexed if generate_solr_index\n end", "def supports_automatic_indices?\n true\n end", "def index\n set_index\n end", "def updateDB(dbName)\n puts \"Creating index on \" + CALDATE_COLLECTION\n @conn[dbName][CALDATE_COLLECTION].create_index({\"body.educationOrganizationId\" => Mongo::ASCENDING}, {:sparse => false })\nend", "def with_temporary_index\n Dir.mktmpdir('braid_index') do |dir|\n Operations::with_modified_environment(\n {'GIT_INDEX_FILE' => File.join(dir, 'index')}) do\n yield\n end\n end\n end", "def bulk_index(document_hashes_or_payload, options = {})\n @client = build_client(options.merge(retry_on_failure: true, timeout: 10))\n\n with_retries do\n payload_generator = Indexer::BulkPayloadGenerator.new(@index_name, @search_config, @client, @is_content_index)\n response = @client.bulk(index: @index_name, body: payload_generator.bulk_payload(document_hashes_or_payload))\n\n items = response[\"items\"]\n failed_items = items.select do |item|\n data = item[\"index\"] || item[\"create\"]\n data.key?(\"error\")\n end\n\n if failed_items.any?\n # Because bulk writes return a 200 status code regardless, we need to\n # parse through the errors to detect responses that indicate a locked\n # index\n blocked_items = failed_items.select do |item|\n error = (item[\"index\"] || item[\"create\"])[\"error\"]\n locked_index_error?(error[\"reason\"])\n end\n if blocked_items.any?\n raise IndexLocked\n else\n GovukError.notify(Indexer::BulkIndexFailure.new, extra: { failed_items: failed_items })\n raise Indexer::BulkIndexFailure\n end\n end\n\n response\n end\n end", "def create_explicit_index( index_name, permits_duplicates, sort_by_proc = nil, sort_duplicates_by_proc = nil )\n \n ensure_index_does_not_exist( index_name, permits_duplicates )\n \n index_instance = ::Persistence::Object::Index::ExplicitIndex.new( index_name, \n instance_persistence_bucket, \n permits_duplicates,\n sort_duplicates_by_proc,\n & sort_by_proc )\n\n indexes[ index_name ] = explicit_indexes[ index_name ] = index_instance\n\n return index_instance\n \n end", "def setup_index\n @index_driver.setup_index\n end", "def index_finalized\n index\n end", "def create_index o_class, name:, on: :automatic, type: :unique\n logger.progname = 'RestCreate#CreateIndex'\n begin\n c = classname o_class\n execute transaction: false do\n \t command = if on == :automatic\n \t\t \"CREATE INDEX #{c}.#{name} #{type.to_s.upcase}\"\n \t\telsif on.is_a? Array\n \t\t \"CREATE INDEX #{name} ON #{classname(o_class)}(#{on.join(', ')}) #{type.to_s.upcase}\"\n \t\telse\n \t\t nil\n \t\tend\n \t [{type: \"cmd\", language: 'sql', command: command}]\n end\n logger.info{\"Index on #{c} based on #{name} created.\"}\n rescue RestClient::InternalServerError => e\n response = JSON.parse(e.response)['errors'].pop\n \t error_message = response['content'].split(':').last\n logger.error{\"Index not created.\"}\n logger.error{\"Error-code #{response['code']} --> #{response['content'].split(':').last }\"}\n nil\n end\n end", "def build_index!\n puts \"build_index!\"\n @indexes = {}\n \n @indexes = @resource_class.build_indexes(@resources)\n @indexes[:_default] ||= @default_order\n end", "def add_to_index(name, key, node); end", "def supports_partial_indexes?\n true\n end", "def add_index(*col_names)\r\n raise \"Do not execute this method in client/server mode!\" if \\\r\n @db.client?\r\n\r\n col_names.each do |c|\r\n raise \"Invalid column name: #{c}\" unless \\\r\n @field_names.include?(c)\r\n \r\n raise \"recno column cannot be indexed!\" if c == :recno\r\n\r\n raise \"Column already indexed: #{c}\" unless \\\r\n @field_indexes[@field_names.index(c)].nil?\r\n end\r\n \r\n last_index_no_used = 0\r\n @field_indexes.each do |i|\r\n next if i.nil?\r\n index_no = i[-1..-1].to_i\r\n last_index_no_used = index_no if index_no > last_index_no_used\r\n end\r\n \r\n @db.engine.add_index(self, col_names, last_index_no_used+1)\r\n\r\n # Need to reinitialize the table instance and associated indexes.\r\n @db.engine.remove_recno_index(@name)\r\n @db.engine.remove_indexes(@name)\r\n\r\n update_header_vars\r\n create_indexes\r\n create_table_class unless @db.server?\r\n end", "def has_index? index\n @index.include? index\n end", "def has_index? index\n @index.include? index\n end" ]
[ "0.7123435", "0.6822825", "0.6721672", "0.6665731", "0.6581441", "0.64493763", "0.6313256", "0.6201618", "0.6175409", "0.6165769", "0.615396", "0.6152387", "0.606203", "0.6056703", "0.6028219", "0.6023471", "0.6015267", "0.6015267", "0.6008429", "0.6001351", "0.6001351", "0.6000393", "0.59878486", "0.59802186", "0.5970626", "0.59680444", "0.5951042", "0.5947997", "0.5921967", "0.5884559", "0.5877006", "0.58650625", "0.5858723", "0.58569485", "0.5846257", "0.58347386", "0.5824548", "0.5807929", "0.5770046", "0.5765135", "0.574931", "0.57482654", "0.57440805", "0.5743986", "0.5738734", "0.57379025", "0.57331467", "0.57331467", "0.5725145", "0.57220566", "0.57145244", "0.5701042", "0.569303", "0.5688231", "0.5685207", "0.5682711", "0.56730586", "0.56600964", "0.5660079", "0.56541", "0.5651566", "0.5643342", "0.56394273", "0.56356335", "0.5634821", "0.5631443", "0.562552", "0.56116086", "0.5611479", "0.5608936", "0.5608237", "0.5606187", "0.560533", "0.55971307", "0.5596185", "0.55876356", "0.55864316", "0.55827653", "0.5577509", "0.55477506", "0.55321634", "0.5529546", "0.55272394", "0.5526507", "0.5526232", "0.5520785", "0.5516083", "0.55142665", "0.55130523", "0.5506726", "0.54998547", "0.549654", "0.5495734", "0.54914486", "0.5483211", "0.54818904", "0.54778254", "0.5461949", "0.5457902", "0.5457902" ]
0.54555327
100
any dlv file under this size should be recomputed, b/c it's probably just comments if this guesses badly, it is just inefficient, not incorrect
def initialize(table='traces') @table=table raise "#{Basedir} does not exists " unless Kernel::test(?d,Basedir) #ip2db=Ips2TTLdistance2db.new ## create a database handle with constants stored in Ips2TTLdistance2db #@dbh=DBI.connect("DBI:Pg:dbname=#{ip2db.databasename};host=#{ip2db.databasehost}", # ip2db.databaseuser, ip2db.databasepasswd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recalculate_filesize\n @filesize = @collection.reduce(0) {|sum,asset| sum + asset.size}\n end", "def size; file_log.size(file_rev); end", "def file_size\n 1000 # temporarily disable file size calculation\n # TODO: fix this in production env (perhaps zencoder is not replacing target file?)\n # self.file.size\n end", "def byte_size; size.y * line_byte_size; end", "def size_fil_header\n 4 + 4 + 4 + 4 + 8 + 2 + 8 + 4\n end", "def fsize\n lib.tcidbfsiz( @db )\n end", "def fast_size2\n c_size = 0\n $postgres.exec_prepared('wsfile_size_multi', [self.id]).each do |row|\n c_size += row.except('id').map{|k,v| v.to_i}.inject(:+)\n end\n c_size\n end", "def d_size\n uint64(header, 'size') / @blockSize\n end", "def interpret_size(size); end", "def filesize; end", "def calc_size\n @input_size = File.size(@original_filepath)\n @output_size = File.size(@min_filepath)\n @diff_size = @input_size - @output_size\n end", "def decompressed_size; end", "def compressed_size; end", "def compressed_size; end", "def file_size\n number_to_human_size(super)\n end", "def file_specific_height\n file_count = @purl_object.all_resource_files.count\n items_to_account_for = [file_count, 4].min\n\n 55 + (items_to_account_for * 67)\n end", "def get_all_size\n s_old = 0\n Dir.glob($dir + '/**/*').each { | a_file |\n dn = File.dirname(a_file)\n s = File.lstat(a_file).size.to_i\n $file_size[ a_file ] = s\n $dir_size[ dn ] = (s_old = $dir_size[ dn ]) ? s_old + s : s\n }\nend", "def calc_size(size)\n eax = size\n edx = size + 0xf\n eax = 0x10\n eax -= 1\n eax += edx\n var_390 = 0x10\n edx = 0\n eax = eax / var_390\n eax *= 0x10\n\n return eax + 0x1c\nend", "def fast_size\n c_size = 0\n ids = self.child_ids\n q = \"SELECT octet_length(data), octet_length(body) AS octet_length2 FROM ws_files WHERE id in (#{ ids.join(\", \")})\"\n request = $postgres.exec(q)\n request.each do |req|\n c_size += req.map{|k,v| v.to_i }.inject(:+)\n end\n c_size\n end", "def size_in_bytes\n ( file_length * 16 ) / 8\n end", "def entry_size; BLOCK_SIZE; end", "def entry_size; BLOCK_SIZE; end", "def d_size\n @capacity / @blockSize\n end", "def size_fil_trailer\n 4 + 4\n end", "def capture_size_before_cache(new_file) \n if model.image_width.nil? || model.image_height.nil?\n model.image_width, model.image_height = `identify -format \"%wx %h\" #{new_file.path}`.split(/x/).map { |dim| dim.to_i }\n end\n end", "def set_size_of_residues!\n @size_of_residues = 0\n Mspire::Fasta.foreach(@local_path) do |entry|\n @size_of_residues += entry.sequence.size\n end\n self\n end", "def edf_size\n File.size(@filename)\n end", "def pos_fil_trailer\n size - size_fil_trailer\n end", "def byte_size(); @data.byte_size + 4; end", "def size_page_body\n size - size_fil_trailer - size_fil_header\n end", "def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end", "def file_size\n self.file_file_size\n end", "def file_size\n @file_size ||= 0\n end", "def size_partial_page_header\n size_fil_header - 4 - 8 - 4\n end", "def size\n synchronize do\n (@f - @b + @size) % @size\n end\n end", "def byte_size\n inject(0){ |sum, path| sum + FileTest.size(path) }\n end", "def compute_size\n return false if self.mp3_file.blank?\n self.size = self.mp3_file.size || 0\n end", "def size(full_path)\n\t\t`du -sb #{full_path}`.match(/(\\d+)/)[1].to_i\n\tend", "def update_file_info\n if self.path\n size = File.exists?(self.path) ? File.size(self.path) : nil\n end\n if size\n (value, units) = bits_to_human_readable(size)\n self.size = value unless value.nil? or value.empty?\n self.size_units = units unless units.nil? or units.empty?\n self.save if self.descMetadata.changed?\n end\n end", "def size_d(floc)\n \"#{gene_d(floc)}/#{@win_size}\"\n\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def fbe_size\n 4\n end", "def height\n file.height\n end", "def compressed_size=(_arg0); end", "def as_size children: true\n WSFile.human_size(optimal_size)\n end", "def size\n chunk_size = nil\n File.open(@file_name) do |file|\n file.seek(@offset + 4, IO::SEEK_CUR)\n case @size_length\n when 4\n chunk_size = file.read(@size_length).unpack('L').first\n when 2\n chunk_size = file.read(@size_length).unpack('S').first\n else\n raise \"Can't decode size field of length #{@size_length}\"\n end\n end\n chunk_size + @data_size_correction\n end", "def block_size\n check_valid\n md.block_size\n end", "def size_fsp_header\n ((4 * 6) + (1 * 8) + (5 * Innodb::List::BASE_NODE_SIZE))\n end", "def recalc_size\n if @mail.nil? or @mail.raw_source.nil?\n new_size = self.get_raw.length\n if new_size == 0\n new_size += self.subject.length unless self.subject.nil?\n new_size += self.message.length unless self.message.nil?\n new_size += self.get_attach_size\n end\n self.size = new_size\n else\n self.size = @mail.raw_source.length\n end\n end", "def file_size; @io_size[@rio] end", "def d_size\n @desc[:size].to_i\n end", "def blksize() end", "def load_factor\n @entry_count / @size\n end", "def interpret_size(size)\n case size\n when /k$/i then size.to_i * 1024\n when /m$/i then size.to_i * 1024 * 1024\n when /g$/i then size.to_i * 1024 * 1024 * 1024\n else size.to_i\n end\n end", "def upd_folder_size\n \n @t1 = Thread.new{ \n \n @time_samples = []\n \n puts \"in upd_folder_size...\"\n prev_size = 0\n loop {\n puts \"in loop each 2 secs\"\n this_size = 0\n @fen_d.children.each { |pn|\n this_size += (pn.size? || 0) if pn.file?\n }\n @time_samples << (this_size - prev_size).abs\n puts \"upd, @time_samples: #{@time_samples.inspect}\"\n sleep @sleep_sample\n prev_size = this_size\n }\n\n }\n \n end", "def upd_folder_size\n \n @t1 = Thread.new{ \n \n @time_samples = []\n \n puts \"in upd_folder_size...\"\n prev_size = 0\n loop {\n puts \"in loop each 2 secs\"\n this_size = 0\n @fen_d.children.each { |pn|\n this_size += (pn.size? || 0) if pn.file?\n }\n @time_samples << (this_size - prev_size).abs\n puts \"upd, @time_samples: #{@time_samples.inspect}\"\n sleep @sleep_sample\n prev_size = this_size\n }\n\n }\n \n end", "def min_file_size\n (1024 * 200)\n end", "def sizeOnDisk(someFile)\n #get directory\n #size of file in directories\n #add\n return Dir.glob(File.join(someFile, '**', '*')).map{|f| File.size(f)}.inject(:+)\nend", "def bundleTimestampBundleSize(dest_folder,new_timestamp,max_size) \n max_size=max_size*1024\n ts=new_timestamp\n fileSize=0 \n deletedFileList=\"\"\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n if(fileSize>max_size)\n ts=ts+60\n fileSize=0\n end \n if file.to_s().end_with?(\"searchDB.sql\") \n File.utime(new_timestamp, new_timestamp, file) \n elsif file.to_s().end_with?(\"deletedList.list\")\n deletedFileList=file\n else\n File.utime(ts, ts, file)\n fileSize=fileSize+File.size(file) \n end\n end\n File.utime(ts, ts, deletedFileList) \nend", "def part_size(total_size, part_size, offset)\n if offset + part_size > total_size\n total_size - offset\n else\n part_size\n end\n end", "def load_record_size\n File.open(File.join(@root + ['size'])) do |f|\n return (Marshal.load(f))\n end\n end", "def size(full_path)\n\t\t`du -s #{Rush.quote(full_path)}`.match(/(\\d+)/)[1].to_i\n\tend", "def data_size\n File.size(file_path)\n end", "def data_size\n File.size(file_path)\n end", "def size_data_dictionary_header\n ((8 * 3) + (4 * 7) + 4 + Innodb::FsegEntry::SIZE)\n end", "def original_file_size\n return @original_file_size\n end", "def size_in_bytes\n files.inject(0) do |sum, f|\n path = File.join self.path, f\n sum + File.size(path)\n end\n end", "def load_factor\n @items / self.get_size\n end", "def to_dir_size(size)\n sorted = @file_table.sort_by { |k, v| v[:mtime] }\n c = SizeConversion.new(size.to_s)\n delete_size = @dir_size - c.to_size(:b).to_f\n\n if delete_size <= 0\n return {}\n end\n\n f_size = 0\n list = {}\n\n sorted.each do |f|\n list[f[0]] = f[1]\n f_size += f[1][:size]\n if f_size >= delete_size\n break\n end\n end\n return list\n end", "def preamble_size\n # Find size from position of data for first shard\n words.at(content_offset + File::Frozen::Descriptor.offset + 7).to_i\n end", "def calculate_size(show)\n print \"\\rcalculating size for #{show}\".ljust(120)\n size = directory_size \"#{PATH}/#{show}\"\n if SHOWS.include? show\n anime = SHOWS[show]\n anime.bytes += size\n else\n anime = Anime.new(show, size)\n RESULTS << anime\n SHOWS[anime.name] = anime\n end\nend", "def calculate_disk_usage\n user_own_maps = self.own_maps #saves 4 calls\n\n files = user_own_maps.map{|m| m.unwarped_filename if File.exist? m.unwarped_filename} + user_own_maps.map{| m | m.masked_src_filename if File.exist? m.masked_src_filename} + user_own_maps.map{|m | m.warped_filename if File.exist? m.warped_filename} + user_own_maps.map{|m| m.warped_png_filename if File.exist? m.warped_png_filename}\n files.compact!\n\n total_size = files.inject(0) {| result, file | result + File.size(file) }\n\n return total_size\n end", "def memsize; RAtlas::memsize(@storage);end", "def update_limit_check(final_book_zip,prod_folder) \n book_size=File.size(final_book_zip)\n accepted_size=(book_size*@max_update_limit.to_i())/100\n update_size=0\n @files = Dir.glob(prod_folder+\"**/**\")\n for file in @files\n if !File::directory?(file )\n if file.to_s()!=final_book_zip\n update_size= update_size+File.size(file)\n end\n end\n end \n if update_size>accepted_size\n delete_update_folder(update_size-accepted_size,prod_folder,final_book_zip)\n end\nend", "def raw_size\n valid_blobs.map(&:raw_size).sum\n end", "def get_size\n\t\tend", "def update_file_size\n size = File.size(self.file_path)\n if !self.image_size? or self.image_size != size\n self.update_attributes({:image_size => size})\n end\n end", "def bytes\n case hydra_model\n when \"Collection\"\n super\n else\n fetch(Solrizer.solr_name(\"file_size\", :stored_sortable, type: :long))\n end \n end", "def fbe_size\n 8\n end", "def fbe_size\n 8\n end", "def fbe_size\n 8\n end", "def fbe_size\n 8\n end", "def size\n @size ||= File.size(file)\n end", "def size_header\n 2 + 2 + 1\n end", "def filesize\n @descriptive_detail.filesize\n end", "def size\n @size \n end", "def size\n @size \n end", "def interpret_size(size)\n case size\n when /k$/i then size.to_i * 1024\n when /m$/i then size.to_i * 1024 * 1024\n when /g$/i then size.to_i * 1024 * 1024 * 1024\n else size.to_i\n end\n end", "def load_factor\n @count.fdiv(size)\n end", "def size\n\t\t7500\n\tend", "def check_file(entry, pathname, previous_size)\n size = pathname.size\n if previous_size && (previous_size == size)\n logger.info(\"File stabilized: #{pathname}. Starting: #{entry.job_class_name}\")\n entry.later(pathname)\n nil\n else\n logger.info(\"Found file: #{pathname}. File size: #{size}\")\n # Keep for the next run\n size\n end\n end", "def file_can_fit?(bytes)\n (self.filesize + bytes) < SitemapGenerator::MAX_SITEMAP_FILESIZE && self.link_count < SitemapGenerator::MAX_SITEMAP_LINKS\n end", "def fbe_size\n 1\n end" ]
[ "0.66798526", "0.65998375", "0.6590753", "0.65602523", "0.64207715", "0.63986605", "0.6382927", "0.6381316", "0.63580567", "0.6309444", "0.630816", "0.6279705", "0.6273612", "0.6273612", "0.62481326", "0.62187374", "0.6187421", "0.6159184", "0.6142946", "0.61356705", "0.60522634", "0.60522634", "0.60242236", "0.59796655", "0.59724236", "0.5963091", "0.5941249", "0.59277815", "0.59180206", "0.59179026", "0.591413", "0.5907354", "0.5892618", "0.58802015", "0.5869536", "0.5863092", "0.5853324", "0.58348864", "0.5834805", "0.5825751", "0.5825651", "0.5825651", "0.5825651", "0.5825651", "0.5825651", "0.5825651", "0.5825651", "0.5825651", "0.5825651", "0.5825651", "0.5815224", "0.58032364", "0.58014804", "0.57877564", "0.5774782", "0.57592016", "0.5757323", "0.5756112", "0.57345504", "0.57304436", "0.5728877", "0.57277524", "0.57084924", "0.57084924", "0.57071143", "0.5704605", "0.56966335", "0.5680983", "0.56769115", "0.56765467", "0.56747997", "0.56747997", "0.567044", "0.56679374", "0.5657683", "0.56469893", "0.5646536", "0.56426895", "0.5639449", "0.5636314", "0.56325054", "0.5630419", "0.5620071", "0.5610243", "0.56042165", "0.5596893", "0.55949867", "0.55949867", "0.55949867", "0.55949867", "0.55947655", "0.5592728", "0.55906814", "0.5585206", "0.5585206", "0.5583682", "0.5575509", "0.5568369", "0.5562838", "0.5562837", "0.55618525" ]
0.0
-1
delete the default shipment and create split shipments out of it
def split_shipment! self.shipments.destroy_all units = self.inventory_units.includes(:variant=>:product) units.group_by{|u| u.variant.product.brand_id}.each do |brand_id,units| s = Spree::Shipment.create!({ :order => self, :shipping_method => shipping_method, :address => self.ship_address, :inventory_units => units}, :without_protection => true) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_shippment(items)\n fill_boxes(items)\n shippment_object\n make_json_object\n end", "def shipped\n \n end", "def create_shipment!\n shipping_method(true)\n\n if shipment.present?\n shipment.update_attributes!(:shipping_method => shipping_method)\n else\n self.shipments << Shipment.create!({ :order => self,\n :shipping_method => shipping_method,\n :address => self.ship_address}, :without_protection => true)\n end\n \n end", "def auto_book_shipment(company_id: nil, customer_id: nil, shipment_id: nil)\n nil\n end", "def shipment\n @shipment ||= Shipment.new(:order => order, :address => ship_address)\n end", "def destroy\n @ship_placement.destroy\n respond_to do |format|\n format.html { redirect_to ship_placements_url, notice: 'Ship placement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @payable = Payable.find(params[:payable_id])\n @payable_shipment = @payable.payable_shipments.find(params[:id])\n @payable_shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to payable_payable_shipments_url(payable) }\n format.json { head :ok }\n end\n end", "def destroy\n @ship_group.destroy\n respond_to do |format|\n format.html { redirect_to ship_groups_url, notice: 'Ship group was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create_manual_shipment(ship_origin, ship_dest, articles_table)\n create_shipment.click\n destination.select ship_dest\n origin.select ship_origin\n sleep 1\n articles_table.hashes.each do |row|\n # go through all the numbered article types\n article_types_numbered.each_with_index do |at, index|\n quantities_numbered[index].set row[\"Quantity\"] if at.text.include? row[\"Article Name\"]\n end\n\n #go through all the unnumbered article types\n article_types_unnumbered.each_with_index do |at, index|\n # checking include? here because article name may contain \"Open Label\" or \"Unnumbered\"\n quantities_unnumbered[index].set row[\"Quantity\"] if at.text.include? row[\"Article Name\"]\n end\n end\n\n search.click if !search[:class].include? \"disabled\"\n sleep 1\n\n if create_new_shipment[:class].include? \"disabled\"\n raise \"Could not find any article types passed to create shipment. Check your passed values.\"\n else\n create_new_shipment.click\n sleep 1\n confirm_create.click\n end\n end", "def destroy\n @shipment_type = ShipmentType.find(params[:id])\n @shipment_type.kill\n\n respond_to do |format|\n format.html { redirect_to(shipment_types_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to company_shipments_path}\n format.json { head :no_content }\n end\n end", "def produce_spaceship(type = :freighter, size: :m, **custom_components)\n components = {enging: :standard,\n seats: :standard,\n subwoofer: :none\n }\n components.merge!(custom_components)\nend", "def build_request\n b = builder\n xml = b.DeleteShipmentRequest(:xmlns => \"http://fedex.com/ws/ship/v#{VERSION[:major]}\") do\n build_authentication(b)\n build_version(b, \"ship\", VERSION[:major], VERSION[:intermediate], VERSION[:minor])\n b.TrackingNumber tracking_number\n b.DeletionControl deletion_control\n end\n end", "def put_ship(ship_size)\n free_field = free_fields.select { |field| field.count >= ship_size }.sample\n random = rand(0..free_field.count - ship_size)\n @ships << free_field.slice(random, ship_size)\n @ships.last.each { |cell| cell.ship = '#' }\n end", "def after_ship\n inventory_units.each { |u| u.ship! if u.can_ship? && !u.state?('shipped') }\n end", "def create\n \n @max_ships=50 \n @ship_group = ShipGroup.new(ship_group_params)\n @ship_name =Unit.find(@ship_group.unit_id).name\n respond_to do |format|\n if @ship_group.save\n format.html { redirect_to @ship_group, notice: 'Ship group was successfully created.' }\n format.json { render :show, status: :created, location: @ship_group }\n else\n format.html { render :new }\n format.json { render json: @ship_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n \n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end", "def ship\n raise NotAllowed unless submitted?\n raise NotAllowed if shipped?\n\n apply(Orders::OrderShipped.strict(data: {\n order_uuid: @uuid,\n order_number: @number\n }))\n end", "def create\n #@shipment = Shipment.new(params[:shipment])\n @order = Order.find_by_number(params[:order_number])\n\n respond_to do |format|\n if @order.shipments.count == 0\n @shipments = Shipment.create_shipments_with_items(@order)\n format.html { redirect_to(admin_fulfillment_shipments_path(:order_id => @order.number), :notice => 'Shipment was successfully created.') }\n else\n form_info\n flash[:alert] = 'This order already has a shipment.'\n format.html { redirect_to(edit_admin_fulfillment_order_path( @order )) }\n end\n end\n end", "def create\n #@shipment = Shipment.new(params[:shipment])\n @order = Order.find_by_number(params[:order_number])\n\n respond_to do |format|\n if @order.shipments.count == 0\n @shipments = Shipment.create_shipments_with_items(@order)\n format.html { redirect_to(admin_fulfillment_shipments_path(:order_id => @order.number), :notice => 'Shipment was successfully created.') }\n else\n form_info\n flash[:alert] = 'This order already has a shipment.'\n format.html { redirect_to(edit_admin_fulfillment_order_path( @order )) }\n end\n end\n end", "def turn_off_multiple_shipment_charges\n multiple_shipping_charges = self.adjustable.adjustments.where(:source_type => \"Spree::Shipment\")\n if multiple_shipping_charges.length > 1\n multiple_shipping_charges.each_with_index do |shipping_charges, index|\n next if index == 0\n shipping_charges.update_attribute_without_callbacks(:amount, 0)\n shipping_charges.update_attribute_without_callbacks(:eligible, false)\n end\n end\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n raise error\n @shipment.update_attributes(:active => false)\n\n\n # We need to add capability to refund and return to stock in one large destroy form\n\n respond_to do |format|\n format.html { redirect_to(admin_fulfillment_shipments_url( :order_id => (@shipment.order.number)) ) }\n end\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n raise error\n @shipment.update_attributes(:active => false)\n\n\n # We need to add capability to refund and return to stock in one large destroy form\n\n respond_to do |format|\n format.html { redirect_to(admin_fulfillment_shipments_url( :order_id => (@shipment.order.number)) ) }\n end\n end", "def shipment_params\n params.require(:shipment).permit(:id, :start_at, :created_at, :updated_at,\n :cancel, :deleted_at, :product_id, :pallets_number, :box_number, :weight,\n :package_type_id, :bag_type_id, :pallet_type_id,\n :comments, :sale_id, :price, :plu, :count, :product_color, :customer_id,\n :box_type_id, :weight, :po_number, :quality,\n pallet_type_attributes: [:id, :name, :_destroy],\n bag_type_attributes: [:id, :name, :_destroy],\n box_type_attributes: [:id, :name, :_destroy],\n product_attributes: [:id, :name, :_destroy],\n count_types_attributes: [:id, :name, :_destroy])\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipments_url) }\n format.xml { head :ok }\n end\n end", "def create_shipment\n to_address = create_address(name: @order.recipient_full_name,\n street1: @order.ship_address.address1,\n street2: @order.ship_address.address2,\n city: @order.ship_address.city,\n state: @order.ship_address.state.try(:name) || '',\n zip: @order.ship_address.zipcode,\n country: @order.ship_address.country.try(:iso) || '',\n phone: @order.ship_address.phone,\n email: @order.email)\n\n from_address = if @carrier == 'auspost'\n create_address(name: Settings['shipping_address']['company_name'],\n street1: Settings['shipping_address']['auspost']['street1'],\n city: Settings['shipping_address']['auspost']['city'],\n state: Settings['shipping_address']['auspost']['state'],\n zip: Settings['shipping_address']['auspost']['zipcode'],\n country: Settings['shipping_address']['auspost']['country'],\n phone: Settings['shipping_address']['auspost']['phone'],\n email: Settings['shipping_address']['email'])\n else\n create_address(name: Settings['shipping_address']['company_name'],\n street1: Settings['shipping_address']['street1'],\n city: Settings['shipping_address']['city'],\n state: Settings['shipping_address']['state'],\n zip: Settings['shipping_address']['zipcode'],\n country: Settings['shipping_address']['country'],\n phone: Settings['shipping_address']['phone'],\n email: Settings['shipping_address']['email'])\n end\n\n parcel = EasyPost::Parcel.create(\n length: Settings['parcel']['length'],\n width: Settings['parcel']['width'],\n height: Settings['parcel']['height'],\n weight: Settings['parcel']['weight']\n )\n\n customs_info = EasyPost::CustomsInfo.create(\n contents_type: Settings['parcel']['easypost']['contents_type'],\n contents_explanation: Settings['parcel']['description'],\n eel_pfc: Settings['parcel']['easypost']['eel_pfc'],\n non_delivery_option: Settings['parcel']['easypost']['non_delivery'],\n restriction_type: Settings['parcel']['easypost'][' restriction_type'],\n customs_items: [{\n description: Settings['parcel']['description'],\n quantity: @order.item_count.to_i,\n value: Settings['parcel']['easypost']['value'],\n weight: Settings['parcel']['weight'],\n origin_country: Settings['shipping_address']['country'],\n hs_tariff_number: Settings['parcel']['hs_tariff_number'],\n currency: Settings['parcel']['currency']\n }]\n )\n\n @shipment = EasyPost::Shipment.create(\n to_address: to_address,\n from_address: from_address,\n parcel: parcel,\n customs_info: customs_info,\n carrier_accounts: [@ship_carrier],\n options: { print_custom_1: @order.item_skus_with_quantity, print_custom_2: @order.number, label_format: 'PNG', currency: 'SGD' }\n )\n @shipment.try(:id).present? && @shipment.try(:messages).present? ? return_shipment_errors : buy_shipment\n end", "def new2\n @order = Order.find( :first,\n :conditions => [\"user_id = ? and status = ? and id = ?\", self.current_user.id, \"incomplete\", params[:id]]) \n begin\n @lastorder = Order.find(:last, :conditions => [\"user_id = ? and id != ?\", self.current_user.id, @order.id])\n if @lastorder != nil\n @order.user_fullname = @lastorder.user_fullname\n @order.user_address = @lastorder.user_address\n @order.user_areacode = @lastorder.user_areacode\n @order.user_city = @lastorder.user_city\n @order.user_country = @lastorder.user_country\n @order.payment_chosen = @lastorder.payment_chosen\n else\n @order.payment_chosen = \"bank\"\n end\n \n \n \n @order.step = \"step2\"\n a = 0 \n price = 0\n unique_del = 0\n deliverables = @order.deliverables.find(:all)\n deliverables.each do |d| #How many items are there in total to ship? What is the total price for the items?\n a += d.amount\n price += d.price.to_f * d.amount.to_i\n unique_del += 1 \n end\n \n #Check whether a deliverable has a listing with the amount in stock of 0 or even removed, then remove this deliverable\n deliverables.each do |d| #How many items are there in total to ship? What is the total price for the items?\n remove = 0\n nr_of_rem = 0\n l = Listing.find(d.listing.id)\n if l.removed == \"1\"\n nr_of_rem += 1\n remove = 1\n end\n if remove == 1\n d.destroy\n if unique_del == nr_of_rem\n #delete total order\n @order.destroy\n end\n \n raise e\n end\n end\n @a = a\n @price = price\n @cost_of_shipping = 0\n rescue\n if remove == 1\n flash[:notice_bad] = t(\"controllers.orders.s10\")\n else\n flash[:notice_bad] = t(\"controllers.orders.s11\") \n end\n \n redirect_to cart_path(1)\n else\n end\n end", "def remove_shipment(id, shipment_ids=[])\n response = Shippo::API.post(\"#{url}/#{CGI.escape(id)}/remove_shipments\", shipment_ids)\n self.from(response)\n end", "def shipment\n @shipment ||= shipments.last\n end", "def shipment\n @shipment ||= shipments.last\n end", "def get_fleet_by_ship(ship_id_defender)\n fleet = FightingFleet.create(user: get_user_by_ship_id(ship_id_defender))\n fleet.ship_groups.each do |group|\n instance = Ship.find_by(:id => ship_id_defender).get_unit_instance(group.unit)\n group.number = instance.amount\n group.save\n end\n fleet.save\n return fleet\n end", "def shipments(force=false)\n if !force and defined? @shipment\n @shipment\n elsif force or (self.shipping? and Shipment.possible_status.include? self.shipping.status)\n @shipment = super\n end\n end", "def seed_data\n\n target_isolates = rand(20) + 5\n shipment = shipments.new({:target_isolates => target_isolates})\n\n base_objective = BaseObjective.parent_objectives.to_a.sample\n if base_objective.first == \"objective_b\"\n bacteria_type = {:bacteria_type => ObjectiveB::bacteria_type_values.sample.last}\n code_prefix = bacteria_type.values.last\n end\n\n objective = base_objective.last\n\n starting_code = starting_code_for(objective, code_prefix ||= nil)\n\n shipment.target_isolates.times do |x|\n parent_objective = objective.new(bacteria_type ||= {})\n \n code_number = parent_objective.code_prefix+\"#{(starting_code + x + 1)}\"\n\n isolate = shipment.isolates.new({code_number: code_number})\n isolate.parent = parent_objective\n isolate.save\n end\n\n shipment.update_attribute(:objective_name, \"#{objective.name} #{objective.new(bacteria_type ||= {}).name}\")\n\n end", "def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: 'Shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def after_ship\n inventory_units.each &:ship!\n Spree::OrderMailer.giftor_shipped_email(self.order).deliver() unless Spree::MailLog.has_email_been_sent_already?(self.order, 'Order::giftor_shipped_email')\n Spree::OrderMailer.giftee_shipped_email(self.order).deliver() if (self.order.is_gift? && !self.order.gift.email.blank? && !Spree::MailLog.has_email_been_sent_already?(order, 'Order::giftee_shipped_email'))\n end", "def shipment\n @shipment ||= shipments.first\n end", "def produce_spaceship6(type = :freighter, size: 10, **custom_components)\r\n components = {\r\n engine: :standard,\r\n seats: :standard,\r\n subwoofer: :none\r\n }\r\n components.merge!(custom_components)\r\nend", "def destroy\n @job_ship.destroy\n redirect_to job_ships_url, notice: 'Job ship was successfully destroyed.'\n end", "def create\n @shipment = current_user.shipments.build(shipment_params_one)\n #Generating Tracking Number for Shipment\n @shipment.tracking = Shipment.set_tracking\n @shipment.tmx = current_user.service_type\n\n #Saving Address\n if @shipment.save_to_book\n @address = Address.save_address(current_user,params[:address].permit!)\n else\n if params[:client][:id].present?\n @address = Address.find(params[:client][:id])\n else\n @address = Address.save_address(current_user,params[:address].permit!)\n end\n end\n @shipment.client = @address.id\n respond_to do |format|\n if @shipment.save\n #Set Packages Detail\n #Detail.set_pakages(@shipment,params[:packages_detail]) if @shipment.packages?\n\n #Sending mail for new shipment to user\n ShipmentMailer.new_shipment(@shipment).deliver if @shipment.notification\n format.html { redirect_to @shipment}\n format.json { render action: 'show', status: :created, location: @shipment }\n\n else\n format.html { render action: 'new' }\n format.json { render json: @shipment.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @shipmment_item.destroy\n respond_to do |format|\n format.html { redirect_to shipmment_items_url, notice: \"Shipmment item was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ship_methods = ShipMethods.find(params[:id])\n @ship_methods.destroy\n\n respond_to do |format|\n format.html { redirect_to(ship_methods_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end", "def update_shipments_with_qb_ids(shipment_id, object)\n file_name = \"#{path.base_name}/#{path.pending}/shipments_#{shipment_id}_.json\"\n\n begin\n contents = amazon_s3.convert_download('json', amazon_s3.bucket.object(file_name).get.body.read)\n amazon_s3.bucket.object(file_name).delete\n rescue Aws::S3::Errors::NoSuchKey => _e\n puts \"File not found[update_shipments_with_qb_ids]: #{file_name}\"\n end\n\n contents.first['items'] = object[:extra_data]['line_items']\n .map do |item|\n item['sales_order_txn_line_id'] = item['txn_line_id']\n item['sales_order_txn_id'] = item['txn_id']\n item.delete('txn_line_id')\n item.delete('txn_id')\n item\n end\n\n contents.first['adjustments'] = object[:extra_data]['adjustments']\n .map do |item|\n item['sales_order_txn_line_id'] = item['txn_line_id']\n item['sales_order_txn_id'] = item['txn_id']\n item.delete('txn_line_id')\n item.delete('txn_id')\n item\n end\n\n amazon_s3.export file_name: file_name, objects: contents\n\n begin\n order_file_name = \"#{path.base_name}/#{path.ready}/orders_#{object[:object_ref]}_.json\"\n amazon_s3.bucket.object(order_file_name).delete\n rescue Aws::S3::Errors::NoSuchKey => _e\n puts \"File not found[delete orders]: #{file_name}\"\n end\n end", "def generate_individual_ships\n # for each ship type, create it and then assign it to its accessor\n %w|carrier battleship submarine warship destroyer|.each do |type|\n ship = Ship.new(type)\n case type\n when \"carrier\"\n then @carrier = ship\n when \"battleship\"\n then @battleship = ship\n when \"submarine\"\n then @submarine = ship\n when \"warship\"\n then @warship = ship\n when \"destroyer\"\n then @destroyer = ship\n end\n @fleet << ship # for fleet-building\n end\n end", "def mark_as_shipped\n @context.no_going_back\n\n list = @data.display_list\n update_from_form(list)\n\n list.each do |address_entry|\n address_entry.each_order do |order_info|\n next unless order_info.ship_order\n\n order = Order.with_id(order_info.order_id)\n\n if order\n order.mark_as_shipped\n else\n raise \"Missing order\"\n end\n\n end\n end\n @session.pop\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(ships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(ships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shiping.destroy\n respond_to do |format|\n format.html { redirect_to shipings_url, notice: 'Shiping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @product_shipment.destroy\n respond_to do |format|\n format.html { redirect_to product_shipments_url, notice: 'Product shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def build_xml\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.DeleteShipmentRequest(:xmlns => \"http://fedex.com/ws/ship/v10\"){\n add_web_authentication_detail(xml)\n add_client_detail(xml)\n add_version(xml)\n xml.TrackingId {\n xml.TrackingIdType \"FEDEX\"\n xml.TrackingNumber @tracking_number\n } \n xml.DeletionControl \"DELETE_ALL_PACKAGES\"\n }\n end\n builder.doc.root.to_xml\n end", "def updatePosition\n super\n\n Bullet.BulletInstances.each { |bullet|\n if collision?(bullet)\n bullet.destroy\n explode\n end\n }\n\n Ship.ShipInstances.each { |ship|\n if collision?(ship)\n ship.destroy\n explode\n end\n }\n end", "def create\n shipment_args = params[:shipment].clone\n \n Shipment.prepare_industry(shipment_args)\n \n # unless Industry.exists?(shipment_args[:industry_id])\n # shipment_args[:new_industry_name] = shipment_args[:industry_id]\n # shipment_args[:industry_id] = nil\n # end\n\n shipment_args[:destination_id] = shipment_args[:destination_id].first unless shipment_args[:destination_id].blank?\n\n @shipment = Shipment.new(shipment_args)\n\n respond_to do |format|\n if @shipment.save\n format.html { redirect_to root_url, notice: 'Shipment was successfully created.' }\n format.json { render json: @shipment, status: :created, location: @shipment }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_sales_for_shippable_file(n, e=nil)\n \n if @file_type == :shippable_file\n s, l, a, rfsb = create_sales_and_return_data(n)\n self.sales += s\n self.line_items += l\n self.addresses += a\n self.ready_for_shipment_batch = rfsb\n rfsb.delete\n Sale.deep_delete_sales(s)\n elsif @file_type == :address_completion_file\n s, e, rfsb = create_sales_and_return_data_address_completion_file(n, e)\n self.sales += s\n self.erroneous_sales += e\n \n self.ready_for_shipment_batch = rfsb\n rfsb.delete\n Sale.deep_delete_sales(s)\n end\n \n end", "def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end", "def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end", "def destroy\n @society_member_ship.destroy\n respond_to do |format|\n format.html { redirect_to society_member_ships_url, notice: 'Society member ship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def ship; end", "def set_shipment\n @shipment = @order.shipments.find(params[:id])\n end", "def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: 'Shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: 'Shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: 'Shipment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def shipped\n order = Order.last\n\n OrderMailer.shipped(order)\n end", "def destroy\n @memeber_ship = MemeberShip.find(params[:id])\n @memeber_ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(memeber_ships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shipment_type.destroy\n respond_to do |format|\n format.html { redirect_to shipment_types_url, notice: 'Shipment type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mentorship = Mentorship.find(params[:id])\n @mentorship.destroy\n\n respond_to do |format|\n format.html { redirect_to(mentorships_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to shipments_url, notice: \"Shipment was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def create\n @shipment = Shipment.new(params[:shipment])\n @shipment.user_id = session[:s_user_id]\n @error = false\n if params[:shipment][:customer_id] != \"\" and params[:shipment][:contract_id] != \"\"\n @error = true\n flash[:error] = \"Either select a customer or a contract for the shipment but not both. A contract belongs to a customer. \" \n end\n \n if params[:shipment][:contract_id] != \"\"\n @contract = Contract.find(@shipment.contract_id)\n @shipment.customer_id = @contract.party_id\n @shipment.cropplan_id = @contract.cropplan_id\n end\n \n if params[:shipment][:shipto_street].blank? || params[:shipment][:shipto_street].nil?\n if !@shipment.customer_id.nil?\n @party = Party.find(@shipment.customer_id)\n if @party.ship_address1.blank? || @party.ship_address1.nil?\n #use mailing address\n @shipment.shipto_street = @party.partyaddress1\n @shipment.shipto_city = @party.partycity\n @shipment.shipto_state = @party.partystate\n @shipment.shipto_postalcode = @party.partypostalcode\n else\n #use shipping address\n @shipment.shipto_street = @party.ship_address1\n @shipment.shipto_city = @party.ship_city\n @shipment.shipto_state = @party.ship_state\n @shipment.shipto_postalcode = @party.ship_postalcode\n end\n end\n end\n \n respond_to do |format|\n if @error == false\n if @shipment.save\n \n format.html { redirect_to(:action => :edit, :id => @shipment.id, :notice => 'Shipment was successfully created.') }\n format.xml { render :xml => @shipment, :status => :created, :location => @shipment }\n else\n @error = true\n \n end\n end\n \n if @error == true\n \n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n get_current_user\n @types = Type.find_by_typename('invoice_terms')\n @terms = 'none'\n \n @terms = @types.type_value_string \n \n \n @shipments = Invoice.get_ready_shipments(@current_user.id, params[:customer_id], params[:start_date], params[:stop_date])\n @count = 0\n \n @shipments.each do |sh|\n @invoice = Invoice.new(params[:invoice])\n @invoice.shipment_id = sh.id\n @invoice.ship_amount = sh.ship_amount\n @invoice.ship_charge = sh.shipping_charge\n @invoice.total_amount = sh.ship_amount.to_f + sh.shipping_charge.to_f\n @types = Type.find_by_typename('invoice_number')\n \n @invno = @types.type_value_integer + 1\n @types.type_value_integer = @invno\n @types.save\n \n @invoice.invoice_number = @invno\n @invoice.invoice_status = 'NEW'\n @invoice.invoice_terms = @terms\n @invoice.invoice_date = Date.today.to_date\n @invoice.user_id = @current_user.id \n @count += 1\n @invoice.save\n \n @shipment = Shipment.find(sh.id)\n @shipment.ship_status = 'invoiced'\n @shipment.save\n end\n\n respond_to do |format|\n message = @count.to_s + ' - Invoice(s) were successfully created.'\n format.html { redirect_to('/invoice_generator', :notice => message) }\n format.xml { render :xml => @invoice, :status => :created, :location => @invoice }\n\n end\n end", "def delete_snat\n super\n end", "def destroy\n @kojenadults_classe_ship = KojenadultsClasseShip.find(params[:id])\n @kojenadults_classe_ship.destroy\n\n respond_to do |format|\n format.html { redirect_to(kojenadults_classe_ships_url) }\n format.xml { head :ok }\n end\n end", "def shipped\n order = Order.second\n items = LineItem.where(order_id: order.id)\n items.each do |item|\n order.line_items << item\n end\n OrderNotifier.shipped(order)\n end", "def before_confirm\n return if defined?(SpreeProductAssembly)\n return unless @order.checkout_steps.include? 'delivery'\n\n packages = @order.shipments.map(&:to_package)\n @differentiator = Spree::Stock::Differentiator.new(@order, packages)\n @differentiator.missing.each do |variant, quantity|\n @order.contents.remove(variant, quantity)\n end\n end", "def ship!(consignment_number, user = nil)\n run_callbacks :ship do\n self.shipped_at = Time.now\n self.shipper = user if user\n self.status = 'shipped'\n self.consignment_number = consignment_number\n self.save!\n Shoppe::OrderMailer.shipped(self).deliver_now\n end\n end", "def set_ship_group\n @ship_group = ShipGroup.find(params[:id])\n end", "def destroy\n @ship.destroy\n respond_to do |format|\n format.html { redirect_to ships_url, notice: 'Ship was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update_shipments_with_payment_ids(shipment_id, object)\n file_name = \"#{path.base_name}/#{path.pending}/shipments_#{shipment_id}_.json\"\n\n begin\n contents = amazon_s3.convert_download('json', amazon_s3.bucket.object(file_name).get.body.read)\n amazon_s3.bucket.object(file_name).delete\n rescue Aws::S3::Errors::NoSuchKey => _e\n puts \"File not found[update_shipments_with_payment_ids]: #{file_name}\"\n end\n\n contents.first['payment'] = object\n\n amazon_s3.export file_name: file_name, objects: contents\n\n begin\n order_file_name = \"#{path.base_name}/#{path.ready}/payments_#{object[:object_ref]}_.json\"\n amazon_s3.bucket.object(order_file_name).delete\n rescue Aws::S3::Errors::NoSuchKey => _e\n puts \"File not found[delete payments]: #{file_name}\"\n end\n end", "def create_handling_charge!\n shipments.each do |shipment|\n next unless shipment.needs_handling_charge? && shipment.stock_location.calculator\n\n amount = shipment.stock_location.calculator.compute_shipment(shipment)\n next if amount == 0\n\n shipment.adjustments.create!(\n source: shipment.stock_location,\n adjustable: shipment,\n amount: amount,\n order: shipment.order,\n label: 'Handling'\n )\n end\n end", "def destroy\n # Logic to delete a record\n @shipment = Shipment.find(params[:id])\n @shipment.destroy\n\n respond_to do |format|\n format.html { redirect_to shipments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ready_for_shipment_batch = ReadyForShipmentBatch.find(params[:id])\n @ready_for_shipment_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to ready_for_shipment_batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipment.destroy\n respond_to do |format|\n format.html { redirect_to preshipments_path, notice: 'Shipment was successfully destroyed.' }\n #format.json { head :no_content }\n end\n end", "def destroy\n @add_shipping.destroy\n respond_to do |format|\n format.html { redirect_to add_shippings_url, notice: 'Add shipping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipdesign = Shipdesign.find(params[:id])\n @shipdesign.destroy\n\n respond_to do |format|\n format.html { redirect_to shipdesigns_url }\n format.json { head :no_content }\n end\n end", "def set_shipment\n @company = Company.find(params[:company_id])\n @shipment = Shipment.find(params[:id])\n\n if !@shipment.Client_ID.blank?\n @client=Client.find(@shipment.Client_ID)\n @shipment.Client_Name = @client.Name\n @shipment.Pickup_Location = @client.Address\n end\n end", "def set_ship_placement\n @ship_placement = ShipPlacement.find(params[:id])\n end", "def create_peer_ship\n\t\tif self.replied == true\n\t\t\tuser_id = self.user_id\n\t\t\tuser2_id = self.to\t\t\t\n\t\t\tPeership.create(:user_id => user_id, :user2_id => user2_id) unless Peership.exists?(user_id, user2_id) \t\t\t\n\t\tend\n\t\t#Delete request object unless user did not make a selection \n\t\tPeerRequest.destroy(self.id) unless self.replied == nil \t\t\n\tend", "def shipped\n OrderNitifierMailer.shipped\n end", "def destroy\n @shipment_product.destroy\n respond_to do |format|\n format.html { redirect_to shipment_products_url, notice: 'Shipment product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipment = Shipment.find(params[:id])\n begin\n @shipment.destroy \n rescue ActiveRecord::DeleteRestrictionError => e\n @shipment.errors.add(:base, e)\n end \n respond_to do |format|\n\n if e.nil?\n\n format.html { redirect_to(\"/shipmentview\", :notice => 'shipment was successfully deleted.') }\n format.xml { head :ok }\n else \n format.html { render :action => \"edit\" }\n end\n\n\n end\n end", "def createShips\n for ship in Ship.find(:all, :order => \"id\")\n self.my_ships.build(ship_id: ship.id)\n self.enemy_ships.build(ship_id: ship.id)\n end\n self.save\n end", "def destroy\n self.littles.each do | little|\n little.big_id = nil;\n end\n self.positions.each do | pos |\n pos.dke_info_id = nil;\n end\n return super\n end", "def update_shipments(tracking_number, shipped_at)\n shipment = order.shipments.first\n\n shipment.shipped_at = shipped_at\n shipment.tracking = tracking_number\n success = shipment.ship\n\n copy_errors(shipment) unless success\n success\n end", "def create_shipment(params)\n %w[value weight_kg contact vehicles origin destination].each do |k|\n return k unless params.key?(k)\n end\n\n Shipment.create(value: params[:value], weight_kg: params[:weight_kg],\n contact_name: params[:contact][:name],\n contact_phone: params[:contact][:phone],\n origin_city: params[:origin][:city],\n origin_state: params[:origin][:state],\n origin_load_at: params[:origin][:load_at],\n destination_city: params[:destination][:city],\n destination_state: params[:destination][:state],\n destination_deliver_at: params[:destination][:deliver_at])\n params[:vehicles].each do |v|\n ShipmentVehicle.create(vehicle_type: v[:type],\n vehicle_body_type: v[:body_type],\n shipment_id: Shipment.last.id)\n end\n Shipment.last.id\n end", "def destroy\n @ship = Ship.find(params[:id])\n @ship.destroy\n\n respond_to do |format|\n format.html { redirect_to ships_url }\n format.json { head :ok }\n end\n end", "def destroy\n WasabbiModship.transaction do\n @wasabbi_modship = WasabbiModship.find(params[:id])\n @wasabbi_modship.destroy\n\n respond_to do |format|\n format.html { redirect_to(wasabbi_modships_url) }\n format.xml { head :ok }\n end\n end\n end", "def destroy\r\n @shipmentmethod.destroy\r\n respond_to do |format|\r\n format.html { redirect_to shipmentmethods_url, notice: 'Shipmentmethod was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def mark_as_shipped\n self.shipped_at = Time.now\n end", "def create_shipment(origin, destination, packages, options={})\n origin, destination = upsified_location(origin), upsified_location(destination)\n options = @options.merge(options)\n packages = Array(packages)\n access_request = build_access_request\n ship_confirm_request = build_ship_confirm(origin, destination, packages, options)\n response = commit(:shipconfirm, save_request(access_request.gsub(\"\\n\",\"\") + ship_confirm_request.gsub(\"\\n\",\"\")), (options[:test] || false))\n parse_ship_confirm_response(origin, destination, packages, response, options)\n end" ]
[ "0.61928374", "0.59945863", "0.59641236", "0.58702356", "0.5850442", "0.576921", "0.5718929", "0.57001406", "0.56667674", "0.5660817", "0.56591797", "0.56439507", "0.56239814", "0.5610756", "0.55948067", "0.55864877", "0.5574602", "0.5569819", "0.5567483", "0.5567483", "0.55569357", "0.55488557", "0.55488557", "0.55419034", "0.5537152", "0.5526106", "0.55257523", "0.5492742", "0.54896784", "0.54896784", "0.54814786", "0.5477423", "0.5468504", "0.5466709", "0.5466297", "0.5457718", "0.5456977", "0.54352915", "0.54116684", "0.5405834", "0.5377137", "0.5374952", "0.5374952", "0.5374952", "0.5361152", "0.53497803", "0.5341537", "0.5339518", "0.5339518", "0.5337437", "0.5328073", "0.53267074", "0.5318668", "0.53072", "0.5301869", "0.52928764", "0.52928764", "0.5290566", "0.5280862", "0.52793413", "0.52734727", "0.52734727", "0.52734727", "0.52704424", "0.5264446", "0.5262317", "0.52579176", "0.52554977", "0.5250563", "0.5249665", "0.5241845", "0.5240207", "0.5239383", "0.5234944", "0.52308756", "0.5229891", "0.5222814", "0.5220221", "0.5219921", "0.5214336", "0.5210898", "0.52082014", "0.52018416", "0.5185599", "0.5180277", "0.51794666", "0.515912", "0.5155634", "0.51505274", "0.51497585", "0.51434803", "0.5138831", "0.51362497", "0.51323134", "0.5129267", "0.5121954", "0.5111843", "0.51114386", "0.51043946", "0.5102766" ]
0.6811934
0
private update adjustment for shipment without passing order
def update_adjustments self.adjustments.reload.each do |adjustment| if adjustment.originator.class == Spree::Shipment adjustment.update! else adjustment.update!(self) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_order\n # If there is no adjustment for the current gift package, just create one here unless there already is one for the gift package\n if self.gift_package_id && self.gift_package_id > 0 && self.adjustments.gift_packaging.where(:originator_id => self.gift_package_id).count == 0\n self.gift_package.adjust(self) \n end \n # Then update all adjustments\n self.update_adjustments\n # update the order totals, etc.\n order.update!\n end", "def ship_order\n self.update_attributes(status: 2)\n end", "def update\n @order.update_attribute(:state, 'cart')\n if params[:shipments_attributes].present?\n if cookies[:board_id].present?\n @order.room_cookie = cookies[:board_id]\n end\n if cookies[:portfolio_id].present?\n @order.portfolio_cookie = cookies[:portfolio_id]\n end\n #params[:shipments_attributes].each do |key, value|\n #\n # shipment = @order.shipments.where(id: value[:id]).first\n # if shipment.present?\n # rate = shipment.shipping_rates.where(id: value[:selected_shipping_rate_id]).first\n #\n # if rate.present?\n # shipment.update_attributes({selected_shipping_rate_id: rate.id, cost: rate.cost})\n # end\n # end\n # shipment.adjustments.create(amount: shipment.cost, source_type: 'Spree::Order', order_id: @order.id, label: 'Shipment')\n #\n # #if @order.adjustments.where(label: 'Shipment').blank?\n # #@order.adjustments.shipping.create(amount: @order.shipments.sum(:cost), source_type: 'Spree::Shipment' ,label: 'Shipment')\n # #end\n #end\n if @order.update_from_params(params, permitted_checkout_attributes)\n persist_user_address\n unless @order.next\n\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to one_page_checkout_path and return\n end\n\n if @order.completed?\n @order.payments.destroy_all if request.put?\n @order.update_totals\n # @order.update(shipment_total: @order.shipments.sum(&:cost))\n shipment_total = @order.shipments.sum(&:cost)\n @order.update(total: @order.item_total + @order.additional_tax_total + shipment_total + @order.promo_total + @order.adjustment_total,shipment_total: shipment_total)#+ @order.adjustment_total\n unless @order.confirmation_delivered?\n @order.deliver_order_confirmation_email\n @order.update_columns(send_order_confirmation_email: true, order_confirmation_sent: true)\n end\n # Rails.logger.info session[:order_id]\n # session[:order_id] = nil\n if @order.subscribe == true\n @subscriber = Spree::Subscriber.find_by_email(@order.email)\n if @subscriber.present?\n @subscriber.update_attribute(\"last_subscribed_at\", Time.now)\n else\n sub = Spree::Subscriber.create(:email => @order.email, :last_subscribed_at => Time.now)\n Rails.logger.info \"ADDED TO MAILCHIMP LIST\" if sub.add_subscriber_to_mailchimp('subscribers')\n end\n end\n\n if @order.user_id.nil? and @order.email.present?\n user = Spree::User.find_by_email(@order.email)\n @order.update_columns(user_id: user.id) if user\n end\n\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n cookies[:user_movement_id] = nil\n redirect_to order_confirmation_path\n else\n redirect_to checkout_state_path(@order.state)\n end\n else\n\n render :edit\n end\n else\n @order.errors.add(:shipments, \"Can't be blank\")\n flash[:error] = @order.errors.full_messages.join(\"\\n\")\n redirect_to cart_path\n end\n\n end", "def update_order\n if order.present?\n order.price = order.order_items.pluck(:total_price).sum rescue 0\n order.shipping_price = 0\n order.total_price = order.price + order.shipping_price\n order.save\n end\n end", "def update\n @shipment.address = @shipment_presenter.address \n @shipment.tracking = @shipment_presenter.shipment.tracking\n @shipment.cost = @shipment_presenter.shipment.cost\n @shipment.shipped_at = Time.now if params[:mark_shipped] \n unless @shipment_presenter.valid? and @shipment.save\n render :action => \"edit\" and return\n end\n @order.state_events.create(:name => t('ship'), :user => current_user, :previous_state => @order.state) if params[:mark_shipped]\n flash[:notice] = t('updated_successfully')\n redirect_to edit_object_url\n end", "def update_order_item\n \n end", "def update\n @sales_order = SalesOrder.find(params[:id])\n\n # update delivery_status(includes reschedule devlivery_plan) \n if not params[:delivery_status]\n # if current_issue_cart.line_items.exists? \n @sales_order.issue_unissue_po_line_items_when_so_and_cart_diffs(current_issue_cart) \n\n @sales_order.line_items.clear\n @sales_order.add_line_items_from_issue_cart(current_issue_cart)\n @sales_order.save\n # Cart.destroy(session[:issue_cart_id])\n # session[:issue_cart_id] = nil \n # end \n end \n\n respond_to do |format|\n if @sales_order.update_attributes(params[:sales_order])\n format.html { redirect_to @sales_order, notice: 'Sales order was successfully updated.' }\n format.json { head :no_content } \n else\n @orders = Order.where(customer_id: @sales_order.customer.id)\n @cart = current_issue_cart\n\n session[:cart_order_type] = \"SalesOrder\"\n session[:cart_order_id] = @sales_order.id\n\n format.html { render action: \"edit\", notice: 'Sales order can not update.' }\n format.json { render json: @sales_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @order.update_attributes(object_params)\n fire_event('spree.checkout.update')\n \n unless apply_coupon_code\n respond_with(@order) { |format| format.html { render :edit } }\n return\n end\n\n # Add Klarna invoice cost\n klarna_payments = @order.payments.valid.where(source_type: \"Spree::KlarnaPayment\")\n \n if @order.adjustments.klarna_invoice_cost.count <= 0 && klarna_payments.any?\n @order.adjustments.create(:amount => klarna_payments.first.payment_method.preferred(:invoice_fee),\n :source => @order,\n :originator => klarna_payments.first.payment_method,\n :locked => true,\n :label => I18n.t(:invoice_fee))\n @order.update!\n elsif @order.adjustments.klarna_invoice_cost.count > 0 \n @order.adjustments.klarna_invoice_cost.destroy_all\n @order.update!\n end\n \n if @order.next\n state_callback(:after)\n else\n flash[:error] = @order.get_error # Changed by Noc\n respond_with(@order, :location => checkout_state_path(@order.state))\n return\n end\n\n if @order.state == \"complete\" || @order.completed?\n flash.notice = t(:order_processed_successfully)\n flash[:commerce_tracking] = \"nothing special\"\n respond_with(@order, :location => completion_route)\n else\n respond_with(@order, :location => checkout_state_path(@order.state))\n end\n else\n respond_with(@order) { |format| format.html { render :edit } }\n end\n end", "def update!\n update_totals\n update_payment_state\n # update_adjustments\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n \n update_attributes_without_callbacks({\n :state => \"complete\"\n }) \n \n logger.info 'UPDATED ORDER'\n # update_hooks.each { |hook| self.send hook }\n end", "def update\n @shipment.tmx = current_user.service_type\n if @shipment.update(shipment_params_one)\n #Update Packages Detail\n #Detail.update_pakages(@shipment,params[:packages_detail]) if @shipment.packages?\n #Sending mail for Updation of shipment to user\n ShipmentMailer.updated_shipment(@shipment).deliver if @shipment.notification && !current_user.is_admin?\n respond_to do |format|\n format.html {\n redirect_to @shipment\n }\n format.json { render action: 'show', status: :created, location: @shipment }\n end\n else\n flash.now[:notice] = 'Shipment was Not Updated.'\n render action: 'edit'\n end\n end", "def update_order(result)\n create_asendia_shipment_record(result['Status'], result['Error'])\n @transaction_id = result['ParcelId']\n @tracking_number = nil\n shipment = @order.shipment\n shipment.tracking = @tracking_number\n shipment.save\n shipment.ship!\n @order.line_items.each do |line_item|\n @success_orders << [\"#{@order.number}, #{line_item.sku}, #{@tracking_number}, #{@transaction_id}, #{line_item.quantity}, #{@order.completed_at}, #{(@order.ship_address.country.try(:name) || '').delete(',')}\"]\n end\n end", "def update\n @shipment = Shipment.find(params[:id])\n\n respond_to do |format|\n if @shipment.update_attributes(allowed_params)\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n form_info\n format.html { render :action => \"edit\" }\n end\n end\n end", "def set_shipper_update\n if order_status_id == 1\n Order.find(id).update_column(:shipper_id, 7)\n Order.find(id).update_column(:ship_date, nil)\n Order.find(id).update_column(:shipping_number, nil)\n end\n end", "def process\n Trade::Shipment.update_all(\n { taxon_concept_id: @taxon_relationship.taxon_concept_id },\n {\n taxon_concept_id: @old_taxon_relationship.taxon_concept_id,\n reported_taxon_concept_id: @taxon_relationship.other_taxon_concept_id\n }\n )\n end", "def update_product\n if inbound_order? || quantity_adjustment?\n product.update(stock: product.stock + quantity)\n else outbound_order?\n product.update(stock: product.stock - quantity)\n end\n end", "def update_shipped!\n update!(shipped: completed_transfer_items.sum(:amount))\n end", "def update!(**args)\n @adjustment_info = args[:adjustment_info] if args.key?(:adjustment_info)\n @date = args[:date] if args.key?(:date)\n @date_unreliability_info = args[:date_unreliability_info] if args.key?(:date_unreliability_info)\n @source = args[:source] if args.key?(:source)\n end", "def update!\n update_totals\n # update_payment_state\n\n shipments.each { |shipment| shipment.update!(self) }#(&:update!)\n update_shipment_state\n\n update_adjustments \n\n # give each of the shipments a chance to update themselves\n # update totals a second time in case updated adjustments have an effect on the total\n update_totals\n \n update_attributes({\n :payment_state => payment_state,\n :item_total => item_total,\n :adjustment_total => adjustment_total,\n :payment_total => payment_total,\n :total => total\n })\n end", "def separate_shipment_costs\n return if @order.canceled?\n extracted_total = 0.to_d\n @order.shipments.each do |shipment|\n # Spree 2.1.x: shipment costs are expressed as order adjustments linked through source to the shipment\n # Spree 2.2.x: shipments have a cost which is authoritative, and one or more adjustments (shiptax, etc)\n cost = if shipment.respond_to?(:adjustment)\n shipment.adjustment.try(:amount) || 0.to_d\n else\n shipment.cost + shipment.adjustment_total\n end\n\n if cost > 0\n extracted_total += cost\n shipment.adjustment.open if shipment.respond_to? :adjustment\n shipment.adjustments.delete_all if shipment.respond_to? :adjustments\n shipment.shipping_rates.delete_all\n shipment.cost = 0\n shipment.add_shipping_method(rop_tbd_method, true)\n shipment.save!\n end\n end\n\n if extracted_total > 0\n # TODO: is Standard Shipping the best name for this? Should i18n happen?\n @order.adjustments.create(amount: extracted_total, label: \"Standard Shipping\", mandatory: false)\n @order.save!\n end\n end", "def recalculate\n line_items = LineItem.where(\"order_id = '#{order.attrs['id']}'\")\n sub_total = 0\n line_items.map do |li|\n sub_total += li.attrs['amount'].to_f * li.attrs['quantity'].to_i\n end\n order.attrs = order.attrs.merge('sub_total' => sub_total)\n if sub_total > DISCOUNTABLE_AMOUNT\n @order.attrs = order.attrs.merge('amount' => sub_total - DISCOUNT, 'discont_desc' => \"#{DISCOUNT} OFF For order more than #{DISCOUNTABLE_AMOUNT}\")\n else\n @order.attrs = order.attrs.merge('amount' => sub_total, 'discont_desc' => '')\n end\n\n @order.save\n\n end", "def update\n @order = Order.find(params[:id])\n redirect_to :action => \"index\" and return if current_admin.limited_sales_rep && !current_admin.users.include?(@order.user)\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to(admin_orders_url, :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n\t\t@state, @path_to, flash[:notice] = flash[:true_if_editing_false_if_shipping] ? \\\n\t\t\t[\"Amended\", orders_path, 'Order was successfully updated.' ] \\\n\t\t\t: \\\n\t\t\t[\"Shipped\", ship_orders_path(:previous_id => @order.id), 'Order was successfully shipped.']\n respond_to do |format|\n if @order.update_attributes(params[:order])\n\t\t\t\tNotifier.order_shipped(@order, @state).deliver\n format.html { redirect_to @path_to }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def change_delivery_drink_quantity\n # get data to add/update\n @data = params[:id]\n @data_split = @data.split(\"-\")\n @add_or_subtract = @data_split[0]\n @user_delivery_id = @data_split[1]\n \n # get User Delivery info\n @account = Account.find_by_id(current_user.account_id)\n @user_subscription = UserSubscriptionn.where(account_id: current_user.account_id, currently_active: true).first\n @user_delivery_info = UserDelivery.find_by_id(@user_delivery_id)\n @delivery = Delivery.find_by_id(@user_delivery_info.delivery_id)\n @inventory = Inventory.find_by_id(@user_delivery_info.inventory_id)\n \n # adjust drink quantity, price and inventory\n @original_quantity = @user_delivery_info.quantity\n @drink_price = @user_delivery_info.inventory. + @user_subscription.pricing_model\n @current_inventory_reserved = @inventory.reserved\n if @add_or_subtract == \"add\"\n # set new quantity\n @new_quantity = @original_quantity + 1\n \n #set new price totals\n @original_subtotal = @delivery.subtotal\n @new_subtotal = @original_subtotal + @drink_price\n @new_sales_tax = @new_subtotal * @account.delivery_zone.excise_tax\n @new_total_price = @new_subtotal + @new_sales_tax\n \n # update reserved inventory \n @new_inventory_reserved = @current_inventory_reserved + 1\n @inventory.update(reserved: @new_inventory_reserved)\n\n # update user delivery info\n @user_delivery_info.update(quantity: @new_quantity)\n \n else\n # set new quantity\n @new_quantity = @original_quantity - 1\n \n #set new price totals\n @original_subtotal = @delivery.subtotal\n @new_subtotal = @original_subtotal - @drink_price\n @new_sales_tax = @new_subtotal * @account.delivery_zone.excise_tax\n @new_total_price = @new_subtotal + @new_sales_tax\n \n # update reserved inventory \n @new_inventory_reserved = @current_inventory_reserved - 1\n @inventory.update(reserved: @new_inventory_reserved)\n \n # update user delivery info\n @user_delivery_info.update(quantity: @new_quantity)\n end\n \n # update delivery info and note a confirmation email should be sent\n @delivery.update(subtotal: @new_subtotal, sales_tax: @new_sales_tax, total_drink_price: @new_total_price, delivery_change_confirmation: false)\n \n # add change to the customer_delivery_changes table\n @customer_delivery_change = CustomerDeliveryChange.where(user_delivery_id: @user_delivery_id).first\n if !@customer_delivery_change.blank?\n @customer_delivery_change.update(new_quantity: @new_quantity, change_noted: false)\n else\n @new_customer_delivery_change = CustomerDeliveryChange.new(user_id: current_user.id, \n delivery_id: @user_delivery_info.delivery_id,\n user_delivery_id: @user_delivery_id,\n beer_id: @user_delivery_info.beer_id,\n original_quantity: @original_quantity,\n new_quantity: @new_quantity,\n change_noted: false)\n @new_customer_delivery_change.save!\n end\n \n # set new delivery details and delivery info\n @next_delivery = UserDelivery.where(delivery_id: @user_delivery_info.delivery_id)\n @delivery = Delivery.find_by_id(@user_delivery_info.delivery_id)\n \n # count number of drinks in delivery\n @drink_count = @next_delivery.sum(:quantity)\n # count number of drinks that are new to user\n @next_delivery_cooler = 0\n @next_delivery_cellar = 0\n @next_delivery_small = 0\n @next_delivery_large = 0\n # cycle through next delivery drinks to get delivery counts\n @next_delivery.each do |drink|\n @quantity = drink.quantity\n if drink.cellar == true\n @next_delivery_cellar += (1 * @quantity)\n else\n @next_delivery_cooler += (1 * @quantity)\n end\n if drink.large_format == true\n @next_delivery_large += (1 * @quantity)\n else\n @next_delivery_small += (1 * @quantity)\n end\n end \n \n respond_to do |format|\n format.js\n end # end of redirect to jquery\n end", "def update_sales_entry\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n @sales_entry = @sales_order.active_sales_entries.where(:id => params[:id]).first\n \n @quantity = params[:sales_entry][:quantity].to_i\n @selling_price_per_piece = BigDecimal( params[:sales_entry][:selling_price_per_piece] )\n \n @new_object = @sales_entry.update_item( @quantity, @selling_price_per_piece)\n @has_no_errors = @new_object.errors.messages.length == 0 \n \n @item = @sales_entry.item\n end", "def update\n @order = Order.find_by(id: session[:order_id])\n @order.assign_attributes(order_update_params[:order])\n @order.last_four_cc = params[:order][:last_four_cc][-4..-1]\n\n if @order.save\n @user = User.find_by(id: session[:user_id])\n redirect_to :shipping\n else\n @user = User.find_by(id: session[:user_id])\n render :edit\n end\n end", "def update!(**args)\n @customer = args[:customer] if args.key?(:customer)\n @enable_orderinvoices = args[:enable_orderinvoices] if args.key?(:enable_orderinvoices)\n @kind = args[:kind] if args.key?(:kind)\n @line_items = args[:line_items] if args.key?(:line_items)\n @notification_mode = args[:notification_mode] if args.key?(:notification_mode)\n @payment_method = args[:payment_method] if args.key?(:payment_method)\n @predefined_delivery_address = args[:predefined_delivery_address] if args.key?(:predefined_delivery_address)\n @promotions = args[:promotions] if args.key?(:promotions)\n @shipping_cost = args[:shipping_cost] if args.key?(:shipping_cost)\n @shipping_cost_tax = args[:shipping_cost_tax] if args.key?(:shipping_cost_tax)\n @shipping_option = args[:shipping_option] if args.key?(:shipping_option)\n end", "def update\n @meal = Meal.find(@order.meal_id)\n @cook = Cook.find(@meal.cook_id)\n @price = @meal.meal_cost\n\n # Total Cost\n quantity = order_params[:quantity].to_i\n price = @meal.meal_cost\n total = quantity * price\n @order.cook_total = (total * Constants::COOKS_NET_PRECENTAGE)\n total += (total * Constants::TAX_RATE_LAWNDALE)\n @order.total = total\n @order.total_cost = if @order.delivery\n total + @order.delivery_fee\n else\n total\n end\n\n # Attach an empty review\n @order.review = Review.new\n\n # Pickup / Delivery TODO somewhat sloppy. Doesn't handle errors.\n if params[:inputPickupDelivery] == 'Delivery'\n @order.delivery = true\n else params[:inputPickupDelivery] == 'Pickup'\n @order.pickup = true\n end\n\n # TODO: commented out\n respond_to do |format|\n if @order.update(order_params)\n # if validDate?(order_params, @meal, @order) && @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n\n else\n format.html { render :edit }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n\n user = current_user\n if !user.default_delivery_address || user.default_delivery_address == ''\n user.default_delivery_address = params[:order][:delivery_address]\n end\n if !user.phone_number || user.phone_number == ''\n user.phone_number = params[:order][:customer_phone]\n end\n user.save\n end", "def edit\n @order = current_order(session) || create_order(session)\n shipping_methods = Breeze::Commerce::ShippingMethod.unarchived\n unless @order.shipping_method && shipping_methods.include?(@order.shipping_method)\n if Breeze::Commerce::ShippingMethod.count > 1\n @order.shipping_method = shipping_methods.unarchived.where(:is_default => true).first\n else\n @order.shipping_method = shipping_methods.unarchived.first\n end\n @order.save\n end\n end", "def ship_address_tax_update\n if ship_address and (ship_address_id_changed? or ship_address.changed?)\n create_avalara_tax_adjustment\n end\n end", "def update\n notice = ''\n @order = Order.find(params[:id])\n unless current_member.admin or (!@order.paid and !@order.taken)\n store_location\n flash[:notice] = \"Too late to edit that one, bro.\"\n redirect_to orders_path\n end\n\n # remove empty items\n params[:order][:order_details_attributes].each{ |k,v|\n if v[:id].nil?\n params[:order][:order_details_attributes].delete(k) if v[:quantity].to_f == 0.0 or v[:quantity].strip == ''\n next\n end\n\n if v[:quantity].to_f == 0.0 or v[:quantity].strip == ''\n OrderDetail.find(v[:id]).destroy\n params[:order][:order_details_attributes].delete(k)\n end\n }\n\n # combine same-stock entries\n stock_quantities = {}\n params[:order][:order_details_attributes].each{ |k,v|\n sid = v[:stock_id].to_i\n q = v[:quantity].to_f\n if stock_quantities[sid].nil?\n stock_quantities[sid] = q\n else\n stock_quantities[sid] += q\n OrderDetail.find(v[:id]).destroy unless v[:id].nil?\n params[:order][:order_details_attributes].delete(k)\n end\n }\n params[:order][:order_details_attributes].each{ |k,v|\n params[:order][:order_details_attributes][k][:quantity] = stock_quantities[v[:stock_id].to_i]\n }\n \n unless current_member.admin\n @order.member = current_member\n end\n\n old_stock_quantities = {}\n @order.order_details.each{ |od|\n next if od.stock.nil?\n old_stock_quantities[od.stock.id] = od.quantity\n } \n\n # first check to make sure there is enough stock available\n stock_quantities.each{ |sid,q|\n s = Stock.find(sid)\n old_stock_quantities[sid] = 0.0 if old_stock_quantities[sid].nil?\n qmax = s.quantity + old_stock_quantities[sid]\n if s.limited and qmax < stock_quantities[sid]\n unless current_member.admin\n @order.errors.add \"Limited Stock Item:\",\"Sorry, there are only #{qmax} #{s.product.units} #{s.name} remaining and you have tried to order #{stock_quantities[sid]}.\"\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n return false\n else\n notice = \"Limited Stock Item: There were only #{qmax} \n #{s.product.units} #{s.name} remaining, \n but I let you do it anyway since you're the boss!\"\n end\n elsif !s.limited and qmax < stock_quantities[sid]\n notice = \"You ordered more #{s.name} than is currently in stock. It may be some delay before this order item is available for pick up.\"\n end\n }\n\n # add back quantity and then subtract it off again\n @order.order_details.each{ |od|\n next if od.stock.nil?\n od.stock.quantity += od.quantity\n od.stock.save\n }\n if !@order.paid and params[:order][:paid].to_i == 1\n @order.paid_at = Time.now\n @order.marked_paid_by = current_member\n @order.save\n end\n\n if !@order.taken and params[:order][:taken].to_i == 1\n @order.taken_at = Time.now\n @order.archived = true\n @order.save\n end\n\n # delete items before we add back the new ones\n @order.order_details = []\n @order.save \n\n respond_to do |format|\n \n if @order.update_attributes(params[:order])\n @order.order_details.each{ |od|\n next if od.stock.nil?\n od.stock.quantity -= od.quantity\n od.stock.save\n if @order.archived\n od.archived_name = od.stock.name\n od.archived_cost = od.stock.final_cost\n od.archived_supplier = od.stock.supplier\n od.archived_product = od.stock.product\n od.archived_markup_pct = od.stock.markup_pct\n od.archived_markup_const = od.stock.markup_const\n end\n od.save\n }\n format.html { redirect_to(orders_path, :notice => \"Order was successfully updated. #{notice}\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def checkout\n @order = Order.new :ordered_on => Date.today\n @order.basket = current_basket\n if(request.get?)\n @order.email = current_clerk.email if current_clerk\n @order.shipment_type = \"pickup\" # price is 0 automatically\n else\n order_ps = params.require(:order).permit( :email,:name , :street , :city , :phone , :shipment_type )\n if @order.update_attributes(order_ps)\n new_basket\n OrderMailer.confirm(@order).deliver\n redirect_to shop_order_path(@order), :notice => t(:thanks)\n return\n end\n end\n end", "def process\n Trade::Shipment.where(taxon_concept_id: @old_taxon_relationship.taxon_concept_id,\n reported_taxon_concept_id: @taxon_relationship.other_taxon_concept_id)\n .update_all(taxon_concept_id: @taxon_relationship.taxon_concept_id)\n end", "def stock_adjustment\n if Store.positive?(self.adjustment)\n self.stock_total = self.sku.stock_adjustments.first.stock_total + self.adjustment\n self.sku.update_column(:stock, self.sku.stock + self.adjustment)\n else\n self.stock_total = self.sku.stock_adjustments.first.stock_total - self.adjustment.abs\n self.sku.update_column(:stock, self.sku.stock - self.adjustment.abs)\n end\n end", "def shipped\n corresponding_item = self.item.take\n current_inventory = corresponding_item.inventory_level\n corresponding_item.update_attribute(:inventory_level, (self.quantity + current_inventory)) unless previous.nil?\n self.update_attribute(:shipped_on, date.current.to_date)\n\n def item_exists_and_active?\n all_active_items = Item.active.all.map(&:id)\n if all_active_items.include?(self.item_id)\n return true\n end\n errors.add(:item_id, \"is not an active item at the chess store\")\n return false\n end\n\n def subtotal(date = nil)\n end\n\n def valid_quantity?\n if self.quantity >= 0\n return true\n end\n stock_quantity = self.item.inventory_level\n if (self.quantity* -1) > stock_quantity\n errors.add(:quantity, \"too much purchase quantity\")\n return false\n end\n return true\n end\nend", "def update!\n return if locked?\n set_eligibility\n if originator.present?\n originator.update_adjustment(self, source)\n end\n end", "def payment_adjustment\n @payment_adjustment ||= 0\n end", "def update\n @user = current_user\n @order = Order.find(params[:id])\n @price_plan = Country.get_price_plan_by_country_and_id(current_user.account.country_short, @order.price_plan_id)\n\n if @order.save\n if @order.purchase\n\n @order.update_attributes(kind: 'paypal', state: 'success', completed_at: Time.now.utc)\n @price_plan.mark_promotion_code_for_usage(@order)\n subscription = @user.account.add_subscription(@price_plan, @order)\n subscription.activate\n @user.account.finish_registration()\n\n redirect_to( action: 'success', id: @order )\n else\n redirect_to( action: 'failure', id: @order )\n end\n else\n render action: 'edit'\n end\n end", "def apply_shipping_cost!(shipment)\n cost = shipment.cost(product_pricing)\n unless cost.nil?\n order_items.create(\n product: shipment.shipping_cost_product,\n amount: 1,\n priority: 1e9,\n price: cost.amount,\n tax_rate: cost.tax_rate,\n price_includes_tax: cost.tax_included,\n label: ''\n )\n end\n order_items.reload\n end", "def update\n @order = Order.find(params[:id])\n @order.order_items = []\n @order.coupon_code = session[:coupon] if session[:coupon].present?\n session[:coupon] = @order.coupon_code\n @order.update_attributes order_params\n #@order.order_item_ids = params[:order][:order_item_attributes].keys.map {|a| a.to_i}\n calculate_total\n respond_to do |format|\n if @order.save\n session[:coupon] = nil\n format.html { redirect_to(@order, :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @order.line_items.destroy_all\n @order.update(cost: 0)\n\n order_params[:line_items].each do |item|\n if !item.empty?\n @order.line_items.create(:product_id => item, :order_id => @order.id)\n @order.update(cost: @order.cost + @order.line_items[0].product.price)\n end\n end\n\n respond_to do |format|\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }\n end\n end", "def update\n @order = Order.find(params[:id])\n # shop = ShopifyAPI::Shop.current\n\n # f = ShopifyAPI::Fulfillment.new({order_id: @order.shopify_order_id,\n # location_id: @order.location_id,\n # line_items: @order.shopify_product_id,\n # tracking_number: @order.tracking_numbers})\n # f.prefix_options = { :order_id => @order.shopify_order_id }\n # f.save!\n # respond_to do |format|\n if @order.update(order_params)\n # ShopifyAPI::Fulfillment.new({order_number: @order.shopify_order_id,\n # location_id: @order.location_id,\n # line_items: @order.shopify_product_id,\n # tracking_numbers: @order.tracking_numbers})\n f = ShopifyAPI::Fulfillment.new(\n :location_id => \"#{@order.location_id}\",\n :line_item => \"#{@order.shopify_product_id}\",\n :tracking_number => \"#{@order.tracking_numbers}\",\n :tracking_company => \"USPS\",)\n f.prefix_options = { :order_id => \"#{@order.shopify_order_id}\" }\n f.save!\n # format.html { redirect_to '/', notice: 'Order was successfully updated.' }\n # format.json { render :show, status: :ok, location: @order }\n else\n # format.html { render :edit }\n # format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n # end\n end", "def adjust(data) \n # blow up if no amount or reason have been submitted\n raise RException.new(\"Undefined adjustment amount\") if data[\"amount\"].nil?\n raise RException.new(\"You must provided an adjustment reason\") if data[\"reason\"].nil?\n \n data[\"commissionable\"] = (!data[\"commissionable\"].nil? && data[\"commissionable\"] == 'on') ? true : false\n data[\"invoiceable\"] = (!data[\"invoiceable\"].nil? && data[\"invoiceable\"] == 'on') ? true : false \n \n # create the adjustment helper class\n adj = Invoice::Adjustment.new(data) \n \n # User selected \"[x]Apply to invoice\" on adjustment form. This adjustment will be applied to both teh Payable AND Invoice\n # THIS IS CLEVER BUT TRICKY since if adjusting a vendor cost, we have to hide the client-adjustment in the all-encompassing\n # \"Freight Charge\" InvoiceItem \n if (adj.invoiceable) \n iitem = get_invoice_item\n \n # blow up if we didn't find a corresponding invoice item to apply adjustment to\n raise RException.new(\"Failed to find invoice-item to apply adjustment to\") if iitem.nil? \n \n # tricky here. we've just loaded the InvoiceItem corresponding to this Payable. Since the user selected [x] \"apply to \n # invoice\" for this Payable adjustment, we're going to apply the adjustment to client as well. \n adj.invoice_item = iitem\n iitem.adjust(adj)\n end\n \n self.adjustments << adj.to_h \n self.cost += adj.amount\n \n return (self.save!) ? adj : false \n end", "def update\n if current_user.role?('manager') and !Manager.find(current_user.manager_id).validity\n redirect_to orders_path, notice: t(:manager_not_valid)\n return\n end\n @order = Order.find(params[:id]) \n \n if @order.exported_at\n redirect_to orders_path, notice: t(:not_edit_exported_order) \n end\n \n unless params[:order][:shipping_address_id] == ''\n @select_shipping_address_id = params[:order][:shipping_address_id]\n end \n \n if current_user.manager_id\n @managers = Manager.where(id: current_user.manager_id)\n @warehouses = Manager.find(current_user.manager_id).warehouses\n @shipping_address_ids = ManagerShippingAddress.where(manager_id: current_user.manager_id).collect(&:shipping_address_id)\n @customer_ids= ShippingAddress.where(id: @shipping_address_ids).collect(&:customer_id)\n @customers = Customer.where(validity: true, id: @customer_ids)\n unless params[:customer_id] == ''\n @select_customer_id = params[:customer_id]\n @shipping_addresses = ShippingAddress.where(id: @shipping_address_ids, customer_id: @select_customer_id)\n else\n @select_customer = @order.shipping_address.customer\n @select_customer_id = @select_customer.id\n @shipping_addresses = @select_customer.shipping_addresses.where(id: @shipping_address_ids)\n end\n else\n @managers = Manager.where(validity: true)\n @warehouses = Warehouse.where(validity: true)\n @customers = Customer.where(validity: true)\n unless params[:customer_id] == ''\n @select_customer_id = params[:customer_id]\n @shipping_addresses = Customer.find(params[:customer_id]).shipping_addresses\n else\n @select_customer = @order.shipping_address.customer\n @select_customer_id = @select_customer.id\n @shipping_addresses = @select_customer.shipping_addresses\n end\n end \n \n unless params[:order][:price_list_id] == ''\n @products = PriceList.find(params[:order][:price_list_id]).products.where(validity: true) \n else\n @products = []\n end \n \n if Settings.default_price_list_id and params[:order][:price_list_id].empty?\n params[:order][:price_list_id] = Settings.default_price_list_id\n end\n \n @price_lists = PriceList.where(validity: true)\n @unit_of_measures = UnitOfMeasure.where(validity: true)\n @categories = Category.where(validity: true)\n \n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to @order, notice: t(:order_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @purchase_order = PurchaseOrder.update_order(params, @company.id, @current_user, @financial_year.year.name)\n respond_to do |format|\n if @purchase_order.save\n @purchase_order.register_user_action(request.remote_ip, 'updated')\n format.html { redirect_to(@purchase_order, :notice => 'Purchase order was successfully updated.') }\n format.xml { head :ok }\n else\n @purchase_order.purchase_order_line_items.each do |line_item|\n (2-line_item.purchase_order_taxes.size).times{ line_item.purchase_order_taxes.build }\n end\n @voucher_setting = VoucherSetting.find_by_company_id_and_voucher_type(@company.id, 6)\n @from_accounts = TransactionType.fetch_from_accounts(@company.id,'purchases')\n @to_accounts = Product.get_purchase_products(@company.id)\n @projects = @company.projects.active\n @tax_accounts = TransactionType.fetch_to_accounts(@company.id, 'tax')\n @other_charge_accounts = Account.get_other_expense_on_purchase_accounts(@company)\n @vendor_account_heads = AccountHead.get_customer_and_vendor_account_heads(@company.id)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @purchase_order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit \n @order = current_order || Order.incomplete.\n includes(line_items: [variant: [:images, :option_values, :product]]).\n find_or_initialize_by(guest_token: cookies.signed[:guest_token])\n @order.save! unless @order.id\n puts \"\\n\\n\\n edit guest_token=[#{cookies.signed[:guest_token]}] order=[#{@order.to_json}] \\n\\n\\n\"\n associate_user \n\n @order.assign_default_addresses!\n puts \"\\n\\n\\n\\n edit assign_default_addresses good bill_address=[#{@order.bill_address}]\\n\\n\\n\\n\";\n @order.bill_address = User.find(1).bill_address.try(:clone) unless @order.bill_address\n puts \"\\n\\n\\n\\n edit bill_address good\\n\\n\\n\\n\";\n \n \n # if @order.next\n # puts \"\\n\\n\\n\\n edit order next good\\n\\n\\n\\n\";\n\n # else\n # puts \"\\n\\n\\n\\n edit order next bad\\n\\n\\n\\n\";\n # end\n \n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n\n if (@order[:state] == 'cart')\n if @order.next\n puts \"\\n\\n\\n\\n edit order next cart good\\n\\n\\n\\n\";\n else\n puts \"\\n\\n\\n\\n edit order next cart bad\\n\\n\\n\\n\";\n end\n else\n puts \"\\n\\n\\n\\n edit order state not eq cart\\n\\n\\n\\n\";\n end \n @order.ship_address = User.find(1).ship_address.try(:clone) unless @order.ship_address\n # @updating_params = {order: { bill_address_attributes: [{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"} ] } }\n \n # \n @order.shipments = Spree::Stock::Coordinator.new(@order).shipments unless @order.shipments&.count > 0\n @order.refresh_shipment_rates\n @order.set_shipments_cost\n @order.apply_free_shipping_promotions\n @order.available_payment_methods\n # @updating_params ||= {}\n # @updating_params[:order] ||= {bill_address_attributes:[{city: \"Kriviy Rih\", country_id: 229, state_id: 2975, zipcode: \"50015\"}]}\n # @updating_params[:order][:bill_address_attributes] ||= [{}]\n # @updating_params[:order][:bill_address_attributes].first[:city] = \"Kriviy Rih\"\n # @updating_params[:order][:bill_address_attributes].first[:country_id] = \"229\"\n # @updating_params[:order][:bill_address_attributes].first[:state_id] = \"2975\"\n # @updating_params[:order][:bill_address_attributes].first[:zipcode] = \"50015\"\n # if @order.update_from_params(@updating_params, permitted_checkout_attributes, request.headers.env)\n\n # end\n # @order.bill_address = user.bill_address.try(:clone)\n # @order.create_proposed_shipments \n # @order.refresh_shipment_rates\n # @order.set_shipments_cost\n # @order.apply_free_shipping_promotions\n puts \"\\n\\n\\n edit shipments=[\"+@order.shipments.to_json+\"]\\n\\n\\n\\n\"\n puts \"\\n\\n\\n edit shipment_total=[\"+@order.shipment_total.to_json+\"]\\n\\n\\n\\n\"\n # puts \"\\n\\n\\n edit client_store_ref_path=[#{client_store_ref_path}] \\n\\n\\n\"\n # puts \"\\n\\n\\n edit packages=[\"+Spree::Stock::Coordinator.packages.to_json+\"]\\n\\n\\n\\n\"\n # flash[:error] = \"order1112=[\"+@order.to_json+\"]\\n\\n available_payment_methods=[\"+@order.available_payment_methods.to_json+\"]\"\n end", "def recalibrate_order!\n order.reload\n order.refresh_shipping_cost\n order.save\n end", "def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end", "def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end", "def update\n if @order.completed?\n process_and_add_store_credit(@order)\n end\n\n return orig_update\n end", "def force_update\n begin\n # force retailer change\n if params['target_retailer_id'].present?\n new_retailer = Spree::Retailer.find(params['target_retailer_id'])\n @order.retailer = new_retailer\n end\n\n # force acceptance\n if params['accepted'].present? and params['accepted'] == 'yes'\n @order.update_attribute(:accepted_at, Time.now)\n end\n\n flash[:notice] = 'Forced updates were made to the order.'\n rescue\n flash[:error] = 'Updates could not be applied'\n end\n redirect_to admin_order_path(@order)\n end", "def update\n update_item_count\n update_totals\n if order.completed?\n update_payment_state\n update_shipments\n update_shipment_state\n update_shipment_total\n end\n run_hooks\n persist_totals\n end", "def update_shipments\n shipping_method_filter = order.completed? ? ShippingMethod::DISPLAY_ON_BACK_END : ShippingMethod::DISPLAY_ON_FRONT_END\n\n shipments.each do |shipment|\n next unless shipment.persisted?\n\n shipment.update!(order)\n shipment.refresh_rates(shipping_method_filter)\n shipment.update_amounts\n end\n end", "def update!(**args)\n @invoice_id = args[:invoice_id] if args.key?(:invoice_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @refund_only_option = args[:refund_only_option] if args.key?(:refund_only_option)\n @return_option = args[:return_option] if args.key?(:return_option)\n @shipment_invoices = args[:shipment_invoices] if args.key?(:shipment_invoices)\n end", "def update!(**args)\n @amount = args[:amount] if args.key?(:amount)\n @description = args[:description] if args.key?(:description)\n @finite_billing_cycle_details = args[:finite_billing_cycle_details] if args.key?(:finite_billing_cycle_details)\n @line_item_free_trial_end_time = args[:line_item_free_trial_end_time] if args.key?(:line_item_free_trial_end_time)\n @line_item_index = args[:line_item_index] if args.key?(:line_item_index)\n @line_item_promotion_specs = args[:line_item_promotion_specs] if args.key?(:line_item_promotion_specs)\n @one_time_recurrence_details = args[:one_time_recurrence_details] if args.key?(:one_time_recurrence_details)\n @product = args[:product] if args.key?(:product)\n @product_payload = args[:product_payload] if args.key?(:product_payload)\n @recurrence_type = args[:recurrence_type] if args.key?(:recurrence_type)\n @state = args[:state] if args.key?(:state)\n end", "def update\n @order = Order.find(params[:id])\n sns = params[:order][:serial_numbers_attributes] || {}\n @order.editing = true\n @client = Client.find_by_id(@order.client_id)\n @bill = Bill.find_by_id((@order.bill_id))\n @render = \"#{@order.product_type.downcase}_fields\"\n @product = @order.product_type.downcase.pluralize\n respond_to do |format|\n if @order.update_attributes(params[:order])\n total_due = 0\n @order.parts.each do |part|\n total_due = part.cost + total_due\n end\n @order.client_needs.each do |client_need|\n total_due = client_need.cost + total_due\n end\n @order.update_attribute(:total_due, total_due)\n Progress.create(:short_description => @order.short_description, :full_description => @order.full_description, :user_id => current_user.id, :order_id => @order.id, :branch_id => @order.branch_id) \n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def shipped(order)\n @order = order\n\n puts \">> shipped order email sent\"\n\n mail to: @admin_email, subject: 'Pragmatic Store Order Shipped'\n end", "def order_update\n OrderMailer.order_update\n end", "def update!(**args)\n @amount = args[:amount] if args.key?(:amount)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end", "def update\n respond_to do |format|\n if @shipment.update(shipment_params)\n format.html { redirect_to sale_path id: @shipment.sale_id }\n #format.json { render :show, status: :ok, location: @shipment }\n else\n format.html { render :edit }\n #format.json { render json: @shipment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @payable = Payable.find(params[:payable_id])\n @payable_shipment = @payable.payable_shipments.find(params[:id])\n\n respond_to do |format|\n if @payable_shipment.update_attributes(params[:payable_shipment])\n format.html { redirect_to([@payable_shipment.payable, @payable_shipment], :notice => 'Payable shipment was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @payable_shipment.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params[:order][:existing_order_product_presentations_attributes] ||= {}\n @order = Order.find(params[:id])\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n notice('updated', Order.human_name)\n format.html { redirect_to(@order) }\n format.xml { head :ok }\n else\n error('no_update')\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @batch_id = args[:batch_id] if args.key?(:batch_id)\n @cancel = args[:cancel] if args.key?(:cancel)\n @cancel_line_item = args[:cancel_line_item] if args.key?(:cancel_line_item)\n @in_store_refund_line_item = args[:in_store_refund_line_item] if args.key?(:in_store_refund_line_item)\n @merchant_id = args[:merchant_id] if args.key?(:merchant_id)\n @merchant_order_id = args[:merchant_order_id] if args.key?(:merchant_order_id)\n @method_prop = args[:method_prop] if args.key?(:method_prop)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @order_id = args[:order_id] if args.key?(:order_id)\n @refund = args[:refund] if args.key?(:refund)\n @reject_return_line_item = args[:reject_return_line_item] if args.key?(:reject_return_line_item)\n @return_line_item = args[:return_line_item] if args.key?(:return_line_item)\n @return_refund_line_item = args[:return_refund_line_item] if args.key?(:return_refund_line_item)\n @set_line_item_metadata = args[:set_line_item_metadata] if args.key?(:set_line_item_metadata)\n @ship_line_items = args[:ship_line_items] if args.key?(:ship_line_items)\n @update_line_item_shipping_details = args[:update_line_item_shipping_details] if args.key?(:update_line_item_shipping_details)\n @update_shipment = args[:update_shipment] if args.key?(:update_shipment)\n end", "def confirmation\n @order = Order.find_by(id: session[:order_id])\n @order.assign_attributes(order_update_params[:order])\n\n #updates status if shipping info exists(after order confirmation)\n @order.assign_attributes(order_state: \"paid\") if params[:order][:carrier_code] != nil\n\n if @order.save\n reset_cart\n render :order_confirmation\n else\n @user = User.find_by(id: session[:user_id])\n render :shipping\n end\n end", "def update\n @order = Order.find(params[:id])\n @delivery = @order.delivery\n @member = @order.member\n\n respond_to do |format|\n if @order.update_attributes(params[:order])\n Notifier.order_confirmation(@order, true).deliver\n flash[:notice] = 'Order was successfully updated.'\n format.html { redirect_to order_path(:id => @order, :farm_id => @farm.id) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def shipped\n order = Order.last\n\n OrderMailer.shipped(order)\n end", "def update!(**args)\n @deliver_by_date = args[:deliver_by_date] if args.key?(:deliver_by_date)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @ship_by_date = args[:ship_by_date] if args.key?(:ship_by_date)\n end", "def order_shipped\n @order = order\n\n mail :to => \"sandra_sovane@inbox.lv\", :subject => 'Pragmatic Store Order Shipped'\n end", "def update\n #params[:sale][:existing_purchase_attributes] ||= {}\n respond_to do |format|\n if @sale.update(sale_params) && calculate_taxes(@sale)\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { render :show, status: :ok, location: @sale }\n else\n format.html { render :edit }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @carrier = args[:carrier] if args.key?(:carrier)\n @line_items = args[:line_items] if args.key?(:line_items)\n @operation_id = args[:operation_id] if args.key?(:operation_id)\n @shipment_group_id = args[:shipment_group_id] if args.key?(:shipment_group_id)\n @shipment_id = args[:shipment_id] if args.key?(:shipment_id)\n @shipment_infos = args[:shipment_infos] if args.key?(:shipment_infos)\n @tracking_id = args[:tracking_id] if args.key?(:tracking_id)\n end", "def shipped(order)\n @order = order\n\n mail to: order.e_mail, subject: 'Eloctronic Shop Order Shipped'\n end", "def update!(**args)\n @product = args[:product] if args.key?(:product)\n @quantity_ordered = args[:quantity_ordered] if args.key?(:quantity_ordered)\n @return_info = args[:return_info] if args.key?(:return_info)\n @shipping_details = args[:shipping_details] if args.key?(:shipping_details)\n @unit_tax = args[:unit_tax] if args.key?(:unit_tax)\n end", "def set_shipper_save\n if order_status_id == 1\n Order.find(id).update_column(:shipper_id, 7)\n Order.find(id).update_column(:ship_date, nil)\n Order.find(id).update_column(:shipping_number, nil)\n end\n end", "def update\n respond_to do |format|\n if @shipment.update(shipment_params)\n format.html { redirect_to company_shipments_path}\n format.json { render :show, status: :ok, location: @shipment }\n else\n format.html { render :edit }\n format.json { render json: @shipment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order.earliest_pickup_date = calculate_earliest_pickup_date(:update)\n # Save off original quantity for order_products\n original_quantities = {}\n @order.order_products.each { |order_product| original_quantities[order_product.id] = order_product.quantity }\n respond_to do |format|\n if @order.update(order_params)\n okay = true\n @order.order_products.each do |order_product|\n new_quantity = order_product.quantity\n original_quantity = original_quantities[order_product.id]\n unless (new_quantity == original_quantity)\n product = order_product.product\n new_quantity_in_stock = (product.quantity_in_stock + original_quantity - new_quantity)\n if new_quantity_in_stock < 0 # Desired quantity no longer available\n okay = false if okay\n # Update the order the best we can and notify user of discrepancy\n new_quantity_in_stock = 0\n # The original quantity was already subtracted from the stock; quantity should never have to decrease below what was previously ordered\n new_quantity = original_quantity + product.quantity_in_stock\n order_product.update_attributes(quantity: new_quantity)\n end\n product.update_attributes(quantity_in_stock: new_quantity_in_stock)\n end\n end\n redirect_to(edit_order_path(@order), notice: t('orders.not_available')) and return if (!okay) # \"One or more of the products you selected is not available in the desired quantity. Please review the updated order.\"\n if session[:showing_user]\n format.html { redirect_to @order.user, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n else\n format.html { redirect_to orders_path, notice: t('orders.create') } # \"Order was successfully updated.\"\n format.json { head :no_content }\n end\n else\n format.html { render action: 'edit' }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @shipment_unit_ids = args[:shipment_unit_ids] if args.key?(:shipment_unit_ids)\n @unit_invoice = args[:unit_invoice] if args.key?(:unit_invoice)\n end", "def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end", "def update!(**args)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end", "def shipped\n order = Order.second\n items = LineItem.where(order_id: order.id)\n items.each do |item|\n order.line_items << item\n end\n OrderNotifier.shipped(order)\n end", "def update\n update_item_count\n update_group_state\n update_totals\n if order.completed?\n update_payment_state\n end\n update_order_type\n update_odd_store_id\n update_sale_total # for card deposit\n\n #run_hooks\n persist_totals\n end", "def update_shipments(tracking_number, shipped_at)\n shipment = order.shipments.first\n\n shipment.shipped_at = shipped_at\n shipment.tracking = tracking_number\n success = shipment.ship\n\n copy_errors(shipment) unless success\n success\n end", "def update\n @order = Order.find(params[:order_id])\n if current_user.role?('manager') and !Manager.find(current_user.manager_id).validity\n redirect_to order_order_items_path(@order), notice: t(:manager_not_valid)\n return \n end \n if @order.exported_at\n redirect_to order_path(@order), notice: t(:not_edit_exported_order) \n end\n \n @order_item = OrderItem.find(params[:id])\n @product_ids = ProductPrice.where(price_list_id: @order.price_list_id).select('product_id').map {|x| x.product_id}\n @products = Product.where(validity: true).where(id: @product_ids)\n @select_unit_of_measure = params[:order_item][:unit_of_measure_id]\n @unit_of_measure_ids = ProductUnitOfMeasure.where(product_id: params[:order_item][:product_id]).select('unit_of_measure_id').map {|x| x.unit_of_measure_id}\n @unit_of_measures = UnitOfMeasure.where(id: @unit_of_measure_ids) \n \n respond_to do |format|\n if @order_item.update_attributes(params[:order_item])\n format.html { redirect_to order_order_item_path(@order, @order_item), notice: t(:order_item_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @order_item.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @order = Order.find(params[:id])\n unless @order.delivery_company_id.blank?\n @order.delivery_company_name=DeliveryCompany.find(@order.delivery_company_id).name\n else\n @order.delivery_company_name=\"\"\n end\n order_status_id=params[:order_status_id].to_i\n if @order.current_order_status.id!=order_status_id\n dict={}\n dict[1]=\"未确认\"\n dict[2]=\"确认\"\n dict[4]=\"正在配货\"\n dict[8]=\"配货完成\"\n dict[16]=\"已发货\"\n dict[64]=\"取消\"\n dict[128]=\"过期\"\n#如果订单标记为退货,则积分不返还,这样就省事一些,退货得退钱到现金账户,没有考虑细节,比如部分退换货\n @order.order_statuses << OrderStatus.create(:name=>dict[order_status_id],:value=>order_status_id,:tuangou=>false,:from=>\"后台订单管理\",:url=>request.fullpath)\n if order_status_id==16 and @order.tuangou==true\n email=@order.user.email\n email=\"frederick.mao@gmail.com\"\n title=@order.tuan.sub_title#以后改成edm_title\n mail=TuanMail.order_send(@order,email,title)\n mail.deliver \n logger.debug(\"TTTTTTTTTTTTREEEEEEEEEEEEEEEEEEEEE\")\n elsif order_status_id==16 and @order.tuangou==false\n CoreMail.order_send(@order).deliver\n logger.debug(\"发送已发货邮件\")\n end\n end\n respond_to do |format|\n if @order.update_attributes(params[:order])\n format.html { redirect_to([:admin,@order], :notice => 'Order was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @amount = args[:amount] if args.key?(:amount)\n @amount_pretax = args[:amount_pretax] if args.key?(:amount_pretax)\n @amount_tax = args[:amount_tax] if args.key?(:amount_tax)\n @line_item_id = args[:line_item_id] if args.key?(:line_item_id)\n @product_id = args[:product_id] if args.key?(:product_id)\n @quantity = args[:quantity] if args.key?(:quantity)\n @reason = args[:reason] if args.key?(:reason)\n @reason_text = args[:reason_text] if args.key?(:reason_text)\n end", "def update_deal_costs(deal)\n end", "def shipment_product_cost_help(shipment_detail)\n total_cost = 0\n return total_cost if shipment_detail.nil?\n total_cost -= (shipment_detail.ship_cost || 0)\n total_cost -= (shipment_detail.insured_cost || 0)\n rate = Product.find(shipment_detail.product_id).exchange_rate || 8.3\n total_cost -= (shipment_detail.custom_cost || 0) * rate\n return total_cost.to_i\n end", "def update!(**args)\n @delivery_requirement = args[:delivery_requirement] if args.key?(:delivery_requirement)\n end", "def shipped\n OrderNitifierMailer.shipped\n end", "def adjust!(adjustment)\n updated_quantities = {}\n item_validator = Errors::InsufficientAllotment.new(\"Adjustment exceeds the available inventory\")\n\n adjustment.line_items.each do |line_item|\n\n inventory_item = self.inventory_items.find_by(item: line_item.item)\n next if inventory_item.nil? || inventory_item.quantity == 0\n\n if ((inventory_item.quantity + line_item.quantity) >= 0)\n updated_quantities[inventory_item.id] = (updated_quantities[inventory_item.id] || inventory_item.quantity) + line_item.quantity\n else\n item_validator.add_insufficiency(line_item.item, inventory_item.quantity, line_item.quantity)\n end\n\n end\n\n raise item_validator unless item_validator.satisfied?\n\n update_inventory_inventory_items(updated_quantities)\n end", "def update\n if @order.update_attributes(object_params)\n fire_event('spree.checkout.update')\n\n unless apply_coupon_code\n respond_with(@order) { |format| format.html { render :edit } }\n return\n end\n\n # Add Klarna invoice cost\n @order.add_klarna_fee!\n # Remove Klarna invoice cost\n @order.remove_klarna_fee!\n\n if @order.next\n # FIXME not working\n # state_callback(:after)\n # fix require recheck\n session[:order_id] = nil if @order.completed?\n else\n flash[:error] = @order.get_error # Changed by Noc\n respond_with(@order, location: checkout_state_path(@order.state))\n return\n end\n\n if @order.state == 'complete' || @order.completed?\n flash.notice = Spree.t(:order_processed_successfully)\n flash[:commerce_tracking] = 'nothing special'\n respond_with(@order, location: completion_route)\n else\n respond_with(@order, location: checkout_state_path(@order.state))\n end\n else\n respond_with(@order) { |format| format.html { render :edit } }\n end\n end", "def mark_as_shipped\n @context.no_going_back\n\n list = @data.display_list\n update_from_form(list)\n\n list.each do |address_entry|\n address_entry.each_order do |order_info|\n next unless order_info.ship_order\n\n order = Order.with_id(order_info.order_id)\n\n if order\n order.mark_as_shipped\n else\n raise \"Missing order\"\n end\n\n end\n end\n @session.pop\n end", "def update!(**args)\n @carrier = args[:carrier] if args.key?(:carrier)\n @line_items = args[:line_items] if args.key?(:line_items)\n @shipment_group_id = args[:shipment_group_id] if args.key?(:shipment_group_id)\n @shipment_id = args[:shipment_id] if args.key?(:shipment_id)\n @shipment_infos = args[:shipment_infos] if args.key?(:shipment_infos)\n @tracking_id = args[:tracking_id] if args.key?(:tracking_id)\n end", "def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end", "def ship\n load_info\n @shipment = Shipment.includes({:order_items => :variant}).find(params[:id])\n\n respond_to do |format|\n if @shipment.ship!\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :notice => 'Shipment was successfully updated.') }\n else\n format.html { redirect_to(admin_fulfillment_shipment_path(@shipment, :order_id => @shipment.order.number), :error => 'Shipment could not be shipped!!!') }\n end\n end\n end", "def update!(**args)\n @cost = args[:cost] if args.key?(:cost)\n @paid_offer_type = args[:paid_offer_type] if args.key?(:paid_offer_type)\n end", "def shipped(order)\n @order = order\n mail to: order.email, subject: 'PMAC Store Order Shipped'\n end", "def update\n if @cart.update(order_params)\n flash[:success] = \"Your order has been placed successfully\"\n # order model method 'update_orderitem_status' changes the orderitems status from \"pending\" to \"paid\"\n @cart.update_orderitem_status\n # order model method 'update_product_stock' updates the inventory of the product ro reflect sale\n @cart.update_product_stock\n # updates the card_number stored in the databas -- only store last 4 digits\n @cart.update(card_number: @cart.card_number.split('').last(4).join)\n redirect_to confirm_path\n return\n else\n flash.now[:failure] = \"A problem occurred: Could not place order\"\n render :edit\n end\n end", "def shipped\n OrderNotifer.shipped\n end", "def update_shipment_state\n # get all the shipment states for this order\n shipment_states = shipments.states\n if shipment_states.size > 1\n # multiple shiment states means it's most likely partially shipped\n self.shipment_state = 'partial'\n else\n # will return nil if no shipments are found\n self.shipment_state = shipment_states.first\n if self.shipment_state\n # shipments exist but there are unassigned inventory units\n self.shipment_state = 'partial'\n end\n end\n\n self.state_changed('shipment')\n end", "def update_work_order_on_update\n _ok = true\n _woi = WorkOrderItem.find_by_delivery_note_item_id(id)\n if !_woi.nil?\n if work_order.blank?\n _woi.destroy\n else\n _woi.attributes = { work_order_id: work_order_id, product_id: product_id, description: description, quantity: quantity, cost: cost,\n price: price, tax_type_id: tax_type_id, store_id: store_id, charge_account_id: charge_account_id,\n updated_by: delivery_note.updated_by.blank? ? delivery_note.created_by : delivery_note.updated_by }\n if !_woi.save\n _ok = false\n else\n # Update totals\n update_work_order_totals(work_order_id)\n end\n end\n end\n _ok\n end", "def shipped\n \n end" ]
[ "0.75130665", "0.7189034", "0.70065576", "0.6834643", "0.67360175", "0.6710495", "0.6707694", "0.67011046", "0.6621398", "0.6618038", "0.65752834", "0.65631765", "0.6539716", "0.6537501", "0.6527779", "0.6524986", "0.64819205", "0.6447702", "0.64275545", "0.642652", "0.6398819", "0.6386859", "0.6335598", "0.6334975", "0.6328422", "0.6325594", "0.6324812", "0.63223267", "0.6308041", "0.6306556", "0.6297827", "0.62850946", "0.6281802", "0.62816113", "0.62679684", "0.6266582", "0.6261963", "0.6243217", "0.6234978", "0.6229933", "0.62244284", "0.6217127", "0.6214417", "0.6212784", "0.6208885", "0.6205984", "0.6204064", "0.6204064", "0.6201522", "0.61881596", "0.6180723", "0.61788225", "0.6178616", "0.6174951", "0.6174344", "0.61729634", "0.61703265", "0.61619985", "0.61618125", "0.6160526", "0.61599696", "0.61593276", "0.6156347", "0.6153824", "0.61510664", "0.61460197", "0.61435825", "0.61411977", "0.61410266", "0.6137212", "0.6128094", "0.6112553", "0.6110561", "0.6097504", "0.6090959", "0.6082393", "0.6082393", "0.6078669", "0.6077434", "0.60743934", "0.60734284", "0.6069605", "0.60691965", "0.60676634", "0.6066927", "0.60647464", "0.6063543", "0.6056576", "0.6054282", "0.6048039", "0.6047988", "0.6047354", "0.6047354", "0.6043488", "0.6039628", "0.6035709", "0.60260147", "0.602513", "0.6023038", "0.6023034" ]
0.67873484
4
Check wallets by currency
def process info = [] Currency.all.each do |currency| if currency.coin group_id = StratumWalletGroup.get_id(1, 'cointrade') # Check locally if currency[:stratum_wallet_id].nil? or currency[:stratum_wallet_id] == 0 # Load from api, or create wallet_eid = StratumWallet.get_id(currency.id, group_id, currency) if wallet_eid.nil? @logger.error "Failed loading/creating wallet #{currency.code}" else # Update Redis currency.update_stratum_wallet_id(wallet_eid) end end #Update currencies memory list info << "#{currency.code} group #{group_id} stratum_wallet_id = #{currency.stratum_wallet_id}" end end @logger.info "Define Stratum wallets: #{JSON.pretty_generate(info)} " rescue SystemMailer.wallet_mapping_error({}, $!.message, $!.backtrace.join("\n")) @logger.error "Failed to map: #{$!}" @logger.error $!.backtrace.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_currencies?\n debit_account.currency?(amount.currency) &&\n credit_account.currency?(amount.currency)\n end", "def fetch_wallet(funds_type, currency_iso_code)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}/#{currency_iso_code}\")\n end", "def same_currency?(currency1, currency2); end", "def same_currency?\n same_currency_cuenta? && same_currency_reserva?\n end", "def coin_exists_on_withdrawal\n \t\treturn if deposited\n \t\tdeposits = Transaction.where(user_id: user_id, coin_id: coin_id, deposited: true)\n \t\twithdrawals = Transaction.where(user_id: user_id, coin_id: coin_id, deposited: false)\n \t\tbalance = deposits.count - withdrawals.count\n \t\terrors.add(:deposited, \"invalid coins\") if balance <= 0 \n \tend", "def my_account\n accounts.currency_code_is(\"flc\").first\n end", "def ==(currency)\n if currency.amount == @amount &&\n currency.currency_code == @currency_code\n true\n else\n false\n end\n end", "def with_currency(account, cur, &block)\n if cur.nil?\n halt 400, {\n status: \"FAIL\",\n code: \"02\",\n message: \"currency is required\"\n }.to_json\n end\n cur = cur.upcase\n if account[:currencies].include? cur\n if block_given?\n yield(cur)\n else\n cur\n end\n else\n halt 400, {\n status: \"FAIL\",\n code: \"02\",\n message: \"currency not supported\"\n }.to_json\n end\n end", "def currency_required? \n deposit_type?\n end", "def fetch_wallets(funds_type = nil)\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}\")\n end", "def check_balances(num)\n @balance.each do |key, value|\n if value.negative?\n puts \"Line #{@blocks[num].block_number}: Invalid block, address #{key} has #{value} billcoins!\"\n return false\n end\n end\n true\n end", "def check_for_curr\n res = false\n not_matched_currency = []\n val_arr = [@txt_val1, @txt_val2, @txt_val3, @txt_val4, @txt_val5, @txt_val_ttl]\n val_arr.each do |val|\n not_matched_currency = false unless val.text.to_s.chr == \"$\"\n end\n res = false unless not_matched_currency.empty?\n res\n end", "def payment_allowed?(acct_no, amount)\n if DB[:Account].where(AcctNo: acct_no).first[:Balance].to_i <\n amount.to_i.fdiv(100)\n return false\n end\n true\n end", "def ==(other_currency); end", "def same_currency?(currency1, currency2)\n currency1.upcase == currency2.upcase\n end", "def same_currency?(currency1, currency2)\n currency1.upcase == currency2.upcase\n end", "def same_currency?(currency1, currency2)\n currency1.upcase == currency2.upcase\n end", "def valid_coin(coin_input)\n coins = [1,5,10,25]\n if coins.include?(coin_input)\n puts \"Total inserted: #{coin_input}\"\n else\n \"Not a valid coin.\"\n end\n end", "def wallet\n # urls\n binance_url = \"http://bit.ly/binance-coinmarket\"\n coinbase_url = \"http://bit.ly/coinbasemacsfreeman\"\n wirex_url = \"https://bit.ly/2QgCLRH\"\n\n # names\n wirex_name = \"Wirex\"\n coinbase_name = \"CoinBase\"\n binance_name = \"Binance\"\n\n #messages\n wirex_msg1 = \"\\tWirex is the easiest wallet to use!\\n\"\n wirex_msg2 = \"\\tGet a visa card related to your cryptos!\\n\"\n wirex_msg3 = \"\\tWirex has just launched its own crypto!\"\n wirex_msg = wirex_msg1 + wirex_msg2 + wirex_msg3\n\n # concatenate\n wirex = wirex_url + \" (\" + wirex_name + \")\\n\" + wirex_msg\n coinbase = coinbase_url + \" (\" + coinbase_name + \")\"\n binance = binance_url + \" (\" + binance_name + \")\"\n\n dashes = \"-\" * 2 * coinbase.length\n # menu with options to choose\n puts dashes\n puts \"Option 1: #{wirex}\"\n puts \"Option 2: #{coinbase}\"\n puts \"Option 3: #{binance}\"\n puts dashes\nend", "def available_currency\n # GROUP THE ORDER BY THE CURRENCY, AND TOTAL THE AMOUNT FOR THAT CURRENCY\n grouped_orders = orders.group_by(&:converted_currency)\n grouped_orders.map{|c| {c[0].denomination => c[1].map(&:purchase_amount).reduce(:+)}}\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 @wallets = Wallet.all\n # @currency = Currency.first\n end", "def transfer_swincoin(amount, payer, payee, key_private)\r\n payer_peer = search_peers_by_port(payee)\r\n if (payer_peer != -1)\r\n new_block(amount, payer, payee, key_private)\r\n else\r\n puts \"Transaction failed. The payee port does not exist!\".red\r\n $status = \"Transaction failed. The payee port does not exist!\"\r\n end\r\nend", "def list_coins\n endpoint = \"#{HOST}/v1/cryptocurrency/map\"\n get(endpoint)\n end", "def defines? currency\n currencies.include?(country_map[currency] ? country_map[currency] : currency)\n end", "def test_should_currency_of_same_amount_and_code\n currency1 = Currency.new(\"USD\", 1.0)\n currency2 = Currency.new(\"USD\", 1.0)\n assert_equal currency1, currency2\n end", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end", "def current_wallet\n # currency_wallet\n @participant ? betting_pool_wallet : points_wallet\n end", "def accounts_payable?\n type == 'ACCPAY'\n end", "def balances?(tk); 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 get_merchant(filtered_txaction_name, sign)\n # don't try to find matches for UNKNOWN transactions (BugzId: 607)\n return if filtered_txaction_name.to_s =~ /UNKNOWN(?: PAYEE)?$/\n\n if account_ids.any? && txaction = Txaction.find(:first, :select => \"merchant_id\",\n :conditions => [\"account_id in (?) \\\n and filtered_name = ? \\\n and merchant_id is not null \\\n and status = ? \\\n and amount #{sign >= 0 ? '>= 0' : '< 0'}\",\n account_ids, filtered_txaction_name, Constants::Status::ACTIVE],\n :order => \"updated_at desc\")\n Merchant.find(txaction.merchant_id)\n end\n end", "def find_price_by_currency(currency)\n self.prices.find_by_currency(currency)\n end", "def wallet_has_at_least?( wallet, amount )\n\t\tbalance = self.balance_for( wallet, true )\n\t\tself.log.debug \"Balance for wallet %s: %p\" % [ wallet, balance ]\n\t\treturn balance >= amount\n\tend", "def cash?\n (payment_method == CASH)\n end", "def is_currency(token)\n _is_in(token, @currency_tags)\n end", "def wallet\n get 'wallet'\n end", "def check_currency_code_validity\n if available_codes.include?(currency_code)\n true\n else\n raise Exception.new(\"Unsupported currency code: #{currency_code}\")\n end\n end", "def exists?(code)\n available_currencies.include?(code)\n end", "def balances\n Crypto.available.active.sort_by(&:name).map do |crypto|\n account = accounts.find { |a| a.crypto_id == crypto.id }\n filtered_nodes = nodes.select{ |n| n.crypto_id == crypto.id && ['online', 'new'].include?(n.status) }\n if account.nil?\n {\n btc: 0.0,\n fee: crypto.percentage_conversion_fee,\n has_nodes: false,\n name: crypto.name,\n slug: crypto.slug,\n symbol: crypto.symbol,\n usd: 0.0,\n value: 0.0,\n wallet: nil,\n withdrawable: crypto.withdrawable?\n }\n else\n crypto_pricer = CryptoPricer.new(account.crypto)\n btc = crypto_pricer.to_btc(account.balance, 'sell')\n usd = crypto_pricer.to_usdt(account.balance, 'sell')\n {\n btc: btc,\n fee: crypto.percentage_conversion_fee,\n has_nodes: filtered_nodes.present?,\n name: account.name,\n slug: crypto.slug,\n symbol: account.symbol,\n usd: usd,\n value: account.balance,\n wallet: account.wallet,\n withdrawable: crypto.withdrawable?\n }\n end\n end\n end", "def balance(currency)\n\t\treturn @balance[currency]\n\tend", "def check(payment)\n retval\n end", "def can_buy_drug?(price, qty)\n wallet > (price * qty) \n end", "def cash?\n self.bil_types.include?(CASH_BILLING.to_s)\n end", "def present_currency_used\n return \"Bitcoin! Like it or not, today you're an activist taking the first step towards financial justice.\" if receipt_confirmed == true and currency_used == \"BTC\"\n return \"Paypal... please consider using an alternative currency in the future\" if currency_used == \"paypal\"\n return \"Bitcoin\" if currency_used == \"BTC\"\n end", "def is_currency?\n self =~ /\\A[+-]?[0-9]{1,3}(?:[0-9]*(?:[.,][0-9]{2})?|(?:,[0-9]{3})*(?:\\.[0-9]{2})?|(?:\\.[0-9]{3})*(?:,[0-9]{2})?)\\z/i\n end", "def verify_transactions(maps)\n # hash literal same as Hash.new\n balance_map = {}\n valid = -1\n maps.each do |x|\n trans = x[:transactions].split(':')\n trans.each_with_index do |y, i|\n # verifing from address vaild/correct format\n from_addr = y[0..5]\n balance_map[from_addr] = 0 unless balance_map.key?(from_addr)\n if i == trans.length - 1\n valid = x[:id] unless from_addr == 'SYSTEM'\n else\n from_addr.delete!('0123456789')\n valid = x[:id] unless from_addr.empty?\n end\n # verifing > in position 7\n valid = x[:id] unless y[6] == '>'\n\n # verifing to address valid/correct format\n to_addr = y[7..12]\n balance_map[to_addr] = 0 unless balance_map.key?(to_addr)\n # puts balance_map[to_addr]\n to_addr.delete!('0123456789')\n valid = x[:id] unless to_addr.empty?\n valid = x[:id] unless y[13] == '('\n valid = x[:id] unless y[y.length - 1] == ')'\n\n amount_num = y[14..y.length - 2]\n balance_map[y[0..5]] -= amount_num.to_i\n balance_map[y[7..12]] += amount_num.to_i\n amount_num.delete!('0123456789')\n valid = x[:id] unless amount_num.empty?\n end\n end\n # really rubocop\n unless valid.to_i.negative?\n puts \"Line #{valid}: Could not parse transactions list.'#{maps[valid.to_i][:transactions]}'\\nBLOCKCHAIN INVALID\"\n return false\n end\n balance_map = balance_map\nend", "def test_withdraw_non_empty_account\n coins = 10\n sender = 112_233\n address = { '445566' => 100 }\n output = -10\n assert_equal output, @verify.withdraw(coins, sender, address)\n end", "def test_converter_takes_3_currencies\n assert_equal({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0},\n Currency_Converter.new({'USD' => 1.00, 'EUR' => 0.74, 'JPY' => 120.0}).currency_list)\n end", "def test_get_coins_valid\r\n assert_equal 'ab12', @g.get_coins('(ab12)')\r\n end", "def validate_billcoins(address)\r\n\t\tif not @billcoins.include? address\r\n\t\t\treturn false, \"Internal Error: #{address} does not exist in the billcoin dictionary\"\r\n\t\tend\r\n\r\n\t\tif @billcoins[address] < 0\r\n\t\t\tsuccess = false\r\n\t\t\terror_msg = \"Invalid block, address #{address} has #{@billcoins[address]} billcoins!\"\r\n\t\t\treturn success, error_msg\r\n\t\tend\r\n\r\n\t\treturn true, ''\r\n\tend", "def had_funds?\n balance_at = self.get_address.balance(self.currency_id, before_time: self.tx_date)\n balance_at >= amount\n end", "def test_should_not_currency_of_same_amount_and_code\n currency1 = Currency.new(\"USD\", 1.0)\n currency2 = Currency.new(\"USD\", 5.0)\n refute_equal currency2, currency1\n end", "def test_charge_cust_cust_has_cash\n @venue.charge_for_stuff(@charges,@venue,@gina)\n assert_equal(290,@gina.wallet)\n end", "def getaccount(coinaddress)\n coind.getaccount coinaddress\n end", "def finance\n authorize_user!\n \n @wallet_data = {}\n @wallets = [ENV['SHOPPING_CART_WALLET']] # BitcoinPayments.get_n_shopping_cart_wallets\n @wallets.each do |wallet|\n i = @wallet_data[wallet.to_sym] = {}\n i['bitcoins_in_wallet'] = 4500000 # 'lookup online, get satoshi' \n i['bitcoins_registered_in_database'] = BitcoinPayment.where(destination_address: wallet).map(&:value).sum # confirmations not right TODu\n i['bitcoins_withdrawn'] = 0 # BitcoinWithdrawls.sum\n i['missing_coins'] = i['bitcoins_in_wallet'] + i['bitcoins_withdrawn'] - i['bitcoins_registered_in_database'] # if not zero, hacking took place\n end\n \n @aggregate_shopping_cart_balance = @wallet_data.map { |wallet, values| values['bitcoins_in_wallet'] }.sum\n @aggregate_recorded_bitcoin_payments = @wallet_data.map { |wallet, values| values['bitcoins_registered_in_database'] }.sum\n @shipping_costs_by_month = [1,2,1,12,123,12,1] # getShippingCostsByMonthForYear(2014)\n @sales_by_month = [1,2,1,12,123,12,1] # get_sales_by_month_for_year(2014)\n @donations_by_month = [1,2,1,12,123,12,1]\n @number_of_sales = Sale.count\n end", "def check_for_eligible_of_free_shipping(order)\n order.each do |key, price|\n if price > 100\n return true\n else\n return false\n end \n end\nend", "def accounts_payable?\n type == 'ACCPAYCREDIT'\n end", "def assert_currency! arg\n defines?(arg) ? (country_map[arg] || arg) : raise(Exchange::NoCurrencyError.new(\"#{arg} is not a currency nor a country code matchable to a currency\"))\n end", "def payment_possible_for?(listing)\n listing.price && listing.price > 0 && stripe_in_use?\n end", "def coinciden_monedas\n unless same_currency?\n errors.add(:base, \"Las monedas de la reserva y la cuenta no coinciden\")\n end\n end", "def getwalletinfo\n @api.request 'getwalletinfo'\n end", "def availableCoins (email)\r\n puts \"The amount of coins in your account is: #{@BetESS.fGetBetESSCoinsFrom(email)}\"\r\n end", "def amount_is_valid_for_outstanding_balance_or_credit\n end", "def coin_grab(input)\n coin = CryptoSearchCli::Coin.find_by_symbol_or_name(input)\n if coin.class == CryptoSearchCli::Coin\n coin.display_current_price\n main_menu(coin)\n else\n puts \"Sorry, that cryptocurrency was not found, please try again\"\n main_lookup\n end\n end", "def foreign_currency?\n !currency_id.blank? && !exchange_rate.blank? && exchange_rate!=0\n end", "def buy\n if @product.price <= @user.coin_credit # Checks whether the user has enough coin_credit or not\n purchase\n else\n @user.errors.add(:coin_credit, :not_enough_credit)\n false\n end\n end", "def not_paid_at_all\n\t\tget_cart_pending_balance == get_cart_price\n\tend", "def combos\n self.option_prices\n combinations = @option_prices.select{|k,v| v == to_cents(@budget)}.keys\n unless combinations.empty? then combinations else \"No exact price matches\" end\n end", "def check_balance\n\t\tsystem('clear')\n\t\tcheck_balance_display\n menu\n\tend", "def payment_possible_for?(listing)\n listing.price && listing.price > 0 && payments_in_use?\n end", "def can_afford_to_bet?(amount)\n (self.balance >= amount)\n end", "def currency_should_be_in_supported\n self.errors.add(:currency, 'exchange rate can not be found and is not supported') if self.currency.present? && !Currency.exists?(:iso_code => self.currency)\n end", "def get_currency(params)\n return params[:currency] unless params[:type] == 'transfer'\n\n return Account.get_from_name(params[:from_account], @current_user).currency\n end", "def can_cash?\n if self.tier && self.tier.piggy_bank\n if rate = find_bonus_rate\n # transfer cents\n if rate.cents.to_i > 0 && rate.funding_source.piggy_bank &&\n cashed_events_limit_not_reached?(rate.max_events_per_month)\n result = rate.funding_source.piggy_bank.transfer(self.receiver.piggy_bank, \n Money.new(rate.cents, rate.default_currency))\n if result.success?\n self.description = result.message \n return true\n end\n end\n end\n end\n false\n end", "def check_for_duplicate_ethereum\n # Check for duplicate Ethereum address\n hashed_db_ethereurm_address = Md5UserExtendedDetail.using_client_shard(client: @client).\n get_hashed_value(@new_ethereum_address)\n\n # check if same ethereum address\n return error_with_data(\n 'am_k_uea_cfde_1',\n \"This Ethereum address already exists for the case.Please provide a different ethereum address\",\n \"This Ethereum address already exists for the case.Please provide a different ethereum address\",\n GlobalConstant::ErrorAction.default,\n {}\n ) if md5_user_extended_detail.ethereum_address == hashed_db_ethereurm_address\n\n user_extended_detail_ids = Md5UserExtendedDetail.using_client_shard(client: @client).\n where(ethereum_address: hashed_db_ethereurm_address).pluck(:user_extended_detail_id)\n\n # Ethereum address is already present\n if user_extended_detail_ids.present?\n # Check whether duplicate address kyc is already approved\n already_approved_cases = []\n UserKycDetail.using_client_shard(client: @client).\n active_kyc.where(client_id: @client_id, user_extended_detail_id: user_extended_detail_ids).each do |ukd|\n if GlobalConstant::UserKycDetail.admin_approved_statuses.include?(ukd.admin_status)\n already_approved_cases << ukd.id if (ukd.id != @user_kyc_detail.id)\n end\n end\n return error_with_data(\n 'am_k_uea_5',\n \"Duplicate Ethereum address cases has already been approved, Case Ids #{already_approved_cases}\",\n \"Duplicate Ethereum address cases has already been approved, Case Ids #{already_approved_cases}\",\n GlobalConstant::ErrorAction.default,\n {}\n ) if already_approved_cases.present?\n end\n\n success\n\n end", "def check_wallet_warnings\n @messages = {}\n # do we have cards?\n @messages[:expired_card] = MESSAGES[:expired_card] if cards.any?(&:expired?)\n @messages[:empty_wallet] = MESSAGES[:empty_wallet] if @cards.length < 1\n # always true, dont stop other callbacks\n true\n end", "def vat_number_expected?\n return false unless has_billing?\n billing_address.country != store.country\n end", "def can_balance(list)\n\nend", "def valid_response_pairs\n split_into_pairs_response.select do |pair|\n (pair - currency_codes).size.zero?\n end\n end", "def check_moneypouch\r\r\n if item.csca_money_pouch?\r\r\n @currency_window.refresh\r\r\n open_currency_window \r\r\n end\r\r\n end", "def curr\n Currency.where('client_id = ? and default_currency = ?', current_user.client_id, \"t\").first.try(:currency_symbol)\n end", "def account_currencies opts={}\n params= {\n account: opts.delete(:account) || client_account,\n strict: opts[:strict].nil?? true : opts[:strict],\n ledger_index: opts[:ledger_index] || \"validated\",\n ledger_hash: opts[:ledger_hash]\n }\n post(:account_currencies, params)\n end", "def deposit (amount, account)\n if account == \"checking\"\n @checking_account_balance += amount\n elsif account == \"saving\"\n @saving_account_balance += amount\n else\n puts \"No account was selected\"\n end\n end", "def currency\n params['list_currency']\n end", "def user_withdrawal\n @coin = Coin.find(params[:coin_name])\n if @coin.blank?\n render json: {error: \"Sorry, this coin is unavailable.\",\n status: 400}\n elsif @coin.amount <= 0\n render json: {error: \"Sorry, not enough amount for withdrawal\",\n status: 400}\n else\n @withdrawal = Transaction.create(transaction_type: \"Withdrawal\", coin_name: params[:coin_name], user_id: user.id)\n @coin.decrement(:amount)\n @withdrawal.save\n render json: @withdrawal\n end\n # emails an alert if the amount of the coin is less than 4\n if @coin.amount < 4\n AdminAlert.coin_required(@coin).deliver\n end\n\n end", "def has_enough_money(item)\r\n if(self.credits>= item.get_price)\r\n return true\r\n else\r\n puts('get money')\r\n return false\r\n end\r\n end", "def check_valid_transactions\n transactions_split = []\n i = 0\n while i < @blocks.count\n # Splits and counts how many transactions there are in a block\n transactions_split = @blocks[i].transaction_string.split(':')\n j = 0\n while j < transactions_split.count\n @transactions = []\n # Splits transaction and saves its data\n transaction_partitions = transactions_split[j].split(/>|[()]/)\n @transactions[j] = Transaction.new(\n transaction_partitions[0],\n transaction_partitions[1],\n transaction_partitions[2].to_i\n )\n\n unless @transactions[j].from_addr.strip.eql? 'SYSTEM'\n @balance[@transactions[j].from_addr] -= @transactions[j].num_billcoins_sent\n end\n\n @balance[@transactions[j].to_addr] += @transactions[j].num_billcoins_sent\n\n if check_valid_format(@blocks[i], @transactions[j]) == false\n puts 'BLOCKCHAIN INVALID'\n exit 0\n end\n\n check_from_addr_length(@blocks[i], @transactions[j])\n check_to_addr_length(@blocks[i], @transactions[j])\n check_from_addr_invalid_char(@blocks[i], @transactions[j])\n check_to_addr_invalid_char(@blocks[i], @transactions[j])\n\n if i == @blocks.count - 1\n if j == transactions_split.count - 1\n unless @transactions[j].from_addr.strip.eql? 'SYSTEM'\n puts \"Line #{@blocks[i].block_number}: the last transaction in #{@transactions[j]\n \t.transaction_string} should be from SYSTEM.\"\n return false\n end\n end\n end\n j += 1\n end\n if check_balances(i) == false\n puts 'BLOCKCHAIN INVALID'\n exit 0\n end\n i += 1\n end\n true\n end", "def currency_list\n %w(USD EUR GBP JPY AUD INR)\n end", "def transaction_currency_code\n hash[\"TransactionCurrencyCode\"]\n end", "def test_check_coins_true\r\n assert_equal 1, @g.check_coins('1')\r\n end", "def test_rates_for_locations_with_only_zip_and_country \n setup_user\n response = @carrier.find_rates(\n @locations[:bare_beverly_hills],\n @locations[:bare_ottawa],\n @packages.values_at(:wii)\n )\n \n assert response.rates.size > 0\n end", "def check_current_billing_in_use\n if Billing.current.where(:member_id => member_id).present? \n errors.add(:base, 'Tidak Dapat Membuat Billing Baru Jika Ada Billing Sebelumnya Yang Belum Di Tutup') \n end \n end", "def check_items_balances\n details.select(&:marked_for_destruction?)\n .all?(&:valid_for_destruction?)\n end", "def service_contract_of(buyer)\n service_contracts.find_by(user_account_id: buyer.id)\n end", "def join(wallet, ledger: '/dev/null', baseline: false, master: false)\n if @id.nil?\n @id = wallet.id\n @key = wallet.key\n @network = wallet.network\n end\n unless wallet.network == @network\n @log.error(\"The wallet is from a different network '#{wallet.network}', ours is '#{@network}'\")\n return\n end\n unless wallet.key == @key\n @log.error('Public key mismatch')\n return\n end\n unless wallet.id == @id\n @log.error(\"Wallet ID mismatch, ours is #{@id}, theirs is #{wallet.id}\")\n return\n end\n seen = 0\n added = 0\n pulled = []\n wallet.txns.each do |txn|\n next if @txns.find { |t| t == txn }\n seen += 1\n if txn.amount.negative?\n dup = @txns.find { |t| t.id == txn.id && t.amount.negative? }\n if dup && !master\n @log.error(\"An attempt to overwrite existing transaction #{dup.to_text.inspect} \\\nwith a new one #{txn.to_text.inspect} from #{wallet.mnemo}\")\n next\n end\n if dup && master\n @log.debug(\"An overwrite to the existing transaction #{dup.to_text.inspect} \\\nis coming from a master node: #{txn.to_text.inspect} from #{wallet.mnemo}\")\n @txns.reject! { |t| t.id == txn.id && t.amount.negative? }\n end\n unless Signature.new(@network).valid?(@key, wallet.id, txn)\n @log.error(\"Invalid RSA signature at the transaction ##{txn.id} of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n else\n if Id::BANNED.include?(txn.bnf.to_s)\n @log.debug(\"The paying wallet is banned, #{wallet.id} can't accept this: #{txn.to_text.inspect}\")\n next\n end\n dup = @txns.find { |t| t.id == txn.id && t.bnf == txn.bnf && t.amount.positive? }\n if dup\n @log.error(\"Overwriting #{dup.to_text.inspect} with #{txn.to_text.inspect} \\\nfrom #{wallet.mnemo} (same ID/BNF)\")\n next\n end\n if !txn.sign.nil? && !txn.sign.empty?\n @log.error(\"RSA signature is redundant at ##{txn.id} of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n unless wallet.prefix?(txn.prefix)\n @log.debug(\"Payment prefix '#{txn.prefix}' doesn't match \\\nwith the key of #{wallet.id}: #{txn.to_text.inspect}\")\n next\n end\n unless @wallets.acq(txn.bnf, &:exists?)\n if baseline\n @log.debug(\"Paying wallet #{txn.bnf} is absent, \\\nbut the txn in in the baseline: #{txn.to_text.inspect}\")\n else\n next if pulled.include?(txn.bnf)\n pulled << txn.bnf\n if yield(txn) && !@wallets.acq(txn.bnf, &:exists?)\n @log.error(\"Paying wallet #{txn.bnf} file is absent even after PULL: #{txn.to_text.inspect}\")\n next\n end\n end\n end\n if @wallets.acq(txn.bnf, &:exists?) &&\n !@wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }\n if baseline\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction, but we trust it, since it's a baseline: #{txn.to_text.inspect}\")\n else\n if pulled.include?(txn.bnf)\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction: #{txn.to_text.inspect}\")\n next\n end\n pulled << txn.bnf\n yield(txn)\n unless @wallets.acq(txn.bnf) { |p| p.includes_negative?(txn.id, wallet.id) }\n @log.debug(\"The beneficiary #{@wallets.acq(txn.bnf, &:mnemo)} of #{@id} \\\ndoesn't have this transaction: #{txn.to_text.inspect}\")\n next\n end\n end\n end\n end\n @txns << txn\n added += 1\n next unless txn.amount.negative?\n File.open(ledger, 'a') do |f|\n f.puts(\n [\n Time.now.utc.iso8601,\n txn.id,\n txn.date.utc.iso8601,\n wallet.id,\n txn.bnf,\n txn.amount.to_i * -1,\n txn.prefix,\n txn.details\n ].map(&:to_s).join(';') + \"\\n\"\n )\n end\n end\n end", "def price_in_usd\n case @currency\n when :inr\n @price_per_share.to_i * 50\n when :gbp\n @price_per_share.to_i * 2\n else\n @price_per_share.to_i\n end\n end", "def test_wallet\n assert_equal(100, @guest1.wallet)\n end", "def rates(coin='Bitcoin', currencies: %w(EUR GBP))\r\n \r\n jeg = JustExchangeRates.new(base: 'USD', app_id: @exchangerate_key, \r\n debug: @debug)\r\n usd = self.price(coin).round(2)\r\n ([:USD] + currencies.map(&:to_sym)).zip(\r\n [usd, *currencies.map {|currency| (usd * jeg.rate(currency)).round(2) }]\r\n ).to_h\r\n \r\n end", "def ver_ledger()\n get_chain()\n Verify.chain($blockchain)\nend", "def wallet_params\n params.permit(:user_id, :currency_id)\n end" ]
[ "0.64214355", "0.62708616", "0.6194144", "0.60878205", "0.60166323", "0.5950085", "0.59104717", "0.59040016", "0.5895025", "0.5836461", "0.57885647", "0.5752347", "0.56782264", "0.56674993", "0.56410336", "0.56410336", "0.56410336", "0.56051457", "0.56041694", "0.56038266", "0.55668366", "0.55593807", "0.55589515", "0.554492", "0.55161875", "0.55157757", "0.5512507", "0.5506521", "0.54992807", "0.5496884", "0.5475469", "0.5473291", "0.5422807", "0.54150385", "0.5414504", "0.54079163", "0.54036206", "0.5400402", "0.5397429", "0.538819", "0.5379694", "0.53788394", "0.53641975", "0.5351903", "0.53446114", "0.53433996", "0.5342115", "0.53420335", "0.53270495", "0.53210604", "0.53115416", "0.53091353", "0.52973664", "0.52948385", "0.52858", "0.5282902", "0.52807015", "0.5266844", "0.5262418", "0.52522343", "0.5250467", "0.52450454", "0.52386993", "0.5234736", "0.5221881", "0.5221742", "0.5218453", "0.5207528", "0.5207186", "0.52006364", "0.52000374", "0.5197429", "0.51973057", "0.5185124", "0.51840454", "0.5183933", "0.5181392", "0.51788455", "0.51725477", "0.51690274", "0.5167166", "0.51392406", "0.5131017", "0.5130114", "0.51280224", "0.5125082", "0.5119324", "0.5116194", "0.5112372", "0.51049954", "0.510357", "0.5099265", "0.5098285", "0.5093789", "0.5084709", "0.50831765", "0.5082799", "0.5079848", "0.50768393", "0.5072077", "0.505841" ]
0.0
-1
Method combines First name, Last name and returns Full Name of Contact
def name name = '' name = first_name if first_name name = name + ' ' + last_name if last_name name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n return Contact.generate_full_name self.first_name, self.middel_name, self.last_name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name \n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end", "def full_name\n first_name.to_s + ' ' + last_name.to_s\n end", "def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name.to_s + \" \" + last_name.to_s\n end", "def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end", "def full_name()\n name + ' ' + last_name\n end", "def full_name\n firstname.capitalize() + \" \" + lastname.capitalize()\n end", "def full_name_first_last\n return self.first_name unless (self.last_name.length > 0)\n return (self.first_name + \" \" + self.last_name)\n end", "def full_name\n if self.first_name.present? and self.last_name.present?\n \"#{self.first_name} #{self.last_name}\"\n else\n self.first_name\n end\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n first_name + ' ' + last_name\n end", "def full_name\n first_name + ' ' + last_name\n end", "def full_name\n first_name + ' ' + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n @first_name + ' ' + @last_name\n end", "def full_name\n [@first_name, @last_name].join(' ')\n end", "def full_name\n \tfirst_name + \" \" + last_name\n end", "def full_name\n \"#{name} #{first_last_name} #{second_last_name}\"\n end", "def full_name\n name = first_name.strip # required\n name << \" #{middle_name.strip}\" if !middle_name.nil?\n name << \" #{last_name.strip}\" # required\n name << \" #{mother_last_name.strip}\" if !mother_last_name.nil?\n\n # capitalize each word and return the capitalized version\n name.split.map(&:capitalize).join(' ')\n end", "def full_name\n\t\tfirst_name + \" \" + last_name\n\tend", "def full_name\n [first_name.to_s, last_name.to_s.upcase].join(' ')\n end", "def full_name\n\t\tfirst_name + ' ' + last_name\n\tend", "def full_name\n\t\tfirst_name + ' ' + last_name\n\tend", "def full_name\n \"#{last_name}, #{first_name} #{middle_name}\"\n end", "def full_name\n \t[self.first_name, self.last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(' ').strip\n end", "def full_name\n if last_name != nil\n first_name + \" \" + last_name\n else\n first_name\n end\n end", "def full_name \r\n [firstname, surname].join(\" \") \r\n end", "def full_name\n if self.first_name && self.last_name \n self.first_name + \" \" + self.last_name \n else\n \"unknown\"\n end\n end", "def full_name\n \"#{first_name}\" \" #{last_name}\"\n end", "def full_name\n # clean_name\n \"#{@first_name} #{@middle_name} #{@last_name}\"\n [first_name, middle_name, last_name].compact.join(' ')\n end", "def full_name\n \t\"#{first_name} #{last_name}\"\n end", "def full_name\n [self.first_name, self.last_name].join(' ')\n end", "def full_name\n [self.first_name, self.last_name].compact.join(\" \").strip\n end", "def full_name\n full_name = first_name\n full_name += ' ' + middle_name if middle_name\n full_name += ' ' + last_name\n end", "def full_name\n \"#{first_name} \" + \"#{last_name}\"\n end", "def full_name\n if first_name.blank?\n last_name\n else\n [last_name, first_name].compact.join(', ')\n end\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n [forename, surname].join(' ')\n end", "def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n return (self.last_name + \", \" + self.first_name)\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def get_full_name\n [first_name, last_name].select(&:present?).join(' ')\n end", "def full_name\n middle_name ? first_name + \" \" + middle_name + \" \" + last_name : first_name + \" \" + last_name\n end", "def full_name\n \"#{first_name} #{family_name}\"\n end", "def full_name\n if self.first_name && self.last_name\n \"#{self.first_name} #{self.last_name}\"\n elsif self.first_name.present?\n \"#{self.first_name}\"\n elsif self.last_name.present?\n \"#{self.last_name}\"\n else\n \"No Name\"\n end\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def fullname\n return @first_name.capitalize + \" \" + @surname.capitalize\n end", "def full_name\n \"#{ first_name } #{ last_name }\"\n end", "def full_name\n new_name = first_name.capitalize + \" \" + last_name.capitalize\n final_name = new_name.split(' ').each(&:capitalize!).join(' ')\n end", "def full_name\n \"#{last_name} #{first_name}\"\n end", "def full_name\n return self.first_name + \" \" + self.last_name\n end", "def full_name\n return self.first_name + \" \" + self.last_name\n end", "def fullname\n return first_name + \" \" + last_name\n end", "def full_name\n if (forename != '' && surname != '')\n forename+' '+surname\n elsif (forename != '')\n forename\n elsif (email != '')\n email\n end\n end", "def full_name\n\t name = \"\"\n\t name = name + \"#{first_name}\" if !first_name.nil? || !first_name.empty?\n\t name = name + \" #{last_name}\" if !last_name.nil? || !last_name.empty?\n\t\tname.gsub(/^ /,'')\n\tend", "def full_name\n\t name = \"\"\n\t name = name + \"#{first_name}\" if !first_name.nil? || !first_name.empty?\n\t name = name + \" #{last_name}\" if !last_name.nil? || !last_name.empty?\n\t\tname.gsub(/^ /,'')\n\tend", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name.titleize} #{last_name.titleize}\"\n end", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n self.first_name + \" \" + self.last_name\n end", "def fullname\n name = firstname + ' ' + lastname\n name.split.map(&:capitalize).join(' ')\n end", "def full_name\n self.first_name.camelize + \" \" + self.last_name.camelize\n end", "def get_full_name\n return self.first_name + \" \" + self.last_name\n end", "def full_name\n object.first_name + \" \" + object.last_name\n end", "def full_name\n \"#{ first_name } #{ last_name }\"\n end", "def full_name\n self.first_name + ' ' + self.last_name\n end", "def full_name\n self.first_name + ' ' + self.last_name\n end", "def full_name\n self.first_name + ' ' + self.last_name\n end", "def fullName\n return first_name + \" \" + last_name\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end" ]
[ "0.8470216", "0.8177915", "0.8177915", "0.8141312", "0.8141312", "0.8141312", "0.8141312", "0.8141312", "0.8141312", "0.8137999", "0.8135187", "0.8135187", "0.8135187", "0.8135187", "0.8135187", "0.8103105", "0.8102288", "0.81004745", "0.80938405", "0.8081592", "0.80691826", "0.8067586", "0.8063989", "0.80628496", "0.805161", "0.80396646", "0.8037488", "0.8037488", "0.8037488", "0.8033294", "0.8033294", "0.8033294", "0.8033294", "0.8033294", "0.8033294", "0.80273825", "0.8025417", "0.8024816", "0.80170506", "0.8006138", "0.800454", "0.8001982", "0.7997568", "0.7997568", "0.79893345", "0.79890233", "0.7983381", "0.79748964", "0.79740614", "0.79667115", "0.7963846", "0.7962638", "0.79429495", "0.79372644", "0.7928548", "0.7927884", "0.7925813", "0.79197836", "0.7918207", "0.79158264", "0.7914778", "0.79116005", "0.79116005", "0.79116005", "0.7909145", "0.7903381", "0.7901701", "0.79007757", "0.78949285", "0.7882143", "0.78818256", "0.7880743", "0.7873145", "0.7865597", "0.7865597", "0.7864601", "0.7861324", "0.7859617", "0.7859617", "0.78564274", "0.78383815", "0.7838131", "0.7838131", "0.7838131", "0.7838131", "0.7838131", "0.7838131", "0.7837697", "0.78347963", "0.78213584", "0.78208286", "0.78187007", "0.7818494", "0.7818247", "0.78081155", "0.78081155", "0.78081155", "0.78077894", "0.7807277", "0.7807277", "0.7807277" ]
0.0
-1
Method combines First name, Middle name & Last name and returns Full Name of Contact
def full_name return Contact.generate_full_name self.first_name, self.middel_name, self.last_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end", "def full_name\n name = first_name.strip # required\n name << \" #{middle_name.strip}\" if !middle_name.nil?\n name << \" #{last_name.strip}\" # required\n name << \" #{mother_last_name.strip}\" if !mother_last_name.nil?\n\n # capitalize each word and return the capitalized version\n name.split.map(&:capitalize).join(' ')\n end", "def full_name\n if first_name? && last_name?\n name_words = first_name.split(\" \") + last_name.split(\" \")\n return name_words.map{ |w| w.capitalize }.join(\" \")\n else\n return email\n end\n end", "def full_name\n middle_name ? first_name + \" \" + middle_name + \" \" + last_name : first_name + \" \" + last_name\n end", "def full_name\n \"#{last_name}, #{first_name} #{middle_name}\"\n end", "def full_name\n firstname.capitalize() + \" \" + lastname.capitalize()\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n return first_name + \" \" + last_name\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name \n [first_name, last_name].join(' ')\n end", "def full_name\n # clean_name\n \"#{@first_name} #{@middle_name} #{@last_name}\"\n [first_name, middle_name, last_name].compact.join(' ')\n end", "def full_name\n full_name = first_name\n full_name += ' ' + middle_name if middle_name\n full_name += ' ' + last_name\n end", "def full_name\n \t([first_name, last_name].compact-['']).join(' ')\n end", "def full_name\n new_name = first_name.capitalize + \" \" + last_name.capitalize\n final_name = new_name.split(' ').each(&:capitalize!).join(' ')\n end", "def full_name\n if self.first_name.present? and self.last_name.present?\n \"#{self.first_name} #{self.last_name}\"\n else\n self.first_name\n end\n end", "def full_name\n [first_name.to_s, last_name.to_s.upcase].join(' ')\n end", "def full_name\n first_name.to_s + ' ' + last_name.to_s\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name_first_last\n return self.first_name unless (self.last_name.length > 0)\n return (self.first_name + \" \" + self.last_name)\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n first_name.to_s + \" \" + last_name.to_s\n end", "def full_name()\n name + ' ' + last_name\n end", "def full_name\n \tfirst_name + \" \" + last_name\n end", "def full_name\n [@first_name, @last_name].join(' ')\n end", "def full_name\n\t\tfirst_name + \" \" + last_name\n\tend", "def full_name\n\t\tfirst_name + ' ' + last_name\n\tend", "def full_name\n\t\tfirst_name + ' ' + last_name\n\tend", "def full_name\n first_name + ' ' + last_name\n end", "def full_name\n first_name + ' ' + last_name\n end", "def full_name\n first_name + ' ' + last_name\n end", "def full_name\n \"#{name} #{first_last_name} #{second_last_name}\"\n end", "def full_name\n [first_name, last_name].join(' ').strip\n end", "def full_name\n \t[self.first_name, self.last_name].join(\" \")\n end", "def full_name\n @first_name + ' ' + @last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n first_name + \" \" + last_name\n end", "def full_name\n if last_name != nil\n first_name + \" \" + last_name\n else\n first_name\n end\n end", "def full_name\n if self.first_name && self.last_name \n self.first_name + \" \" + self.last_name \n else\n \"unknown\"\n end\n end", "def fullname\n name = firstname + ' ' + lastname\n name.split.map(&:capitalize).join(' ')\n end", "def full_name\n\t name = \"\"\n\t name = name + \"#{first_name}\" if !first_name.nil? || !first_name.empty?\n\t name = name + \" #{last_name}\" if !last_name.nil? || !last_name.empty?\n\t\tname.gsub(/^ /,'')\n\tend", "def full_name\n\t name = \"\"\n\t name = name + \"#{first_name}\" if !first_name.nil? || !first_name.empty?\n\t name = name + \" #{last_name}\" if !last_name.nil? || !last_name.empty?\n\t\tname.gsub(/^ /,'')\n\tend", "def full_name\n self.first_name.camelize + \" \" + self.last_name.camelize\n end", "def full_name\n \"#{first_name}\" \" #{last_name}\"\n end", "def full_name\n if (forename != '' && surname != '')\n forename+' '+surname\n elsif (forename != '')\n forename\n elsif (email != '')\n email\n end\n end", "def full_name\n if first_name.blank?\n last_name\n else\n [last_name, first_name].compact.join(', ')\n end\n end", "def full_name\n [self.first_name, self.last_name].compact.join(\" \").strip\n end", "def full_name \r\n [firstname, surname].join(\" \") \r\n end", "def full_name\n \t\"#{first_name} #{last_name}\"\n end", "def casual_full_name\n [just_first, last].join(\" \")\n end", "def full_name\n [self.first_name, self.last_name].join(' ')\n end", "def full_name\n if self.first_name && self.last_name\n \"#{self.first_name} #{self.last_name}\"\n elsif self.first_name.present?\n \"#{self.first_name}\"\n elsif self.last_name.present?\n \"#{self.last_name}\"\n else\n \"No Name\"\n end\n end", "def full_name\n if (first_name && last_name) && (!first_name.blank? && !last_name.blank?)\n \" #{first_name} #{last_name}\"\n else\n \" #{nickname}\"\n end\n end", "def full_name\n # if @middle_name.nil?\n # \"#{@first_name} #{@last_name}\"\n # else\n # \"#{@first_name} #{@middle_name} #{@last_name}\"\n # end \n [@first_name, @middle_name, @last_name].compact.join(' ')\n end", "def full_name\n [forename, surname].join(' ')\n end", "def full_name\n (first_name + ' ' + last_name).titleize\n end", "def get_full_name\n [first_name, last_name].select(&:present?).join(' ')\n end", "def full_name\n \"#{first_name.titleize} #{last_name.titleize}\"\n end", "def full_name\n \"#{first_name} #{family_name}\"\n end", "def full_name(first_name, last_name)\n name = first_name.capitalize + \" \" + last_name.capitalize\n return name\nend", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name_last_first\n return self.first_name unless (self.last_name.length > 0)\n return (self.last_name + \", \" + self.first_name)\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def fullname\n return @first_name.capitalize + \" \" + @surname.capitalize\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n fname + ' ' + lname\n end", "def full_name\n \"#{first_name} \" + \"#{last_name}\"\n end", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n\t\t\"#{first_name} #{last_name}\"\n\tend", "def full_name\n \"#{ first_name } #{ last_name }\"\n end", "def full_name\n \"#{first_name.capitalize} #{last_name.capitalize}\"\n end", "def full_name\n \"#{last_name} #{first_name}\"\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name\n f_name + \" \" + l_name \n end", "def full_name\n return self.first_name + \" \" + self.last_name\n end", "def full_name\n return self.first_name + \" \" + self.last_name\n end", "def full_name\n self.first_name + \" \" + self.last_name\n end", "def entire_full_name\r\n mi.blank? ? \"#{first_name} #{last_name}\" : \"#{first_name} #{mi} #{last_name}\"\r\n end", "def full_name\r\n last_name.blank? ? \"#{first_name} #{mi}\" : \"#{last_name}, #{first_name} #{mi}\"\r\n end", "def full_name\n \"#{first_name} #{last_name}\"\n end", "def full_name(first_name, last_name)\n first_name.capitalize + ' ' + last_name.capitalize\nend" ]
[ "0.82870626", "0.8255562", "0.821288", "0.81470543", "0.8136675", "0.81085455", "0.8104215", "0.8104215", "0.80901086", "0.80901086", "0.80901086", "0.80901086", "0.80901086", "0.8088031", "0.8088031", "0.8088031", "0.8088031", "0.8088031", "0.8088031", "0.80834216", "0.80793726", "0.8078146", "0.80683094", "0.8061383", "0.8050023", "0.80385727", "0.803098", "0.8027606", "0.80138755", "0.8007526", "0.800438", "0.80041337", "0.79688245", "0.7964929", "0.79636556", "0.79632723", "0.79632723", "0.7959926", "0.7959926", "0.7959926", "0.79587203", "0.79558724", "0.7951753", "0.7950315", "0.795024", "0.795024", "0.795024", "0.795024", "0.795024", "0.795024", "0.7948172", "0.79433966", "0.7932302", "0.7915296", "0.7915296", "0.7914959", "0.791396", "0.7909783", "0.7907121", "0.78993374", "0.7890285", "0.7886607", "0.7885957", "0.7885352", "0.78809905", "0.78783906", "0.7872687", "0.7870605", "0.78703517", "0.7870123", "0.7868783", "0.7864416", "0.785871", "0.78537077", "0.78485405", "0.7846035", "0.7846035", "0.7846035", "0.7834431", "0.7813506", "0.7808207", "0.7805965", "0.7801092", "0.7801092", "0.7801092", "0.7801092", "0.7801092", "0.7801092", "0.7794167", "0.7789783", "0.7787952", "0.77866876", "0.77777076", "0.777719", "0.777719", "0.7769936", "0.77674806", "0.77583313", "0.7747561", "0.7747146" ]
0.83620644
0
Method returns Primary Email of a contact if any or blank otherwise
def email return Contact.get_default_email self.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_email\n primary_email_object = emails.find_by(is_primary: true)\n return if primary_email_object.blank?\n\n primary_email_object.address\n end", "def primary_email\n primary_contacts(emails, :email_rank_code, &:first)\n end", "def primary_email\n if self[\"gd$email\"]\n _email = self[\"gd$email\"].find { |e| e.primary == \"true\" }\n _email ? _email.address : nil\n else\n nil # no emails at all\n end\n end", "def email\n if md = RE_EMAIL.match(contact.to_s)\n md[0]\n else\n nil\n end\n end", "def email\n multi_email.primary_email_record.try(:email)\n end", "def email_address\n (email_addresses.where(primary: true).first || email_addresses.first).try(:email) ||\n current_address.try(:email) ||\n permanent_address.try(:email) ||\n user.try(:username)\n end", "def primaryContactName\n if primary_contact\n primary_contact.full_name\n else\n \"Unassigned\"\n end\n end", "def contact_email\n return @contact_email\n end", "def email_address\n raw_info['email_addresses'] && raw_info['email_addresses'].first\n end", "def email_address\n authentications.emails.active.first.uid rescue nil\n end", "def email\n # If product_specific_contacts is off, always return the facility's email\n return facility.email unless SettingsHelper.feature_on? :product_specific_contacts\n contact_email.presence || facility.try(:email)\n end", "def get_attendee_name_from_email(attemail, companyid, matterid)\n attemail = attemail.chomp\n cnt = Contact.first(:conditions => {:company_id => companyid, :email => attemail})\n usr = User.first(:conditions => {:company_id => companyid, :email => attemail})\n if cnt or usr\n if cnt\n cnt.full_name\n else\n usr.full_name\n end\n end\n end", "def contact_email\n contact['email_address']\n end", "def email\n return unless @user.loa3?\n\n value_for('emails')&.first\n end", "def primary_smtp_address\n return @primary_smtp_address\n end", "def email\n @net_ldap_entry[:mail].first\n end", "def contact_email\n\t\treturn get_configuration['sa_contact_email']\n\tend", "def get_email_address\n response = get_current_user_meta('email')\n email = response['query']['userinfo']['email']\n return if email == ''\n\n email\n end", "def email\n pull unless @details\n begin\n return @details.email_address.address\n rescue\n return nil\n end\n end", "def identifier\n unless full_name.blank?\n full_name\n else\n email.split('@').join(' from ')\n end\n end", "def official_email\n @net_ldap_entry[:berkeleyeduofficialemail].first\n end", "def me_user_email\n email = Email.find_primary(me).take if auth?\n email.email || ''\n end", "def email_from_infos\n user_infos.map(&:email).try(:first)\n end", "def retrieve_contact_by_email\n unless @rolodex.is_empty?\n print \"Please, provide the email of the contact in question: \"\n contact = @rolodex.search_contact(gets.chomp)\n if contact\n @rolodex.display_particular(contact)\n else\n puts \"Error: contact not found.\"\n end\n else\n contact = false\n puts \"Error: the Rolodex is empty.\"\n end\n return contact\n end", "def contact_email\n self.contact[:contact_email]\n end", "def primary_mailing_address\n mailing_address_type_code = Address.mailing_address_type.to_i\n\n primary_contacts(addresses, :address_rank_code) do |ts|\n ts.detect { |t| t.address_type_code == mailing_address_type_code }\n end\n end", "def display_one_contact\n contact = retrieve_contact_by_email\n end", "def email_name\n @email_name || if self[:email]\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.first}\" if 2 == split_host.size\n end\n rescue URI::InvalidURIError\n nil\n end", "def email\n mail.first\n end", "def email\n mail.first\n end", "def email\n if @data.attribute_names.include?(:cmupreferredmail)\n @email ||= @data[:cmupreferredmail].last\n else\n @email ||= @data[:mail].last\n end\n end", "def email\n if self.alternate_email.blank?\n if self.alumni?\n \"#{self.username}@alumni.calvin.edu\"\n else\n \"#{self.username}@students.calvin.edu\"\n end\n else\n self.alternate_email\n end\n end", "def from_email\n EmailAddress.find(:all).first\n end", "def contact_email\n EMAILS[:contact].split(' ').last[1..-2] \n end", "def name_and_email\r\n if email\r\n return \"#{self.entire_full_name} <#{self.email}>\"\r\n else\r\n return nil\r\n end\r\n end", "def email_address\n return @email_address\n end", "def email_address\n return @email_address\n end", "def identifier\n name.presence || email.split('@').join(' from ')\n end", "def investor_email_address\n return self.user_company_info.blank? ? self.email : self.user_company_info.business_email\n end", "def email\n if read_attribute(:active) == 1\n if Rails.env.development?\n self.first_name + \" \" + self.last_name + \" <dtg_ror_devel@lists.teradyne.com>\"\n else\n read_attribute(:email)\n end\n else\n \"\"\n end\n end", "def user_email\n msg['email'] || entry['email'] || reject['email']\n end", "def primary_contact?\n primary_contact.present?\n end", "def email\n if self[:email] && !@email_name\n self[:email]\n elsif self.email_name && self.email_domain\n self[:email] = \"#{self.email_name}@#{self.email_domain}\"\n end\n end", "def sender_email\n msg['from_email'] || msg['sender'] || entry['sender'] || reject['sender']\n end", "def email\n\t\tif self.email_address\n\t\t\tself.email_address.email\n\t\telse\n\t\t\tself.user.email\n\t\tend\n\tend", "def primary_address\n primary_contacts(addresses, :address_rank_code, &:first)\n end", "def display_name\n return \"#{first_name} #{last_name}\".strip if first_name\n return email\n end", "def contact_email\n TESTING_EMAIL || @comment[:email]\n end", "def email\n @email ||= select { |type,value| type == :email }.map do |(type,value)|\n value\n end\n end", "def display_name\n display = [first_name, last_name].join(' ').strip\n display.blank? ? email : display\n end", "def email\n userid.try(:match, / <(.*@.*)>/).try(:[], 1)\n end", "def email_address\n @data['emailAddress']\n end", "def determine_email\n return email[-7..-1] == \"uga.edu\" # this should be a constant\n end", "def primary_smtp_address=(value)\n @primary_smtp_address = value\n end", "def email_from\n case self.type\n when 'test'\n \"milo.thurston@oerc.ox.ac.uk\"\n when 'left','sdm','lcc','cde'\n \"neil.caithness@oerc.ox.ac.uk\"\n else\n \"noreply.oboe@oerc.ox.ac.uk\"\n end\n end", "def email\n user.emails.where( email: self.email_id ).first\n end", "def email\n result_record = default_email_record\n default_email_record.email if result_record\n end", "def email\n result_record = default_email_record\n default_email_record.email if result_record\n end", "def default_email_record\n valid_emails = emails.each.select do |email_record|\n !email_record.destroyed? && !email_record.marked_for_destruction?\n end\n result = valid_emails.find(&:primary?)\n result ||= valid_emails.first\n result\n end", "def default_email_record\n valid_emails = emails.each.select do |email_record|\n !email_record.destroyed? && !email_record.marked_for_destruction?\n end\n result = valid_emails.find(&:primary?)\n result ||= valid_emails.first\n result\n end", "def organiser_email\n organiser ? organiser.email : \"\"\n end", "def return_email_domain \n return \"@\" + self.email.split('@')[1]\n end", "def email\n get_attribute('Email')\n end", "def contacts_gmail_email(contacts)\n @hash_contactos = Hash.new\n \t\t@contact_email = []\n contacts.each {|lista|\n lista.each {|key,value|\n if (key == :email)\n @contact_email << value\n end\n }\n }\n return @contact_email\n\tend", "def by_email email\n query = { \"and\" => [{ \"email\" => { \"is\"=> email } },{ \"record type\"=> { \"is\"=> \"person\" }} ] }\n resp = @nimble.get 'contacts', { :query => query.to_json }\n self.contact = resp['resources'].first\n return nil unless self.contact\n self\n end", "def name_or_email\n if name.present?\n name\n else\n email\n end\n end", "def name\n \temail.split('@')[0]\n end", "def get_contact_emails\n if @info == nil || !(@info.key? \"contacts\")\n return Array.new\n end\n \n return @info[\"contacts\"]\n end", "def email_address\n get_attribute(Yoti::Attribute::EMAIL_ADDRESS)\n end", "def formatted_email(contact)\n \"#{contact.username} <#{contact.email}>\"\n end", "def match_email( val )\n\t\tmatch = RFC822_EMAIL_ADDRESS.match( val )\n\t\tself.log.debug \"Validating an email address %p: %p\" %\n\t\t\t[ val, match ]\n\t\treturn match ? match[0] : nil\n\tend", "def email\n @maintainers.first['email']\n end", "def email\n candidate_sheet.candidate_email.to_s\n end", "def name_or_contact_info\n if name.blank?\n [email, phone].join(', ')\n else\n name\n end\n end", "def email\n return @email\n end", "def email\n return @email\n end", "def display_name\n email\n end", "def mail_nickname\n return @mail_nickname\n end", "def google_email(connection)\n email_array = connection[\"gd$email\"]\n unless email_array.nil? or email_array.blank?\n return email_array[0][\"address\"]\n end\n end", "def email_domain\n if !self[:email].blank?\n split_host = URI.parse(\"#{self[:email]}\").path.split('@')\n \"#{split_host.last}\" if 2 == split_host.size\n else\n self.organization.site_domain if self.organization\n end\n rescue URI::InvalidURIError\n nil\n end", "def default_email_record\n valid_emails = emails.each.select { |email_record| !email_record.marked_for_destruction? }\n result = valid_emails.find(&:primary?)\n result ||= valid_emails.first\n result ||= emails.order('primary=1 ASC').first\n result\n end", "def partial_email\n @partial_email ||=\n begin\n uid,_,domain = email.partition('@')\n if uid.length < 4\n uid = '*' * uid.length\n elsif uid.length < 8\n uid = uid[0..2] + ('*' * (uid.length - 3))\n else\n uid = uid[0..2] + ('*' * (uid.length - 6)) + uid[-3..-1]\n end\n \"#{uid}@#{domain}\"\n end\n end", "def preferred_contact_detail\n return nil if preferred_contact_method.blank?\n if preferred_contact_method == (\"Home Phone\")\n number_to_phone(phone_home)\n elsif preferred_contact_method == (\"Mobile Phone\")\n number_to_phone(phone_mobile)\n elsif preferred_contact_method.include?(\"Email\")\n email\n end\n end", "def display_name\n email.gsub(/@.*/, \"\")\n end", "def email_with_name\n if email\n %Q{\"#{first} #{last}\" <#{email}>}\n end\n end", "def email\n preferred_email\n end", "def email_without_domain\n if email =~ /(^[^@]+)@/\n $1\n else\n email\n end\n end", "def email_without_domain\n if email =~ /(^[^@]+)@/\n $1\n else\n email\n end\n end", "def rep_email\r\n return if self.assigned_to.nil?\r\n \r\n if (bomb_squad = AppConfig.CUSTOMER_STAFF[self.assigned_to])\r\n return \"\\\"#{name}\\\" <#{bomb_squad_email}>\"\r\n else\r\n raise \"BombSquad \\\"#{self.assigned_to}\\\" is not existing for \\\"#{self.account_num}\\\"\"\r\n end\r\n end", "def contact\n @contact ||= get_contact(@data_object.user_contact)\n end", "def name_or_email\n self.name.blank? ? self.email : self.name\n end", "def email\n find_by_type('email')\n end", "def email; default_profile.try :email; end", "def default_email_address_header\n default_email_address.nil? ? original_email_address_header : default_email_address.to_header\n end", "def contact_id\n addr_type = ALF::AddressType.where('address_type_id', self.address_type).first\n\n # if it is HOME type then base off of household\n if addr_type.address_type == 'Home'\n prev_id = CIVICRM::VineContactPrevId.where(alf_id: self.household).take\n else\n prev_id = CIVICRM::VineContactPrevId.where(alf_id: self.person).take\n end\n\n # if no prev_id then base off of what is found\n if prev_id.nil?\n if self.person.present?\n prev_id = CIVICRM::VineContactPrevId.where(alf_id: self.person).take\n else\n prev_id = CIVICRM::VineContactPrevId.where(alf_id: self.household).take\n end\n end\n\n return if prev_id.nil?\n contact = CIVICRM::Contact.where(id: prev_id.contact_id).take\n\n return if contact.nil?\n return contact.id\n end", "def default_email( cid )\n return \"#{cid}@#{DEFAULT_DOMAIN}\"\n end", "def get_contact\n if self.contact_id\n return self.contact\n end\n end", "def find_email\n val = @email\n return if val.nil? \n val = LdapQuery::Scanner.search(val).as_user_attributes[:email] \n if val.nil?\n errors.add :base, 'Email address not found'\n return false\n end\n @email = val\n xdelegate = User.find_by_email(val.to_s)\n if xdelegate.nil?\n errors.add :base, 'Email does not have an account on this website'\n return false\n else\n self.delegate_user_id = xdelegate.id\n end\n\n end", "def contact_email=(value)\n @contact_email = value\n end", "def mail_from\n if @yaml[\"mail\"][\"from\"] != \"example@example.com\"\n return @yaml[\"mail\"][\"from\"]\n end\n end" ]
[ "0.83127165", "0.82457817", "0.8234795", "0.7814641", "0.7607048", "0.74769187", "0.74534076", "0.73707074", "0.7350632", "0.7205736", "0.7195834", "0.71909875", "0.70083004", "0.69953036", "0.69882786", "0.69879574", "0.6984345", "0.6971407", "0.6968407", "0.68911135", "0.68753177", "0.68674946", "0.686286", "0.68564296", "0.68523985", "0.68510723", "0.68444395", "0.6821407", "0.67889345", "0.67889345", "0.6770877", "0.6764063", "0.6714057", "0.66912043", "0.6536781", "0.6430836", "0.6430836", "0.64227736", "0.6387366", "0.63846517", "0.63661075", "0.6359972", "0.6359351", "0.63334036", "0.6330995", "0.6321479", "0.632126", "0.6316191", "0.63136953", "0.6308799", "0.6290075", "0.6289616", "0.62896097", "0.6285387", "0.6282222", "0.62700975", "0.6269228", "0.6269228", "0.62516165", "0.62516165", "0.6229882", "0.6223833", "0.6220857", "0.6213177", "0.6210866", "0.6209958", "0.6209219", "0.6203864", "0.62025225", "0.6188748", "0.6187808", "0.6156782", "0.61523616", "0.61464345", "0.61400205", "0.61400205", "0.6124964", "0.61221397", "0.61193275", "0.61149573", "0.61135817", "0.61046517", "0.6094169", "0.608795", "0.60856855", "0.6076925", "0.60766536", "0.60766536", "0.6073674", "0.6059018", "0.60498196", "0.60482186", "0.60450727", "0.603875", "0.6032978", "0.60282975", "0.60184467", "0.6017311", "0.60124314", "0.6003282" ]
0.7551905
5
Method returns the top connector status of Contact
def is_top_connector? TopConnector.exists? :contact_id => self.id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n @connections.status\n end", "def connection_status\n \t@current_connection = ConnectionInfo.where(\"disconnected_at is null\").first\n end", "def connector_type\n cable.connector_types[self.end - 1]\n end", "def getConnectorStart()\n\t\tif @roomConnectors.length() > 0\n\t\t\treturn @roomConnectors[0][0], @roomConnectors[0][1]\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def connected\n\t\treturn @connected\n\tend", "def connection_status_client_status; end", "def connection_status\n @connection_status ||= @node['connectionStatus']\n end", "def status\r\n connection.status\r\n end", "def incoming_order_status\n\tmost_recent_order_statuses = order_statuses.order(:updated_at).last(2)\n\tincoming_order_status = most_recent_order_statuses[1]\n end", "def connection_status\n @connection_status ||= @node['connectionStatus']\n end", "def requested_connection_status_for(user)\n connection_request = ConnectionRequest.find_by(sender_id: self.id, receiver_id: user.id)\n return :none if connection_request.nil?\n connection_request.status.to_sym\n end", "def status\n Skype.send_ :command => \"get call #{@call_id} status\"\n end", "def topMostCard\n object.cards.mostRecentlyUpdated.one[0]\n end", "def last_contacted\n object.channels.where(is_private: true).first.last_message_time\n end", "def status\n return VAProfile::ContactInformation::PersonResponse::RESPONSE_STATUS[:not_authorized] unless @user.loa3?\n\n response.status\n end", "def getStatus\r\n\t\t\t\t\treturn @status\r\n\t\t\t\tend", "def get_status\n return @m_status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def get_status\n @connection.get(\"/\").body\n end", "def no_contact_deal_status\n return self.deal_statuses.where(\"original_id = 7\").first\n end", "def connected\n return @poco_data[:connected] unless @poco_data == nil\n str = pick_first_node(@poco.xpath('./poco:connected'))\n return nil if str == nil\n\n if str == \"true\"\n true\n elsif str == \"false\"\n false\n else\n nil\n end\n end", "def account_status\n overview_table.rows_text[1][3]\n end", "def get_crxde_status\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def connector_id\n return @connector_id\n end", "def leads\n self.contacts.all(:conditions=> [\"status = 'lead'\"])\n end", "def status\n if self.locked\n if self.public? && self.visible?\n return 0\n elsif !self.public? && self.visible?\n return 1\n elsif self.public? && !self.visible?\n return 2\n elsif !self.public? && !self.visible?\n return 3\n end\n else\n if self.public? && self.visible?\n return 4\n elsif !self.public? && self.visible?\n return 5\n elsif self.public? && !self.visible?\n return 6\n elsif !self.public? && !self.visible?\n return 7\n end\n end\n end", "def status\n @wrapper.status\n end", "def status\n info[\"Status\"]\n end", "def communication_status_for_solr\n return status\n end", "def status\n\t\treturn @status\n\tend", "def last_status; end", "def contacts\n Easybill::Api::Contacts\n end", "def contact?\r\n infoxml = get_info\r\n \r\n if contact = infoxml['contact']\r\n return contact == '1'\r\n end\r\n \r\n return false\r\n end", "def status\n if recent_calls.count >= recent_minimum && percent_failed >= failure_threshold\n if (current_time - last_failure_time) > reset_timeout\n :half_open\n else\n :open\n end\n else\n :closed\n end\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n @object.status\n end", "def get_status\n @reply['status']\n end", "def getStatus\n @status\n end", "def entity_contactinfo_preferred_check\n @entity_contactinfo_exists = false\n # find all person's contact infos\n @person_contactinfos = PersonContactinfo.find(:all, :conditions => ['person_id =?', @person.person_id])\n if !@person_contactinfos.empty?\n for contactinfo in @person_contactinfos\n # if any person contact info is preferred\n # set the check to true\n if contactinfo.preferred == true\n @entity_contactinfo_exists = true\n end\n end\n end\n return @entity_contactinfo_exists\n end", "def top\n @ole.Top\n end", "def top\n @ole.Top\n end", "def status\n info['status']\n end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact; Contact.get(self.contact_id); end", "def contact_to(actor)\n sent_contacts.received_by(actor.id).first\n end", "def query_status\n log_power_relay_connection(:status) do\n relay_status = relay_connection.status(outlet)\n if secondary_outlet\n secondary_outlet_status = relay_connection.status(secondary_outlet)\n handle_mismatch_status if relay_status != secondary_outlet_status\n end\n relay_status\n end\n end", "def contacts\n self.connections.map do |connection|\n connection.contact\n end\n end", "def connected?\n @status == :connected\n end", "def last_status\n self.dossier_statuses.order(\"created_at DESC\").limit(1).first\n end", "def status\n ::HubEdos::Common::Reference::Descriptor.new(@data['status']) if @data['status']\n end", "def get_contact_state(contact)\n require_relative 'contactservicestate'\n ContactServiceState.new(@api, @api.do_request('GET', get_base_api_path() + '/states/' + contact.id))\n end", "def current_client\n self.clients.where(status: true).first\n end", "def best_comm(addr)\n\n addr_nbo = Socket.resolv_nbo_i(addr)\n comm = nil\n msb = 0\n\n each { |route|\n if ((route.subnet_nbo & route.netmask_nbo) ==\n (addr_nbo & route.netmask_nbo))\n if (route.bitmask >= msb)\n comm = route.comm\n msb = route.bitmask\n end\n end\n }\n\n comm\n end", "def status\n @content[0]\n end", "def get_call_status\r\n\t dialstatus = get_variable(\"dialstatus\")\r\n\t if dialstatus == nil #the dial command has not returned yet..thus the call is in progress\r\n\t return :InProgress\r\n\t elsif dialstatus == \"ANSWER\" #the dial command returned from a successfully answered call\r\n\t return :Answered\r\n\t elsif dialstatus == \"BUSY\" #the dial command met with a busy signal on the other end\r\n\t return :Busy\r\n\t elsif dialstatus == \"NOANSWER\" #the dial command aborted due to no answer\r\n\t return :NoAnswer\r\n\t elsif dialstatus == \"CONGESTION\" #the dial command failed due to congestion\r\n\t return :Congestion\r\n\t elsif dialstatus == \"CHANUNAVAIL\" #the dial command failed due to misc reasons.\r\n\t return :ChannelUnavailable\r\n\t else\r\n\t return :Offline #not sure\r\n\t end\r\n\tend", "def current_status\n Status.find_by(layer_id: id, latest: true).status\n end", "def activity_stream_status\n data[:activity_stream_status]\n end", "def activity_stream_status\n data[:activity_stream_status]\n end", "def get_status\n\t\tstatus\n\tend", "def active?\n head.active?\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def top\n return @top\n end", "def top\n return @top\n end", "def fetch_contact_info\n lambda {\n user.vet360_contact_info\n }\n end", "def contact_to(subject)\n sent_contacts.received_by(subject).first\n end", "def status\n @status\n end", "def status\n @status\n end", "def get_before_status\n return @m_before_status\n end", "def get_company_info_from_fullcontact\n response = HTTParty.get(FULLCONTACT_LOOKUP_API, query: { \"domain\" => fetched_domain,\n \"apiKey\" => FULLCONTACT_API_KEY })\n response = response.success? ? JSON(response.body) : raise(\"Could not get information from FullContact, check rate limit.\")\n raise \"FullContact retry error\" if response[\"status\"] == 202 # FullContact queues for search sometimes.\n response\n end", "def current_order_status\n\tmost_recent_order_statuses = order_statuses.order(:updated_at).last(2)\n\tcurrent_order_status = most_recent_order_statuses[0]\n end", "def status\n STATUSES[self.status_id]\n end", "def global_status\n status_counts = @count.values_at(*BareTest::StatusOrder)\n most_important_status = BareTest::StatusOrder.zip(status_counts) { |status, count|\n break status if count > 0\n } || :success\n end", "def check_info\n connection = Connection.where(group_id: params[:group_id], contact_id: params[:contact_id]).first\n json_details = if connection.present?\n {\n status: true,\n delete_connection_url: connection_path(connection),\n connection_id: connection\n }\n else\n { status: false }\n end\n render json: json_details\n end" ]
[ "0.6166162", "0.5930187", "0.571587", "0.565967", "0.5516205", "0.5496794", "0.541558", "0.5384492", "0.5379278", "0.5327636", "0.5326426", "0.5294457", "0.52766067", "0.52710396", "0.52410865", "0.5230667", "0.5228206", "0.5219499", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52187765", "0.52065104", "0.5205849", "0.52033967", "0.5195294", "0.5189117", "0.51795924", "0.51690364", "0.51502126", "0.5147214", "0.5140746", "0.5138749", "0.5133558", "0.512642", "0.5108821", "0.5103535", "0.51015306", "0.5092474", "0.5092474", "0.5087877", "0.5086142", "0.50807357", "0.5071248", "0.5068568", "0.5068568", "0.5063788", "0.5061905", "0.5061905", "0.5061905", "0.5061905", "0.5061905", "0.5045533", "0.50212663", "0.50187343", "0.5017569", "0.5015578", "0.5015521", "0.5014258", "0.50142545", "0.50059813", "0.5004104", "0.50019705", "0.5001369", "0.50002015", "0.50002015", "0.49809435", "0.49807483", "0.49771762", "0.49764895", "0.49764895", "0.4968665", "0.49661228", "0.49653", "0.49653", "0.49636304", "0.4949772", "0.49306697", "0.49167258", "0.4913257", "0.48934576" ]
0.7028141
0
Method validates a Contact for Manual Entry
def validate? valid = true if first_name.blank? && last_name.blank? errors.add_to_base("Must enter contact name") valid = false end ex_email = Contact.find(:first, :include => [:emails], :conditions => ["emails.email_text = ? AND contacts.user_id = ? AND merged_to_form_contact_id = 0", self.email, self.user_id]) if ex_email errors.add_to_base("Contact already in network") valid = false end valid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate\n validates_contact\n end", "def validate_that_at_least_one_set_of_contact_info_is_present\n return if veteran_contact_info.present? || claimant_contact_info.present?\n\n errors.add :form_data, I18n.t('appeals_api.errors.contact_info_presence')\n end", "def verify_contact_address\n unless contact_address =~ /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i\n errors.add(:contact_address, \"is not an email address\")\n end\n end", "def contact_fields\n if contact_type == 'contact'\n validates_length_of :first_name, minimum: 2, maximum: 20 if validates_presence_of :first_name\n validates_length_of :last_name, minimum: 2, maximum: 20 if validates_presence_of :last_name\n end\n end", "def validate\n if !new_record? && current?\n errors.add('contact_name', 'Please provide a contact name for your enquiry') unless contact_name.present?\n errors.add('contact_phone', 'Please provide a phone number where we may contact you at about your enquiry') unless contact_phone.present?\n end\n end", "def validate_contacts\n # we assume they are set at this point\n # contacts are unique\n contacts = [ self.requester, self.subject_expert, self.sponsor ]\n if Set.new(contacts).length != contacts.length\n add_validation 'All contacts must be unique'\n end\n\n # sponsor should be higher than expert, and expert higher than requester\n # ranks are reversed, rank 1 is top (board chairman)\n if self.sponsor.title.rank >= self.subject_expert.title.rank\n add_validation 'Sponsor should be a higher rank than the Subject Expert'\n end\n if self.subject_expert.title.rank >= self.requester.title.rank\n add_validation 'Subject Expert should be a higher rank than the Requester'\n end\n\n # contacts are co-located!\n if Set.new(contacts.map { |contact| contact.office.mail_code }).length > 1\n add_validation 'All contacts should be co-located'\n end\n end", "def _validate(record, pattern)\n\t\trecord.errors[:contact_data] << \"(#{record.contact_data}) is not valid\" unless\n\t\t\t!record.contact_data.nil? and \\\n\t\t\t!record.contact_data.empty? and \\\n\t\t\trecord.contact_data =~ pattern\n\tend", "def validated_for_update?(c)\n valid = true\n if first_name.blank? && last_name.blank?\n c.errors.add_to_base(\"Must enter contact name\")\n valid = false\n end\n ex_email = Contact.find(:first, :include => [:emails], :conditions => [\"emails.email_text = ? AND contacts.user_id = ? AND contacts.id != ? AND merged_to_form_contact_id = 0\", email, user_id, c.id])\n if ex_email\n c.errors.add_to_base(\"Contact already in network\")\n valid = false\n end\n valid\n end", "def address_valid?(validation_contexts)\n return true if address.nil?\n return true unless reg_company_contact_address_yes_no == 'N' || reg_company_contact_address_yes_no.to_s.empty?\n\n address.valid?(validation_contexts)\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def validate\n super\n if root? && (self.email.to_s.empty? || errors.invalid?(:email)) && self.phone.to_s.empty?\n errors.add(:base, \"Phone number or email address must be provided\".t)\n end\n if self.email\n unless self.organization.worldwide.map(&:site_domain).compact.include?(self.email_domain)\n errors.add(:email, \"not a valid email address at %{org}\".t % {:org => self.organization.root.name})\n end\n end\n end", "def validate!\n\t\t\t\treturn true\n\t\t\tend", "def validate\n unless address =~ /^(\\d{1,3}\\.){3}\\d{1,3}$/\n raise ValidationError, \"Invalid address\"\n end\n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validate_pos_invoice\n if self.customer_id && !self.pos_invoice_addresses\n raise_error('Billing address Required!!!!')\n end\nend", "def validate\r\n\r\n end", "def validate\n errors.add(:post_office, \"- must be filled for postalcode #{self.postal_code}\") if self.post_office.blank? && !self.postal_code.blank?\n errors.add(:postal_code, \"- must be filled for #{self.post_office}\") if self.postal_code.blank? && !self.post_office.blank? \n errors.add_to_base(\"- Person must have at least one phonenumber\") if (self.phone_home.blank? && self.phone_cell.blank? && self.phone_work.blank?) \n end", "def validate_on_create\n @count_client_contact_record = ClientContactRecord.count(:all,\n :conditions => ['client_contract_id=?',client_contract_id])\n if @count_client_contact_record == 0\n errors.add_to_base('Please Add Client contact record first')\n return false\n else\n return true\n end\n end", "def validate!\n # pass\n end", "def validate!\n true\n end", "def point_of_contact_is_associated\n return unless point_of_contact\n return if users.include? point_of_contact\n\n errors.add(:point_of_contact, 'must be an associated applicant')\n end", "def valid?\n return false if @default_from_address.nil?\n return false if @default_from_address.to_s.length > 50\n return false if @portal_url_override.nil?\n return false if @portal_url_override.to_s.length > 100\n return false if @site_url.nil?\n return false if @site_url.to_s.length > 100\n return false if !@logo_path.nil? && @logo_path.to_s.length > 200\n contact_sync_validator = EnumAttributeValidator.new('String', [\"FL\", \"LF\", \"CFL\", \"CLF\"])\n return false unless contact_sync_validator.valid?(@contact_sync)\n return false if @server_time_zone.nil?\n return false if @default_calendar.nil?\n return false if @default_address_format.nil?\n return true\n end", "def validate\n \n \n end", "def valid?(entry)\n true\n end", "def valid?(cc)\n\nend", "def padma_contact_setted_correctly\n return if self.padma_contact.nil?\n unless padma_contact.is_a?(PadmaContact)\n raise 'This is not a contact!'\n end\n if padma_contact.id != self.contact_id\n if self.contact_id.nil?\n # if they differ because contact_id is nil we set it here\n self.contact_id = self.padma_contact.id\n else\n raise 'This is the wrong contact!'\n end\n end\n end", "def primary_contact?\n primary_contact.present?\n end", "def validated?; end", "def validation; end", "def validation; end", "def valid?(_) true end", "def valid?(_) true end", "def valid_attendee\n #puts \"USER DEVICE TOKENS #{@device_tokens}\"\n return (!@phone_number.nil? && !@phone_number.empty?)\n # && !@first_name.nil? && !@first_name.empty? && !@last_name.nil? && !@last_name.empty?)\n end", "def validate\n #errors.add(:cc_number, \"There appears to be a typo in your Credit Card number.<br/>Please re-enter your card number.<br/> If you continue to have trouble, please <a url='/contactus.htm'>Contact Us.</a>\") unless cc_number.creditcard?\n today = DateTime.now\n #if (today.month > self.expiration_month && today.year >= self.expiration_year)\n #\terrors.add(:expiration_month, 'Please enter a valid expiration date.')\n #end\n\n # Add errors for credit card accounts\n #if (credit_card_payment? && self.cc_number.blank?)\n # errors.add(:cc_number, ERROR_EMPTY)\n #end\n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def validate\n end", "def validator; end", "def check_contact_info\n @user = current_user\n if @user.invalid?\n return redirect_to edit_user_path(current_user)\n end\n end", "def validate\n end", "def validate\n end", "def validate\n end", "def validate_realm\nif ! validate_a_display_name( self.realm )\nerrors.add( :realm , \"Invalid realm (see RFC 3261).\" )\nend\nend", "def run_validations\n true\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def populate_contact_details\n last_booking = Bookings::Booking.last_accepted_booking_by(bookings_school)\n\n return false if last_booking.blank?\n\n assign_attributes(\n contact_name: last_booking.contact_name,\n contact_email: last_booking.contact_email,\n contact_number: last_booking.contact_number,\n location: last_booking.location,\n )\n\n true\n end", "def is_valid; end", "def email_validate(contacts, current_email) \n if contacts.where(email: current_email).present?\n return true\n end\n false\n end", "def valid?\n return false if @address1.nil?\n return false if @address1.to_s.length > 100\n return false if @address1.to_s.length < 1\n return false if !@address2.nil? && @address2.to_s.length > 100\n return false if @amount.nil?\n return false if @amount > 10000000\n return false if @amount < 1\n return false if !@business_description.nil? && @business_description.to_s.length > 500\n business_type_validator = EnumAttributeValidator.new('String', [\"corporate\", \"individual\"])\n return false unless business_type_validator.valid?(@business_type)\n return false if !@corporate_number.nil? && @corporate_number !~ Regexp.new(/^\\\\d{13}$/)\n return false if @email.nil?\n return false if @end_date.nil?\n return false if @prefecture.nil?\n prefecture_validator = EnumAttributeValidator.new('String', [\"北海道\", \"青森県\", \"岩手県\", \"宮城県\", \"秋田県\", \"山形県\", \"福島県\", \"茨城県\", \"栃木県\", \"群馬県\", \"埼玉県\", \"千葉県\", \"東京都\", \"神奈川県\", \"新潟県\", \"富山県\", \"石川県\", \"福井県\", \"山梨県\", \"長野県\", \"岐阜県\", \"静岡県\", \"愛知県\", \"三重県\", \"滋賀県\", \"京都府\", \"大阪府\", \"兵庫県\", \"奈良県\", \"和歌山県\", \"鳥取県\", \"島根県\", \"岡山県\", \"広島県\", \"山口県\", \"徳島県\", \"香川県\", \"愛媛県\", \"高知県\", \"福岡県\", \"佐賀県\", \"長崎県\", \"熊本県\", \"大分県\", \"宮崎県\", \"鹿児島県\", \"沖縄県\"])\n return false unless prefecture_validator.valid?(@prefecture)\n return false if !@remark.nil? && @remark.to_s.length > 500\n return false if !@representative_name.nil? && @representative_name.to_s.length > 30\n return false if @tel.nil?\n return false if @tel !~ Regexp.new(/^0((\\\\d{1,2}-?\\\\d{1,4}|\\\\d{3,4}-?\\\\d{1,2})-?\\\\d{4}|120-?\\\\d{3}-?\\\\d{3})$/)\n return false if !@url.nil? && @url.to_s.length > 500\n return false if @zip_code.nil?\n return false if @zip_code !~ Regexp.new(/^\\\\d{3}-?\\\\d{4}$/)\n return true\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:contact_method_type_code => self.contact_method_type_code},{:contact_method_code => self.contact_method_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_contact_method\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def address_present\n if address.blank?\n errors.add(:address, \"Can't be empty\")\n end\n end", "def validate_cc\n if cc? and !is_valid_email? cc\n errors.add(:base, I18n.t('reservation.validate_cc'))\n end\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 !@city.nil? && @city.to_s.length > 50\n return false if !@state_identifier.nil? && @state_identifier.to_s.length > 50\n return false if !@zip.nil? && @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\n end", "def save\n validate!\n unless errors.any?\n begin\n self.cc = @ccapi.get_contact_by_email(email_address) unless email_address.to_s.empty?\n if !cc\n self.cc = @ccapi.add_contact(self)\n else\n self.cc = @ccapi.update_contact(self)\n end\n ccontact_to_contact\n rescue Exception => e\n errors.add(:email_address, e.to_s)\n return false\n end\n end\n end", "def create\n @contact = Contact.new(contact_params)\n\n respond_to do |format|\n if (Contact.where(\"lower(email_address) = ?\", contact.email_address).count == 0) and @contact.save\n format.html { redirect_to @contact, notice: 'Contact was successfully created.' }\n format.json { render :edit, status: :created, location: @contact }\n else\n format.html { render :new }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def valid?\n [:from, :to].each do |field|\n return false if !self[field] || self[field].empty?\n end\n \n self[:subject] ? true : false\n end", "def validate_for_email_or_phone\n unless valid_format_email_or_phone?\n errors.add(:email_or_phone, :invalid)\n end\n end", "def perspective_must_validate\n if sender.present? && recipient.present? && !self_contact.self?\n errors.add_to_base('Not set up from perspective of self')\n end\n end", "def contact_organization_matches\n if contact && contact.organization_id != organization_id\n errors.add(:contact, \"must have the same organization\")\n end\n end", "def valid; end", "def validate(doc)\n\t\treturn true\n\tend", "def new_contact?\n if self.contact_id == nil\n true\n else\n false\n end\n end", "def check_email_format\n if !(email =~ /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i)\n errors.add(:email, 'Invalid email format')\n elsif email_changed? && Contact.exists?(email: email, user_id: user_id)\n errors.add(:email, 'Email is already added into your contacts')\n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def contact \n\n end", "def contactus\r\n end", "def verify_contact_names(test_data)\n test_names = test_data[Org::CONTACT_NAMES.name]\n errors = []\n test_names = [{ Org::CONTACT_NAME.name => ''}] unless test_names\n test_names.each_with_index do |test_name, index|\n text_values_match?(test_name[Org::CONTACT_NAME.name], element_value(contact_name_input(index)), errors)\n end\n errors\n end", "def initial_requirements_valid?()\n if all_required_documents_has_attachment?\n update_procedure_elements()\n\n email_data = {user: self.procedure.user, template: 'initial_validation_success', procedure_name: name}\n send_email(email_data)\n users = User.with_role :representante_facultad\n email_data = {owner: self.procedure.user, procedure_name: name , template: 'need_to_approve' }\n send_multiple_emails(users, email_data)\n\n return true\n else\n return false\n end\n end", "def valid_record?(ems)\n @edit[:errors] = []\n if ems.emstype == \"scvmm\" && ems.security_protocol == \"kerberos\" && ems.realm.blank?\n add_flash(_(\"Realm is required\"), :error)\n end\n if !ems.authentication_password.blank? && ems.authentication_userid.blank?\n @edit[:errors].push(_(\"Username must be entered if Password is entered\"))\n end\n if @edit[:new][:password] != @edit[:new][:verify]\n @edit[:errors].push(_(\"Password/Verify Password do not match\"))\n end\n if ems.supports_authentication?(:metrics) && @edit[:new][:metrics_password] != @edit[:new][:metrics_verify]\n @edit[:errors].push(_(\"C & U Database Login Password and Verify Password fields do not match\"))\n end\n if ems.kind_of?(ManageIQ::Providers::Vmware::InfraManager)\n unless @edit[:new][:host_default_vnc_port_start] =~ /^\\d+$/ || @edit[:new][:host_default_vnc_port_start].blank?\n @edit[:errors].push(_(\"Default Host VNC Port Range Start must be numeric\"))\n end\n unless @edit[:new][:host_default_vnc_port_end] =~ /^\\d+$/ || @edit[:new][:host_default_vnc_port_end].blank?\n @edit[:errors].push(_(\"Default Host VNC Port Range End must be numeric\"))\n end\n unless (@edit[:new][:host_default_vnc_port_start].blank? &&\n @edit[:new][:host_default_vnc_port_end].blank?) ||\n (!@edit[:new][:host_default_vnc_port_start].blank? &&\n !@edit[:new][:host_default_vnc_port_end].blank?)\n @edit[:errors].push(_(\"To configure the Host Default VNC Port Range, both start and end ports are required\"))\n end\n if !@edit[:new][:host_default_vnc_port_start].blank? &&\n !@edit[:new][:host_default_vnc_port_end].blank?\n if @edit[:new][:host_default_vnc_port_end].to_i < @edit[:new][:host_default_vnc_port_start].to_i\n @edit[:errors].push(_(\"The Host Default VNC Port Range ending port must be equal to or higher than the starting point\"))\n end\n end\n end\n @edit[:errors].empty?\n end", "def validate\n true\n end", "def validate\n if self.body.empty? || self.body =~ /^\\s+$/\n errors.add(:body, \"^Please enter your annotation\")\n end\n if !MySociety::Validate.uses_mixed_capitals(self.body)\n errors.add(:body, '^Please write your annotation using a mixture of capital and lower case letters. This makes it easier for others to read.')\n end\n end", "def valid?\n return false if !@external_id.nil? && @external_id.to_s.length > 64\n return false if !@first_name.nil? && @first_name.to_s.length > 128\n return false if @last_name.nil?\n return false if @last_name.to_s.length > 64\n return false if @last_name.to_s.length < 1\n return false if !@middle_name.nil? && @middle_name.to_s.length > 64\n gender_validator = EnumAttributeValidator.new('String', [\"M\", \"F\"])\n return false unless gender_validator.valid?(@gender)\n return false if !@language.nil? && @language.to_s.length > 32\n return false if !@phone.nil? && @phone.to_s.length > 64\n return false if !@email.nil? && @email.to_s.length > 128\n return false if !@doc_type.nil? && @doc_type.to_s.length > 32\n return false if !@doc_issuer_info.nil? && @doc_issuer_info.to_s.length > 256\n return false if !@doc_series.nil? && @doc_series.to_s.length > 64\n return false if !@doc_number.nil? && @doc_number.to_s.length > 64\n return false if !@department_code.nil? && @department_code.to_s.length > 64\n return false if !@department_name.nil? && @department_name.to_s.length > 256\n return false if !@building_no.nil? && @building_no.to_s.length > 8\n return false if !@city.nil? && @city.to_s.length > 32\n return false if !@country_code.nil? && @country_code.to_s.length > 8\n return false if !@country_name.nil? && @country_name.to_s.length > 64\n return false if !@district.nil? && @district.to_s.length > 64\n return false if !@flat_no.nil? && @flat_no.to_s.length > 8\n return false if !@house_no.nil? && @house_no.to_s.length > 16\n return false if !@region.nil? && @region.to_s.length > 64\n return false if !@room_no.nil? && @room_no.to_s.length > 8\n return false if !@settlement_type.nil? && @settlement_type.to_s.length > 32\n return false if !@street.nil? && @street.to_s.length > 64\n return false if !@raw_address.nil? && @raw_address.to_s.length > 512\n true\n end", "def validated; end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def contact\n end", "def is_valid?\n end", "def email_required?; false end", "def contact\n\n end", "def contact\n\n end" ]
[ "0.7018682", "0.6405677", "0.63949496", "0.6386284", "0.63279635", "0.63274956", "0.6300706", "0.60699385", "0.59637433", "0.58243674", "0.58243674", "0.58243674", "0.5777996", "0.5763454", "0.57205427", "0.57137734", "0.57137734", "0.57137734", "0.57137734", "0.5706434", "0.5686821", "0.56757444", "0.56664526", "0.5665211", "0.564775", "0.5637814", "0.56299573", "0.56266236", "0.5613735", "0.55711484", "0.5561911", "0.5523693", "0.55192", "0.55160797", "0.55160797", "0.5510522", "0.5510522", "0.550776", "0.5501542", "0.5496205", "0.5496205", "0.5496205", "0.5496205", "0.5496205", "0.54943985", "0.54940945", "0.54872346", "0.54861015", "0.54861015", "0.54861015", "0.5485862", "0.54781365", "0.54761964", "0.5473314", "0.54716915", "0.5469998", "0.5458571", "0.54356414", "0.54340875", "0.5433295", "0.54276556", "0.5427357", "0.54228354", "0.541765", "0.5405842", "0.54040027", "0.5401688", "0.5386242", "0.5381542", "0.5377686", "0.5372558", "0.53697294", "0.5368371", "0.5365849", "0.5360414", "0.5348288", "0.53479964", "0.53377867", "0.53354585", "0.5331331", "0.5328547", "0.531721", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5305851", "0.5302204", "0.52998877", "0.5299813", "0.5299813" ]
0.60282665
8
Method validates a Contact for Manual Update
def validated_for_update?(c) valid = true if first_name.blank? && last_name.blank? c.errors.add_to_base("Must enter contact name") valid = false end ex_email = Contact.find(:first, :include => [:emails], :conditions => ["emails.email_text = ? AND contacts.user_id = ? AND contacts.id != ? AND merged_to_form_contact_id = 0", email, user_id, c.id]) if ex_email c.errors.add_to_base("Contact already in network") valid = false end valid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate\n validates_contact\n end", "def validate\n if !new_record? && current?\n errors.add('contact_name', 'Please provide a contact name for your enquiry') unless contact_name.present?\n errors.add('contact_phone', 'Please provide a phone number where we may contact you at about your enquiry') unless contact_phone.present?\n end\n end", "def contact_fields\n if contact_type == 'contact'\n validates_length_of :first_name, minimum: 2, maximum: 20 if validates_presence_of :first_name\n validates_length_of :last_name, minimum: 2, maximum: 20 if validates_presence_of :last_name\n end\n end", "def validate_update(comment)\n true\n end", "def validate_on_update # :doc:\n end", "def validate_contacts\n # we assume they are set at this point\n # contacts are unique\n contacts = [ self.requester, self.subject_expert, self.sponsor ]\n if Set.new(contacts).length != contacts.length\n add_validation 'All contacts must be unique'\n end\n\n # sponsor should be higher than expert, and expert higher than requester\n # ranks are reversed, rank 1 is top (board chairman)\n if self.sponsor.title.rank >= self.subject_expert.title.rank\n add_validation 'Sponsor should be a higher rank than the Subject Expert'\n end\n if self.subject_expert.title.rank >= self.requester.title.rank\n add_validation 'Subject Expert should be a higher rank than the Requester'\n end\n\n # contacts are co-located!\n if Set.new(contacts.map { |contact| contact.office.mail_code }).length > 1\n add_validation 'All contacts should be co-located'\n end\n end", "def validate_that_at_least_one_set_of_contact_info_is_present\n return if veteran_contact_info.present? || claimant_contact_info.present?\n\n errors.add :form_data, I18n.t('appeals_api.errors.contact_info_presence')\n end", "def validate!; end", "def validate!; end", "def validate!; end", "def validate?\n valid = true\n if first_name.blank? && last_name.blank?\n errors.add_to_base(\"Must enter contact name\")\n valid = false\n end\n ex_email = Contact.find(:first, :include => [:emails], :conditions => [\"emails.email_text = ? AND contacts.user_id = ? AND merged_to_form_contact_id = 0\", self.email, self.user_id])\n if ex_email\n errors.add_to_base(\"Contact already in network\")\n valid = false\n end\n valid\n end", "def patch_valid?\n validate(false).empty?\n end", "def validate \n#\tfirst check whether combo fields have been selected\n\t is_valid = true\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:contact_method_type_code => self.contact_method_type_code},{:contact_method_code => self.contact_method_code}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_contact_method\n\t end\n\t if is_valid\n\t\t is_valid = ModelHelper::Validations.validate_combos([{:party_type_name => self.party_type_name},{:party_name => self.party_name}],self) \n\tend\n\t#now check whether fk combos combine to form valid foreign keys\n\t if is_valid\n\t\t is_valid = set_party\n\t end\n\t#validates uniqueness for this record\n\t if self.new_record? && is_valid\n\t\t validate_uniqueness\n\t end\nend", "def validate_on_create\n @count_client_contact_record = ClientContactRecord.count(:all,\n :conditions => ['client_contract_id=?',client_contract_id])\n if @count_client_contact_record == 0\n errors.add_to_base('Please Add Client contact record first')\n return false\n else\n return true\n end\n end", "def modify_contact\n contact = retrieve_contact_by_email\n if contact\n attr_code = attr_menu\n if attr_code\n print \"You have chosen to change the contact's #{@@attr_ops[attr_code]}. Is that correct? \"\n confirm = gets.chomp.downcase\n if confirm == 'yes'\n print \"Please provide the new value for #{@@attr_ops[attr_code]}: \"\n new_value = gets.chomp\n contact = @rolodex.modify(contact, attr_code, new_value)\n if contact\n puts \"Contact successfully updated:\\n#{contact}\\n\"\n end\n elsif confirm == 'no'\n print \"Update canceled. \"\n else\n puts \"Error: only 'yes' and 'no' are valid responses.\"\n end\n end\n end \n return contact\n end", "def save\n validate!\n unless errors.any?\n begin\n self.cc = @ccapi.get_contact_by_email(email_address) unless email_address.to_s.empty?\n if !cc\n self.cc = @ccapi.add_contact(self)\n else\n self.cc = @ccapi.update_contact(self)\n end\n ccontact_to_contact\n rescue Exception => e\n errors.add(:email_address, e.to_s)\n return false\n end\n end\n end", "def verify_contact_address\n unless contact_address =~ /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i\n errors.add(:contact_address, \"is not an email address\")\n end\n end", "def validate!\n\t\t\t\treturn true\n\t\t\tend", "def check_contact_info\n @user = current_user\n if @user.invalid?\n return redirect_to edit_user_path(current_user)\n end\n end", "def padma_contact_setted_correctly\n return if self.padma_contact.nil?\n unless padma_contact.is_a?(PadmaContact)\n raise 'This is not a contact!'\n end\n if padma_contact.id != self.contact_id\n if self.contact_id.nil?\n # if they differ because contact_id is nil we set it here\n self.contact_id = self.padma_contact.id\n else\n raise 'This is the wrong contact!'\n end\n end\n end", "def modify_contact\n\n end", "def _validate(record, pattern)\n\t\trecord.errors[:contact_data] << \"(#{record.contact_data}) is not valid\" unless\n\t\t\t!record.contact_data.nil? and \\\n\t\t\t!record.contact_data.empty? and \\\n\t\t\trecord.contact_data =~ pattern\n\tend", "def contact_update(args)\n super # placeholder so that I can add some doc\n end", "def contact_update(args)\n super # placeholder so that I can add some doc\n end", "def check_email_format\n if !(email =~ /\\A([^@\\s]+)@((?:[-a-z0-9]+\\.)+[a-z]{2,})\\z/i)\n errors.add(:email, 'Invalid email format')\n elsif email_changed? && Contact.exists?(email: email, user_id: user_id)\n errors.add(:email, 'Email is already added into your contacts')\n end\n end", "def validate!\n # pass\n end", "def validate!\n true\n end", "def valid?\n return false if @default_from_address.nil?\n return false if @default_from_address.to_s.length > 50\n return false if @portal_url_override.nil?\n return false if @portal_url_override.to_s.length > 100\n return false if @site_url.nil?\n return false if @site_url.to_s.length > 100\n return false if !@logo_path.nil? && @logo_path.to_s.length > 200\n contact_sync_validator = EnumAttributeValidator.new('String', [\"FL\", \"LF\", \"CFL\", \"CLF\"])\n return false unless contact_sync_validator.valid?(@contact_sync)\n return false if @server_time_zone.nil?\n return false if @default_calendar.nil?\n return false if @default_address_format.nil?\n return true\n end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def populate_contact_details\n last_booking = Bookings::Booking.last_accepted_booking_by(bookings_school)\n\n return false if last_booking.blank?\n\n assign_attributes(\n contact_name: last_booking.contact_name,\n contact_email: last_booking.contact_email,\n contact_number: last_booking.contact_number,\n location: last_booking.location,\n )\n\n true\n end", "def validate!\n return true if @validated\n\n optionally_migrate2to3\n\n if imap.valid? && mbox.valid?\n @validated = true\n return true\n end\n\n delete\n\n false\n end", "def validate\r\n\r\n end", "def update\n if @current_user_permissions.find_by(permission_name: \"Edit Contact\").value == false\n @not_authorized = true\n render( :edit)\n else\n respond_to do |format|\n if @contact.update(contact_params)\n if params[:contact][:referred_contact][:reference_contact_id] != ''\n @refer_contact = ReferredContact.new\n @refer_contact.contact_id = params[:contact][:referred_contact][:contact_id]\n @refer_contact.reference_contact_id = params[:contact][:referred_contact][:reference_contact_id]\n if @refer_contact.save\n format.html { redirect_to edit_contact_path, notice: 'Contact Referred was successfully added.' }\n format.json { render :show, status: :ok, location: @contact }\n end\n else\n format.html { redirect_to contacts_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n end\n else\n format.html { redirect_to edit_contact_path, notice: \"Resubmit the form\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def update\n respond_to do |format|\n if @contact.update(contact_params)\n update_custom_field_values\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def validated?; end", "def can_update_addresses?\n !complete?\n end", "def update\n if @contact.update(contact_params)\n head :no_content\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end", "def initial_requirements_valid?()\n if all_required_documents_has_attachment?\n update_procedure_elements()\n\n email_data = {user: self.procedure.user, template: 'initial_validation_success', procedure_name: name}\n send_email(email_data)\n users = User.with_role :representante_facultad\n email_data = {owner: self.procedure.user, procedure_name: name , template: 'need_to_approve' }\n send_multiple_emails(users, email_data)\n\n return true\n else\n return false\n end\n end", "def validate_user_complete_update\n\t\tself.complete = User::user_complete_validation(self)\n\tend", "def new_contact?\n if self.contact_id == nil\n true\n else\n false\n end\n end", "def modify_contact\n\t\tputs \"Please enter the id of the contact to modify: \"\n\t\tid = gets.chomp.to_i\n puts \"Please confirm 'yes' or 'no' to modify this contact: \"\n puts @rolodex.display_contact(id)\n answer = gets.chomp.downcase\n if answer == 'yes'\n puts \"Please enter the number of the attribute you would like to edit: \\n\n 1. First Name \\n\n 2. Last Namme \\n\n 3. Email \\n\n 4. Note\"\n option = gets.chomp.to_i\n puts \"Please provide the edit:\"\n new_attribute = gets.chomp\n @rolodex.modify_contact(id, option, new_attribute)\n puts \"Edit complete: \"\n puts @rolodex.display_contact(id)\n elsif answer == 'no'\n return\n else\n puts \"That is not a valid answer, please try again.\"\n end\n\tend", "def update!(**args)\n @contact_email = args[:contact_email] unless args[:contact_email].nil?\n @contact_phone = args[:contact_phone] unless args[:contact_phone].nil?\n @contact_website = args[:contact_website] unless args[:contact_website].nil?\n @default_language = args[:default_language] unless args[:default_language].nil?\n end", "def email_validate(contacts, current_email) \n if contacts.where(email: current_email).present?\n return true\n end\n false\n end", "def ur_contact_update\n #skip if all three field are empty\n if params[:ur_contact][:name].blank? && params[:ur_contact][:email].blank? && params[:ur_contact][:telephone].blank? then\n Rails.logger.info \"Zero info on contact for reservation #{params[:user_reservation_id]}. Skipping...\"\n head :ok\n return\n end\n\n #skip if there's no name\n if params[:ur_contact][:name].blank? then\n Rails.logger.info \"Name field is blank. Skipping...\"\n end\n\n #load the user reservation\n ur = UserReservation.find(params[:user_reservation_id])\n\n #skip if the reservation method is online\n if ur.online? then\n Rails.logger.info \"Reservation #{params[:user_reservation_id]} is created online. Skipping...\"\n head :ok\n return\n end\n\n #scenario #1a: ur_contact id is detected\n if !params[:ur_contact][:id].empty? then\n Rails.logger.info \"Linking contact #{params[:ur_contact][:id]} to reservation #{params[:user_reservation_id]}...\"\n\n ur.update_attributes({contact_id:params[:ur_contact][:id], contact_type:params[:ur_contact][:type]})\n\n head :accepted\n return\n end\n\n #screnario #2: current ur has a contact_id, check if it's big change or not\n # if the name is the same, just update the email/telephone, otherwise go to\n if !ur.contact_id.blank? && params[:ur_contact][:id].empty? then\n if ur.contact.name == params[:ur_contact][:name] then\n #sanity checks, the contact type is UrContact and you own it\n if ur.contact_type == \"UrContact\" then\n UrContact.transaction do\n ur.contact.update_attributes({email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n end\n head :accepted\n return\n else\n head :ok\n return\n end\n end\n end\n\n #screnario #3: no current contact, or the chages are too big\n # default screnario is to create a new contact and link it\n Rails.logger.info \"Creating new contact for reservation #{params[:user_reservation_id]}...\"\n UrContact.transaction do\n #create the ur contact\n urContact = current_user.ur_contacts.new({name:params[:ur_contact][:name],\n email:params[:ur_contact][:email], telephone:params[:ur_contact][:telephone]})\n if urContact.save then\n ur.update_attributes({contact_id:urContact.id, contact_type:\"UrContact\"})\n head :created\n return\n else\n render json: {errors:urContact.errors.messages}, status: :internal_server_error\n end\n end\n\n end", "def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to after_save_path, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @contact = args[:contact] if args.key?(:contact)\n end", "def validate\n \n \n end", "def extra_validations\n success\n end", "def validated; end", "def update!(**args)\n @validations = args[:validations] if args.key?(:validations)\n end", "def update?\n @current_user.permission('FdpContact', :clerk)\n end", "def validate_pos_invoice\n if self.customer_id && !self.pos_invoice_addresses\n raise_error('Billing address Required!!!!')\n end\nend", "def is_valid; end", "def validation; end", "def validation; end", "def set_contact_method\n\n\tcontact_method = ContactMethod.find_by_contact_method_type_code_and_contact_method_code(self.contact_method_type_code,self.contact_method_code)\n\t if contact_method != nil \n\t\t self.contact_method = contact_method\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"combination of: 'contact_method_type_code' and 'contact_method_code' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def update_contact_in_salesforce\n \tsf = Salesforce::API.connect_to_salesforce\n \tcontact_id = self.sf_contact_id\n \tsf.update(\n \"Contact\",\n Id: \"#{contact_id}\",\n Name: \"#{self.first_name}\",\n Email: \"#{self.email}\",\n )\n end", "def should_update_shared_contact\n _supplier = Supplier.find(supplier)\n _entity = Entity.find(_supplier.entity)\n # Retrieve contact by its id\n _contact = SharedContact.find(shared_contact_id) rescue nil\n if _contact.nil?\n # Not found ??? Maybe is another contact... Let's check it out\n _contact = SharedContact.find_by_name_organization_type(last_name, first_name, organization_id, 2) rescue nil\n if _contact.nil?\n # No contact yet: Let's create a new one\n _contact = create_shared_contact(_entity, _supplier)\n else\n # Contact exists but with a different id\n _contact = update_shared_contact(_contact, _entity, _supplier)\n end\n else\n # Contact found, updates it\n _contact = update_shared_contact(_contact, _entity, _supplier)\n end\n # Update contact id\n self.update_column(:shared_contact_id, _contact.id) if !_contact.id.nil?\n true\n end", "def update fields\n self.contact = @nimble.put \"contact/#{self.id}\", { fields: fields }\n return nil unless self.contact\n self\n end", "def validate\r\n @invalid=false\r\n end", "def update_payment_contact_info(contact_info, email)\n cc_address_tb.type_text(contact_info.address) unless contact_info.address.nil?\n # Since country and state are close related, you have to change them together\n unless contact_info.country.nil?\n cc_country_select.select(contact_info.country)\n alert_accept if alert_present?\n wait_until_bus_section_load\n case contact_info.country\n when 'United States'\n cc_state_us_select.select(contact_info.state_abbrev)\n when 'Canada'\n cc_state_ca_select.select(contact_info.state_abbrev)\n else\n cc_state_tb.type_text(contact_info.state)\n end\n end\n cc_city_tb.type_text(contact_info.city) unless contact_info.city.nil?\n cc_zip_tb.type_text(contact_info.zip) unless contact_info.zip.nil?\n cc_phone_tb.type_text(contact_info.phone) unless contact_info.phone.nil?\n cc_email_tb.type_text(email) unless email.nil?\n end", "def update\n if @contact.update(contact_params)\n fresh_when(@contact)\n render json: @contact, status: :ok, location: @contact\n else\n render json: { errors: @contact.errors.messages }, status: :unprocessable_entity\n end\n end", "def update\n flash.clear\n begin\n @contact = Contact.find(params[:id])\n @contact.update_attribute(:updated_by, current_user.id)\n rescue ActiveRecord::RecordNotUnique => e\n if e.message =~ /for key 'index_emails_on_address'/\n email = e.message.scan(/Duplicate entry '(.*)' for key 'index_emails_on_address'.*/).flatten.first\n err = [\"the email address <strong>'#{h(email)}'</strong>\",\n \"Check the emails fields\"]\n else\n company = params[:contact][:company] || \"ERROR\"\n country = params[:contact][:country] || \"ERROR\"\n err = [\"the company <strong>\\\"#{h(company)}\\\"</strong> in the country: <strong>\\\"#{h(country)}\\\"</strong>\",\n \"Check the company, country, address and first name fields\"]\n end\n flash[:error] = <<EOL\n<h3>An error prevented the reccord from being saved (duplicate entry):</h3>\nSorry, #{h(err.first)} already exists in the database. Please take one of the following action:\n<ul>\n <li>#{h(err.last)}</li>\n <li>Do not create the contact, but find and update the already existing company using the search form on the main contact page</li>\n</ul>\nEOL\n end\n respond_to do |format|\n if @contact.update_attributes(params[:contact])\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def validate\n end", "def update\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { render action: 'edit' , notice: 'Kontakten uppdaterades!' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def validate\n end", "def validate\n end", "def validate\n end", "def update\n @contact.update(contact_params)\n if @contact.valid?\n render json: @contact\n end\n end", "def valid?(cc)\n\nend", "def update\n if params[:cros]=='y'\n #update from cros post. @xieyinghua\n new_contact_params=contact_params\n new_contact_params[:name]=params[:name]\n new_contact_params[:phone]=params[:phone]\n new_contact_params[:reason]=params[:reason]\n new_contact_params[:email]=params[:email]\n\n contact_params=new_contact_params\n end\n\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def validate_on_update(fields)\n check_required_fields(fields, self.class.required_on_update)\n validate_on_save(fields)\n end", "def update\n @contact = current_user.contact\n if @contact.update_attributes(params[:contact])\n redirect_to admin_jobs_path, notice: 'Informacion de contacto actualizada satisfactoriamente.'\n else\n render action: \"edit\"\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @contact.update(contact_params)\n\t\t\t\tformat.html { redirect_to user_contact_path, notice: 'Contact 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: @contact.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def run_validations\n true\n end", "def valid_record?(ems)\n @edit[:errors] = []\n if ems.emstype == \"scvmm\" && ems.security_protocol == \"kerberos\" && ems.realm.blank?\n add_flash(_(\"Realm is required\"), :error)\n end\n if !ems.authentication_password.blank? && ems.authentication_userid.blank?\n @edit[:errors].push(_(\"Username must be entered if Password is entered\"))\n end\n if @edit[:new][:password] != @edit[:new][:verify]\n @edit[:errors].push(_(\"Password/Verify Password do not match\"))\n end\n if ems.supports_authentication?(:metrics) && @edit[:new][:metrics_password] != @edit[:new][:metrics_verify]\n @edit[:errors].push(_(\"C & U Database Login Password and Verify Password fields do not match\"))\n end\n if ems.kind_of?(ManageIQ::Providers::Vmware::InfraManager)\n unless @edit[:new][:host_default_vnc_port_start] =~ /^\\d+$/ || @edit[:new][:host_default_vnc_port_start].blank?\n @edit[:errors].push(_(\"Default Host VNC Port Range Start must be numeric\"))\n end\n unless @edit[:new][:host_default_vnc_port_end] =~ /^\\d+$/ || @edit[:new][:host_default_vnc_port_end].blank?\n @edit[:errors].push(_(\"Default Host VNC Port Range End must be numeric\"))\n end\n unless (@edit[:new][:host_default_vnc_port_start].blank? &&\n @edit[:new][:host_default_vnc_port_end].blank?) ||\n (!@edit[:new][:host_default_vnc_port_start].blank? &&\n !@edit[:new][:host_default_vnc_port_end].blank?)\n @edit[:errors].push(_(\"To configure the Host Default VNC Port Range, both start and end ports are required\"))\n end\n if !@edit[:new][:host_default_vnc_port_start].blank? &&\n !@edit[:new][:host_default_vnc_port_end].blank?\n if @edit[:new][:host_default_vnc_port_end].to_i < @edit[:new][:host_default_vnc_port_start].to_i\n @edit[:errors].push(_(\"The Host Default VNC Port Range ending port must be equal to or higher than the starting point\"))\n end\n end\n end\n @edit[:errors].empty?\n end", "def validate\n super\n if root? && (self.email.to_s.empty? || errors.invalid?(:email)) && self.phone.to_s.empty?\n errors.add(:base, \"Phone number or email address must be provided\".t)\n end\n if self.email\n unless self.organization.worldwide.map(&:site_domain).compact.include?(self.email_domain)\n errors.add(:email, \"not a valid email address at %{org}\".t % {:org => self.organization.root.name})\n end\n end\n end", "def edit_email\n @errors = {}\n end", "def update\n respond_to do |format|\n @user = ContactService.update(@user, user_params, current_user, root_user)\n @profile = @user.profile\n if @user.errors.empty?\n format.html { redirect_to params[:original_url].presence || contacts_url, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @user }\n else\n format.html do\n if @user.errors[:existing].any?\n @user.skip_existing_checking = true\n render :add_existing_contact\n else\n render :edit\n end\n end\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def update\n pars = contact_params\n pars[:uid] = current_user.id\n\n group_ids = []\n unless pars[:contact_group_attributes].nil?\n pars[:contact_group_attributes].each do |group|\n group_ids << BSON::ObjectId.from_string(group[:_id])\n end\n end\n pars.delete(:contact_group_attributes)\n\n if group_ids.blank?\n @contact.unset(:contact_group_ids)\n else\n @contact.set(contact_group_ids: group_ids)\n end\n\n respond_to do |format|\n begin\n if @contact.update(pars)\n expire_fragment contact_url(@contact)\n if pars[:contact_profile_attributes][:last_name] != @contact.contact_profile[:last_name] or\n pars[:contact_profile_attributes][:first_name] != @contact.contact_profile[:first_name]\n Cashier.expire \"contacts-filter-#{current_user.id}\"\n end\n\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n create_profile\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n rescue Mongo::Error::OperationFailure => exception\n create_profile\n contact = duplicate_contact\n error = (t 'mongoid.errors.contact.duplicate_val')\n .gsub('%phone%', \"#{contact_params[:prefix]} #{contact_params[:mobile]}\")\n @contact.errors[t 'mongoid.errors.contact.duplicate_key'] =\n \"#{error} <a href=\\\"#{contact_path contact}\\\">#{t 'view_contact'}</a>\"\n\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contact = CompanyContact.find(params[:id])\n if @contact.update_attributes(params[:company_contact])\n head :no_content\n else\n respond_with @contact, status: :unprocessable_entity\n end\n end", "def validate!\n validate_patches!\n validate_new_branch_name! if new_branch?\n validate_permissions!\n end", "def validate\n\n end", "def contact_organization_matches\n if contact && contact.organization_id != organization_id\n errors.add(:contact, \"must have the same organization\")\n end\n end", "def valid; end", "def check_updated_course_data_validity(course_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code StartDate EndDate IsActive),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'StartDate' => { 'type' => %w(string null) },\n 'EndDate' => { 'type' => %w(string null) },\n 'IsActive' => { 'type' => 'boolean' }\n }\n }\n JSON::Validator.validate!(schema, course_data, validate_schema: true)\nend", "def save\n # can put other business rules here to notify other users etc or start background processes\n # to handle new contact saves\n contact.addresses = self.addresses\n # can get rid of bang, depends on how we want to bubble up exceptions\n contact.save!\n contact\n end", "def validate_cc\n if cc? and !is_valid_email? cc\n errors.add(:base, I18n.t('reservation.validate_cc'))\n end\n end", "def valid?\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n end", "def contact_update(handle, fields)\n fields = contact_prepare(fields)\n fields[:handle] = handle\n query 'contact-modify', fields\n end", "def update\n @contact.user = @user\n\n #TODO: Not sure why, but attorney_type is NOT beign emptied out when Contact Type is of something\n # else besides Attorney. Need to look into this when there is a chance since Attorney Type can be\n # persisted once and then never emptied if the Contact Type is changed (which doesn't happen often luckily)\n\n\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def after_validate\n end" ]
[ "0.70229536", "0.63903046", "0.6388088", "0.6354135", "0.6290593", "0.62462604", "0.6065871", "0.60438716", "0.60438716", "0.60438716", "0.6012076", "0.5992357", "0.5966696", "0.5943815", "0.59399045", "0.5924662", "0.5907218", "0.59043497", "0.58974147", "0.5894543", "0.5870249", "0.5841826", "0.58312786", "0.58312786", "0.58142257", "0.58056766", "0.5775943", "0.5773603", "0.57580376", "0.57580376", "0.57580376", "0.57580376", "0.5743778", "0.57362354", "0.57243943", "0.57073456", "0.5704355", "0.56901866", "0.56810296", "0.56768495", "0.5658698", "0.56580466", "0.56544125", "0.5647044", "0.56356865", "0.56247234", "0.5622874", "0.5617839", "0.5606355", "0.5600724", "0.5599686", "0.55956924", "0.5593119", "0.5589392", "0.558319", "0.5581138", "0.55800015", "0.55800015", "0.5570043", "0.55665493", "0.55626684", "0.5556818", "0.5549186", "0.5533568", "0.553327", "0.55274147", "0.5525277", "0.551779", "0.55159", "0.55159", "0.55159", "0.5513356", "0.5513032", "0.5511708", "0.5508553", "0.5508125", "0.55075186", "0.5507015", "0.5498202", "0.5494301", "0.54895", "0.5489416", "0.54838854", "0.54838854", "0.54838854", "0.54838854", "0.54838854", "0.5478106", "0.54774094", "0.54739535", "0.5473717", "0.5473102", "0.54723126", "0.54710996", "0.5468288", "0.54645276", "0.5463274", "0.54621035", "0.54560864", "0.54501367" ]
0.7387179
0
Method Returns Collection of Contacts that are suspected as duplicates in the Merge but not Merged. THis scenario does not occur now.
def duplicates Contact.find(:all, :conditions => ["id != ? AND merge_id = ?", id, merge_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge(contacts_with_dupes)\n group_by_email(contacts_with_dupes).flat_map do |_, contacts|\n contacts.sort_by! { |c| c[:date_added] }\n\n contacts.first.tap do |merged|\n contacts[1..-1].each do |newer|\n merged.keys.each do |key|\n merged[key] = newer[key] unless newer[key].to_s.empty?\n end\n end\n end\n end\n end", "def similarity_of_contacts\n return if self.finished?\n if !Contact.where(:_id => self.first_contact_id).exists? || !Contact.where(:_id => self.second_contact_id).exists?\n self.errors[:existence_of_contacts] << I18n.t('errors.merge.existence_of_contacts')\n else\n if !first_contact.similar.include?(second_contact)\n self.errors[:similarity_of_contacts] << I18n.t('errors.merge.similarity_of_contacts')\n end\n end\n end", "def contacts\n first_set = self.initiated_contacts\n second_set = self.received_contacts\n return first_set + second_set\n end", "def missed_contacts\n @contacts.where(contact_type: 'PBX', answered: nil, after_call_ended: nil, direction: 'I').where.not(call_ended: nil, service_id: 120)\n end", "def contact_groups_represented\n @contact_groups_represented ||= contacts.map(&:contact_groups).flatten.uniq\n end", "def contacts\n @contacts ||= User.any_in(:_id => facilities.map(&:consumer_ids).flatten.uniq)\n end", "def contact_groups_represented\n @contact_groups_represented ||= contacts.map(&:contact_groups).flatten.uniq\n end", "def remove_duplicates\n return @remove_duplicates if @set_remove_duplicates\n @remove_duplicates ||= true\n end", "def common_contacts_with(other_person, options = {})\n # I tried to do this in SQL for efficiency, but failed miserably.\n # Horrifyingly, MySQL lacks support for the INTERSECT keyword.\n common_contacts = []\n other_person.dogs.each do |dog|\n common_contacts << (contacts & dog.contacts)\n end\n return common_contacts.flatten.uniq.paginate(options)\n end", "def contacts\n ensure_cache_up_to_date\n contacts = self.redis.keys(\"bluster:objects:contact:*\")\n contacts.map! { |r| r.split(\":\")[3] }\n contacts.uniq\n end", "def contacts\n collection = CapsuleCRM::ContactCollection.new(self,CapsuleCRM::Contact, [])\n collection.concat emails\n collection.concat phone_numbers\n collection.concat websites\n collection.concat addresses\n collection\n end", "def duplicates\n @duplicates = Duplicate.all\n @duplicates.sort! do |x, y|\n diff = (x.person.last_name || '') <=> y.person.last_name\n if diff == 0\n (x.person.first_name || '') <=> y.person.first_name\n else\n diff\n end\n end\n end", "def contact_ids\n (object.added_contacts + object.mutual_contacts).map{|ct| ct.slug }\n end", "def get_all_contacts\n\t\t#@contacts = Contact.find_with_deleted(:all, :conditions=>[\"company_id=?\", get_company_id], :order=>\"coalesce(last_name,'')||''||first_name||''||coalesce(middle_name,'') asc\")\n #Bug 11593 Deleted contacts are displayed in Drop down.\n @contacts = Contact.find(:all, :conditions=>[\"company_id=?\", get_company_id], :order=>\"coalesce(last_name,'')||''||first_name||''||coalesce(middle_name,'') asc\")\n end", "def answered_contacts\n @contacts.where(contact_type: 'PBX').where.not(answered: nil, service_id: 120)\n end", "def duplicates(collection); end", "def possible_duplicates\n @duplicates = {}\n if last_name.present?\n last_name_duplicates = Person.where(last_name: last_name).where.not(id: id)\n last_name_duplicates.each do |duplicate|\n duplicate_hash = {}\n duplicate_hash['person'] = duplicate\n duplicate_hash['match_count'] = 1\n duplicate_hash['last_name_match'] = true\n duplicate_hash['matches_on'] = ['Last Name']\n @duplicates[duplicate.id] = duplicate_hash\n end\n end\n if email_address.present?\n email_address_duplicates = Person.where(email_address: email_address).where.not(id: id)\n email_address_duplicates.each do |duplicate|\n if @duplicates.key? duplicate.id\n @duplicates[duplicate.id]['match_count'] += 1\n @duplicates[duplicate.id]['matches_on'].push('Email Address')\n else\n @duplicates[duplicate.id] = {}\n @duplicates[duplicate.id]['person'] = duplicate\n @duplicates[duplicate.id]['match_count'] = 1\n @duplicates[duplicate.id]['matches_on'] = ['Email Address']\n end\n @duplicates[duplicate.id]['email_address_match'] = true\n end\n end\n if phone_number.present?\n phone_number_duplicates = Person.where(phone_number: phone_number).where.not(id: id)\n phone_number_duplicates.each do |duplicate|\n if @duplicates.key? duplicate.id\n @duplicates[duplicate.id]['match_count'] += 1\n @duplicates[duplicate.id]['matches_on'].push('Phone Number')\n else\n @duplicates[duplicate.id] = {}\n @duplicates[duplicate.id]['person'] = duplicate\n @duplicates[duplicate.id]['match_count'] = 1\n @duplicates[duplicate.id]['matches_on'] = ['Phone Number']\n end\n @duplicates[duplicate.id]['phone_number_match'] = true\n end\n end\n if address_1.present?\n address_1_duplicates = Person.where(address_1: address_1).where.not(id: id)\n address_1_duplicates.each do |duplicate|\n if @duplicates.key? duplicate.id\n @duplicates[duplicate.id]['match_count'] += 1\n @duplicates[duplicate.id]['matches_on'].push('Address_1')\n else\n @duplicates[duplicate.id] = {}\n @duplicates[duplicate.id]['person'] = duplicate\n @duplicates[duplicate.id]['match_count'] = 1\n @duplicates[duplicate.id]['matches_on'] = ['Address_1']\n end\n @duplicates[duplicate.id]['address_1_match'] = true\n end\n end\n @duplicates\n end", "def get_other_contacts(matter)\n client_contacts = matter.client_contacts\n client_contacts << matter.primary_matter_contact\n client_contacts.compact\n end", "def contacts\n Contact.where(account_ids: self._id)\n end", "def duplicates?(collection); end", "def merge_duplicates!\n Rails.logger.info \"Merging duplicates of #{url}\"\n duplicates.each do |dupe|\n dupe.merge_with!(self)\n end\n end", "def merged_into\n checked = []\n t = self\n while t.merged?\n t = Ticket.find(t.merge_ticket_id)\n raise \"Merge loop: #{checked.inspect}\" if checked.include?(t.id)\n checked << t.id\n end\n t\n end", "def possible_duplicates\n @duplicates = {}\n check_last_name_duplicates if last_name.present?\n check_email_duplicates if email_address.present?\n check_phone_number_duplicates if phone_number.present?\n check_address_duplicates if address_1.present?\n @duplicates\n end", "def common_contacts_with(other_person, options = {})\n # I tried to do this in SQL for efficiency, but failed miserably.\n # Horrifyingly, MySQL lacks support for the INTERSECT keyword.\n (contacts & other_person.contacts).paginate(options)\n end", "def remove_invalid_references\n addresses = self.addresses.to_set\n missing = Set.new\n result = map do |r|\n common = (addresses & r['references'])\n if common.size != r['references'].size\n missing.merge(r['references'] - common)\n end\n r = r.dup\n r['references'] = common\n r\n end\n return result, missing\n end", "def primary_service_learning_contacts\n u = Unit.find_by_abbreviation(\"carlson\")\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => u.id, :primary_contact => true}})\n c.empty? ? position_supervisor_contacts : c\n end", "def find_dupes\n @hathi_report_filtered.find_all.with_index do |row, index|\n row if (row['local_id'] == @hathi_report_filtered.at(index + 1)&.[]('local_id')) || (row['local_id'] == @hathi_report_filtered.at(index - 1)['local_id'])\n end.compact\n end", "def co_author_list \n if self.first_author \n list = [self.first_author]\n list.concat self.coauthors.reject{|ca|ca ==self.first_author}\n return list\n else\n return self.coauthors\n end\n end", "def contacts!(params = {})\n # contacts in this group\n @contacts = nil\n contacts\n end", "def all_contacts\n Contact.all\n end", "def finished_contacts\n @contacts.where(contact_type: 'PBX').where.not(answered: nil, call_ended: nil, service_id: 120)\n end", "def contact_merge(contact_id, duplicate_contact_id)\n response = xmlrpc('ContactService.merge', contact_id, duplicate_contact_id)\n end", "def grouped_duplicates(collection); end", "def remove_contacts_from_selection\n logger.debug \"**** remove CONTRIBUTORS from SELN ****\"\n show_params(params) #debug params and put them in logs\n @role_contactinfos_ids = params[:role_contactinfos][:ids]\n previous_contacts = session[SELECTED_CONTACTS]\n for removed_contact_id in @role_contactinfos_ids\n # get the contact to remove\n removed_contact_id = removed_contact_id.gsub('role_contactinfo_', '')\n removed_contact = RoleContactinfo.find( removed_contact_id )\n \n # remove contact\n previous_contacts.delete(removed_contact)\n # new_contacts = new_contacts + [new_person_contact] unless !previous_contacts.include?new_person_contact\n end\n session[SELECTED_CONTACTS] = previous_contacts\n @contacts = session[SELECTED_CONTACTS]\n @already_selected = session[SELECTED_CONTACTS]\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n render :layout => false\n end", "def ssn_merge_bad\n\t\t@objs = Person.find(:all, :conditions => ['ssn in (?)', BAD_SSNS], :order => 'id desc')\n\tend", "def getContacts\n messages = [] \n \n if !self.received_messages.nil?\n messagesRecv = (self.received_messages.order(:updated_at)).reverse \n\t messagesRecv.each do |recv|\n\t user = User.find(recv.sender_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n if !self.send_messages.nil?\n messagesSend = (self.send_messages.order(:updated_at)).reverse \n\t messagesSend.each do |send|\n\t user = User.find(send.receiver_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n\t return messages\n end", "def comics_owned\n comics_array = self.comics.map do |comic|\n comic\n end\n comics_array.uniq\n end", "def contacts!(params = {})\n @contacts ||= get_contacts({\"group\" => self.id}.merge(params))\n end", "def get_apple_mail_contacts(vcf_data)\n @user = current_user\n begin\n temp_file = \"/tmp/#{Time.now.to_i.to_s}.vcf\"\n f = open(temp_file, \"wb\")\n contents = vcf_data\n c = contents.gsub(/[^\\x00-\\x7F]/n,'')\n f.write(c)\n f.close\n\n cards = Vpim::Vcard.decode(File.open(temp_file))\n @importedContacts = []\n @emails = []\n cards.each do |card|\n person = {}\n person[\"fname\"] = card.name.formatted\n person[\"email\"] = card.email.to_s\n #person[\"email\"] = person[\"email\"].tr(\"\\n\", \"\") if person[\"email\"]\n if !person[\"email\"].blank?\n #Do not add duplicates\n unless @importedContacts.any? {|h| h[\"email\"] == person[\"email\"]}\n @importedContacts << person\n end\n end\n end\n @importedContacts.each do |mail|\n @emails.push(mail.fetch('email'))\n end\n @importedContacts.sort! { |a, b| a.fetch(\"fname\").downcase <=> b.fetch(\"fname\").downcase }\n rescue\n #do nothing\n end\n\n return @importedContacts\n end", "def merge_with(master, ignored_attr = [])\n # Just in case a user tries to merge a contact with itself,\n # even though the interface prevents this from happening.\n return false if master == self\n\n merge_attr = self.merge_attributes\n # ------ Remove ignored attributes from this contact\n ignored_attr.each { |attr| merge_attr.delete(attr) }\n\n # Perform all actions in an atomic transaction, so that if one part of the process fails,\n # the whole merge can be rolled back.\n Contact.transaction do\n\n # ------ Merge attributes: ensure only model attributes are updated.\n model_attributes = merge_attr.dup.reject{ |k,v| !master.attributes.keys.include?(k) }\n master.update_attributes(model_attributes)\n\n # ------ Merge 'belongs_to' and 'has_one' associations\n {'user_id' => 'user', 'lead_id' => 'lead', 'assigned_to' => 'assignee'}.each do |attr, method|\n unless ignored_attr.include?(attr)\n master.send(method + \"=\", self.send(method))\n end\n end\n \n # ------ Merge address associations\n master.address_attributes.keys.each do |attr|\n unless ignored_attr.include?(attr)\n master.send(attr + \"=\", self.send(attr))\n end\n end\n\n # ------ Merge 'has_many' associations\n self.tasks.each { |t| t.asset = master; t.save! }\n self.emails.each { |e| e.mediator = master; e.save! }\n self.comments.each { |c| c.commentable = master; c.save! }\n\n # Find all AccountContact records with the duplicate contact,\n # and only add the master contact if it is not already added to the account.\n AccountContact.find_all_by_contact_id(self.id).each do |ac|\n unless ac.account.contacts.include?(master)\n ac.contact_id = master.id; ac.save!\n end\n end\n \n # Find all ContactOpportunity records with the duplicate contact,\n # and only add the master contact if it is not already added to the opportunity.\n ContactOpportunity.find_all_by_contact_id(self.id).each do |co|\n unless co.opportunity.contacts.include?(master)\n co.contact_id = master.id; co.save!\n end\n end\n\n # Merge tags\n all_tags = (self.tags + master.tags).uniq\n master.tag_list = all_tags.map(&:name).join(\", \")\n \n # Call the merge_hook - useful if you have custom actions that need to happen during a merge\n master.merge_hook(self)\n\n if master.save!\n # Update any existing aliases that were pointing to the duplicate record\n ContactAlias.find_all_by_contact_id(self.id).each do |ca|\n ca.update_attribute(:contact, master)\n end\n\n # Create the contact alias and destroy the merged contact.\n if ContactAlias.create(:contact => master,\n :destroyed_contact_id => self.id)\n # Must force a reload of the contact, and shake off all migrated assets.\n self.reload\n self.destroy\n end\n end\n end # transaction\n end", "def closed_contacts\n @contacts.where(contact_type: 'PBX').where.not(call_ended: nil, answered: nil, service_id: 120, after_call_ended: nil)\n end", "def failed_email_delivery_contacts\n \n failed_email_delivery_contacts = Array.new \n \n mailout_contacts.each do |mc|\n failed_email_delivery_contacts.push(mc) if !mc.delivery_timestamp.blank? && mc.delivery_failed\n end\n \n return failed_email_delivery_contacts\n end", "def find_contacts\n logger.debug \"**** FIND CONTRIBUTORS ****\"\n show_params(params) #debug params and put them in logs\n \n \n @person_query = params[:search][:person]\n @org_query = params[:search][:organisation]\n \n \n #This populates @contacts \n @found_contacts = search_by_name_and_organisation(@person_query, @org_query)\n session[:contacts_from_search] = @found_contacts\n \n @already_selected = session[SELECTED_CONTACTS]\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n render :layout => false\n end", "def contacts\n @contacts ||= @ab.people.map {|abperson| Macabee::Contact.new(abperson, :macabee => self)}\n end", "def parents\n Contact.find(:all, :conditions => [\"merged_to_form_contact_id = ?\", self.id])\n end", "def involved_people\n # [self.user, self.answerers, self.commenters].flatten.uniq\n [self.user].flatten.uniq\n end", "def current_account_contact_ids\n current_account.added_contact_ids + current_account.mutual_contact_ids\n end", "def unique_ministry_campuses_old(top = true)\n unless @unique_ministry_campuses\n res = lambda {\n @unique_ministry_campuses = ministry_campuses.clone\n @unique_campuses = campuses.clone\n subministry_campuses(top).each do |mc|\n @unique_ministry_campuses << mc unless @unique_campuses.include?(mc.campus)\n @unique_campuses << mc.campus\n end\n @unique_ministry_campuses\n }\n @unique_ministry_campuses = (Rails.env.production? ? Rails.cache.fetch([self, 'unique_ministry_campuses']) {res.call} : res.call)\n end\n return @unique_ministry_campuses\n end", "def authors_synced\n Author.where.not(gh_issue_number: nil)\n end", "def without_duplicates(bindings); end", "def multiple_unique_events_for_contact?\n contact_links.map(&:event).uniq.compact.count > 1\n end", "def yammer_group_coworkers\n set = []\n self.cached_yammer_groups.each do |group|\n set += self.company.cached_yammer_group_contacts(group.id)\n end\n return set\n end", "def remove_duplicates()\n self.duplicate_transactions_by_actor().each do |a, txns|\n # Spaceship operator, if my actor is of greater value than theirs, skip because they should remove the dupe\n next if (self.actor <=> a) == 1\n txns.each do |txn|\n self.counts[self.actor][\"txns\"].delete(txn)\n end\n end\n end", "def get_dup_auths(book_cd_authors)\n\t\tresult = Array.new\n\t\tbook_cd_authors[\"cd\"].each do |auth_name,_|\n\t\t\tif book_cd_authors[\"book\"].has_key?(auth_name)\n\t\t\t\tresult.push(auth_name)\n\t\t\t\tbook_cd_authors[\"cd\"].delete(auth_name)\n\t\t\tend\n\t\tend\n\t\treturn result\n\tend", "def contacts\n @contacts ||= CreditorContactProxy.new(self)\n end", "def un_merge\n Contact.transaction do\n self.parents.each do |contact|\n contact.update_attribute('merged_to_form_contact_id', 0)\n if contact.contact_type == Constants::CONTACT_TYPE::PROSPECT\n ContactProspect.update_all(\"prospect_old_id = NULL, prospect_id = #{contact.id}\", \"prospect_old_id = #{contact.id}\")\n else\n ContactProspect.update_all(\"contact_old_id = NULL, contact_id = #{contact.id}\", \"contact_old_id = #{contact.id}\")\n end\n end\n self.emails.clear\n self.sources.clear\n self.contact_metas.clear\n self.destroy_shares\n self.destroy\n\n end\n end", "def contacts\n return [] unless persisted?\n results = connection.get(\"#{self.class.path}/#{@attributes[\"Id\"]}\")\n @attributes['ContactIds'] = results.first['ContactIds']\n end", "def primary_contacts_for_unit(unit)\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => unit.id, :primary_contact => true}})\n return c.empty? ? contacts_for_unit(unit) : c\n end", "def contacts\n fail NotPersisted if id.nil?\n\n @contacts ||=\n begin\n links = Amorail::ContactLink.find_by_leads(id)\n links.empty? ? [] : Amorail::Contact.find_all(links.map(&:contact_id))\n end\n end", "def contact_histories\n @contact_histories ||= contacts.collect(&:contact_histories) + former_contacts.collect(&:contact_histories).flatten\n end", "def sugar_contacts_with_email\n sugar_contact_ids = sugar_contacts.map { |sc| sc.id }\n SugarContact.find_with_email(sugar_contact_ids)\n end", "def contacts\n @contacts ||= DebtorContactProxy.new(self)\n end", "def collect_badges_to_merge()\n @dup_badge_matrix_ids = {} # This will allow: src key id |=> dest value id\n badge_collector = @row_collectors[ Badge.table_name ]\n if badge_collector != nil\n badge_collector.duplicate_rows.each do |src_badge_row|\n dest_badge_candidate = badge_collector.dest_rows.find do |dest_row|\n (src_badge_row.team_id == dest_row.team_id) &&\n (src_badge_row.season_id == dest_row.season_id)\n end\n @dup_badge_matrix_ids[ src_badge_row.id ] = dest_badge_candidate.id if dest_badge_candidate\n end\n end\n @dup_badge_matrix_ids\n end", "def duplicates(collection)\n grouped_duplicates(collection).flatten\n end", "def direct_duplicates\n\t\tself.class.unscope.where(archetype: self)\n\tend", "def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end", "def find_duplicates\r\n @dmds = @lists.last\r\n end", "def all_contacts\n ret = []\n chunk_size = 200\n offset = 0\n \n while (chunk = contacts(:limit => chunk_size, :offset => offset)).size != 0\n ret.push(*chunk)\n offset += chunk_size\n break if chunk.size < chunk_size\n end\n ret\n end", "def validate_contacts\n # we assume they are set at this point\n # contacts are unique\n contacts = [ self.requester, self.subject_expert, self.sponsor ]\n if Set.new(contacts).length != contacts.length\n add_validation 'All contacts must be unique'\n end\n\n # sponsor should be higher than expert, and expert higher than requester\n # ranks are reversed, rank 1 is top (board chairman)\n if self.sponsor.title.rank >= self.subject_expert.title.rank\n add_validation 'Sponsor should be a higher rank than the Subject Expert'\n end\n if self.subject_expert.title.rank >= self.requester.title.rank\n add_validation 'Subject Expert should be a higher rank than the Requester'\n end\n\n # contacts are co-located!\n if Set.new(contacts.map { |contact| contact.office.mail_code }).length > 1\n add_validation 'All contacts should be co-located'\n end\n end", "def shared\n @contact = Person.find(params[:id])\n redirect_to contacts_path and return if @person == @contact\n @title = \"Shared Contacts with %{name}\".t % { :name => @contact.name }\n @people = do_search_people(@person.friends.shared_with(@contact), nil, :with_tags => true)\n render :template => 'contacts/index'\n end", "def associated_workspaces(workspace_ids)\n tmp = workspace_ids || []\n self.contacts_workspaces.each do |k|\n k.destroy unless tmp.delete(k.workspace_id.to_s)\n end\n tmp.each do |w_id|\n if !ContactsWorkspace.exists?(:workspace_id => w_id, :contactable_id => self.id, :contactable_type => \"Person\")\n self.contacts_workspaces << contacts_workspaces.build(:workspace_id => w_id, :contactable_id => self.id, :contactable_type => \"Person\")\n end\n end\n end", "def user_role_contacts(achived,sort_order)\n remaining_roles = []\n merge_roles = remove_county_or_country_roles\n\n merge_roles.each do |role|\n remaining_roles << contact_types[role]\n end\n\n remaining_roles = remaining_roles.flatten\n contacts = Contact.where(contact_type: { '$in': remaining_roles }).archived(achived).all.order_by(sort_order)\n contacts\n end", "def non_interview_reports_for_activity(person, survey, contact_link)\n person.non_interview_reports.select do |nir|\n !nir.response_set.nil? &&\n nir.response_set.survey.title == survey.title &&\n contact_link.event.contacts.include?(nir.contact)\n end\n end", "def add_new_contacts(emails)\n\t\t@list_email = []\n\t\temails.each {|email|\n\t\t\t@list_email << email if !already_exits?(email)\n\t\t}\n\t\treturn @list_email\n\tend", "def common\n #if Contact.where(:organization_id => current_user.organization.id).any?\n # #@users = current_user.organization.contacts.group_by{|u| u.first_name[0]}\n # @users = Contact.where(:organization_id => current_user.organization.id).order(\"name,first_name\")\n #end\n # Contact.all.each do |contact|\n # contact.update_column :created_by, current_user.id\n # end\n begin\n lastcontact = current_user.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n unless lastcontact.present?\n lastcontact = current_user.organization.activities.where(\"activity_status=? and activity_type in (?)\", \"Create\", [\"IndividualContact\", \"CompanyContact\"]).last\n\n end\n if lastcontact.present?\n if lastcontact && lastcontact.activity_type == \"IndividualContact\"\n @contact = IndividualContact.find(lastcontact.activity_id)\n get_contact_attrs\n elsif lastcontact && lastcontact.activity_type == \"CompanyContact\"\n @contact = CompanyContact.find(lastcontact.activity_id)\n get_contact_attrs\n end\n else\n contacts=current_user.organization.individual_contacts\n @contact = contacts.last\n get_contact_attrs\n end\n rescue ActiveRecord::RecordNotFound\n flash[:bowarning]=\"It seems you don't have sufficient privilege to access this item or something went wrong with your account permissions. Please contact Admin to get this fixed.\"\n #redirect_to contacts_path\n end\n\n end", "def included_associations\n (self.class.replicate_associations + @replicate_opts[:associations]).uniq\n end", "def duplicated_cards\n Cache.hash_get_all(\"#{@batch_id}_duplicated_cards\").presence || {}\n end", "def find_phone_duplicates(master_customer)\n if master_customer.phone != nil\n #TODO ignore customer records with no orders - i.e. merged records.\n duplicate_by_phone = Customer.select(:id).where(\"phone = '#{master_customer.phone}'\n and id < #{master_customer.id}\")\n end\nend", "def work_profile_block_cross_profile_contacts_search\n return @work_profile_block_cross_profile_contacts_search\n end", "def contacts\n @contacts ||= get_attr(:contacts).collect { |c| OpenStruct.new(c) }\n end", "def show_related\n approved_friends = current_user.allFriends.map!{|user| user.id}\n pending_friends = current_user.allPendingFriends.map!{|user| user.id}\n contacts = []\n filtered_contacts = current_user.contacts.where(\"contacts.name ilike '%#{current_user.lastname}%'\").joins('inner join users on users.email = contacts.email')\n filtered_contacts.each do |contact|\n user = User.find_by_email(contact.email)\n\n # Verify current user isn't that contact!\n next if user.id == current_user.id\n\n # Rehash contact\n currentContact = {\n :uid => Digest::MD5.hexdigest(contact.id.to_s),\n :name => contact.name,\n :email => contact.email,\n :source => contact.source,\n :user_id => user.id,\n :is_confirmed_friend => approved_friends.include?(user.id),\n :is_pending_friend => pending_friends.include?(user.id),\n :profile_photo => user.profile_photo\n }\n\n # Add to contacts list\n contacts << currentContact\n end\n render :status => 200, :json => {:contacts => contacts, :total_contacts => contacts.size}\n end", "def clean_empty_contacts\n return if contacts.nil?\n\n contacts.delete_if do |contact|\n clean_blanks(contact)\n\n contact.blank? || has_only_blank_phones(contact)\n end\n\n self.contacts = nil if contacts.blank?\n end", "def add_contacts \n params[:contact_ids] = params[:contact_ids][0].split(', ')\n contacts = current_user.contacts.find(params[:contact_ids]) \n @notification = current_user.notifications.find(params[:id])\n \n contacts = contacts.collect{|el| @notification.contacts.include?(el) ? nil : el}.compact\n contacts.each do |el|\n @notification.receipients.create( :contact_id => el.id, :status => 'active' )\n end\n \n render :update do |page| \n page.redirect_to(@notification)\n end \n end", "def complement\n self.class.all.difference(self)\n end", "def\tmerge_accounts_change\n\t\tchanged = false\n\t\taccounts_to_remove = NSMutableArray.alloc.init\n\t\t@accounts.each do |account|\n\t\t\tif account.new?\n\t\t\t\t#new added and deleted account, just leave it\n\t\t\t\tif account.deleted?\n\t\t\t\t\taccounts_to_remove.addObject(account)\n\t\t\t\telse\n\t\t\t\t\tchanged = true\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tchanged = true if account.changed?\n\t\t\tend\n\t\tend\n\t\t@accounts.removeObjectsInArray(accounts_to_remove)\n\n\t\tchanged\n\tend", "def duplicate_viol_candidates\n @partition.find_all { |part| part.size > 1 }\n end", "def accepted_invitees\n (collaborations.where(is_accepted: true) + Collaboration.where(collaboration_level: documents, is_accepted: true)).uniq(&:collaborator_id)\n end", "def get_contact_emails\n if @info == nil || !(@info.key? \"contacts\")\n return Array.new\n end\n \n return @info[\"contacts\"]\n end", "def remove_blank_contacts\n self.details = details.select { |cd| !cd.value.blank? }\n end", "def people_involved(notification)\n people = User.joins(:comments)\n .joins('INNER JOIN patches ON patches.id = comments.patch_id')\n .joins('INNER JOIN merge_requests ON merge_requests.id = patches.merge_request_id')\n .where(notification => true)\n .where('merge_requests.id = ?', id).uniq\n people << reviewer if reviewer\n (people << author).uniq\n end", "def grouped_duplicates(collection)\n collection.group_by { |item| item }.values.reject(&:one?)\n end", "def conflicts\n @grid.values.select { |claims| claims.size > 1 }\n end", "def fixDupePeople\n puts \"Scanning for unconnected authors.\"\n connectAuthors # make sure all newly converted (or reconverted) items have author->people links\n\n puts \"Scanning for referenced people.\"\n referencedPeople = Set.new\n ItemAuthor.where(Sequel.lit(\"person_id is not null\")).each { |row|\n row[:person_id] and referencedPeople << row[:person_id]\n }\n\n puts \"Scanning for duplicate people.\"\n emailToPeople = Hash.new { |h,k| h[k] = Set.new }\n Person.where(Sequel.lit(\"attrs->'$.email' is not null\")).each { |person|\n attrs = JSON.parse(person.attrs)\n next if attrs['forwarded_to']\n Set.new([attrs['email']] + (attrs['prev_emails'] || [])).each { |email|\n emailToPeople[email.downcase] << person.id\n }\n }\n\n puts \"Change phase starting.\"\n DB.transaction {\n emailToPeople.each { |email, people|\n next if people.size == 1\n\n keep = people & referencedPeople\n keep.empty? and keep << people.to_a.sort[0]\n\n toss = people - keep\n if !toss.empty?\n puts \"#{email}: keep=#{keep.to_a.join(\";\")} toss=#{toss.to_a.join(\";\")}\"\n toss.each { |id| Person[id].delete }\n end\n\n if keep.size > 1\n sorted = keep.to_a.sort\n target = sorted[0]\n remap = sorted[1..-1]\n puts \"#{email}: target=#{target} remap=#{remap.join(\";\")}\"\n remap.each { |source|\n ItemAuthor.where(person_id: source).update(person_id: target)\n }\n end\n }\n }\nend", "def merge_requests_to_import\n project.merge_requests.id_not_in(already_imported_objects).with_state(:merged)\n end", "def get_uniq_locations\n start_array = StartLocation.all.map { |start_location| start_location.name }\n EndLocation.all.each { |end_location| start_array << end_location.name }\n uniq_arr = start_array.uniq\n uniq_arr\nend", "def find_and_merge_duplicate_hosts!\n # find all duplicate addresses within the same workspace currently in the db\n dupe_addresses_and_workspaces = ApplicationRecord.connection.execute(%Q{\n SELECT workspace_id, address, count_addr\n FROM (\n SELECT workspace_id, address, COUNT(address) AS count_addr\n FROM hosts\n GROUP BY address, workspace_id\n ) X\n WHERE count_addr > 1\n })\n\n if dupe_addresses_and_workspaces.present? and\n not dupe_addresses_and_workspaces.num_tuples.zero?\n puts \"Duplicate hosts in workspace found. Merging host references.\"\n # iterate through the duped IPs\n dupe_addresses_and_workspaces.each do |result|\n # so its come to this\n address = ApplicationRecord.connection.quote(result['address'])\n workspace_id = result['workspace_id'].to_i\n # look up the duplicate Host table entries to find all IDs of the duped Hosts\n hosts = ApplicationRecord.connection.execute(%Q|\n SELECT id\n FROM hosts\n WHERE address=#{address} AND workspace_id=#{workspace_id}\n ORDER BY id DESC\n |)\n # grab and quote the ID for each result row\n hosts = hosts.map { |h| h[\"id\"].to_i }\n # grab every Host entry besides the first one\n first_host_id = hosts.first\n dupe_host_ids = hosts[1..-1]\n # update associations to these duplicate Hosts\n HOST_ASSOCIATION_MAP.each do |table, column|\n ApplicationRecord.connection.execute(%Q|\n UPDATE #{table} SET #{column}=#{first_host_id}\n WHERE #{column} IN (#{dupe_host_ids.join(',')})\n |)\n end\n # destroy the duplicate host rows\n ApplicationRecord.connection.execute(%Q|\n DELETE FROM hosts WHERE id IN (#{dupe_host_ids.join(',')})\n |)\n end\n\n # At this point all duped hosts in the same workspace should be merged.\n # You could end up with duplicate services, but hey its better than just\n # dropping all data about the old Host.\n end\n end", "def includes_all?(other)\n leftovers = other.dup\n leftovers.delete_elements!(self)\n leftovers.empty?\n end", "def complement\n self.class.all.difference(self)\n end", "def correlate\n correlated = false\n r = nil\n\n # Correlate by address\n if self.address?\n matched_street = self.community.residents.where(\"residents.id != ? AND address ILIKE ? AND last_name ILIKE ?\", self.id, self.address, self.last_name)\n\n if matched_street.count > 0\n matched = matched_street.select { |resident| resident.first_name == self.first_name }\n\n if matched.count > 1\n # Well, what are the odds? =(\n end\n\n if matched.count == 1\n r = matched.first\n\n self.merge_into(r)\n correlated = true\n\n else\n # No match, but might match with a StreetAddress file\n matched_addr = self.community.street_addresses.where(\"address ILIKE ?\",\"%#{self.address}%\")\n\n if matched_addr.count == 1\n street = matched_addr.first\n\n self.street_address = street\n end\n end\n end\n end\n\n # Correlate by email\n if self.email?\n matched_email = self.community.residents.where(\"residents.id != ? AND email ILIKE ?\", self.id, self.email)\n\n # If this happens, then at least one of the files must have been\n # inputted/modified in the organizer app\n if matched_email.count > 1\n end\n\n # Add whatever was inputted to the existing Residents file\n if matched_email.count == 1\n r = matched_email.first\n\n self.merge_into(r)\n\n correlated = true\n end\n end\n\n # If there is neither an address nor an email, then there's a good chance of\n # correlating with the wrong file...so don't correlate\n if correlated\n self.destroy\n end\n\n r\n end", "def contacts\n self.connections.map do |connection|\n connection.contact\n end\n end" ]
[ "0.642129", "0.63884264", "0.6226378", "0.62016684", "0.6129265", "0.6113292", "0.59946615", "0.5966752", "0.59532094", "0.5919953", "0.5893186", "0.580054", "0.57838774", "0.57540345", "0.5693528", "0.5678384", "0.5638158", "0.56254077", "0.56212527", "0.56030095", "0.55835474", "0.55643857", "0.5562713", "0.5548967", "0.5529473", "0.54916763", "0.54901457", "0.5484492", "0.54786354", "0.5464462", "0.54488796", "0.5431841", "0.54303074", "0.5422979", "0.53680867", "0.53645533", "0.5363771", "0.5362967", "0.535782", "0.53299373", "0.53288615", "0.53256834", "0.53252476", "0.532267", "0.5322522", "0.53050655", "0.52949613", "0.52934164", "0.528964", "0.5284508", "0.5279502", "0.5279185", "0.52765054", "0.52731407", "0.52724683", "0.5270784", "0.52689934", "0.5267018", "0.5264114", "0.525963", "0.5259104", "0.5249187", "0.52471095", "0.5246243", "0.5245751", "0.52378696", "0.52317715", "0.5231269", "0.52294195", "0.52113605", "0.52109736", "0.5202953", "0.5178684", "0.5170126", "0.5164746", "0.51644075", "0.51509815", "0.5148882", "0.51317906", "0.5128059", "0.51269114", "0.51201314", "0.5118748", "0.5117434", "0.51141405", "0.5103071", "0.5100989", "0.5094737", "0.5079517", "0.5066983", "0.50664395", "0.506567", "0.50655353", "0.5062063", "0.5058711", "0.5055708", "0.5053673", "0.5049331", "0.5046099", "0.50203204" ]
0.7821992
0
Method Returns Collection of Contacts that were Merged to form the calling Contact
def parents Contact.find(:all, :conditions => ["merged_to_form_contact_id = ?", self.id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def contacts\n first_set = self.initiated_contacts\n second_set = self.received_contacts\n return first_set + second_set\n end", "def contacts\n collection = CapsuleCRM::ContactCollection.new(self,CapsuleCRM::Contact, [])\n collection.concat emails\n collection.concat phone_numbers\n collection.concat websites\n collection.concat addresses\n collection\n end", "def all_contacts\n Contact.all\n end", "def contacts\n Contact.where(account_ids: self._id)\n end", "def get_other_contacts(matter)\n client_contacts = matter.client_contacts\n client_contacts << matter.primary_matter_contact\n client_contacts.compact\n end", "def duplicates\n Contact.find(:all, :conditions => [\"id != ? AND merge_id = ?\", id, merge_id])\n end", "def contacts\n self.connections.map do |connection|\n connection.contact\n end\n end", "def contacts(params = {})\n # contacts in this group\n @contacts ||= get_contacts({\"group\" => self.id}.merge(params))\n end", "def contacts\n return [] unless persisted?\n results = connection.get(\"#{self.class.path}/#{@attributes[\"Id\"]}\")\n @attributes['ContactIds'] = results.first['ContactIds']\n end", "def merge(contacts_with_dupes)\n group_by_email(contacts_with_dupes).flat_map do |_, contacts|\n contacts.sort_by! { |c| c[:date_added] }\n\n contacts.first.tap do |merged|\n contacts[1..-1].each do |newer|\n merged.keys.each do |key|\n merged[key] = newer[key] unless newer[key].to_s.empty?\n end\n end\n end\n end\n end", "def get_all_contacts\n\t\t#@contacts = Contact.find_with_deleted(:all, :conditions=>[\"company_id=?\", get_company_id], :order=>\"coalesce(last_name,'')||''||first_name||''||coalesce(middle_name,'') asc\")\n #Bug 11593 Deleted contacts are displayed in Drop down.\n @contacts = Contact.find(:all, :conditions=>[\"company_id=?\", get_company_id], :order=>\"coalesce(last_name,'')||''||first_name||''||coalesce(middle_name,'') asc\")\n end", "def contacts!(params = {})\n @contacts ||= get_contacts({\"group\" => self.id}.merge(params))\n end", "def all_contacts\n ret = []\n chunk_size = 200\n offset = 0\n \n while (chunk = contacts(:limit => chunk_size, :offset => offset)).size != 0\n ret.push(*chunk)\n offset += chunk_size\n break if chunk.size < chunk_size\n end\n ret\n end", "def contacts\n contact_client.contacts\n end", "def get_matters_and_contacts\n\t\tget_matters\n\t\tget_all_contacts\n\tend", "def contacts\n @contacts ||= @ab.people.map {|abperson| Macabee::Contact.new(abperson, :macabee => self)}\n end", "def getContacts\n messages = [] \n \n if !self.received_messages.nil?\n messagesRecv = (self.received_messages.order(:updated_at)).reverse \n\t messagesRecv.each do |recv|\n\t user = User.find(recv.sender_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n if !self.send_messages.nil?\n messagesSend = (self.send_messages.order(:updated_at)).reverse \n\t messagesSend.each do |send|\n\t user = User.find(send.receiver_id)\n\t unless messages.include?(user)\n\t\t messages += [user]\n\t\t end\n\t end\n end\n\t return messages\n end", "def contacts\n ensure_cache_up_to_date\n contacts = self.redis.keys(\"bluster:objects:contact:*\")\n contacts.map! { |r| r.split(\":\")[3] }\n contacts.uniq\n end", "def contacts\n @contacts = @seller.get_contacts\n end", "def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end", "def contacts\n @contacts ||= DebtorContactProxy.new(self)\n end", "def contacts\n fail NotPersisted if id.nil?\n\n @contacts ||=\n begin\n links = Amorail::ContactLink.find_by_leads(id)\n links.empty? ? [] : Amorail::Contact.find_all(links.map(&:contact_id))\n end\n end", "def contact_merge(contact_id, duplicate_contact_id)\n response = xmlrpc('ContactService.merge', contact_id, duplicate_contact_id)\n end", "def all\n ContactDatabase.get_all\n end", "def get_apple_mail_contacts(vcf_data)\n @user = current_user\n begin\n temp_file = \"/tmp/#{Time.now.to_i.to_s}.vcf\"\n f = open(temp_file, \"wb\")\n contents = vcf_data\n c = contents.gsub(/[^\\x00-\\x7F]/n,'')\n f.write(c)\n f.close\n\n cards = Vpim::Vcard.decode(File.open(temp_file))\n @importedContacts = []\n @emails = []\n cards.each do |card|\n person = {}\n person[\"fname\"] = card.name.formatted\n person[\"email\"] = card.email.to_s\n #person[\"email\"] = person[\"email\"].tr(\"\\n\", \"\") if person[\"email\"]\n if !person[\"email\"].blank?\n #Do not add duplicates\n unless @importedContacts.any? {|h| h[\"email\"] == person[\"email\"]}\n @importedContacts << person\n end\n end\n end\n @importedContacts.each do |mail|\n @emails.push(mail.fetch('email'))\n end\n @importedContacts.sort! { |a, b| a.fetch(\"fname\").downcase <=> b.fetch(\"fname\").downcase }\n rescue\n #do nothing\n end\n\n return @importedContacts\n end", "def contacts\n @contacts ||= get_attr(:contacts).collect { |c| OpenStruct.new(c) }\n end", "def contacts\n\t\t@contact = Contact.first();\n\tend", "def get_list(options={})\n rsp = @flickr.send_request('flickr.contacts.getList', options)\n collect_contacts(rsp)\n end", "def contacts!(params = {})\n # contacts in this group\n @contacts = nil\n contacts\n end", "def contacts\n @contacts ||= CreditorContactProxy.new(self)\n end", "def contact_ids\n (object.added_contacts + object.mutual_contacts).map{|ct| ct.slug }\n end", "def contacts\n @contacts ||= User.any_in(:_id => facilities.map(&:consumer_ids).flatten.uniq)\n end", "def contacts\n\t\t@user = current_user\n\t\tcheck_if_myself\n\t\t@contacts = @user.contacts\n\tend", "def sugar_contacts_with_email\n sugar_contact_ids = sugar_contacts.map { |sc| sc.id }\n SugarContact.find_with_email(sugar_contact_ids)\n end", "def show_related\n approved_friends = current_user.allFriends.map!{|user| user.id}\n pending_friends = current_user.allPendingFriends.map!{|user| user.id}\n contacts = []\n filtered_contacts = current_user.contacts.where(\"contacts.name ilike '%#{current_user.lastname}%'\").joins('inner join users on users.email = contacts.email')\n filtered_contacts.each do |contact|\n user = User.find_by_email(contact.email)\n\n # Verify current user isn't that contact!\n next if user.id == current_user.id\n\n # Rehash contact\n currentContact = {\n :uid => Digest::MD5.hexdigest(contact.id.to_s),\n :name => contact.name,\n :email => contact.email,\n :source => contact.source,\n :user_id => user.id,\n :is_confirmed_friend => approved_friends.include?(user.id),\n :is_pending_friend => pending_friends.include?(user.id),\n :profile_photo => user.profile_photo\n }\n\n # Add to contacts list\n contacts << currentContact\n end\n render :status => 200, :json => {:contacts => contacts, :total_contacts => contacts.size}\n end", "def getContacts\n @contact_list.each_with_index do |c, i|\n #puts \"#{i +1}) #{c}\"\n puts \"#{i +1}) #{c[:first_name]} #{c[:last_name]} #{c[:email]}\"\n end\n end", "def common_contacts_with(other_person, options = {})\n # I tried to do this in SQL for efficiency, but failed miserably.\n # Horrifyingly, MySQL lacks support for the INTERSECT keyword.\n common_contacts = []\n other_person.dogs.each do |dog|\n common_contacts << (contacts & dog.contacts)\n end\n return common_contacts.flatten.uniq.paginate(options)\n end", "def get_contacts\n @notification_server.get_contacts\n end", "def contacts\n parser.contacts\n end", "def get_contact_emails\n if @info == nil || !(@info.key? \"contacts\")\n return Array.new\n end\n \n return @info[\"contacts\"]\n end", "def matter_contact_records\n get_comp_id = get_company_id\n @contacts = Contact.get_contact_records(current_company,get_comp_id) \n @matters = Matter.get_matter_records(get_comp_id, get_employee_user_id)\n end", "def find_all_contacts_with_email(&block)\n t = Thread.start do\n emails = []\n content_resolver = @context.get_content_resolver()\n cursor = content_resolver.query(ContactsContract::Contacts::CONTENT_URI, nil, nil, nil, nil)\n\n if cursor.get_count() > 0\n Logger.d(\"#{cursor.get_count} contacts are candidate for sync!\")\n while cursor.moveToNext() do\n text = cursor.get_string(cursor.get_column_index(\"sort_key\"))\n emails << text if is_contact_an_email?(text) == true\n end\n Logger.d(\"#{emails.length} contacts to actually sync!\")\n \n block.call(emails) # Invoke caller's block only when non-zero emails were found\n else\n Logger.d(\"NO contact to sync!\")\n end\n cursor.close\n\n end # Thread ends\n end", "def common_contacts_with(other_person, options = {})\n # I tried to do this in SQL for efficiency, but failed miserably.\n # Horrifyingly, MySQL lacks support for the INTERSECT keyword.\n (contacts & other_person.contacts).paginate(options)\n end", "def get_all_contacts\r\n info = load_contacts\r\n info.each do |arr|\r\n puts \"#{arr[0]}: #{arr[1]} (#{arr[2]})\"\r\n end\r\n puts \"---\"\r\n puts \"#{generate_id} records total\"\r\n end", "def merge_with(master, ignored_attr = [])\n # Just in case a user tries to merge a contact with itself,\n # even though the interface prevents this from happening.\n return false if master == self\n\n merge_attr = self.merge_attributes\n # ------ Remove ignored attributes from this contact\n ignored_attr.each { |attr| merge_attr.delete(attr) }\n\n # Perform all actions in an atomic transaction, so that if one part of the process fails,\n # the whole merge can be rolled back.\n Contact.transaction do\n\n # ------ Merge attributes: ensure only model attributes are updated.\n model_attributes = merge_attr.dup.reject{ |k,v| !master.attributes.keys.include?(k) }\n master.update_attributes(model_attributes)\n\n # ------ Merge 'belongs_to' and 'has_one' associations\n {'user_id' => 'user', 'lead_id' => 'lead', 'assigned_to' => 'assignee'}.each do |attr, method|\n unless ignored_attr.include?(attr)\n master.send(method + \"=\", self.send(method))\n end\n end\n \n # ------ Merge address associations\n master.address_attributes.keys.each do |attr|\n unless ignored_attr.include?(attr)\n master.send(attr + \"=\", self.send(attr))\n end\n end\n\n # ------ Merge 'has_many' associations\n self.tasks.each { |t| t.asset = master; t.save! }\n self.emails.each { |e| e.mediator = master; e.save! }\n self.comments.each { |c| c.commentable = master; c.save! }\n\n # Find all AccountContact records with the duplicate contact,\n # and only add the master contact if it is not already added to the account.\n AccountContact.find_all_by_contact_id(self.id).each do |ac|\n unless ac.account.contacts.include?(master)\n ac.contact_id = master.id; ac.save!\n end\n end\n \n # Find all ContactOpportunity records with the duplicate contact,\n # and only add the master contact if it is not already added to the opportunity.\n ContactOpportunity.find_all_by_contact_id(self.id).each do |co|\n unless co.opportunity.contacts.include?(master)\n co.contact_id = master.id; co.save!\n end\n end\n\n # Merge tags\n all_tags = (self.tags + master.tags).uniq\n master.tag_list = all_tags.map(&:name).join(\", \")\n \n # Call the merge_hook - useful if you have custom actions that need to happen during a merge\n master.merge_hook(self)\n\n if master.save!\n # Update any existing aliases that were pointing to the duplicate record\n ContactAlias.find_all_by_contact_id(self.id).each do |ca|\n ca.update_attribute(:contact, master)\n end\n\n # Create the contact alias and destroy the merged contact.\n if ContactAlias.create(:contact => master,\n :destroyed_contact_id => self.id)\n # Must force a reload of the contact, and shake off all migrated assets.\n self.reload\n self.destroy\n end\n end\n end # transaction\n end", "def list\n ContactDatabase.list\n end", "def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end", "def contacts\n contacts = []\n contacts.concat(registrant_contact.is_a?(Array) ? registrant_contact : [registrant_contact]) if property_supported?(:registrant_contact)\n contacts.concat(admin_contact.is_a?(Array) ? admin_contact : [admin_contact]) if property_supported?(:admin_contact)\n contacts.concat(technical_contact.is_a?(Array) ? technical_contact : [technical_contact]) if property_supported?(:technical_contact)\n contacts.compact\n end", "def contacts()\n return MicrosoftGraph::Contacts::ContactsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\n end", "def current_account_contact_ids\n current_account.added_contact_ids + current_account.mutual_contact_ids\n end", "def find_contacts\n logger.debug \"**** FIND CONTRIBUTORS ****\"\n show_params(params) #debug params and put them in logs\n \n \n @person_query = params[:search][:person]\n @org_query = params[:search][:organisation]\n \n \n #This populates @contacts \n @found_contacts = search_by_name_and_organisation(@person_query, @org_query)\n session[:contacts_from_search] = @found_contacts\n \n @already_selected = session[SELECTED_CONTACTS]\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n render :layout => false\n end", "def contacts\n @contacts ||= Harvest::API::Contacts.new(credentials)\n end", "def get_contacts(params={})\n @obj.get('get-contacts', @auth.merge(params))\n end", "def contact_groups_represented\n @contact_groups_represented ||= contacts.map(&:contact_groups).flatten.uniq\n end", "def contacts\n Person.find_by_sql(contact_query(\"people.id, people.created_at\"))\n end", "def contacts(options = {})\n params = { :limit => 200 }.update(options)\n response = get(PATH['contacts_full'], params)\n parse_contacts response_body(response)\n end", "def contacts\n @contacts = Employee.by_company_id(params[:company_id]).by_search(params[:search]).by_contacts(current_user).paginate :page => params[:page]\n @active_employers = current_user.employers.active_employers.all\n end", "def contacts_for_unit(unit)\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => unit.id}})\n return c.empty? ? contacts : c\n end", "def finished_contacts\n @contacts.where(contact_type: 'PBX').where.not(answered: nil, call_ended: nil, service_id: 120)\n end", "def contact_groups_represented\n @contact_groups_represented ||= contacts.map(&:contact_groups).flatten.uniq\n end", "def merged_into\n checked = []\n t = self\n while t.merged?\n t = Ticket.find(t.merge_ticket_id)\n raise \"Merge loop: #{checked.inspect}\" if checked.include?(t.id)\n checked << t.id\n end\n t\n end", "def shared\n @contact = Person.find(params[:id])\n redirect_to contacts_path and return if @person == @contact\n @title = \"Shared Contacts with %{name}\".t % { :name => @contact.name }\n @people = do_search_people(@person.friends.shared_with(@contact), nil, :with_tags => true)\n render :template => 'contacts/index'\n end", "def contacts\n contacts_raw.present? ? JSON.parse(contacts_raw) : {}\n end", "def contacts(options={})\n order_option = [group_by_sort_order, options[:order]].reject {|s| s.blank?}.join(',')\n order_option = nil if order_option.blank?\n\n # joins = (order_option && order_option.include?('authors')) ? \"LEFT OUTER JOIN users authors ON authors.id = #{Contact.table_name}.author_id\" : nil\n\n joins = []\n if order_option\n if order_option.include?('authors')\n joins << \"LEFT OUTER JOIN users authors ON authors.id = #{Contact.table_name}.author_id\"\n end\n order_option.scan(/cf_\\d+/).uniq.each do |name|\n column = available_columns.detect {|c| c.name.to_s == name}\n join = column && column.custom_field.join_for_order_statement\n if join\n joins << join\n end\n end\n end\n joins = joins.any? ? joins.join(' ') : nil\n\n\n scope = Contact.scoped({})\n\n options[:search].split(' ').collect{ |search_string| scope = scope.live_search(search_string) } unless options[:search].blank?\n options[:include] << :assigned_to if (order_option && order_option.include?('users'))\n scope.visible.scoped(:conditions => options[:conditions]).find :all, :include => ([:projects, :address] + (options[:include] || [])).uniq,\n :conditions => statement,\n :order => order_option,\n :joins => joins,\n :limit => options[:limit],\n :offset => options[:offset]\n rescue ::ActiveRecord::StatementInvalid => e\n raise StatementInvalid.new(e.message)\n end", "def contacts() @contacts ||= Flickr::Contacts.new(self) end", "def queue_contacts\n @contacts.where(contact_type: 'PBX', direction: 'I', forwarded_to_agent: nil, call_ended: nil).where.not(service_id: 120)\n end", "def get_contacts(user_or_identifier)\n identifier = identifier_param(user_or_identifier)\n json = parse_response(get(\"/api/#{API_VERSION}/get_contacts\",\n :apiKey => @api_key,\n :identifier => identifier))\n ContactList.new(json)\n end", "def all\n # TODO: Return an Array of Contact instances made from the data in 'contacts.csv'.\n\n all_contacts = []\n CSV.foreach('contacts.csv') do |row|\n # TODO call contact.new for each row\n all_contacts << Contact.new(row[0], row[1], row[2])\n end\n all_contacts\n end", "def scrape_contacts; end", "def get_google_contacts\n url = \"https://www.google.com/m8/feeds/contacts/default/full?access_token=#{token}&alt=json&max-results=100\"\n response = open(url)\n json = JSON.parse(response.read)\n my_contacts = json['feed']['entry']\n\n my_contacts.each do |contact|\n name = contact['title']['$t'] || nil\n email = contact['gd$email'] ? contact['gd$email'][0]['address'] : nil\n tel = contact['gd$phoneNumber'] ? contact[\"gd$phoneNumber\"][0][\"$t\"] : nil\n if contact['link'][1]['type'] == \"image/*\"\n picture = \"#{contact['link'][1]['href']}?access_token=#{token}\"\n else\n picture = nil\n end\n contacts.first_or_create({name: name, email: email, tel: tel})\n end\n end", "def add_contacts \n params[:contact_ids] = params[:contact_ids][0].split(', ')\n contacts = current_user.contacts.find(params[:contact_ids]) \n @notification = current_user.notifications.find(params[:id])\n \n contacts = contacts.collect{|el| @notification.contacts.include?(el) ? nil : el}.compact\n contacts.each do |el|\n @notification.receipients.create( :contact_id => el.id, :status => 'active' )\n end\n \n render :update do |page| \n page.redirect_to(@notification)\n end \n end", "def index\n\t\t@contacts = current_user.contacts.get_active_contacts\n\tend", "def contacts\n Easybill::Api::Contacts\n end", "def leads\n self.contacts.all(:conditions=> [\"status = 'lead'\"])\n end", "def requested_contact_links\n requested_contacts.map do |p|\n conn = Connection.conn(self, p)\n edit_connection_path(conn)\n end\n end", "def requested_contact_links\n requested_contacts.map do |p|\n conn = Connection.conn(self, p)\n edit_connection_path(conn)\n end\n end", "def primary_service_learning_contacts\n u = Unit.find_by_abbreviation(\"carlson\")\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => u.id, :primary_contact => true}})\n c.empty? ? position_supervisor_contacts : c\n end", "def user_role_contacts(achived,sort_order)\n remaining_roles = []\n merge_roles = remove_county_or_country_roles\n\n merge_roles.each do |role|\n remaining_roles << contact_types[role]\n end\n\n remaining_roles = remaining_roles.flatten\n contacts = Contact.where(contact_type: { '$in': remaining_roles }).archived(achived).all.order_by(sort_order)\n contacts\n end", "def merge_requests\n merge_requests = MergeRequestsFinder.new(current_user).execute\n unless default_project_filter\n merge_requests = merge_requests.in_projects(project_ids_relation)\n end\n\n merge_requests =\n if query =~ /[#!](\\d+)\\z/\n merge_requests.where(iid: $1)\n else\n merge_requests.full_search(query)\n end\n\n merge_requests.reorder('updated_at DESC')\n end", "def populatecombo \n sorted_contacts\n render :partial=>'/common/existingcontact',:object=>account_contacts\n end", "def similarity_of_contacts\n return if self.finished?\n if !Contact.where(:_id => self.first_contact_id).exists? || !Contact.where(:_id => self.second_contact_id).exists?\n self.errors[:existence_of_contacts] << I18n.t('errors.merge.existence_of_contacts')\n else\n if !first_contact.similar.include?(second_contact)\n self.errors[:similarity_of_contacts] << I18n.t('errors.merge.similarity_of_contacts')\n end\n end\n end", "def list\n contacts_index(Contact.all)\n end", "def un_merge\n Contact.transaction do\n self.parents.each do |contact|\n contact.update_attribute('merged_to_form_contact_id', 0)\n if contact.contact_type == Constants::CONTACT_TYPE::PROSPECT\n ContactProspect.update_all(\"prospect_old_id = NULL, prospect_id = #{contact.id}\", \"prospect_old_id = #{contact.id}\")\n else\n ContactProspect.update_all(\"contact_old_id = NULL, contact_id = #{contact.id}\", \"contact_old_id = #{contact.id}\")\n end\n end\n self.emails.clear\n self.sources.clear\n self.contact_metas.clear\n self.destroy_shares\n self.destroy\n\n end\n end", "def index\n @subcontractor_contacts = SubcontractorContact.all\n end", "def contacts(reload = false)\n self.cache(CostAgent::Contact, :all, reload) do\n (self.api(\"contacts\")/\"contact\").collect do |contact|\n projects = self.projects(:all, reload).select { |p| p.contact_id == (contact/\"id\").first.inner_text.to_i }\n Contact.new(\n :id => (contact/\"id\").first.inner_text.to_i,\n :organisation_name => (contact/\"organisation-name\").first.inner_text,\n :first_name => (contact/\"first-name\").first.inner_text,\n :last_name => (contact/\"last-name\").first.inner_text,\n :address1 => (contact/\"address1\").first.inner_text,\n :address2 => (contact/\"address2\").first.inner_text,\n :address3 => (contact/\"address3\").first.inner_text,\n :town => (contact/\"town\").first.inner_text,\n :region => (contact/\"region\").first.inner_text,\n :country => (contact/\"country\").first.inner_text,\n :postcode => (contact/\"postcode\").first.inner_text,\n :phone_number => (contact/\"phone-number\").first.inner_text,\n :email => (contact/\"email\").first.inner_text,\n :billing_email => (contact/\"billing-email\").first.inner_text,\n :contact_name_on_invoices => (contact/\"contact-name-on-invoices\").first.inner_text == \"true\",\n :sales_tax_registration_number => (contact/\"sales-tax-registration-number\").first.inner_text,\n :uses_contact_invoice_sequence => (contact/\"uses-contact-invoice-sequence\").first.inner_text == \"true\",\n :account_balance => (contact/\"account-balance\").first.inner_text.to_f,\n :projects => projects)\n end\n end\n end", "def contacts(consent)\n process_consent(consent)\n contacts_xml = access_live_contacts_api()\n contacts_list = WindowsLive.parse_xml(contacts_xml)\n end", "def index\n @other_contactinfos = OtherContactinfo.all\n end", "def index\n @merges = Merge.all\n end", "def get_agent_contacts(params)\n message = {\n serviceGroupID: params[:service_group_id],\n serviceID: params[:service_id],\n teamID: params[:team_name],\n agentID: params[:agent_id],\n startDate: params[:start_date],\n endDate: params[:end_date],\n contactTypes: params[:contact_type],\n useServiceTime: false\n }\n\n reply = @client.call(:get_contacts, message: message)\n data = reply.body.dig(:get_contacts_response,\n :get_contacts_result,\n :array_of_string)\n\n data = check_if_data_exists(data)\n data = map_contacts_data(data)\n delete_contact_headers(data)\n data\n end", "def index\n @contacts = current_user.contacts.all\n\n\n end", "def get_outlook_contacts(csv_data)\n @user = current_user\n\n @importedContacts =\n parse_csv_contacts(csv_data) or\n parse_csv_contacts(utf16_to_utf8(csv_data)) or \n []\n\n return @importedContacts\n end", "def primary_contacts_for_unit(unit)\n c = contacts.find(:all, :conditions => {:organization_contact_units => {:unit_id => unit.id, :primary_contact => true}})\n return c.empty? ? contacts_for_unit(unit) : c\n end", "def associated_contacts(accounts_path = [])\n if portal_case_scope__c == SCOPES[:this_account]\n contacts\n elsif portal_case_scope__c == SCOPES[:children_accounts]\n self.contacts + sibling_contacts\n elsif portal_case_scope__c.nil? and parent\n parent.associated_contacts(accounts_path << self)\n else # portal_case_scope__c is nil and this is root\n if accounts_path.empty?\n contacts\n else\n accounts_path.first.contacts\n end\n end\n end", "def answered_contacts\n @contacts.where(contact_type: 'PBX').where.not(answered: nil, service_id: 120)\n end", "def get_service_contacts(service_id, start_date, end_date)\n get_agent_contacts(service_group_id: -1,\n service_id: service_id,\n team_name: '',\n agent_id: -1,\n start_date: start_date,\n end_date: end_date,\n contact_type: 'PBX EMAIL SMS FAX SCAN CHAT COBRO MANUAL FACE TASK VIDEO')\n end", "def contacts\n contacts = params[:contacts].map{|c| c[1]}\n if contacts\n logger.debug \">>> received #{contacts.length} contacts\"\n end\n render :text => \"ok\"\n end", "def get_contacts(options = {})\n send_request(\"get\", contacts_url, body: options.to_json)\n end", "def people_involved(notification)\n people = User.joins(:comments)\n .joins('INNER JOIN patches ON patches.id = comments.patch_id')\n .joins('INNER JOIN merge_requests ON merge_requests.id = patches.merge_request_id')\n .where(notification => true)\n .where('merge_requests.id = ?', id).uniq\n people << reviewer if reviewer\n (people << author).uniq\n end", "def user_added_contact_emails\n self.user ? self.user.added_contacts.pluck('email') + [self.user.email] : []\n end" ]
[ "0.7499693", "0.70603544", "0.6941987", "0.6640651", "0.664044", "0.6612947", "0.65297437", "0.6513908", "0.65033674", "0.6486956", "0.64663416", "0.6463961", "0.6399552", "0.63609123", "0.63422996", "0.63251644", "0.6323237", "0.6290057", "0.62756443", "0.6255044", "0.62267834", "0.6198982", "0.6197369", "0.61903393", "0.6181046", "0.61607015", "0.6114856", "0.6109238", "0.61049414", "0.6096464", "0.6069147", "0.60601133", "0.60500467", "0.60458004", "0.6042057", "0.59795225", "0.5977229", "0.58990484", "0.58902746", "0.58778054", "0.58685195", "0.5850045", "0.5831536", "0.58108187", "0.5804695", "0.58021957", "0.58011425", "0.57965034", "0.57872385", "0.5775008", "0.5759973", "0.5757321", "0.5745799", "0.5728294", "0.57227284", "0.57202125", "0.5719934", "0.56964546", "0.56923795", "0.56877965", "0.5674122", "0.5651369", "0.56373817", "0.56320614", "0.5626699", "0.5612945", "0.5603714", "0.55785996", "0.55663514", "0.55539846", "0.5548961", "0.5541793", "0.55408686", "0.5539119", "0.5534432", "0.55342054", "0.55342054", "0.5524653", "0.5524119", "0.5518201", "0.5503883", "0.55038434", "0.54941505", "0.54917663", "0.5490331", "0.54881495", "0.5488001", "0.5476369", "0.5470245", "0.54575855", "0.5455176", "0.5454818", "0.54509443", "0.5438821", "0.54361326", "0.54288584", "0.54239374", "0.5411954", "0.540778", "0.5389623" ]
0.6291385
17
Method To Unmerge Contact
def un_merge Contact.transaction do self.parents.each do |contact| contact.update_attribute('merged_to_form_contact_id', 0) if contact.contact_type == Constants::CONTACT_TYPE::PROSPECT ContactProspect.update_all("prospect_old_id = NULL, prospect_id = #{contact.id}", "prospect_old_id = #{contact.id}") else ContactProspect.update_all("contact_old_id = NULL, contact_id = #{contact.id}", "contact_old_id = #{contact.id}") end end self.emails.clear self.sources.clear self.contact_metas.clear self.destroy_shares self.destroy end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tag_from_contact\n\t\t\t\t# unlike the remove method in account, this only removes the tag from one contact\n\t\t\t\t\n\t\t\tend", "def unlink_contact(_contact)\n _rc = false\n if self.contacts.detect { |c| c._id ==_contact._id }\n _facility = self.facilities.any_in(consumer_ids: [_contact._id]).first\n if _facility\n _facility.delete_or_remove_consumer(_contact)\n self.save!\n @contacts = nil\n _rc = true\n end\n end\n if self.reverse_contacts.detect { |c| c._id ==_contact._id }\n _facility = _contact.facilities.any_in(consumer_ids: [self._id]).first\n if _facility\n _facility.delete_or_remove_consumer(self)\n _contact.save!\n @reverse_contacts = nil\n _contact\n _rc = true\n end\n end\n _rc\n end", "def modify_existing_contact\n self.to_contact.modify_existing_contact.to_contact\n end", "def remove_contact(contact)\n @contacts.delete(contact)\n end", "def unlink(contact)\n contact.accounts.delete(self)\n contact.lists = contact.lists.reject{|l|l.account == self}\n if contact.owner == self\n contact.owner = nil\n contact.cached_owner = nil\n end\n contact.save\n end", "def delete\n MoxiworksPlatform::Contact.delete(self.to_hash)\n end", "def contacts!(params = {})\n # contacts in this group\n @contacts = nil\n contacts\n end", "def delete(contacts)\n @@contacts.delete(contact)\n end", "def destroy\n @contact = @current_affiliate_group.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @referral_contact.destroy\n end", "def uncheck_remove_contact(contact)\n @browser.div(:id=>\"addpeople_selected_contacts_container\").link(:text=>contact).parent.checkbox.clear\n end", "def delete\n\t\t#@@contacts -= [delete_id.to_i]\n\t\t@@contacts.delete(self)\n\tend", "def remove_contact(params={})\n @obj.put('remove-contact', @auth.merge(params))\n end", "def delete_contact(contact_to_delete)\n @contacts.delete(contact_to_delete)\n end", "def contact_merge(contact_id, duplicate_contact_id)\n response = xmlrpc('ContactService.merge', contact_id, duplicate_contact_id)\n end", "def -(contact_record_2)\n me = dup\n me.details = details - self.class.shared_contact_details(self,contact_record_2)\n me\n end", "def remove_contacts_from_selection\n logger.debug \"**** remove CONTRIBUTORS from SELN ****\"\n show_params(params) #debug params and put them in logs\n @role_contactinfos_ids = params[:role_contactinfos][:ids]\n previous_contacts = session[SELECTED_CONTACTS]\n for removed_contact_id in @role_contactinfos_ids\n # get the contact to remove\n removed_contact_id = removed_contact_id.gsub('role_contactinfo_', '')\n removed_contact = RoleContactinfo.find( removed_contact_id )\n \n # remove contact\n previous_contacts.delete(removed_contact)\n # new_contacts = new_contacts + [new_person_contact] unless !previous_contacts.include?new_person_contact\n end\n session[SELECTED_CONTACTS] = previous_contacts\n @contacts = session[SELECTED_CONTACTS]\n @already_selected = session[SELECTED_CONTACTS]\n \n # processing for existent contacts from mailout or saved contact lists\n saved_list_contacts = session[:list_contacts]\n mailout_list_contacts = session[:mailout_contacts]\n if saved_list_contacts != nil\n @already_selected = @already_selected + saved_list_contacts\n end\n if mailout_list_contacts != nil\n @already_selected = @already_selected + mailout_list_contacts\n end \n \n render :layout => false\n end", "def delete\n @@contacts.delete(self)\n end", "def delete\n @@contacts.delete(self)\n end", "def delete\n @@contact_list.delete(self)\n end", "def destroy\n @contact_detail.destroy\n @contact_details = ContactDetail.all\n end", "def merge(contacts_with_dupes)\n group_by_email(contacts_with_dupes).flat_map do |_, contacts|\n contacts.sort_by! { |c| c[:date_added] }\n\n contacts.first.tap do |merged|\n contacts[1..-1].each do |newer|\n merged.keys.each do |key|\n merged[key] = newer[key] unless newer[key].to_s.empty?\n end\n end\n end\n end\n end", "def merge!(with); end", "def removeBuddy(contact)\n \n unless SocialStream::Presence.enable\n return\n end\n \n unless contact.receiver.subject_type == \"User\" and contact.sender.subject_type == \"User\"\n return\n end\n \n #XMPP DOMAIN\n domain = SocialStream::Presence.domain\n user_sid = contact.sender.slug + \"@\" + domain\n user_name = contact.sender.name \n buddy_sid = contact.receiver.slug + \"@\" + domain\n buddy_name = contact.receiver.name\n \n #Check for bidirecctional\n \n if contact.sender.contact_actors(:type=>:user).include?(contact.receiver)\n #Bidirectional contacts\n #Execute unsetRosterForBidirectionalTie(user_sid,oldfriend_sid,oldfriendNick,oldfriendGroup)\n SocialStream::Presence::XmppServerOrder::unsetRosterForBidirectionalTie(buddy_sid,user_sid,user_name,\"SocialStream\")\n elsif contact.sender.contact_actors(:type=>:user, :direction=>:sent).include?(contact.receiver)\n #Unidirectional contacts\n SocialStream::Presence::XmppServerOrder::removeBuddyFromRoster(user_sid,buddy_sid)\n end\n \n end", "def remove(email)\n @mailing_list.remove_contacts(email, force:true)\n end", "def delete(contactname)\n\n end", "def remove_contact(options={})\n list_id = options.delete(:list_id)\n email = options.delete(:email)\n\n request_body = ''\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.RemoveRecipient do\n xml.LIST_ID list_id\n xml.EMAIL email unless email.nil?\n options.each do |field, value|\n xml.COLUMN do\n xml.NAME field.to_s\n xml.VALUE value.to_s\n end\n end\n end\n end\n end\n\n send_xml_api_request(request_body)\n true\n end", "def remove_contacts\n selected_contact_ids = params[:selected_contact_ids]\n\n Contact.where(:id => selected_contact_ids).destroy_all\n contacts_list\n end", "def delete\n Contact.all.delete(self)\n end", "def delete(contact)\n @@contacts.delete(contact)\n end", "def contacts(params = {})\n # contacts in this group\n @contacts = nil\n contacts!\n end", "def unfollow(actor)\n contact = contact_to!(actor)\n contact.update_column(:blocked, true)\n contact\n end", "def unmerge(type)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'type', type)\n\t\t\tclient.queue_service_action_call('social', 'unmerge', 'KalturaSocial', 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 remove_blank_contacts\n self.details = details.select { |cd| !cd.value.blank? }\n end", "def delete_contact\n contact = retrieve_contact_by_email\n if contact\n if @rolodex.delete(contact)\n puts \"Contact successfully deleted.\"\n end\n end\n end", "def duplicates\n Contact.find(:all, :conditions => [\"id != ? AND merge_id = ?\", id, merge_id])\n end", "def merge!(other); end", "def unsubscribe_all(contact_field_value, contact_field_name)\n full_path = full_resource_path('/unsubscribe_all')\n query_params = MaropostApi.set_query_params({\"contact[#{contact_field_name}]\" => contact_field_value})\n \n MaropostApi.put_result(full_path, {}, query_params)\n end", "def delete_contact(params={})\n @obj.delete('delete-contact', @auth.merge(params))\n end", "def clean_empty_contacts\n return if contacts.nil?\n\n contacts.delete_if do |contact|\n clean_blanks(contact)\n\n contact.blank? || has_only_blank_phones(contact)\n end\n\n self.contacts = nil if contacts.blank?\n end", "def destroy\n @contact = @business.contacts.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to business_contacts_url(@business) }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n\n head :no_content\n end", "def remove_contact\n Account.transaction do\n contact = Contact.find params[:id]\n unless contact.has_matters? \n @account_contact.destroy! if @account_contact= AccountContact.find_by_account_id_and_contact_id(params[:account_id], params[:id])\n flash[:notice] = \"#{t(:text_contact)} #{t(:flash_was_successful)} #{t(:text_deleted)} For This #{t(:text_account)}\"\n else\n flash[:error] = \"This contact has Matter(s) associated\"\n end\n if request.xhr?\n render :nothing=>true\n else\n redirect_to:back\n end\n end\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:html, :js, :xml)\n end", "def contact_delete(_args)\n raise NotImplementedError, 'Contacts are deleted with a garbage collector'\n end", "def destroy\n remove_contacts_dependencies\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to contacts_url, notice: 'Contact was destroyed.' }\n format.json { head :no_content }\n end\n end", "def normalize_candidate_entries\n a = Candidate.campany_candidate.where(email: email)\n a.each do |candidate|\n cp = CandidatesCompany.where(candidate_id: candidate.id)\n cp.update_all(candidate_id: id)\n # group_ids= candidate.groups.map{|g| g.id}\n # self.update_attribute(:group_ids, group_ids)\n candidate.delete\n end\n end", "def destroy\n #ContactAccount.where(contacto_id: @contacto.id).each{|c| c.destroy}\n #ContactClient.where(contacto_id: @contacto.id).each{|c| c.destroy}\n @contacto.destroy\n respond_to do |format|\n format.html { redirect_to contactos_url, notice: 'El Contacto ha sido eliminado exitosamente.' }\n format.json { head :no_content }\n\n end\n\n end", "def remove_contacts_from_selection\n logger.debug \"**** REMOVE CONTACTS FROM SELN ****\"\n show_params(params) #debug params and put them in logs\n #@role_contactinfos_ids = params[:role_contactinfos][:ids]\n \n\t# case for removing all\n\tif params[:remove] == 'all'\n\t session[SELECTED_CONTACTS] = Array.new\n\t session[:contacts_to_add] = Array.new\n\t\n\t# case for removing seleted only \n\telse\n\t @selected_role_contactinfos = session[:contacts_to_add]\n\t\n\t @role_contactinfos_ids = @selected_role_contactinfos.map{|rc| \"role_contactinfo_\" + rc.role_contactinfo_id.to_s}\n\t\n previously_selected_contacts = session[SELECTED_CONTACTS]\n \n # remove contacts\n for removed_contact_id in @role_contactinfos_ids\n # get the contact to remove\n removed_contact = RoleContactinfo.find( removed_contact_id.gsub('role_contactinfo_', '') )\n previously_selected_contacts.delete(removed_contact)\n\t session[:contacts_to_add].delete(removed_contact)\n # new_contacts = new_contacts + [new_person_contact] unless previously_selected_contacts.include?new_person_contact\n end\n \n # update session variable with removed contacts\n session[SELECTED_CONTACTS] = previously_selected_contacts\n end\n\t\n # UI variables\n @contacts = session[SELECTED_CONTACTS]\n @already_selected = get_already_selected()\n \n\tpaginated_selected_results\n\t\n\trender :layout => false\n end", "def destroy\n Conshejointable.where(:contact_id =>@contact.id).delete_all\n Description.where(:contact_id =>@contact.id).delete_all\n puts @contact.id.to_s + \": \" + @contact.name\n @contact.delete\n respond_to do |format|\n format.html { redirect_to contacts_path, notice: 'Contact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def update\n pars = contact_params\n pars[:uid] = current_user.id\n\n group_ids = []\n unless pars[:contact_group_attributes].nil?\n pars[:contact_group_attributes].each do |group|\n group_ids << BSON::ObjectId.from_string(group[:_id])\n end\n end\n pars.delete(:contact_group_attributes)\n\n if group_ids.blank?\n @contact.unset(:contact_group_ids)\n else\n @contact.set(contact_group_ids: group_ids)\n end\n\n respond_to do |format|\n begin\n if @contact.update(pars)\n expire_fragment contact_url(@contact)\n if pars[:contact_profile_attributes][:last_name] != @contact.contact_profile[:last_name] or\n pars[:contact_profile_attributes][:first_name] != @contact.contact_profile[:first_name]\n Cashier.expire \"contacts-filter-#{current_user.id}\"\n end\n\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n create_profile\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n rescue Mongo::Error::OperationFailure => exception\n create_profile\n contact = duplicate_contact\n error = (t 'mongoid.errors.contact.duplicate_val')\n .gsub('%phone%', \"#{contact_params[:prefix]} #{contact_params[:mobile]}\")\n @contact.errors[t 'mongoid.errors.contact.duplicate_key'] =\n \"#{error} <a href=\\\"#{contact_path contact}\\\">#{t 'view_contact'}</a>\"\n\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n\n ur_contact = UrContact.find(params[:id])\n\n #you can delete contacts you don't own\n if ur_contact.user_id != current_user.id then\n Rails.logger.error \"Attempt to delete contact you don't own\"\n head :internal_server_error\n return\n end\n\n if ur_contact.destroy then\n render json: {message:'Content Deleted'}\n else\n head :internal_server_error\n end\n end", "def destroy\n @company = Company.find(params[:id])\n @contactinfo= Contactinfo.find(@company.contactinfos_id)\n @contactinfo.destroy\n @company.destroy\n\n respond_to do |format|\n format.html { redirect_to(companies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n check_member_or_admin_of_group?\n @contact = @group.contacts.friendly.find(params[:id])\n #@contact = @group.contacts.find_by_slug(params[:id])\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to @group}\n format.json { head :no_content }\n end\nend", "def remove_contact(list_id, email)\n endpoint = \"/api/v1/list/#{list_id}/remove-contact/\"\n base_params = base_params(endpoint)\n custom_params = {\n \"email\" => email\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def update\n if params[:commit] == 'Unsubscribe'\n redirect_to contact_unsubscribe_path(id: @contact.id, list_id: MASTER_LIST_ID) and return\n else\n respond_to do |format|\n if @contact.update(contact_params)\n format.html { redirect_to @contact, notice: 'Contact was successfully updated.' }\n format.json { render :show, status: :ok, location: @contact }\n else\n format.html { render :edit }\n format.json { render json: @contact.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def blank_contact\n person = ABPerson.new\n person.initWithAddressBook(@ab)\n Macabee::Contact.new(person, :macabee => self)\n end", "def destroy\n @point_of_contact.destroy\n\n head :no_content\n end", "def remove_custom_field(key)\n self.contact_fields.delete(key)\n end", "def merge(to_be_merged)\n scheme_ids = identifiers.pluck(:identifier_scheme_id)\n # merge logic\n # => answers -> map id\n to_be_merged.answers.update_all(user_id: id)\n # => notes -> map id\n to_be_merged.notes.update_all(user_id: id)\n # => plans -> map on id roles\n to_be_merged.roles.update_all(user_id: id)\n # => prefs -> Keep's from self\n # => auths -> map onto keep id only if keep does not have the identifier\n to_be_merged.identifiers\n .where.not(identifier_scheme_id: scheme_ids)\n .update_all(identifiable_id: id)\n # => ignore any perms the deleted user has\n to_be_merged.destroy\n end", "def delete_which_contact\n\t\tputs \"What is the ID of the contact you want to delete?\"\n\t\tuser_id = gets.chomp.to_i\n\t\t@rolodex.delete_contact(user_id)\n\tend", "def check_remove_contact(contact)\n @browser.div(:id=>\"addpeople_selected_contacts_container\").link(:text=>contact).parent.checkbox.set\n end", "def contacts\r\n @contact = @customer.contact_people.find_by_id params[:id]\r\n \r\n # Delete contact\r\n if @contact && params[:method] == \"delete\"\r\n @store_user.my_account_log(@contact,\"Delete Contact #{@contact.name}\")\r\n @contact.destroy\r\n @customer.update_ax( :contacts => [@contact] )\r\n redirect_to :id => nil\r\n end\r\n \r\n # Add or update contact\r\n if request.post? && params[:contact]\r\n @contact ||= @customer.contact_people.build\r\n @contact.attributes = params[:contact]\r\n if @contact.save\r\n redirect_to :id => nil\r\n else\r\n @customer.contact_people.delete @contact\r\n render\r\n end\r\n \r\n # Synchronize customer\r\n @customer.update_ax( :contacts => [@contact] ) if @contact.errors.empty?\r\n @store_user.my_account_log(@contact,\"Add or Update Contact #{@contact.name}\")\r\n end\r\n end", "def unjoin(other)\t\t\n\t\t# Ensure the other CSV has the keys present\n\t\tif not has_keys?(other)\n\t\t\traise \"ERROR: Could not find all key columns #{@keys.to_s} in other CSV\"\n\t\tend\n\t\t\n\t\t# Because .length will change as we delete, we must save ahead of time\n\t\t# and also track the number of rows we've removed\n\t\tlength = @matrix.length\n\t\tremoved_count = 0\n\t\t\n\t\t# Iterate our matrix removing rows present in the other CSV\n\t\t0.upto length do |index|\n\t\t\t# nil row check\n\t\t\tif not @matrix[index-removed_count]\n\t\t\t\tnext\n\t\t\tend\n\t\t\t\n\t\t\t# If this row IS also present in other, delete it here\n\t\t\tif also_present?(@matrix[index-removed_count], other)\n\t\t\t\t@matrix.delete(index-removed_count)\n\t\t\t\tremoved_count += 1\n\t\t\tend\n\t\tend\t\t\n\tend", "def unjoin(&block)\n @objs.find(&block)\n end", "def merge_with(master, ignored_attr = [])\n # Just in case a user tries to merge a contact with itself,\n # even though the interface prevents this from happening.\n return false if master == self\n\n merge_attr = self.merge_attributes\n # ------ Remove ignored attributes from this contact\n ignored_attr.each { |attr| merge_attr.delete(attr) }\n\n # Perform all actions in an atomic transaction, so that if one part of the process fails,\n # the whole merge can be rolled back.\n Contact.transaction do\n\n # ------ Merge attributes: ensure only model attributes are updated.\n model_attributes = merge_attr.dup.reject{ |k,v| !master.attributes.keys.include?(k) }\n master.update_attributes(model_attributes)\n\n # ------ Merge 'belongs_to' and 'has_one' associations\n {'user_id' => 'user', 'lead_id' => 'lead', 'assigned_to' => 'assignee'}.each do |attr, method|\n unless ignored_attr.include?(attr)\n master.send(method + \"=\", self.send(method))\n end\n end\n \n # ------ Merge address associations\n master.address_attributes.keys.each do |attr|\n unless ignored_attr.include?(attr)\n master.send(attr + \"=\", self.send(attr))\n end\n end\n\n # ------ Merge 'has_many' associations\n self.tasks.each { |t| t.asset = master; t.save! }\n self.emails.each { |e| e.mediator = master; e.save! }\n self.comments.each { |c| c.commentable = master; c.save! }\n\n # Find all AccountContact records with the duplicate contact,\n # and only add the master contact if it is not already added to the account.\n AccountContact.find_all_by_contact_id(self.id).each do |ac|\n unless ac.account.contacts.include?(master)\n ac.contact_id = master.id; ac.save!\n end\n end\n \n # Find all ContactOpportunity records with the duplicate contact,\n # and only add the master contact if it is not already added to the opportunity.\n ContactOpportunity.find_all_by_contact_id(self.id).each do |co|\n unless co.opportunity.contacts.include?(master)\n co.contact_id = master.id; co.save!\n end\n end\n\n # Merge tags\n all_tags = (self.tags + master.tags).uniq\n master.tag_list = all_tags.map(&:name).join(\", \")\n \n # Call the merge_hook - useful if you have custom actions that need to happen during a merge\n master.merge_hook(self)\n\n if master.save!\n # Update any existing aliases that were pointing to the duplicate record\n ContactAlias.find_all_by_contact_id(self.id).each do |ca|\n ca.update_attribute(:contact, master)\n end\n\n # Create the contact alias and destroy the merged contact.\n if ContactAlias.create(:contact => master,\n :destroyed_contact_id => self.id)\n # Must force a reload of the contact, and shake off all migrated assets.\n self.reload\n self.destroy\n end\n end\n end # transaction\n end", "def destroy\n @other_contactinfo.destroy\n respond_to do |format|\n format.html { redirect_to other_contactinfos_url, notice: 'Other contactinfo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def merge\n return if old_user.nil? || new_user.nil? || old_user.id == new_user.id\n\n copy_missing_one_to_ones\n replace_old_with_new_in_groups\n set_replacement_references\n deactivate_old_user\n faye_publisher.broadcast_to_contacts\n old_faye_publisher.broadcast_to_contacts\n end", "def destroy\n @library_contact = @library_location.library_contacts.find(params[:id])\n @library_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to center_library_location_path(@center, @library_location) }\n format.json { head :no_content }\n end\n end", "def destroy\n @global_contact = GlobalContact.find(params[:id])\n @global_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(global_contacts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contact.destroy\n render json:Contact.all\n end", "def destroy\n @contact = current_user.contacts.find(params[:contact_id])\n @request = @contact.requests.find(params[:id])\n @request.destroy\n @requests = @contact.requests.last_requests\n\n respond_with @request do |format|\n format.html { redirect_to(contact_requests_path) }\n end\n end", "def dissolve(user, contact)\n transaction do\n destroy(conn(user, contact))\n destroy(conn(contact, user))\n end\n end", "def unjoin(p1, p2, whence = nil)\n p1.remove(p2)\n p2.remove(p1)\n end", "def merge_user_addresses\n if user\n l = Spree::AddressBookList.new(user)\n\n if self.bill_address && self.bill_address.valid?\n bill = l.find(self.bill_address)\n if bill\n if self.bill_address_id != bill.id\n oldbill = self.bill_address\n self.bill_address_id = bill.primary_address.id\n oldbill.destroy\n end\n end\n\n if self.bill_address.user_id.nil?\n self.bill_address.user = self.user\n self.bill_address.save unless self.bill_address.new_record? || !self.bill_address.valid?\n end\n end\n\n if self.ship_address && self.ship_address.valid?\n if self.ship_address.same_as?(self.bill_address)\n self.ship_address = self.bill_address\n else\n ship = l.find(self.ship_address)\n if ship\n if self.ship_address_id != ship.id\n oldship = self.ship_address\n self.ship_address_id = ship.primary_address.id\n oldship.destroy\n end\n end\n\n if self.ship_address.user_id.nil?\n self.ship_address.user = self.user\n self.ship_address.save unless self.ship_address.new_record? || !self.ship_address.valid?\n end\n end\n end\n\n user.addresses.reload\n end\n end", "def modify_contact\n\n end", "def opt_out_contact(options={})\n contact_list_id = options.delete(:list_id)\n email = options.delete(:email)\n\n request_body = String.new\n xml = Builder::XmlMarkup.new(:target => request_body, :indent => 1)\n\n xml.instruct!\n xml.Envelope do\n xml.Body do\n xml.OptOutRecipient do\n xml.LIST_ID contact_list_id\n xml.EMAIL email\n\n options.each do |field, value|\n xml.COLUMN do\n xml.NAME field\n xml.VALUE value\n end\n end\n end\n end\n end\n\n doc = send_xml_api_request(request_body)\n result_dom(doc)['RecipientId']\n end", "def update!(**args)\n @contact = args[:contact] if args.key?(:contact)\n end", "def destroy\n @contact = CompanyContact.find(params[:id])\n @contact.destroy\n head :no_content\n end", "def merge!; end", "def remove_entity(entity)\n key = \"contacts_for:#{entity.id}\"\n @redis.srem(key, self.id)\n end", "def breakup(person, contact)\n transaction do\n destroy(conn(person, contact))\n destroy(conn(contact, person))\n end\n end", "def remove_contact(jid)\n contact = stream.user.contact(jid)\n raise StanzaErrors::ItemNotFound.new(self, 'modify') unless contact\n if local_jid?(contact.jid)\n user = storage(contact.jid.domain).find_user(contact.jid)\n end\n\n if user && user.contact(stream.user.jid)\n user.contact(stream.user.jid).subscription = 'none'\n user.contact(stream.user.jid).ask = nil\n end\n stream.user.remove_contact(contact.jid)\n [user, stream.user].compact.each do |save|\n storage(save.jid.domain).save_user(save)\n stream.update_user_streams(save)\n end\n\n send_result_iq\n push_roster_updates(stream.user.jid,\n Contact.new(jid: contact.jid, subscription: 'remove'))\n\n if local_jid?(contact.jid) && user.nil?\n push_roster_updates(contact.jid,\n Contact.new(jid: stream.user.jid, subscription: 'removed'))\n end\n\n if local_jid?(contact.jid)\n send_unavailable(stream.user.jid, contact.jid) if contact.subscribed_from?\n send_unsubscribe(contact)\n if user && user.contact(stream.user.jid)\n push_roster_updates(contact.jid, user.contact(stream.user.jid))\n end\n else\n send_unsubscribe(contact)\n end\n end", "def postEntityUnmerge( entity_id, unmerge_masheryid, unmerge_supplier_id, unmerge_user_id, destructive)\n params = Hash.new\n params['entity_id'] = entity_id\n params['unmerge_masheryid'] = unmerge_masheryid\n params['unmerge_supplier_id'] = unmerge_supplier_id\n params['unmerge_user_id'] = unmerge_user_id\n params['destructive'] = destructive\n return doCurl(\"post\",\"/entity/unmerge\",params)\n end", "def destroy\n @corp_contact = CorpContact.find(params[:id])\n @corp_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to corp_contacts_url,\n notice: (crud_notice('destroyed', @corp_contact) + \"#{undo_link(@corp_contact)}\").html_safe }\n format.json { head :no_content }\n end\n end", "def parse_contacts\n case params[:importer]\n when GMAIL, YAHOO, HOTMAIL\n request.env['omnicontacts.contacts'].map { |c| [c[:email], c[:email]] }.to_json\n when LINKEDIN then fetch_linkedin_contacts\n end\n end", "def delete id=nil\n id ||= self.id\n @nimble.delete \"contact/#{id}\"\n end", "def delink_addresses\n delink_addresses_validation\n save\n end", "def destroy\n @contact.destroy\n render json: {status: 204}\n end", "def destroy\n @contact.destroy\n #Contact.delete(@contact.id)\n respond_to do |format|\n format.html { redirect_to contacts_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @contact.destroy\n respond_to do |format|\n format.html { redirect_to admin_contacts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @member_contact.destroy\n respond_to do |format|\n format.html { redirect_to member_contacts_url }\n format.json { head :no_content }\n end\n end", "def delete_contact\n\t\tputs \"\\nProvide a contact ID: \"\n\t\tid_entry = gets.chomp.to_i\n\t\t@rolodex.delete_one_contact(id_entry)\n\t\tputs \"\\nContact #{id_entry} is deleted FOREVER!\"\n\tend", "def delete_contact\n\t\tcontact_delate_check(params[:user_id], params[:to_delete_id])\n\t\tContact.delete(Contact.where(from_user: params[:user_id], to_user: params[:to_delete_id]))\n\t\tredirect_to contacts_page_path(id: params[:user_id])\n\tend", "def update\n \n \n @contact_group = ContactGroup.find(params[:id])\n contacts = params[:contacts]\n @contact_group.contact_lists.clear\n respond_to do |format|\n if @contact_group.update_attributes(params[:group])\n \tunless contacts.nil?\n \tcontacts.each do |contact|\n \t\t @contact_group.contact_lists << ContactList.find(contact)\n \tend\n end\n flash[:notice] = \"#{@contact_group.name} was successfully updated.\"\n format.html { redirect_to(admin_contact_groups_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contact_group.errors, :status => :unprocessable_entity }\n end\n end\n\n\n\n end", "def destroy\n @contact = Contact.find(params[:id])\n @contact.destroy\n\n respond_to do |format|\n format.html { redirect_to client_contacts_path(@firm), :notice => \"'#{ Contact.model_name.human } удален.'\" }\n format.json { head :ok }\n end\n end", "def contacts!(params = {})\n @contacts ||= get_contacts({\"group\" => self.id}.merge(params))\n end", "def remove_contact id, contact_id\n return make_request(\"#{self.endpoint}/#{id}/contact/remove/#{contact_id}\", {}, :post)\n end", "def delete_pre_address(address)\n address = address.sub(/^\\s*mail\\:\\s*/i, '')\n address.gsub(/.*\\,\\s+(\\d+\\b\\s+\\w)/i, '\\1')\n end", "def revise(contactlist, opts = {})\n foreign_xref = opts[:xref]\n if contactlist.select {|r| !r['xref'] || !r['xref'][foreign_xref]}.any?\n raise \"At least one record is missing an xref.#{foreign_xref} value\"\n end\n\n changes = diffs(contactlist, opts)\n if opts[:additions]\n # Find all the Address Book uids that have been assigned to contacts during the diff process above;\n # don't treat these records as new additions.\n ab_changes = changes.map {|k,v| v.select {|chg| chg[1] == 'xref.ab'}}.map(&:first).compact\n matched_ab_uids = ab_changes.map {|ary| ary[2]}\n\n newuids = contacts.map(&:uuid) - contactlist.map{|c| c['xref'] && c['xref'][xrefkey]} - matched_ab_uids\n\n # adds = additions(contactlist).reject {|k,v| matched_ab_uids.include?(k)}\n adds = contacts.select {|c| newuids.include?(c.to_hash['xref'][xrefkey])}\n\n {\n :changes => changes,\n :additions => adds.map(&:to_hash)\n }\n else\n changes\n end\n end", "def destroy\n #@enc_contacto.contactos.each do |contacto|\n # contacto.destroy\n\n #end\n @enc_contacto.destroy\n\n respond_to do |format|\n format.html { redirect_to enc_contactos_url, notice: 'Enc contacto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.6606985", "0.65824574", "0.63902843", "0.63557243", "0.6297876", "0.6173803", "0.6135985", "0.61075574", "0.6054319", "0.6038812", "0.6034099", "0.6012317", "0.60014975", "0.5994348", "0.5992247", "0.5987092", "0.5949446", "0.5891389", "0.5891389", "0.5889042", "0.58774173", "0.5869335", "0.58689904", "0.5862754", "0.5795114", "0.5751953", "0.5744745", "0.574139", "0.5737068", "0.5692126", "0.5683311", "0.56711406", "0.5665014", "0.5661906", "0.56589144", "0.56542504", "0.5652277", "0.5651111", "0.5595984", "0.5590187", "0.5574449", "0.5566488", "0.5544792", "0.5535261", "0.553525", "0.54998267", "0.5486539", "0.54677135", "0.546376", "0.54437566", "0.5430512", "0.54085773", "0.5404902", "0.5390643", "0.5386021", "0.5377757", "0.5371518", "0.5368788", "0.536637", "0.5363247", "0.5355975", "0.5355382", "0.53553444", "0.53513795", "0.53501505", "0.5344665", "0.5332219", "0.5328334", "0.53281474", "0.53190434", "0.5314776", "0.53123176", "0.531096", "0.53034216", "0.52985317", "0.5298266", "0.529435", "0.52919936", "0.5285859", "0.5285533", "0.52850085", "0.5275404", "0.5274941", "0.52705544", "0.5263491", "0.52632886", "0.5261778", "0.52599144", "0.525775", "0.5257564", "0.5253039", "0.52435017", "0.52375585", "0.52207035", "0.5212627", "0.5212159", "0.5201463", "0.51970905", "0.5193614", "0.51922035" ]
0.78927857
0
def set_company(company_name) if self.valid? unless company_name.nil? company_name = company_name.strip unless company_name.blank? company = Company.find_or_create_by_name company_name self.company_id = company.id self.company_name = company.name end end end end
def update_company company_name if self.valid? unless company_name.nil? company_name = company_name.strip if company_name.blank? self.company_id = 0 self.company_name = '' else company = Company.find_or_create_by_name company_name unless company.id == self.company_id self.company_id = company.id self.company_name = company.name end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_company_name\n @company_name = CompanyName.find(params[:id])\n end", "def company=(company)\n super(Company.find_or_create_by_name(company))\n end", "def company_name=(company_name)\n if !company_name.nil? && company_name.to_s.length < 0\n fail ArgumentError, 'invalid value for \"company_name\", the character length must be great than or equal to 0.'\n end\n\n @company_name = company_name\n end", "def company_name=(company_name)\n if company_name.nil?\n fail ArgumentError, 'company_name cannot be nil'\n end\n\n if company_name.to_s.length < 1\n fail ArgumentError, 'invalid value for \"company_name\", the character length must be great than or equal to 1.'\n end\n\n @company_name = company_name\n end", "def set_company\n id = params[:company_id] ? params[:company_id] : params[:id]\n @company = Company.find(id)\n end", "def set_company\n @company = Company.find(params[:company])\n end", "def set_company\n @company = Company.find(1)\n end", "def set_company\n @company = Company.find(params[:company_id])\n end", "def set_company\n @company = Company.find_by(code: params[:company_id])\n end", "def set_company\n @company = Company.find_by(code: params[:company_id])\n end", "def set_company\n @company = Company.friendly.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id]);\n end", "def company=(v)\n Axlsx.validate_string v\n @company = v\n end", "def set_CompanyName(value)\n set_input(\"CompanyName\", value)\n end", "def set_company\n @company ||= Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id])\n end", "def set_Company(value)\n set_input(\"Company\", value)\n end", "def set_new_company\n @new_company = NewCompany.find(params[:id])\n end", "def set_company_field\n @company_field = CompanyField.find(params[:id])\n end", "def company=(v) Axlsx.validate_string v; @company = v; end", "def set_company\n Company.find(params[:id])\n end", "def set_company\n @company = Company.find(params[:id]) rescue nil\n companies_redirection if @company.nil?\n end", "def set_company\n @companies = Company.all\n @company = Company.new\n end", "def before_create\n # Cloned so we can pass objects as name parameter to new Company\n self.name = self.name.clone.normalize!\n super\n end", "def set_company \n #params[id]に/users/数でとってきた値を入れている\n @company = Company.find(params[:id])\n end", "def assign_company_and_set_passenger\n self.type= 'Passenger'\n if self.email\n domain = self.email.split('@')[1]\n company = Company.find_or_initialize_by(domain: domain)\n if company.new_record?\n logger.debug 'creating company with '+domain\n company.name= domain\n company.address= 'unknown'\n end\n self.company = company\n self.default_office = company.offices.first if self.default_office.nil?\n else\n false\n end\n end", "def set_company\n @company = Company.find(params[:id])\n skip_authorization\n end", "def set_company\n @client_company = ClientCompany.find(params[:id])\n end", "def current_company=(company_obj)\n self.current_company_id = company_obj.id\n self.save\n end", "def set_contact_company\n @contact_company = ContactCompany.find(params[:id])\n end", "def set_company\n @company = @community.companies.friendly.find(params[:id])\n end", "def create_company\n company = Company.create!()\n company\n end", "def set_company\n @company = Company.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n redirect_to root_url, :flash => { :alert => \"Record not found.\" }\n end", "def create\n @company = Company.create!(company_params)\n end", "def create\n @company = Company.new(params[:company])\n @company.introducer_id = -1\n if [99,1,2,3].include?(current_user.role_id) then #管理员\n \t@company.introducer_id = current_user.company.id\n end\n\n respond_to do |format|\n if @company.save\n flash[:notice] = 'Company was successfully created.'\n format.html { redirect_to(@company) }\n format.xml { render :xml => @company, :status => :created, :location => @company }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_credit_company\n @credit_company = CreditCompany.find(params[:id])\n end", "def find_company_id(name)\n @company = Company.find_or_create_by(name: name)\n @company.id\n end", "def create\n @company = Company.new\n @company.name = params[:new_company][:name]\n @company.slug = @company.name.parameterize\n @company.state = COMPANY_STATE[:unchecked]\n @user = User.new\n if @company.save\n @user = @company.users.build\n @user.email = params[:new_company][:email]\n @user.name = t(:root)\n @user.state = STATE[:unchecked]\n @user.role = ROOT\n @user.password_digest = 0\n @user.locale = I18n.locale\n if @user.save\n UserMailer.verification_email(@user).deliver\n flash[:success] = t(:company_account_created)\n redirect_to company_signin_path @company.id\n else\n @company.destroy\n render 'new'\n end\n else\n render 'new'\n end\n end", "def create\n @company = Company.new(company_params)\n\n \n if @company.save\n redirect_to companies_path, notice: 'Company was successfully created.' \n else\n format.html { render :new }\n end\n end", "def set_business_company\n @business_company = Business::Company.find(params[:id])\n end", "def create\n\t\t@company = Company.new(company_params)\n\t\t# for admin to add a company\n\t\tif admin? && @company.save\n\t\t\tflash[:success] = \"#{@company.name} was successfully saved!\"\n\t\t\tredirect_to beanformed_company_beans_path(@company.id)\n\t\t# for all users; new companies come in as approved : false\n\t\telsif @company.save\n\t\t\tflash[:success] = \"Thanks for registering #{@company.name}! You will be notified when you are approved!\"\n\t\t\t@roaster = Roaster.find(session[:roaster_id])\n\t\t\t@roaster.update({company_id: @company.id, phone: params[:company][:phone], role: \"pending\"})\n\t\t\tredirect_to new_beanformed_company_path\n\t\telse\n\t\t\tflash[:error] = \"Please fill out all fields.\"\n\t\t\tredirect_to new_beanformed_company_path\n\t\tend\n\tend", "def set_company_owner\n @company_owner = CompanyOwner.find(params[:id])\n end", "def set_customer_company\n @customer_company = CustomerCompany.find(params[:id])\n end", "def set_account_company\n @account_company = Account::Company.find(params[:id])\n end", "def company_name\n @company_name\n end", "def create_company_data\n @user = User.find(params[:user_id])\n @current_company = @user.companies.find_by({:selected => true})\n @company = @user.companies.find(params[:id])\n\n if @company.update_attributes(company_data_params)\n flash[:success] = \"Datos actualizados\"\n\n redirect_to user_company_path(@user,@company)\n else\n flash[:danger] = \"No se pudo editar!\"\n render 'new'\n end\n end", "def create\n @company = Company.new(params[:company])\n\n if @company.save\n flash[:success] = \"Company was successfully created.\"\n redirect_to crm_path\n else\n render :action => 'new'# Clear page\n end\n end" ]
[ "0.8134257", "0.80279374", "0.7890128", "0.77635014", "0.7657602", "0.762966", "0.7577724", "0.75354016", "0.751264", "0.751264", "0.7444966", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.735183", "0.7351368", "0.7344068", "0.7344068", "0.7344068", "0.7344068", "0.7344068", "0.7344068", "0.7344068", "0.7344068", "0.73426265", "0.7341391", "0.7336885", "0.73113084", "0.7286891", "0.7286891", "0.7286891", "0.72284186", "0.71978116", "0.71397966", "0.7119688", "0.7118107", "0.71118784", "0.7104394", "0.7084165", "0.70804346", "0.7008771", "0.69917786", "0.6958535", "0.6949118", "0.69304156", "0.68634635", "0.68486524", "0.684756", "0.6845289", "0.6833246", "0.6811365", "0.6809316", "0.67761105", "0.6761438", "0.67461336", "0.6734204", "0.6729392", "0.67225474", "0.6681927", "0.6678612", "0.6646521", "0.66421634" ]
0.87759185
0
Save titles for contact
def save_contact_titles(positions) title_str= '' positions.each_with_index do |position, index| if position.is_current == 'true' company = Company.find_or_create_by_name(position.company.name) title = self.titles.build(:position => position.title, :company_id => company.id) title_str += ', ' unless index == 0 title_str += "#{title.position} at #{company.name}" end end self.update_attribute(:title, title_str) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_titles\n # Title was submitted\n if self.title.blank?\n self.title = get_title_from_chartup(chartup) || 'Untitled'\n else\n set_chartup_title(self.title)\n end\n end", "def set_saved_title\n @saved_title = SavedTitle.find(params[:id])\n end", "def contact\n @title = \"contact\"\n end", "def create\n @title = Title.new(title_params)\n\n if @title.save\n redirect_to edit_title_path(@title), :flash => { :success => t('titles.titles') + \" \"+ t('commons.create_success')}\n else\n render :new, status: :unprocessable_entity\n end\n\n end", "def create\n fix_decimal_numbers(params[:title])\n @title = Title.new(params[:title])\n\n respond_to do |format|\n if @company.titles << @title\n flash[:notice] = 'Título foi criado com sucesso.'\n format.html { redirect_to(financial_company_title_url(:id=>@title,:company_id=>@company)) }\n format.xml { render :xml => @title, :status => :created, :location => @title }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @title.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_name_title\n @name_title = NameTitle.find(params[:id])\n end", "def add_title\n @bib.title.to_bibtex @item\n end", "def updateTitle(id, title)\n item = Todo.find(id)\n item.title = title\n item.save\nend", "def save_comic(comic_title, u1)\n comic = find_or_create_comic(comic_title)\n find_or_create_reading_list(u1.id, comic.id)\n end", "def title=(new_title)\n @title= Book.titleize(new_title)\n end", "def save\n\t\tCSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n\t\t\tcsv << [@author, @content]\n\t\tend\n\tend", "def titleize_proper_names\n self.author = self.author.titleize\n self.editor = self.editor.titleize if self.editor\n self.buyed_from = self.buyed_from.titleize if self.buyed_from\n end", "def save\n CSV.open('./db/gossip.csv', 'a+') { |csv| csv << [@author, @content] }\n end", "def setTitle (title)\n @title = title.to_s\n end", "def title_set(title)\n self.sirname.set title\n end", "def save\n CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n csv << [@author, @content]\n end\n end", "def save\n CSV.open('./db/gossip.csv', 'ab') do |csv|\n csv << [@content, @author]\n end\n end", "def SetTitle(title)\n\t\t#Title of document\n\t\t@title = title\n\tend", "def set_title(title)\n @title = title\n end", "def set_title\r\n @title = Title.find(params[:id])\r\n end", "def setTitle(title)\r\n\t\t\t\t\t@title = title\r\n\t\t\t\tend", "def contact_us\r\n\t@title = \"Contact Us\"\r\n end", "def save\n file = CSV.open(File.expand_path(\"../../db/gossip.csv\", __FILE__), \"ab\") do |csv|\n csv << [@author, @content]\n end\n file.close\n end", "def after_title_update(title)\n Exporter::Mailsender.title_updated(from, to, title).deliver\n end", "def title=( new_title )\nif @writable\n@title = new_title\nend\nend", "def title=(title)\n t = Title.new\n t.content = title\n self.dc_titles = [t]\n title\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def set_title\n @title = Title.find(params[:id])\n end", "def setTitle(title)\n @fields['title'] = title\n self\n end", "def setTitle(title)\n @fields['title'] = title\n self\n end", "def setTitle(title)\n @fields['title'] = title\n self\n end", "def setTitle(title)\n @fields['title'] = title\n self\n end", "def title=(text); end", "def title=(text); end", "def set_fund_item_title\n return if @set_fund_item_title\n if title? && ( perspective == PERSPECTIVES.first )\n fund_item.title = title if title? && fund_item.title != title\n @set_fund_item_title = true\n fund_item.save\n @set_fund_item_title = false\n end\n end", "def title= title\n @title = title\n end", "def ctitle(title)\n self.title = title\n end", "def save\n MoxiworksPlatform::Contact.update(self.to_hash)\n end", "def save\n\t CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n\t csv << [@author, @content]\n\t end\n\tend", "def title(title)\n @title=title\n end", "def create\n Contact.create(name:params[:name],title:params[:title],content:params[:content],information:params[:information])\n flash[:success] = \"谢谢您对公司的关注,我们会尽快处理您的留言!\"\n redirect_to contacts_path\n\n\n\n end", "def job_titles_attributes=(job_title_attributes)\n job_title_attributes.values.each do |job_title_attribute|\n if job_title_attribute[:title] != \"\"\n job_title = JobTitle.find_or_create_by(job_title_attribute)\n self.job_titles << job_title\n end\n end \n end", "def titleize(title)\n\tbook = Book.new\n\tbook.title = title\n\treturn book.title\nend", "def update_title\n\t\tday = Day.from_identifier(post_params[:day])\n\t\tdocument = Document.for_user(@user.id, day.year, day.month, day.day).first\n\t\traise \"Unknown document\" unless document\n\t\tdocument.title = post_params[:title]\n\t\tdocument.save!\n\t\trender_ok\n\tend", "def saved_title_params\n params.permit(:title, :description, :image_url)\n end", "def title(title)\n @title = title\n end", "def create\n @title = Title.new(title_params)\n @event = Event.find(title_params[:event_id])\n @event.titles << @title\n\n respond_to do |format|\n if @title.save\n format.html { redirect_to \"/events/#{@event.id}\", notice: 'Title was successfully created.' }\n format.json { render :show, status: :created, location: @title }\n else\n format.html { render :new }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_page(title, attr)\n title = normalize_title(title)\n \n page = find_page(title)\n page.set(attr)\n \n transaction \"update `#{page.title}'\" do\n store[page.title + '.md'] = page\n end\n end", "def set_title(params)\n @title.merge_with_hash(params)\n end", "def title=(value)\n write_attribute(:title, value.capitalize)\n end", "def index\n @saved_titles = SavedTitle.all\n end", "def new_title_for(text)\n title I18n.t(\"backend.general.newForm\", :model => text.is_a?(String) ? text : text.send(:human_name))\n end", "def create\n @title = Title.new(title_params)\n \n respond_to do |format|\n if @title.save\n format.html { redirect_to titles_url(search: @title.title), notice: 'Title was successfully created.' }\n format.json { render :show, status: :created, location: @title }\n else\n format.html { render :new }\n format.json { render json: @title.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @name_title = NameTitle.new(name_title_params)\n\n respond_to do |format|\n if @name_title.save\n format.html { redirect_to @name_title, notice: 'Name title was successfully created.' }\n format.json { render :show, status: :created, location: @name_title }\n else\n format.html { render :new }\n format.json { render json: @name_title.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_title(new_title, opts={})\n if self.datastreams.has_key?(\"descMetadata\")\n desc_metadata_ds = self.datastreams[\"descMetadata\"]\n if desc_metadata_ds.respond_to?(:title_values)\n desc_metadata_ds.title_values = new_title\n else\n desc_metadata_ds.title = new_title\n end\n end\n end", "def save\n CSV.open(\"./db/gossip.csv\", \"ab\") do |csv|\n csv << [@author, @content]\n end\nend", "def store_title variable_name\r\n command 'storeTitle', variable_name\r\n end", "def set_title_and_description\n \t\tresp = get_resp(self.url)\n \t\tself.title = resp.match(/<title>(.+)<\\/title>/)[1]\n \t\tself.description = resp.match(/<meta name=\"description\" content=\"([^\\\"]*)/)[1]\n \t\tself.save!\n \tend", "def title=(string)\n frm.text_field(:id=>\"subject\").set(string)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def title=(title)\n\t super(standardize_title(title))\n\t\t\t#self[:title] = title.strip\n\tend", "def update_title\n @cookbook = current_cookbook\n @cookbook.title = params[:cookbook][:title]\n if @cookbook.save\n redirect_to templates_path, notice: \"Your Cookbook name has been changed!\"\n else\n render :edit_title\n end\n end", "def title=(value)\n\t\t\t@title = value\n\t\tend", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def set_Title(value)\n set_input(\"Title\", value)\n end", "def title=(new_title = nil)\n @info[:Title] = new_title\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=(value)\n @title = value\n end", "def title=( new_title ) ##(main\n unless @read_only\n @title = new_title \n end \n end", "def add_post_by_title(title)\n title = Post.new(title) #to create a new song\n title.author = self #associate the objects.\n end", "def save\n @title = Title.find(params[:title_id])\n @title.title = @title.clean_input(params[:title])\n \n respond_to do |format|\n if @title.save\n State.update_state(current_user.id,@title.task_id)\n format.js \n else\n format.js {render \"shared/save_failed\"}\n end\n end\n end", "def title=(new_title)\n super(new_title)\n self[:slug] = new_title.parameterize if new_title\n end", "def handle_title_change\n post = n_state(:post)\n unless post.attribute_was_changed?(:title)\n post.record_change_for_attribute(:title)\n force_update\n end\n end", "def title=(new_title)\n new_title.capitalize!\n arr = ['over', 'the', 'and', 'in', 'of', 'a', 'an']\n @title = new_title.split(' ').map! { |word| arr.include?(word) ? word : word.capitalize }.join(' ')\n end", "def contact\n\t\t\"#{small_title(titre.to_s)} #{contact_prenom.to_s} #{contact_nom.to_s}\".strip\t\t\n\tend", "def save_title_query\n @query = TitleQuery.new(user_id: current_user.try(:id), query: params[:term])\n @query.save\n end", "def title=(title)\n if self.kind == TITLE && !title.blank? && title.first == \"\\r\"\n write_attribute(:title, \" #{title}\")\n else\n write_attribute(:title, title)\n end\n end", "def title(title)\n filename(title)\n @methods[:title] = title\n end", "def update_title( doc_id:, title: )\n send_request :post, \"document/#{@app}/#{doc_id}/title/#{URI.escape title}\", {}, :json\n end", "def title=(title)\n @attributes[:title] = title\n end", "def contact\r\n\t\t\"#{small_title(contact_titre.to_s)} #{contact_prenom.to_s} #{contact_nom.to_s}\".strip\t\t\r\n\tend", "def contacte_params\n params.require(:contacte).permit(:title, :content)\n end", "def set_game_title\n @game_title = GameTitle.find(params[:id])\n end", "def save_content(title, content)\n\tFile.open(\"pages/#{title}.txt\" , \"w\") do |file|\n\t file.print(content)\n end \t\t\nend" ]
[ "0.6404645", "0.6220932", "0.61893195", "0.6028167", "0.59328157", "0.59262687", "0.5821474", "0.5804921", "0.5788068", "0.57827574", "0.5780047", "0.57742757", "0.5755893", "0.57304657", "0.5717839", "0.57167625", "0.57158715", "0.5715551", "0.57153976", "0.57029545", "0.56935465", "0.56713235", "0.5670638", "0.56654197", "0.5659705", "0.56592965", "0.56586665", "0.56586665", "0.56586665", "0.56586665", "0.56586665", "0.56565535", "0.56565535", "0.56565535", "0.56565535", "0.5651789", "0.5651789", "0.5649766", "0.56306154", "0.5628747", "0.5605781", "0.55921894", "0.5589192", "0.5587318", "0.55731165", "0.55640906", "0.55560285", "0.5546038", "0.5542143", "0.55421096", "0.55415505", "0.5536628", "0.55290073", "0.55217946", "0.55057144", "0.5504504", "0.5497297", "0.546016", "0.5455256", "0.54541713", "0.5450754", "0.5445308", "0.54359704", "0.54359704", "0.5414518", "0.540766", "0.54047614", "0.5401693", "0.5401693", "0.5401693", "0.5401693", "0.5401693", "0.5401693", "0.5401693", "0.5401693", "0.5401693", "0.5400549", "0.5396855", "0.5396855", "0.5396855", "0.5396855", "0.5396855", "0.5396855", "0.5396855", "0.53953606", "0.53854847", "0.53820807", "0.5379753", "0.536932", "0.5365536", "0.53614247", "0.53573287", "0.5355247", "0.53548443", "0.5354364", "0.534742", "0.5346436", "0.5342041", "0.53419846", "0.5339447" ]
0.75141835
0
The two methods 'default_chain' and 'default_tire_size' offers a way to provide specializations > line 31 and 49.
def initialize(**opts) @size = opts[:size] @chain = opts[:chain] || default_chain @tire_size = opts[:tire_size] || default_tire_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_tire_size\n raise NotImplementedError, \"This #{self.class} cannot respond to:\"\n end", "def default_tire_size\n '23'\n end", "def default_tire_size\n '2.1'\n end", "def default_tire_size\n raise NotImplementedError, \n \"This #{self.class.to_s} can not respond_to :: #{__method__.to_s}\"\n end", "def default_tire_size\n raise NotImplementedError, \n \"This #{self.class.to_s} can not respond_to :: #{__method__.to_s}\"\n end", "def default_chain\n '10-speed'\n end", "def default_chain\n '10-speed'\n end", "def default_chain\n \"10-speed\"\n end", "def default(options = T.unsafe(nil)); end", "def size_from_default\n DEFAULT_SIZE\n end", "def default; end", "def default; end", "def default(key) end", "def default_size\n @total_memory ? @total_memory * @weighting : nil\n end", "def default_options; end", "def default_options; end", "def default_options; end", "def default_proc() end", "def default_options # :nodoc:\n { :consume => true,\n :memoize => false,\n :offset => 0\n }\n end", "def default_page_size\n 10\n end", "def default\n end", "def default(options = {}, &blk)\n quorum 'default', options, &blk\n end", "def method_missing(*args)\n default\n end", "def default_wrapper; end", "def default_values\n self.weight ||= 10.0\n end", "def applyInheritedDefaults(kitten, type)\n return if !kitten.is_a?(Hash)\n kitten['cloud'] ||= @config['cloud']\n kitten['cloud'] ||= MU::Config.defaultCloud\n\n if !MU::Cloud.supportedClouds.include?(kitten['cloud'])\n return\n end\n\n cloudclass = MU::Cloud.cloudClass(kitten['cloud'])\n\n resclass = MU::Cloud.resourceClass(kitten['cloud'], type)\n\n schema_fields = [\"us_only\", \"scrub_mu_isms\", \"credentials\", \"billing_acct\"]\n if !resclass.isGlobal?\n kitten['region'] ||= @config['region']\n kitten['region'] ||= cloudclass.myRegion(kitten['credentials'])\n schema_fields << \"region\"\n end\n\n kitten['credentials'] ||= @config['credentials']\n kitten['credentials'] ||= cloudclass.credConfig(name_only: true)\n\n kitten['us_only'] ||= @config['us_only']\n kitten['us_only'] ||= false\n\n kitten['scrub_mu_isms'] ||= @config['scrub_mu_isms']\n kitten['scrub_mu_isms'] ||= false\n\n if kitten['cloud'] == \"Google\"\n# TODO this should be cloud-generic (handle AWS accounts, Azure subscriptions)\n if resclass.canLiveIn.include?(:Habitat)\n kitten[\"project\"] ||= MU::Cloud::Google.defaultProject(kitten['credentials'])\n schema_fields << \"project\"\n end\n if kitten['region'].nil? and !kitten['#MU_CLOUDCLASS'].nil? and\n !resclass.isGlobal? and\n ![MU::Cloud::VPC, MU::Cloud::FirewallRule].include?(kitten['#MU_CLOUDCLASS'])\n if MU::Cloud::Google.myRegion((kitten['credentials'])).nil?\n raise ValidationError, \"Google '#{type}' resource '#{kitten['name']}' declared without a region, but no default Google region declared in mu.yaml under #{kitten['credentials'].nil? ? \"default\" : kitten['credentials']} credential set\" \n end\n kitten['region'] ||= MU::Cloud::Google.myRegion\n end\n elsif kitten[\"cloud\"] == \"AWS\" and !resclass.isGlobal? and !kitten['region']\n if MU::Cloud::AWS.myRegion.nil?\n raise ValidationError, \"AWS resource declared without a region, but no default AWS region found\"\n end\n kitten['region'] ||= MU::Cloud::AWS.myRegion\n end\n\n\n kitten['billing_acct'] ||= @config['billing_acct'] if @config['billing_acct']\n\n kitten[\"dependencies\"] ||= []\n\n # Make sure the schema knows about these \"new\" fields, so that validation\n # doesn't trip over them.\n schema_fields.each { |field|\n if @@schema[\"properties\"][field]\n MU.log \"Adding #{field} to schema for #{type} #{kitten['cloud']}\", MU::DEBUG, details: @@schema[\"properties\"][field]\n @@schema[\"properties\"][type][\"items\"][\"properties\"][field] ||= @@schema[\"properties\"][field]\n end\n }\n end", "def get_options(default_or_custom, items_type)\n default_or_custom == \"default\" ? (return get_default(items_type)) :\n (return get_custom(items_type))\nend", "def initialize\n @default_model = [:symbol, 10000]\n @default_size = 10\n end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def defaults; end", "def default_definition() {} end", "def default_page_size\n 50\n end", "def required_defaults; end", "def default_options; {} end", "def only default: nil\n if count == 1\n first\n else\n default\n end\n end", "def default_count\n 1\n end", "def defaults!; end", "def defaults!; end", "def slice_with_default(*keys, default: nil)\n\t\t\t\tkeys.each_with_object(::Hash.new) do |k, hash| \n\t\t\t\t\tif has_key?(k) || default == :default_proc\n\t\t\t\t\t\thash[k] = self[k] \n\t\t\t\t\telse\n\t\t\t\t\t\thash[k] = default\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend", "def default_protocol_envelope_size(protocol_version)\n protocol_version > '2.1' ? 512000 : 153600\n end", "def default_page_size\n PAGE_SIZE\n end", "def base\n if type.base?\n self\n else\n prefix ? type.base * prefix.factor : type.base\n end\n end", "def set_default_options\n end", "def my_size\n 1\n end", "def derive_default_helpers(options)\n []\n end", "def set_generic_traps\n super\n end", "def request_size\n super || 0\n end", "def initialize(specifications = T.unsafe(nil)); end", "def default_size_multiplier(font)\n\n # Define font hash.\n factors = {\n across_the_road: 0.7,\n alabama: 0.8,\n arty_signature: 2.5,\n asem_kandis: 0.9,\n autograf: 0.5,\n born_ready: 0.5,\n brittany_signature: 0.5,\n bulgatti: 0.5,\n estelly: 0.5,\n friday_vibes: 0.8,\n from_skyler: 0.6,\n gallatone: 0.75,\n halimun: 0.4,\n hello_santtiny: 0.5,\n just_realize: 0.7,\n just_signature: 0.35,\n mayestica: 0.9,\n notera: 0.6,\n prestige_signature: 0.8,\n reinata: 1,\n santos_dumont: 1,\n shopping_list: 1,\n signatures: 0.75,\n signerica: 0.4,\n silver_pen: 0.8,\n sophistica: 0.75,\n southampton: 0.75,\n thankfully: 0.5,\n the_jacklyn: 0.8,\n tomatoes: 0.35,\n wanted_signature: 0.7,\n white_angelica: 0.4,\n xtreem: 0.7\n }\n\n # Return factor.\n return factors.fetch(font.parameterize.underscore.to_sym, 0.5)\n\n end", "def method (number, default1 = 1, default2 = 2)\nend", "def default_page_size\n 100000\n end", "def generic_traps\n super\n end", "def specific_max_size(number); end", "def test_Hash_InstanceMethods_default\n\t\th = Hash.new\n\t\tassert_equal(nil, h.default)\n\t\tassert_equal(nil, h.default(2))\n\n\t\th = Hash.new(\"cat\")\n\t\tassert_equal(\"cat\", h.default)\n\t\tassert_equal(\"cat\", h.default(2))\n\n\t\th = Hash.new {|h,k| h[k] = k.to_i*10}\n\t\tassert_equal(nil, h.default)\n\t\tassert_equal(20 , h.default(2))\n\tend", "def default(locale, object, subject, options = T.unsafe(nil)); end", "def test_serializer_defaults\n m = define_serializer do |cls|\n attribute :name\n attribute :station\n attribute :rank\n\n cls.send(:define_method, :default_value) do |object, attr_name|\n 'SERIALIZER_NONE'\n end\n end\n\n valid = [\n %w(Data NCC-1701-D ltc),\n %w(Q SERIALIZER_NONE SERIALIZER_NONE),\n %w(Quark DS9 SERIALIZER_NONE)\n ]\n\n m.render(small_user_table).zip(valid).each do |got, expected|\n assert_equal expected, got\n end\n end", "def optional_tiles; end", "def default_max_size; end", "def default_page_size\n 100_000\n end", "def test_defaultproviders\n basic = @type.provide(:basic) do\n defaultfor :operatingsystem => :somethingelse,\n :operatingsystemrelease => :yayness\n end\n\n assert_equal(basic, @type.defaultprovider)\n @type.defaultprovider = nil\n\n greater = @type.provide(:greater) do\n defaultfor :operatingsystem => Facter.value(\"operatingsystem\")\n end\n\n assert_equal(greater, @type.defaultprovider)\n end", "def default_batch_size\n raise NotImplementedError, 'This must be implemented in a subclass.'\n end", "def default_if_not_specified(opt,default_opt)\n opt ? opt : default_opt\nend", "def with_defaults(defaults); end", "def defaults(defaults = T.unsafe(nil)); end", "def default_keys; end", "def default=(_); end", "def default_collector\n self[:default]\n end", "def blk_length(arg)\n case arg\n when :mifare\n 16\n when :ntag\n 4\n when ->(b) { b.is_a?(Integer) }\n arg\n end\n end", "def default_lineage\n if parent.nil? then\n 'New'\n elsif specimen_characteristics.equal?(parent.specimen_characteristics) then\n 'Aliquot'\n else\n 'Derived'\n end\n end", "def pack_option(default, store)\n raise NotImplementedError, \"Subclass must implement pack_option\"\n end", "def get_default(items_type)\n case items_type\n when \"descriptions\"\n return %w[sticky steamy hot spicy bitter cheesy vegan smelly crunchy sweet]\n when \"cooking methods\"\n return %w[baked fried steamed grilled smoked fermented slow-cooked\n microwaved uncooked roasted]\n when \"foods\"\n return %w[salmon pasta tofu chicken pork ham chowder sushi pizza pancakes]\n end\nend", "def default(key = nil) \n if key.is_a?(Symbol) && key?(key) \n self[key] \n else \n key ? super : super()\n end \n end", "def merge_default_options(name, type, options = {})\n list_options[name][type].merge(options)\n\t\tend", "def generic?; true; end", "def default_reservation_size\n\t\t\t\t\t1\n\t\t\t\tend", "def size\n super\n end", "def size\n super\n end", "def default_fetch_size\n 100\n end", "def set_default_attrs\n self.state = 'Texas' if self.respond_to? :state\n self.origin = 'hunted' if self.respond_to? :origin\n self.gender = 'male' if self.respond_to? :gender\n if self.respond_to? :parts\n parts = Part::NAMES.map { |part_name| {name: part_name} }\n parts << { other: true }\n self.parts = parts\n end\n if self.respond_to? :taxidermy_parts\n taxidermy_parts = self.class::DEFAULT_TAXIDERMY_PARTS.map { |part_name| {name: part_name} }\n taxidermy_parts << { other: true }\n self.taxidermy_parts = taxidermy_parts\n end\n self\n end", "def default_font_size\n (options[:default] and options[:default][:size]) ? options[:default][:size] : 40\n end", "def default_options\n # {}\n end", "def short(options = T.unsafe(nil)); end", "def set_default\n end", "def setup_defaults()\n {\n 'box' => {\n 'memory' => '2048',\n 'cpus' => '2'\n }\n }\nend", "def plausible? rest, size, hints = {}\n true\n end", "def default_version\n return @versions[:large] if @versions.key?(:large)\n return @versions[:medium] if @versions.key?(:medium)\n return @versions[:small] if @versions.key?(:small)\n end", "def default_options\n { throttle: 'throttle' }\n end", "def test_Hash_InstanceMethods_default=\n\t\th = {'a'=>100, 'b'=>200}\n\t\th.default = \"Go fish\"\n\t\tassert_equal(100, h['a'])\n\t\tassert_equal(\"Go fish\", h[\"z\"])\n\n\t\t# This doesn't do what you might hope... (but see default_proc=)\n\t\th.default = lambda { |hash, key| hash[key] = key + key }\n\tend", "def default_request_options\n {:timeout => 0, :head => {}}\n end", "def set_defaults\n super\n self.expected_useful_miles ||= 0\n self.asset_type_id ||= AssetType.where(class_name: self.name).pluck(:id).first\n end", "def tier\n raw_tier || Tier.default\n end", "def default=(_arg0); end" ]
[ "0.6421778", "0.6192532", "0.6043917", "0.6030757", "0.6030757", "0.56372744", "0.56372744", "0.5530686", "0.54070413", "0.5393867", "0.5338277", "0.5338277", "0.51637363", "0.51445943", "0.5060263", "0.5060263", "0.5060263", "0.49945265", "0.49917507", "0.49617237", "0.4923225", "0.48971903", "0.48687315", "0.48670915", "0.48611298", "0.4853547", "0.48505947", "0.48262927", "0.48253193", "0.48253193", "0.48253193", "0.48253193", "0.48253193", "0.48253193", "0.48253193", "0.48253193", "0.48253193", "0.48253193", "0.48220396", "0.48138165", "0.48126292", "0.48116443", "0.4810669", "0.4800139", "0.4796571", "0.4796571", "0.479327", "0.4790412", "0.47886372", "0.47756565", "0.47737056", "0.4773333", "0.47522217", "0.47440916", "0.47408006", "0.47285035", "0.47283715", "0.47113487", "0.47070077", "0.46815455", "0.4667839", "0.46651867", "0.466463", "0.46514323", "0.46479622", "0.46475255", "0.46409404", "0.4633534", "0.46306807", "0.462092", "0.4609089", "0.46023828", "0.4601119", "0.45971128", "0.4594722", "0.45927113", "0.4591304", "0.45910677", "0.45834294", "0.45750782", "0.4574596", "0.4573326", "0.45723101", "0.45689857", "0.45689857", "0.45653152", "0.45626968", "0.45510125", "0.45509496", "0.45470127", "0.45468107", "0.4536712", "0.45345998", "0.45258376", "0.4518473", "0.45139545", "0.45108485", "0.45074767", "0.45044237", "0.44935715" ]
0.6125143
2