query
stringlengths 7
9.5k
| document
stringlengths 10
1.07M
| negatives
sequencelengths 19
19
| metadata
dict |
---|---|---|---|
1. Reads 1024 bytes from /dev/urandom | def getOneKb
# copy stream used with 1024 byte limit as last param
IO.copy_stream('/dev/urandom', ARGV[0], 1024)
end | [
"def random_bytes(p0) end",
"def get_random\n File.read(\"/dev/urandom\", 8).unpack(\"H*\")[0].hex\n rescue\n rand(9117854927)\n end",
"def add_urandom\n begin\n OpenSSL::Random.load_random_file('/dev/urandom')\n rescue OpenSSL::Random::RandomError\n # probably not available, reraise if mandatory for you\n end\n end",
"def generate_random_bytes\n SecureRandom.random_bytes(10)\n end",
"def random_bytes(bytes); OpenSSL::Random.random_bytes(bytes) end",
"def random_bytes(size)\n OpenSSL::Random.random_bytes size\n end",
"def randblock()\n return SecureRandom.random_bytes(SecureRandom.random_number(16))\n end",
"def cisco_rand\n rand(1 << 24)\n end",
"def random_str(n_bytes)\n (0..255).to_a.sample(n_bytes).map(&:chr).join\nend",
"def pick_random(stream)\n stream.chars.uniq.sample\nend",
"def rand_byte\n self[SecureRandom.random_number(size)]\n end",
"def entropy e=ENTROPY_FILE\n return rand.to_s unless File.exist? e\n if !File.exist? e\n return sha_to_b64 Digest::SHA1.hexdigest(\"#{Time.now.to_f}#{rand}-kickoff\")\n end\n File.open e, \"r\" do |f|\n return f.readlines.chomp\n end\nend",
"def random_chunk_size(bytes=16)\r\n return bytes.times.map{ (rand(0x8) + 0x8).to_s(16) }.join\r\n end",
"def read_bytes(sd, n)\n\n out = []\n\n while (n > out.size) \n data = sd.read_bytes(n - out.size)\n break unless data\n out = out + data\n end\n\n return out\nend",
"def random_chunk_size(bytes=16)\n return bytes.times.map{ (rand(0x8) + 0x8).to_s(16) }.join\n end",
"def read_bytes(io, length); end",
"def random_binary(n_bytes)\n #(Array.new(n_bytes) { rand(0x100) }).pack('c*')\n SecureRandom.random_bytes(64)\n end",
"def rand_byte!\n i = SecureRandom.random_number(size)\n rv = self[i,1]\n self[i,1] = ''\n rv\n end",
"def __random_uint32\n @_java_secure_random.nextLong & 0xFFFFFFFF\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
NameDescriptorfull_class_name full_class_name() Return the full class name (with '::' between the components) or "" if there's no class name | def full_class_name
end | [
"def full_class_name\n @class_names.join(\"::\")\n end",
"def class_name\n name.split('::').last\n end",
"def class_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 1]\n end",
"def class_name\n name.sub('.', ' ').sub(':', ' pseudo-class-').strip\n end",
"def get_complete_class_name(class_or_module, name = class_or_module.name)\n if !class_or_module.parent.name.nil? && class_or_module.parent.is_a?(RDoc::NormalModule)\n get_complete_class_name(class_or_module.parent, \"#{class_or_module.parent.name}::#{name}\")\n else\n name\n end\n end",
"def class_name\n klass = single_class\n while klass.name == ''\n klass = klass.superclass\n end\n if list_context?\n \"[#{klass}]\"\n else\n klass.name\n end\n end",
"def js_full_class_name\n [js_full_scope, short_component_class_name.split(\"::\").last].join(\".\")\n end",
"def short_hierarchy_class_name\n hierarchy_class_name.split('::').last\n end",
"def js_full_class_name\n [js_full_scope, short_component_class_name.split(\"::\").last].join(\".\")\n end",
"def package_class_name(package)\n package.to_s.gsub(/^.*::/, '')\n end",
"def class_unqualified_name(clazz)\n name = clazz.name\n if name =~ /::([^:]+)$/\n $1\n else\n name\n end\n end",
"def class_unqualified_name(clazz)\n name = clazz.name\n (name =~ /::([^:]+)$/) ? $1 : name\n end",
"def namespace_class_name\n [self.namespace, self.class_name].compact.join '.'\n end",
"def get_class_name\n \"#{ file_name }\".chop.capitalize\n end",
"def class_name\n %x{\n var first = self[0];\n return (first && first.className) || \"\";\n }\n end",
"def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end",
"def full_name\n \"#{namespace.name || namespace.inspect}::#{namespace.instances[ self ]}\"\n end",
"def full_name\n name = self.ref.respond_to?(:full_name) ? self.ref.full_name : :\"\"\n return :\"#{name}::#{self.name}\"\n end",
"def class_name\n assert_exists\n return @o.invoke(\"className\")\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Perform modifications or simulate them Parameters:: iCommitModifications (_Boolean_): Do we really perform the modifications ? Return:: _Exception_: An error, or nil in case of success | def performModify(iCommitModifications)
rError = nil
# Modify the issue_relations view to add the WEACE icon
rError = modifyFile("#{@ProductConfig[:RedmineDir]}/app/views/issue_relations/_form.rhtml",
/<%= toggle_link l\(:button_cancel\), 'new-relation-form'%>/,
"<a title=\"In case of duplicates, this will trigger the WEACE process named Ticket_CloseDuplicate. Click for explanations.\" href=\"#{@ProviderEnv[:WEACEMasterInfoURL]}#Redmine.TicketTracker.Ticket_CloseDuplicate\"><img src=\"http://weacemethod.sourceforge.net/wiki/images/1/1e/MasterIcon.png\" alt=\"In case of duplicates, this will trigger the WEACE process named Ticket_CloseDuplicate. Click for explanations.\"/></a>\n",
/<\/p>/,
:CommitModifications => iCommitModifications)
if (rError == nil)
# Modify the issue_relations controller
rError = modifyFile("#{@ProductConfig[:RedmineDir]}/app/controllers/issue_relations_controller.rb",
/@relation.issue_from = @issue/,
"
# === Changed by WEACE Master Adapter for Redmine/TicketTracker... ===
if (request.post?)
if (@relation.relation_type == IssueRelation::TYPE_DUPLICATES)
# Call WEACE Master Server
lCommand = \"#{@ProviderEnv[:WEACEExecuteCmd]} MasterServer --user Scripts_Validator --process Ticket_CloseDuplicate -- --masterticket \#{@relation.issue_to_id} --slaveticket \#{@issue.id} 2>&1\"
lOutput = `\#{lCommand}`
lErrorCode = $?
if (lErrorCode != 0)
@relation.save
logger.error(\"Call to WEACE Master Server failed (error code \#{lErrorCode}). Here is the command: \#{lCommand}. Here is its output: \#{lOutput}.\")
flash[:warning] = l('Error while calling WEACE Master Server. Please check logs to get further details. The action was still performed as if WEACE Master Server was not installed.')
else
flash[:notice] = l('WEACE Master Server processed request successfully.')
end
render :update do |page|
page.redirect_to(:controller => 'issues', :action => 'show', :id => @issue)
end
return
else
@relation.save
end
end
# === ... End of change ===
",
/respond_to do \|format\|/,
:Replace => true,
:CommitModifications => iCommitModifications)
end
return rError
end | [
"def commit_patch\n patch.error = nil\n\n @t.apply patch.file\n @t.add '.'\n @t.commit '', reuse_message: patch.second_commit\n rescue => error\n # Houston we have a problem\n patch.error = error\n # first we yield to allow a fix\n yield patch if block_given?\n\n # if a fix was made, retry\n if patch.changed?\n patch.save\n retry\n end\n end",
"def performModify(iCommitModifications)\n # Modify the skin to add WEACE icon if not already present\n return modifyFile(\n \"#{@MediawikiDir}/includes/Skin.php\",\n /function getPoweredBy\\(\\) \\{/,\n \" $img = $img.'<a title=\\\"Some content of this website can be modified by some WEACE processes. Click for explanations.\\\" href=\\\"#{@ProviderEnv[:WEACESlaveInfoURL]}#Adapters.Mediawiki\\\"><img src=\\\"http://weacemethod.sourceforge.net/wiki/images/9/95/WEACESlave.png\\\" alt=\\\"Some content of this website can be modified by some WEACE processes. Click for explanations.\\\"/></a>'; /* WEACE Slave Insert */\\n\",\n /return /,\n :CheckMatch => [\n /\\/\\* WEACE Slave Insert \\*\\//\n ],\n :ExtraLinesDuringMatch => true,\n :CommitModifications => iCommitModifications\n )\n end",
"def check_modifications\n run_check_in_repository '-a -m'\n end",
"def commit\n @repo.commit\n end",
"def save_modifications!(options)\n unless @modifications.blank?\n PublicEarth::Db::Photo.connection.transaction do\n @modifications.each { |frog| frog.save!(options) }\n end \n end\n end",
"def commit_operation\n end",
"def commit\n diff? ? super : original\n end",
"def testCommitAgainstRegression\n rError = nil\n\n # If we commit all files, no need to checkout in a different repository\n if (@LstFiles == nil)\n rError = executeRegression(@LocalRepository)\n else\n # Check out the project in a temporary repository\n require 'tmpdir'\n lTempRepositoryDirName = \"#{Dir.tmpdir}/WEACERegTest_#{Thread.current.object_id}\"\n require 'fileutils'\n FileUtils::mkdir_p(lTempRepositoryDirName)\n change_dir(lTempRepositoryDirName) do\n # Checkout using svn\n `svn co #{@SVNCOCmd}`\n # Now replace the files we want with the ones from the local repository\n @LstFiles.each do |iFileName|\n lSrcFileName = \"#{@LocalRepository}/#{iFileName}\"\n lDstFileName = \"#{lTempRepositoryDirName}/#{iFileName}\"\n if (File.exists?(lSrcFileName))\n FileUtils::cp(lSrcFileName, lDstFileName)\n elsif (File.exists?(lDstFileName))\n FileUtils::rm(lDstFileName)\n end\n end\n # Execute the regression from this repository\n rError = executeRegression(lTempRepositoryDirName)\n end\n if (rError == nil)\n # Perfect, we can clean up the temporary directory\n FileUtils::rm_rf(lTempRepositoryDirName)\n else\n log_err \"An error occurred when testing regression: #{rError}. Leaving checked-out repository #{lTempRepositoryDirName} for further investigations. Feel free to remove it.\"\n end\n end\n\n return rError\n end",
"def commit(opts = {:use_dirstate => true, :update_dirstate => true})\n valid = false # don't update the DirState if this is set!\n \n commit = ((modified || []) + (added || [])).sort\n remove = removed\n xtra = extra.dup\n branchname = xtra[\"branch\"]\n text = description\n \n p1, p2 = parents.map {|p| p.node }\n c1 = repo.changelog.read(p1) # 1 parent's changeset as an array\n c2 = repo.changelog.read(p2) # 2nd parent's changeset as an array\n m1 = repo.manifest.read(c1[0]).dup # 1st parent's manifest\n m2 = repo.manifest.read(c2[0]) # 2nd parent's manifest\n \n if opts[:use_dirstate]\n oldname = c1[5][\"branch\"]\n tests = [ commit.empty?, remove.empty?, !opts[:force],\n p2 == NULL_ID, branchname == oldname ]\n if tests.all?\n UI::status \"nothing changed\"\n return nil\n end\n end\n \n xp1 = p1.hexlify\n xp2 = p2 == NULL_ID ? \"\" : p2.hexlify\n \n Hook.run_hook :pre_commit\n journal = Amp::Mercurial::Journal.new(:opener => repo.store_opener)\n \n fresh = {} # new = reserved haha i don't know why someone wrote \"haha\"\n changed = []\n link_rev = repo.size\n \n (commit + (remove || [])).each {|file| UI::status file }\n \n # foreach file in commit:\n # commit_file file\n # end\n commit.each do |file|\n versioned_file = self[file]\n fresh[file] = versioned_file.commit :manifests => [m1, m2],\n :link_revision => link_rev,\n :journal => journal ,\n :changed => changed\n \n new_flags = versioned_file.flags\n \n # TODO\n # Clean this shit up\n if [ changed.empty? || changed.last != file, \n m2[file] != fresh[file]\n ].all?\n changed << file if m1.flags[file] != new_flags\n end\n m1.flags[file] = new_flags\n \n repo.staging_area.normal file if opts[:use_dirstate]\n end\n \n # add_manifest_entry\n man_entry, updated, added = *add_manifest_entry(:manifests => [m1, m2],\n :changesets => [c1, c2],\n :journal => journal ,\n :link_rev => link_rev,\n :fresh => fresh ,\n :remove => remove ,\n :changed => changed )\n\n # get_commit_text\n text = get_commit_text text, :added => added, :updated => updated,\n :removed => removed, :user => user ,\n :empty_ok => opts[:empty_ok] ,\n :use_dirstate => opts[:use_dirstate]\n \n # atomically write to the changelog\n # add_changelog_entry\n # for the unenlightened, rents = 'rents = parents\n new_rents = add_changelog_entry :manifest_entry => man_entry,\n :files => (changed + removed),\n :text => text,\n :journal => journal,\n :parents => [p1, p2],\n :user => user,\n :date => date,\n :extra => xtra\n \n \n # Write the dirstate if it needs to be updated\n # basically just bring it up to speed\n if opts[:use_dirstate] || opts[:update_dirstate]\n repo.dirstate.parents = new_rents\n removed.each {|f| repo.dirstate.forget(f) } if opts[:use_dirstate]\n repo.staging_area.save\n end\n \n # The journal and dirstates are awesome. Leave them be.\n valid = true\n journal.close\n \n # if an error and we've gotten this far, then the journal is complete\n # and it deserves to stay (if an error is thrown and journal isn't nil,\n # the rescue will destroy it)\n journal = nil\n \n # Run any hooks\n Hook.run_hook :post_commit, :added => added, :modified => updated, :removed => removed, \n :user => user, :date => date, :text => text,\n :revision => repo.changelog.index_size\n return new_rents\n rescue StandardError => e\n if !valid\n repo.dirstate.invalidate!\n end\n if e.kind_of?(AbortError)\n UI::warn \"Abort: #{e}\"\n else\n UI::warn \"Got exception while committing. #{e}\"\n UI::warn e.backtrace.join(\"\\n\")\n end\n \n # the journal is a vestigial and incomplete file.\n # destroyzzzzzzzzzzz\n journal.delete if journal\n end",
"def commit_helper_modified(modified_files)\n\t\tmodified_files.each do |file|\n\t\t\ttype = File.extname(file)\n\t\t\tfile.slice!(type)\n\t\t\tputs file + \" -> \" + set_filename_in_rep(file, type)\n\t\t\tinitialize_files(@branch_dir , set_filename_in_rep(file, type) , read_file(@currentDir, file + type))\n\t\tend\n\t\tupdate_currentBranchfile()\n\t\tupdate_branches()\n\t\tdelete_ready_for_commitfiles()\n\tend",
"def commitChange( change, user = User.getlogin )\n must_exist\n\n change[:minutesSpent] = 0 if change[:minutesSpent].nil?\n\n # Normalize dependencies to an array of ticket ids.\n modifications = {}\n [:dependencies, :dependers].each do |depType|\n if change.key? depType\n modifications[depType] = change[depType].map do |dep|\n dep.is_a?( Ticket ) ? dep.id : dep\n end\n end\n end\n\n # Make sure the change will succeed before committing, so we don't \n # half-commit a change then fail.\n ensureChangeIsConsistent( change.merge( modifications ) )\n\n changes = \"\"\n\n # Process everything except the change log.\n change.each do |id, value|\n if modifications.key? id\n value = modifications[id]\n end\n\n case id\n when :project\n changes += diff( 'Project', self.project, value )\n self.project = value\n when :status\n changes += diff( 'Status', self.status, value )\n self.status = value\n when :keywords\n changes += diff( 'Keywords', self.keywords, value)\n self.keywords = value\n when :description\n changes += diff( 'Description', self.description, description )\n self.description = value\n when :assignedUsers\n changes += diff( 'Assigned', self.assignedUsers, value )\n self.assignedUsers = value\n when :listeningUsers\n changes += diff( 'Listening', self.listeningUsers, value )\n self.listeningUsers = value\n when :priority\n changes += diff( 'Priority', self.priority, value )\n self.priority = value\n when :minutesSpent\n self.minutesSpent += value\n when :minutesRemaining\n self.minutesRemaining = value\n when :dependencies\n changes += diff( 'Depends', self.dependencies, value )\n self.dependencies = value\n when :dependers\n changes += diff( 'Depended on by', self.dependers, value )\n self.dependers = value\n when :due\n changes += diff( 'Due date', self.due, value )\n self.due = value\n end\n end\n\n if changes.empty?\n changelog = change[:changelog]\n else\n changelog = changes + \"\\n\" + change[:changelog]\n end\n\n # Add the change log entry\n cl = NewTicketEntry.new( @id )\n cl.user = user\n cl.text = changelog\n cl.minutes = change[:minutesSpent]\n cl.commit\n\n toAlert = self.listeningUsers | self.assignedUsers\n\n toAlert.each do |username|\n mail = Mail.new\n mail.to = EmailFilter.filter( username )\n mail.subject = \"#{self.project.shortName}: #{self.description} (#{@id})\"\n mail.message = headers + \"\\n\\n\" + \"-\"*80 + \"\\n\" + getChangeLogAsString\n mail.send\n end\n end",
"def attempt_change(action, source_db, target_db, diff, remaining_attempts)\n rep_helper.session.send(target_db).transaction(:requires_new => true) { yield }\n rep_helper.commit\n end",
"def commit\n return false unless self.elected\n\n # group management\n# person.groups = person.groups | [Group.find_by_name(\"officers\"), Group.find_by_name(\"comms\"),Group.find_by_name(self.position)]\n # TODO: Support adding assistant officers too\n cship = Committeeship.create({\n person_id: self.person_id,\n committee: self.position,\n semester: self.semester,\n title: 'officer'\n })\n\n # username changes\n person.username = self.final_username\n unless person.valid? && person.save && person.reload && self.reload\n Rails.logger.error \"Failed to apply username change #{person.username_was} -> #{self.final_username}\"\n return false\n end\n\n # ensure s/he has a tutor\n unless self.person.get_tutor\n Rails.logger.error \"Failed to create tutor for #{person.username}\"\n return false\n end\n\n # hknmod\n cmd = []\n cmd << \"-s\"\n cmd << \"-l #{self.person.username}\"\n cmd << \"-c #{self.position}\"\n# if self.first_election?\n# cmd << \"-a\"\n cmd << \"--nf #{self.person.first_name.inspect}\"\n cmd << \"--nl #{self.person.last_name.inspect}\"\n cmd << \"-e #{self.person.email.inspect}\"\n# else # returning officer\n# cmd << \"-m\"\n# end\n\n hknmod_cmd = \"./run_hknmod #{cmd.join ' '}\"\n\n Rails.logger.info \"Election Create: #{self.inspect} #{self.person.inspect}: #{hknmod_cmd}\"\n #Rails.logger.info `./run_hknmod #{cmd.join ' '}`\n #Rails.logger.info system('./run_hknmod', *cmd)\n\n # Write into log file rather than directly hknmodding\n File.open(OutputFile, 'a') do |f|\n f.puts hknmod_cmd\n end\n\n return true\n end",
"def run_git_second_commit\n raise \"Git 2nd commit failed\" unless system(\"set +x; EDITOR=true git commit --amend ChangeLog\")\n end",
"def commit_if_dirty(soft_commit = false)\n session.commit_if_dirty soft_commit\n end",
"def handle_silent_modification_failure?\n self[:raise_on_save_failure] == false && self[:save_after_modify]\n end",
"def commit_if_dirty(soft_commit = false)\n session.commit_if_dirty soft_commit\n end",
"def testConflictCommit\n setupTest do |iTasksFileName, iTicketsFileName, iLocalRepository|\n $Context[:OS_ExecAnswers] = [\n # svn up => no conflict\n [ 0, 'M SampleFile.txt' ],\n # svn ci => conflict\n [ 1, 'Sending SampleFile.txt\nsvn: Commit failed (details follow):\nsvn: Out of date: \\'SampleFile.txt\\' in transaction \\'g\\'' ]\n ]\n executeProcess(\n [\n '--user', 'CommitUser',\n '--branch', 'BranchName',\n '--comment', 'CommitComment',\n '--tasksfile', iTasksFileName,\n '--ticketsfile', iTicketsFileName,\n '--local', iLocalRepository\n ],\n :Error => WEACE::Master::Server::Processes::Dev_Commit::CommitConflictError\n )\n end\n end",
"def processModifications(initRental, rentalMod, initRentalInfo, cars)\n newRental = initRental.merge(rentalMod);\n newRentalInfo = processRental(newRental, cars);\n getRentalModActions(initRentalInfo, newRentalInfo);\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Attempt to cherrypick a merge request into the autodeploy branch Returns a Result object | def cherry_pick(merge_request)
assert_mirrored!(merge_request.merge_commit_sha)
unless SharedStatus.dry_run?
client.cherry_pick(
project.auto_deploy_path,
ref: merge_request.merge_commit_sha,
target: @target
)
end
Result.new(merge_request, :success)
rescue Gitlab::Error::Error => ex
Result.new(merge_request, :failure, ex.message)
end | [
"def merge\n return unless request_exists?\n option = @args.shift\n unless @current_request['head']['repo']\n # Someone deleted the source repo.\n user = @current_request['head']['user']['login']\n url = @current_request['patch_url']\n puts \"Sorry, #{user} deleted the source repository, git-review doesn't support this.\"\n puts 'Tell the contributor not to do this.'\n puts\n puts 'You can still manually patch your repo by running:'\n puts\n puts \" curl #{url} | git am\"\n puts\n return false\n end\n message = \"Accept request ##{@current_request['number']} and merge changes into \\\"#{target}\\\"\"\n exec_cmd = \"merge #{option} -m '#{message}' #{@current_request['head']['sha']}\"\n puts\n puts 'Request title:'\n puts \" #{@current_request['title']}\"\n puts\n puts 'Merge command:'\n puts \" git #{exec_cmd}\"\n puts\n puts git_call(exec_cmd)\n end",
"def merge\n return unless request_exists?\n # FIXME: What options are allowed here?\n option = @args.shift\n unless @current_request.head.repo\n # Someone deleted the source repo.\n user = @current_request.head.user.login\n url = @current_request.patch_url\n puts \"Sorry, #{user} deleted the source repository.\"\n puts 'git-review doesn\\'t support this.'\n puts 'Tell the contributor not to do this.'\n puts\n puts 'You can still manually patch your repo by running:'\n puts\n puts \" curl #{url} | git am\"\n puts\n return false\n end\n message = \"Accept request ##{@current_request.number}\" +\n \" and merge changes into \\\"#{target}\\\"\"\n command = \"merge #{option} -m '#{message}' #{@current_request.head.sha}\"\n puts\n puts 'Request title:'\n puts ' ' + @current_request.title\n puts\n puts 'Merge command:'\n puts \" git #{command}\"\n puts\n puts git_call command\n end",
"def merge(number)\n request = get_request_by_number(number)\n if request.head.repo\n message = \"Accept request ##{request.number} \" +\n \"and merge changes into \\\"#{local.target}\\\"\"\n command = \"merge -m '#{message}' #{request.head.sha}\"\n puts\n puts \"Request title:\"\n puts \" #{request.title}\"\n puts\n puts \"Merge command:\"\n puts \" git #{command}\"\n puts\n puts git_call(command)\n else\n print_repo_deleted(request)\n end\n end",
"def merge_pull_request\n git.merge pull_request.branch\n end",
"def merge_pull_request(repo, number, commit_message = T.unsafe(nil), options = T.unsafe(nil)); end",
"def cherry_pick_commit(project, sha, branch, options = {})\n options[:branch] = branch\n\n post(\"/projects/#{url_encode project}/repository/commits/#{sha}/cherry_pick\", body: options)\n end",
"def merge(join_request)\n work = ::GitFunctionality::Repo.new.get_working_repo(join_request.curricula)\n work.checkout(join_request.target_stream)\n work.fetch\n work.pull\n work.merge(join_request.source_stream)\n work.branch(join_request.source_stream).delete\n work.push\n work.fetch\n work.pull\n end",
"def merge_request(id)\n url = merge_request_url(id) + \".xml\"\n doc = Nokogiri::HTML(open(url))\n ending_commit = doc.at(\"ending-commit\").content\n merge_base_sha = doc.xpath('//versions/version').last.at('merge_base_sha').content\n summary = doc.at(\"summary\").content\n proposal = doc.at(\"proposal\").content\n result = MergeRequest.new\n result.ending_commit = ending_commit\n result.merge_base_sha = merge_base_sha\n result.summary = summary\n result.id = id\n result.proposal = proposal\n result\n end",
"def merge_pull_request(owner, repo, number)\n put \"/repos/#{owner}/#{repo}/pulls/#{number}/merge\"\n end",
"def merging\n @mergin ||= ApiFactory.new 'Repos::Merging'\n end",
"def merge!\n in_locked_and_timed_satellite do |merge_repo|\n if merge_in_satellite!(merge_repo)\n # push merge back to Gitolite\n # will raise CommandFailed when push fails\n merge_repo.git.push({raise: true}, :origin, merge_request.target_branch)\n\n # remove source branch\n if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch)\n # will raise CommandFailed when push fails\n merge_repo.git.push({raise: true}, :origin, \":#{merge_request.source_branch}\")\n end\n\n # merge, push and branch removal successful\n true\n end\n end\n rescue Grit::Git::CommandFailed\n false\n end",
"def merge_branch\n git.merge branch\n rescue Git::MergeFailed\n cli.say \"Merge failed. Please resolve these conflicts.\"\n end",
"def git_command__cherry_pick\n [\n \"cherry-pick\", # command\n [], # options\n ]\n end",
"def merge_pull_request(repo, number, commit_message='', options = {})\n put \"#{Repository.path repo}/pulls/#{number}/merge\", options.merge({:commit_message => commit_message})\n end",
"def merge(branch, author, date, message)\r\n ex(\"bzr merge ..\\\\#{branch}\")\r\n commit(author, date, message)\r\n end",
"def git_branch_merge\n initial_branch = get_current_branch\n\n branches.each do |branch|\n `git checkout #{branch}`\n `echo \"Merging master into #{branch}\" >&2`\n `git pull --rebase origin master`\n `echo \"Master merged into #{branch}\" >&2`\n end\n\n `git checkout #{initial_branch}`\nend",
"def update\n @pullRequest = PullRequest.find(params[:id])\n\t\t@git = Git.init()\n\t\tDir.chdir(@pullRequest.source_repo.path)\n\t\trequestor_path = \"#{@pullRequest.repository.path}\"\n\t\t@git.pull(requestor_path, \"master\") # fetch and a merge\n\t\t@pullRequest.status = \"ACCEPTED\"\n if @pullRequest.save\n\t\t\trespond_with(@pullRequest)\n\t\telse\n\t\t\trender json: {error: \"An error occurred while updating your pull request\"}\n end\n end",
"def pull_request_merged?(owner, repo, number)\n boolean_request :get, \"/repos/#{owner}/#{repo}/pulls/#{number}/merge\"\n end",
"def check_conflict()\n check_results = []\n\n repo_name = github.pr_json[:base][:repo][:full_name]\n\n pull_requests = github.api.pull_requests(repo_name).select do |pr|\n pr[:id] != github.pr_json[:id] && pr[:base][:label] == github.pr_json[:base][:label]\n end\n\n return check_results if pull_requests.empty?\n\n g = Git.open(Dir.pwd)\n\n pull_requests.each do |pr|\n result = {\n pull_request: pr,\n mergeable: true,\n conflicts: []\n }\n\n uuid = SecureRandom.uuid\n\n r = g.add_remote(uuid, pr[:head][:repo][:ssh_url])\n r.fetch()\n\n branch1 = github.pr_json[:head][:ref]\n branch2 = \"#{uuid}/#{pr[:head][:ref]}\"\n\n base = `git merge-base #{branch1} #{branch2}`.chomp\n\n Tempfile.open('tmp') do |f|\n patch = `git format-patch #{base}..#{branch2} --stdout`.chomp\n f.sync = true\n f.puts patch\n out, s = Open3.capture2e(\"git apply --check #{f.path}\")\n\n out.each_line do |line|\n\n if 'patch failed' == line.split(':')[1].strip\n conflict = {\n file: line.split(':')[2].strip,\n line: line.split(':')[3].strip.to_i\n }\n result[:conflicts] << conflict\n end\n end\n\n result[:mergeable] = result[:conflicts].empty?\n end\n\n g.remove_remote(uuid)\n\n check_results << result\n end\n\n check_results\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Verify the merge commit has been mirrored to the Security repository | def assert_mirrored!(merge_commit_sha)
Retriable.with_context(:api, tries: 10) do
client.commit(project.security_path, ref: merge_commit_sha)
end
rescue ::Gitlab::Error::NotFound
# If the commit still isn't available after retries, something may be
# wrong with our mirroring or merge-train, and we should fail loudly
raise MirrorError, "Unable to find #{merge_commit_sha} on #{project.security_path}"
end | [
"def verify_valid_branch_merge\n # trying to merge backwards with a direct ancestor of the current directory.\n # that's crazy.\n if ancestor == remote\n raise abort(\"can't merge with ancestor\")\n elsif ancestor == @local_parent\n # If we're at the branch point, without a difference in branch names, just do an update.\n # Kind of the opposite of the last case, only isntead of trying to merge directly backward,\n # we're trying to merge directly forward. That's wrong.\n if @local_parent.branch == remote.branch\n raise abort(\"nothing to merge (use 'amp update' or check\"+\n \" 'amp heads')\")\n end\n end\n # Can't merge when you have a dirty working directory. We don't want to lose\n # those changes!\n if !force && (working_changeset.changed_files.any? || working_changeset.deleted.any?)\n raise abort(\"oustanding uncommitted changes\")\n end\n end",
"def verify_valid_update\n if branch_merge\n verify_valid_branch_merge\n elsif !overwrite?\n verify_non_destructive\n end\n end",
"def check()\n # Check if merge is possible\n are_mergeable = true\n smc = SwimmerMergeChecker.new( @master_swimmer, @slave_swimmer )\n if !smc.analyze\n process_text_log << smc.analysis_text_log\n are_mergeable = false\n else\n process_text_log << \"\\r\\nCheck for merge '#{ @slave_swimmer.complete_name }' (id: #{ @slave_swimmer.id }) and '#{@master_swimmer.complete_name}' (id: #{ @master_swimmer.id }) succesfull\\r\\n\\r\\n\"\n end\n are_mergeable\n end",
"def verify_commits expected_commits\n expected_commits.diff! commits_in_current_repo(expected_commits.headers)\nend",
"def merge!\n in_locked_and_timed_satellite do |merge_repo|\n if merge_in_satellite!(merge_repo)\n # push merge back to Gitolite\n # will raise CommandFailed when push fails\n merge_repo.git.push({raise: true}, :origin, merge_request.target_branch)\n\n # remove source branch\n if merge_request.should_remove_source_branch && !project.root_ref?(merge_request.source_branch)\n # will raise CommandFailed when push fails\n merge_repo.git.push({raise: true}, :origin, \":#{merge_request.source_branch}\")\n end\n\n # merge, push and branch removal successful\n true\n end\n end\n rescue Grit::Git::CommandFailed\n false\n end",
"def check_sync!(local_sha: local_commit_sha, remote_sha: remote_commit_sha)\n return if remote_sha == local_sha\n\n raise <<~EOM\n Must be in-sync with #{@github}. Local commit: #{local_sha.inspect} #{@github}: #{remote_sha.inspect}\n \"Make sure that you've pulled: `git pull --rebase #{@github_url} main`\n EOM\n end",
"def check_merged!\n check_everything_commited!\n branch = current_branch\n git \"checkout master\"\n git \"pull --rebase\"\n merged = git(\"branch --merged\").include?(branch)\n git \"checkout #{branch}\"\n unless merged\n raise AssistedWorkflow::Error, \"this branch is not merged into master\"\n end\n merged\n end",
"def verify_no_uncommitted_merge\n if !overwrite? && @working_changeset.parents.size > 1\n raise abort(\"outstanding uncommitted merges\")\n end\n end",
"def check_merge_commit_detected(level = :fail)\n message = 'Some merge commits were detected, you must use rebase to sync with base branch.'\n merge_commit_detector = /^Merge branch '#{github.branch_for_base}'/\n\n report(level, message) if git.commits.any? { |commit| commit.message =~ merge_commit_detector }\n end",
"def merge_commit?\n !squash?\n end",
"def remote_differs?\n remote_sha = nil\n current_sha = nil\n git_repo = git_repo_for(@repo_dir)\n without_size_limit(git_repo) do\n do_fetch(git_repo)\n revision = resolve_revision\n remote_name = validate_revision(git_repo, revision)\n remote_sha = git_repo.sha_for(remote_name ? remote_name : revision)\n current_sha = git_repo.sha_for(nil)\n end\n current_sha != remote_sha\n end",
"def verify_merge_requests_import\n logger.info(\"== Verifying merge request import ==\")\n @mr_diff = verify_mrs_or_issues('mr')\n end",
"def do_commits_conflict?(commit1, commit2)\n result = false\n\n `git checkout #{commit1}`\n merge_output = `git merge #{commit2}`\n\n if /CONFLICT/ =~ merge_output\n result = true\n `git merge --abort`\n end\n\n `git clean -xdf`\n `git reset --hard`\n `git checkout .`\n\n return result\nend",
"def verify_repository_import\n logger.info(\"== Verifying repository import ==\")\n expect(imported_project.description).to eq(gh_repo.description)\n # check via include, importer creates more branches\n # https://gitlab.com/gitlab-org/gitlab/-/issues/332711\n expect(gl_branches).to include(*gh_branches)\n expect(gl_commits).to match_array(gh_commits)\n end",
"def test_checkout_local_rsync\n @actor.story = []\n @config[:repository_is_not_reachable_from_remote]= true\n @config[:use_rsync]= true\n @config[:local_rsync_cache]= \"/tmp/local_cache\"\n @config[:remote_rsync_cache]= \"/tmp/remote_cache\"\n @config[:rsync_username]= \"ausername\"\n\n assert_nothing_raised { @scm.checkout(@actor) }\n\n assert_equal 3, @scm.local_cmds.size\n\n # check the local commands were correct\n assert_match %r{/path/to/svn update\\s+-q\\s+-r\\s+/tmp/local_cache}, @scm.local_cmds[0]\n\n # and that it did rsync to bpth servers\n assert_match %r{rsync --archive --compress --copy-links --cvs-exclude --delete-after --no-blocking-io --stats -e ssh /tmp/local_cache/ ausername@server1:/tmp/remote_cache/}, @scm.local_cmds[1]\n assert_match %r{rsync --archive --compress --copy-links --cvs-exclude --delete-after --no-blocking-io --stats -e ssh /tmp/local_cache/ ausername@server2:/tmp/remote_cache/}, @scm.local_cmds[2]\n\n assert_nil @actor.channels.last.sent_data\n\n # check command to remote server is correct\n assert_match %r{cp -a /tmp/remote_cache/ /path/to/releases/version}, @actor.command\n end",
"def identical?\n loaded_commit.date == needed_commit.date\n rescue Git::GitExecuteError\n false\n end",
"def verify_repository_import\n logger.info(\"== Verifying repository import ==\")\n expect(imported_project.description).to eq(source_project.description)\n expect(branches).to match_array(source_branches)\n expect(commits).to match_array(source_commits)\n end",
"def outdated_merge_ref?\n return false unless merge_ref_auto_sync_enabled?\n return false unless merge_request.open?\n\n return true unless ref_head = merge_request.merge_ref_head\n return true unless target_sha = merge_request.target_branch_sha\n return true unless source_sha = merge_request.source_branch_sha\n\n ref_head.parent_ids != [target_sha, source_sha]\n end",
"def test_leaves_all_resolutions_after_update_to_branch_conflicting_with_two\n @git.push('origin/master', @git.target)\n branch_1 = add_branch\n add_file(branch_1, 'conflict_1')\n add_file(branch_1, 'conflict_2')\n merge(branch_1)\n branch_2 = add_branch\n merge(branch_2)\n resolution_3, branch_3 = make_conflicting_branch(branch_1, fname: 'conflict_1')\n merge(resolution_3)\n merge(branch_3)\n resolution_4, branch_4 = make_conflicting_branch(branch_1, fname: 'conflict_2')\n super_res = make_resolution_branch([resolution_3, resolution_4], 'master')\n merge(super_res)\n merge(resolution_4)\n merge(branch_4)\n flush_log\n\n add_file(branch_1, 'other_file')\n write_list([branch_1])\n flush_log\n assert rebuild, -> { @log.string }\n assert_equal [branch_2, branch_3, branch_4, super_res, resolution_3, resolution_4, branch_1].map(&:log), @git.current_branch_list, @log.string\n refute File.exist?('failed_report.json')\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
creates contact while associating contact with applicable events and user admin level | def create
@contact = Contact.new(contact_params.except(:user_id, :event_id))
@contact.admin_level=(User.find(session[:user_id]))
@contact.set_event(contact_params[:event_id], user_admin_level)
@user = User.find_by(id: contact_params[:user_id])
@contact.user = @user
@event = Event.find_by(id: contact_params[:event_id])
if @contact.save then nested_contact_redirect(@event, @contact) else render :new end
end | [
"def create\n @event_contact = EventContact.new event_contact_params\n render_entity @event_contact\n end",
"def create_new_contact(cnt_info, groups)\n id = DB[:contacts].insert(\n first_name: cnt_info[0],\n last_name: cnt_info[1],\n email: cnt_info[3],\n number: cnt_info[2]\n )\n\n assing_contact_to_goup(groups, id)\n end",
"def add_initial_contact\n # case_watcher_lists.create(:contact => initial_contact)\n end",
"def create_contact\n company = Company.find(params[:company_id])\n \n if params[:user].present?\n new_user = User.new(params[:user])\n new_user.skip_confirmation!\n \n if new_user.save\n company.update_attributes(:contact => new_user.id) if params[:primary_contact].present? && params[:primary_contact] == \"true\"\n UserMailer.welcome_email(new_user.email).deliver if params[:welcome_email] == \"true\"\n @log_msg = \"Contact \" + new_user.id.to_s + \" created by user \" + current_user.id.to_s\n end \n end\n \n return render :partial => 'layouts/conditional_popup_display', :locals => {:partial_tobe_rendered => \"companies/contacts\", :partial_locals => {:company_contacts => company.contacts, :company => company}, :modal_id => \"contactentry\", :button_caption => params[:commit] }\n end",
"def create_add_contact_hook\n return success unless @marketing_communication_flag == 1\n\n Email::HookCreator::AddContact.new(\n receiver_entity_id: @manager_id,\n receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,\n add_ost_master_list: true\n ).perform\n\n success\n end",
"def add_emergency_contact\n contact = EmergencyContact.create(user_id: self.id, name: \"\", phone_number: \"\", )\n end",
"def add_contact_in_email_service\n\n Email::HookCreator::AddContact.new(\n receiver_entity_id: @manager_id,\n receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,\n custom_attributes: {\n GlobalConstant::PepoCampaigns.platform_signup_attribute => GlobalConstant::PepoCampaigns.platform_signup_value\n }\n ).perform\n\n end",
"def add_contact_in_email_service\n\n Email::HookCreator::AddContact.new(\n receiver_entity_id: @manager_id,\n receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,\n custom_attributes: {\n GlobalConstant::PepoCampaigns.platform_signup_attribute => GlobalConstant::PepoCampaigns.platform_signup_value,\n GlobalConstant::PepoCampaigns.platform_marketing_attribute => @platform_marketing,\n GlobalConstant::PepoCampaigns.manager_first_name_attribute => @manager_first_name,\n GlobalConstant::PepoCampaigns.manager_last_name_attribute => @manager_last_name\n }\n ).perform\n\n end",
"def create_add_contact_hook\n return success unless (@manager_validation_hash_obj.extra_data || {})[:platform_marketing] == 1\n\n Email::HookCreator::AddContact.new(\n receiver_entity_id: @manager_validation_hash_obj.manager_id,\n receiver_entity_kind: GlobalConstant::EmailServiceApiCallHook.manager_receiver_entity_kind,\n add_ost_master_list: true\n ).perform\n\n success\n end",
"def create_contact(name, telephone, email)\n\t contact = {name: name, telephone: telephone, email: email}\n\tend",
"def create_AC_contact\n @devicecontact = Contact.find_contact(@params['contact']['contactid'])\n if @devicecontact\n contact = @devicecontact\n else\n contact = Contact.create_new(@params['contact'])\n end\n puts \"CREATING THE NEW OPPORTUNITY FROM AC SEARCH\" \n opp = Opportunity.create_for_new_contact(@params['opportunity'], contact.object)\n SyncEngine.dosync\n redirect :controller => :Contact,\n :action => :show, \n :id => contact.object,\n :query => { :origin => 'SearchContacts', :back => 'callback:'}\n \n end",
"def add_contact(contact)\n case contact\n when User\n return UserContact.create(owner_id: self.id, user_id: contact.id)\n when Email\n return EmailContact.create(owner_id: self.id, email: contact.email)\n end\n end",
"def create_contact(options = {})\n post(:contacts, contacts: [options]).pop\n end",
"def create\n @admin_contact = Admin::Contact.new(admin_contact_params)\n\n respond_to do |format|\n if @admin_contact.save\n format.html { redirect_to admin_contacts_path, notice: mk_notice(@admin_contact, :id, 'Contact', :create) }\n format.json { render json: @admin_contact, status: :created, location: admin_contacts_path }\n else\n format.html { render :new }\n format.json { render json: @admin_contact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_contact(contact_info)\n self.refresh_access_token!\n\n contact = OpenStruct.new({\n first_name: contact_info[:first_name],\n last_name: contact_info[:last_name],\n phone: contact_info[:phone]\n })\n\n haml_template = File.read(File.join(TEMPLATES_DIR, 'contact.xml.haml'))\n request_body = Haml::Engine.new(haml_template, remove_whitespace: true).render(Object.new, {\n contact: contact,\n user: self\n })\n\n @response = @oauth_access_token.post(\n 'https://www.google.com/m8/feeds/contacts/default/full',\n {\n body: request_body,\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n @response.status == 201\n end",
"def create\n\t\t@admin_contact = Admin::Contact.new(admin_contact_params)\n\n\t\tif @admin_contact.save\n\t\t\tAdminMailer.delay(:queue => 'notification_to_admin', :priority => 2).mail_notice(params[:profile_email],params[:dashboard_comment][:name],params[:dashboard_comment][:email],params[:dashboard_comment][:body])\n\t\t\t#respond_to do |format|\n\t\t\t\t@comment = Admin::Contact.last\n\t\t\t#\tformat.js\n\t\t\t#end\n\t\tend\n\tend",
"def create\n @user_contact = @current_user.user_contacts.new(user_contact_params)\n if @user_contact.save\n render :show, status: :created, location: @user_contact\n else\n render json: @user_contact.errors, status: :unprocessable_entity\n end\n end",
"def create_contact(body)\n endpoint = \"https://api.xero.com/api.xro/2.0/Contacts/#{body[:contactID]}\"\n response = @token.post(endpoint, { json: JSON.dump(body) }, { \"Accept\": \"application/json\" })\n business.update(xero_id: xero_id)\n end",
"def construct_order_contact\n edsc_user = User.find_by(echo_id: user.echo_id)\n\n # TODO: Take into account address and phone values stored for the user\n # TODO: Try to use appropriate array syntax for phones\n {\n email: edsc_user.urs_profile['email_address'],\n first_name: edsc_user.urs_profile['first_name'],\n last_name: edsc_user.urs_profile['last_name'],\n organization: edsc_user.urs_profile['organization'],\n address: {\n country: edsc_user.urs_profile['country']\n },\n phones: {\n '0': {\n number: '0000000000', phone_number_type: 'BUSINESS'\n }\n },\n role: 'Order Contact'\n }\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
chooses redirect based on whether contact is nested or not | def nested_contact_redirect(event, contact)
if !!event then redirect_to event_path(event) else redirect_to contact_path(contact) end
end | [
"def load_current_contact_or_redirect\n unless self.current_contact\n redirect_to new_press_contact_path\n return false\n end\n true\n end",
"def load_current_contact_or_redirect\n unless self.current_contact\n redirect_to new_corporate_contact_path\n return false\n end\n true\n end",
"def contact\n redirect_to navigation_contact_path\n end",
"def check_for_nested_urls\n if params[:parent_controller] == \"urls\"\n @show_nested_urls = false\n else\n @show_nested_urls = true\n end\n end",
"def apply_redirecting\n if @category.redirecting? && @category.products.visible.empty?\n if first_child = @category.children.live.first\n return redirect_to show_category_path(first_child)\n end\n end\n false\n end",
"def determine_redirect(response_set, event)\n if event.nil?\n participant_path(response_set.participant)\n elsif response_set.instrument_associated?\n edit_instrument_contact_link_path(most_recent_contact_link)\n elsif event.closed?\n participant_path(response_set.participant)\n else\n decision_page_contact_link_path(most_recent_contact_link)\n end\n end",
"def redirectToContactDetail\n url = @driver.current_url();\n #puts url\n newUrl = url.split('/003')\n #puts newUrl\n @driver.get \"#{newUrl[0]}\" + \"/#{@@contactCreation[0][\"Id\"]}\"\n end",
"def contacts_link\n if for_all_aspects? || aspect_ids.size > 1\n Rails.application.routes.url_helpers.contacts_path\n else\n Rails.application.routes.url_helpers.contacts_path(:a_id => aspect.id)\n end\n end",
"def legacy_redirect\n community = Community.where(\"lower(legacy_url) = ?\", params[:legacy_community_name].to_s.downcase).first\n \n if community\n redirect_to community, status: 301\n elsif college = College.where(\"lower(short_name) = ?\", params[:legacy_college_name].to_s.downcase).first\n redirect_to college, status: 301\n else\n flash[:notice] = \"The link you clicked is out of date! We couldn't figure out where you wanted to go...\"\n redirect_to listings_url, status: 301\n end\n end",
"def redirect_if_current_agency_not_found\n return unless active_agency\n # Redirect if current domain and subdomain don't match record\n if intended_domain(current_domain) == active_agency.domain\n if (current_subdomain || \"\") != active_agency.subdomain\n unless active_agency.subdomain.blank?\n redirect_subdomain = active_agency.subdomain\n else\n redirect_subdomain = nil\n end\n redirect_to root_url(:subdomain => redirect_subdomain)\n end\n # NOTE: if domain doesn't match, then continue with current value for\n # active agency, which will be the master agency with the smallest id\n end\n end",
"def redirect_to_comment(comment, options = {})\n if comment.depth > ArchiveConfig.COMMENT_THREAD_MAX_DEPTH\n default_options = {\n :controller => comment.commentable.class.to_s.underscore.pluralize,\n :action => :show,\n :id => comment.commentable.id,\n :anchor => \"comment_#{comment.id}\"\n }\n # display the comment's direct parent (and its associated thread)\n redirect_to(url_for(default_options.merge(options)))\n else\n redirect_to_all_comments(comment.ultimate_parent, options.merge({:show_comments => true, :anchor => \"comment_#{comment.id}\"}))\n end\n end",
"def redirect_to_parent (args = {})\n redirect_to @city ? @city : @university, :notice => args[:notice]\n end",
"def conditional_redirect_to_navigation_path(item)\n item_path = polymorphic_path(item)\n # We have to compare against the unaltered PATH_INFO.\n original_path = request.env['ORIGINAL_PATH_INFO']\n if item_path != original_path && original_path != root_path\n redirect_to(item_path)\n return true\n end\n false\n end",
"def create\n @contact = Contact.new(contact_params.except(:user_id, :event_id))\n @contact.admin_level=(User.find(session[:user_id]))\n @contact.set_event(contact_params[:event_id], user_admin_level)\n @user = User.find_by(id: contact_params[:user_id])\n @contact.user = @user\n @event = Event.find_by(id: contact_params[:event_id])\n if @contact.save then nested_contact_redirect(@event, @contact) else render :new end\n end",
"def redirect_based_on(voucher, force=false)\n if logged_in? || force\n case voucher.kind\n when :partner_membership\n redirect_to new_user_partner_path\n else\n redirect_to complete_voucher_path\n end\n else\n redirect_to complete_voucher_path\n end\n end",
"def not_contact_no_request_partial_path(contact)\n if recipient_is_contact? == false && unaccepted_contact_exists(contact) == false\n \"private/conversations/conversation/request_status/send_request\"\n else\n 'shared/empty_partial'\n end\n end",
"def org_redirection_method\n if org_present?\n redirect_to root_path if org_controller?\n else\n redirect_to new_organization_path unless org_controller?\n end\n end",
"def redirect_based_on_organisation_completeness(organisation)\n\n if helpers.complete_organisation_details?(organisation)\n\n logger.info \"Organisation details complete for #{organisation.id}\"\n\n redirect_to(:start_an_application)\n\n else\n\n logger.info \"Organisation details not complete for #{organisation.id}\"\n\n redirect_to organisation_type_path(organisation.id)\n\n end\n\n end",
"def require_viewpoints\r\n redirect_to(home_url) and return unless @cobrand.cobrand_or_child_of?(Cobrand[\"viewpoints\"])\r\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /user_labs GET /user_labs.json | def index
@user_labs = UserLab.all
end | [
"def show\n @lab_user = LabUser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_user }\n end\n end",
"def index\n @labs = Lab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labs }\n end\n end",
"def index\n @remote_labs = current_user.remote_labs\n authorize RemoteLab\n end",
"def collabs\n @users = User.all.filter { |user| user.user_name.downcase.include?(params[:q].downcase) }\n render json: @users, each_serializer: CollabSerializer\n end",
"def index\n @labs = ::Lab.all\n end",
"def index\n @vet_labs = VetLab.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vet_labs }\n end\n end",
"def index\n @user = User.find(params[:user_id])\n @lab_memberships = @user.lab_memberships\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lab_memberships }\n end\n end",
"def show\n @lab_name = LabName.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_name }\n end\n end",
"def index\n @slabs = Slab.all\n end",
"def show\n @luser = Luser.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @luser }\n end\n end",
"def index\n @user_challenges = UserChallenge.all\n render json: @user_challenges\n end",
"def create\n @user_lab = UserLab.new(user_lab_params)\n\n respond_to do |format|\n if @user_lab.save\n format.html { redirect_to @user_lab, notice: 'User lab was successfully created.' }\n format.json { render :show, status: :created, location: @user_lab }\n else\n format.html { render :new }\n format.json { render json: @user_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @laboratories = Laboratory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @laboratories }\n end\n end",
"def index\n @labours = Labour.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @labours }\n end\n end",
"def index\n @lends = User.find_by_id(params[:user_id]).lends\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lends }\n end\n end",
"def list\n\t \tuser_list=::PluginStore.get('discourse-opencollective-plugin','user_data')\n\t \tparsed=JSON.parse(user_list)\n\t \trender json: parsed\n\t end",
"def show\n @lab_check = LabCheck.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_check }\n end\n end",
"def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end",
"def get_lists(user)\n get(\"/#{user}/lists.json\")\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /user_labs POST /user_labs.json | def create
@user_lab = UserLab.new(user_lab_params)
respond_to do |format|
if @user_lab.save
format.html { redirect_to @user_lab, notice: 'User lab was successfully created.' }
format.json { render :show, status: :created, location: @user_lab }
else
format.html { render :new }
format.json { render json: @user_lab.errors, status: :unprocessable_entity }
end
end
end | [
"def create\n lab = Lab.find_by(id: params[:lab_id])\n user_lab = current_user.user_labs.create(lab: lab)\n\n respond_to do |format|\n if user_lab.save\n format.html { redirect_to labs_url , notice: 'Successfully subscribed.' }\n format.json { render :show, status: :created, location: labs_url }\n else\n format.html { render :new }\n format.json { render json: user_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @blab = current_user.blabs.build(blab_params)\n\n respond_to do |format|\n if @blab.save\n format.html { redirect_to @blab, notice: 'Blab was successfully created.' }\n format.json { render :show, status: :created, location: @blab }\n else\n format.html { render :new }\n format.json { render json: @blab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab = Lab.new(params[:lab])\n respond_to do |format|\n if @lab.save\n format.html { redirect_to labs_path, notice: 'Lab was successfully created.' }\n format.json { render json: @lab, status: :created, location: @lab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab_user_info = LabUserInfo.new(lab_user_info_params)\n\n respond_to do |format|\n if @lab_user_info.save\n format.html { redirect_to @lab_user_info, notice: 'Lab user info was successfully created.' }\n format.json { render :show, status: :created, location: @lab_user_info }\n else\n format.html { render :new }\n format.json { render json: @lab_user_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @user_labs = UserLab.all\n end",
"def create\n @blab = Blab.new(params[:blab])\n\n respond_to do |format|\n if @blab.save\n \tcurrent_user.blabs << @blab\n format.html { redirect_to blabs_path, notice: 'good job blabber mouth.' }\n format.json { render json: @blab, status: :created, location: @blab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @blab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab = Lab.new(lab_params)\n\n respond_to do |format|\n if @lab.save\n format.html { redirect_to [:adm, @lab], notice: 'Lab was successfully created.' }\n format.json { render json: @lab, status: :created, location: @lab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @remote_lab = RemoteLab.new(remote_lab_params)\n @remote_lab.user = current_user\n\n authorize @remote_lab\n\n respond_to do |format|\n if @remote_lab.save\n format.html { redirect_to @remote_lab, notice: 'Remote lab was successfully created.' }\n format.json { render :show, status: :created, location: @remote_lab }\n else\n format.html { render :new }\n format.json { render json: @remote_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab = Lab.new(lab_params)\n\n respond_to do |format|\n if @lab.save\n format.html { redirect_to @lab, notice: 'Lab was successfully created.' }\n format.json { render json: @lab, status: :created, location: @lab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab = Lab.new(params[:lab])\n\n respond_to do |format|\n if @lab.save\n format.html { redirect_to @lab, notice: 'Lab was successfully created.' }\n format.json { render json: @lab, status: :created, location: @lab }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab = ::Lab.new(lab_params)\n\n respond_to do |format|\n if @lab.save\n format.html { redirect_to admin_lab_url(@lab), notice: 'Lab was successfully created.' }\n format.json { render :show, status: :created, location: admin_lab_url(@lab) }\n else\n format.html { render :new }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @lab_check = @operations_check.lab_checks.create(lab_check_params)\n @lab_check.lab_name = params[:lab_name].to_s\n\n respond_to do |format|\n if @lab_check.save\n format.html { redirect_to operations_check_path(@operations_check.id, tab:\"labs\"), \n notice: 'Lab check was successfully created.' }\n format.json { render json: @lab_check, status: :created, location: @lab_check }\n else\n format.html { redirect_to @operations_check, \n notice: 'Commit Failed - You need to give a ticket number if the check failed! ' }\n end\n end\n end",
"def update\n respond_to do |format|\n if @user_lab.update(user_lab_params)\n format.html { redirect_to @user_lab, notice: 'User lab was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_lab }\n else\n format.html { render :edit }\n format.json { render json: @user_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_lab_groups(user)\n user.lab_groups.clear if !user.lab_groups.empty?\n vals = lab_group_params.values.first\n if !vals.nil?\n vals.each do |id|\n if !id.empty?\n lg = LabGroup.find(id)\n user.lab_groups << lg\n end\n end\n end\n end",
"def create\n @lti_user = LtiUser.new(lti_user_params)\n\n respond_to do |format|\n if @lti_user.save\n format.html { redirect_to @lti_user, notice: 'Lti user was successfully created.' }\n format.json { render :show, status: :created, location: @lti_user }\n else\n format.html { render :new }\n format.json { render json: @lti_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @lab_name = LabName.new(params[:lab_name])\n\n respond_to do |format|\n if @lab_name.save\n format.html { redirect_to @lab_name, notice: 'Lab name was successfully created.' }\n format.json { render json: @lab_name, status: :created, location: @lab_name }\n else\n format.html { render action: \"new\" }\n format.json { render json: @lab_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_user_data(user_data)\n # Define a valid, empty payload and merge! with the user_data. Print it.\n payload =\n {\n 'OrgDefinedId' => '', # String\n 'FirstName' => 'TestUser', # String\n 'MiddleName' => 'Test', # String\n 'LastName' => 'Test', # String\n 'ExternalEmail' => nil, # String (nil or well-formed email addr)\n 'UserName' => 'test12345a', # String\n 'RoleId' => 110, # number\n 'IsActive' => false, # bool\n 'SendCreationEmail' => false, # bool\n }.merge!(user_data)\n # requires: UserData JSON block\n # Define a path referencing the course data using the course_id\n check_user_data_validity(payload)\n path = \"/d2l/api/lp/#{$lp_ver}/users/\"\n _post(path, payload)\n puts '[+] User creation completed successfully'.green\n # returns a UserData JSON block for the newly created user\nend",
"def index\n @remote_labs = current_user.remote_labs\n authorize RemoteLab\n end",
"def destroy\n @user_lab.destroy\n respond_to do |format|\n format.html { redirect_to user_labs_url, notice: 'User lab was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /user_labs/1 PATCH/PUT /user_labs/1.json | def update
respond_to do |format|
if @user_lab.update(user_lab_params)
format.html { redirect_to @user_lab, notice: 'User lab was successfully updated.' }
format.json { render :show, status: :ok, location: @user_lab }
else
format.html { render :edit }
format.json { render json: @user_lab.errors, status: :unprocessable_entity }
end
end
end | [
"def update\n @lab_user = LabUser.find(params[:id])\n\n respond_to do |format|\n if @lab_user.update_attributes(params[:lab_user])\n format.html { redirect_to @lab_user, notice: 'Lab user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lab_user_info.update(lab_user_info_params)\n format.html { redirect_to @lab_user_info, notice: 'Lab user info was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_user_info }\n else\n format.html { render :edit }\n format.json { render json: @lab_user_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(params[:lab])\n format.html { redirect_to @lab, notice: 'Lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lab.update(lab_params)\n format.html { redirect_to admin_lab_url(@lab), notice: 'Lab was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_lab_url(@lab)}\n else\n format.html { render :edit }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab = Lab.find(params[:id])\n\n respond_to do |format|\n if @lab.update_attributes(lab_params)\n format.html { redirect_to [:adm, @lab], notice: 'Lab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_initiative_user.update(api_v1_initiative_user_params)\n format.html { redirect_to @api_v1_initiative_user, notice: 'Initiative user was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative_user }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_initiative_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @operations_check = OperationsCheck.find(params[:operations_check_id])\n @lab_check = @operations_check.lab_checks.find(params[:id])\n \n respond_to do |format|\n if @lab_check.update_attributes(lab_check_params)\n format.html { redirect_to @lab_check, notice: 'Lab check was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_check.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_name = LabName.find(params[:id])\n\n respond_to do |format|\n if @lab_name.update_attributes(params[:lab_name])\n format.html { redirect_to @lab_name, notice: 'Lab name was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_name.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n @laboratory = Laboratory.find(params[:id])\n\n if @laboratory.update!(laboratory_params)\n render json: @laboratory\n else \n render json: @laboratory.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @api_v1_user.update(api_v1_user_params)\n render json: @api_v1_user\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end",
"def update\n @collab = Collab.find(params[:id])\n\n respond_to do |format|\n if @collab.update_attributes(params[:collab])\n format.html { redirect_to @collab, notice: 'Collab was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def update\n authorize @remote_lab\n respond_to do |format|\n if @remote_lab.update(remote_lab_params)\n format.html { redirect_to @remote_lab, notice: 'Remote lab was successfully updated.' }\n format.json { render :show, status: :ok, location: @remote_lab }\n else\n format.html { render :edit }\n format.json { render json: @remote_lab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend",
"def update\n @lab_test = LabTest.find(params[:id])\n\n respond_to do |format|\n if @lab_test.update_attributes(params[:lab_test])\n format.html { redirect_to client_lab_tests_path(@client), notice: t(:lab_test_saved) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_test.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @lti_user.update(lti_user_params)\n format.html { redirect_to @lti_user, notice: 'Lti user was successfully updated.' }\n format.json { render :show, status: :ok, location: @lti_user }\n else\n format.html { render :edit }\n format.json { render json: @lti_user.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\n respond_to do |format|\n if @collab.update(collab_params)\n format.html { redirect_to @collab, notice: 'Collab was successfully updated.' }\n format.json { render :show, status: :ok, location: @collab }\n else\n format.html { render :edit }\n format.json { render json: @collab.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @lab_method = LabMethod.find(params[:id])\n\n respond_to do |format|\n if @lab_method.update_attributes(params[:lab_method])\n format.html { redirect_to @lab_method, notice: 'Lab method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_method.errors, status: :unprocessable_entity }\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /user_labs/1 DELETE /user_labs/1.json | def destroy
@user_lab.destroy
respond_to do |format|
format.html { redirect_to user_labs_url, notice: 'User lab was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @lab_user = LabUser.find(params[:id])\n @lab_user.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_users_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab = Lab.find(params[:id])\n @lab.destroy\n\n respond_to do |format|\n format.html { redirect_to adm_labs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab.destroy\n respond_to do |format|\n format.html { redirect_to labs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab = lab.find(params[:id])\n @lab.destroy\n\n respond_to do |format|\n format.html { redirect_to labs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @api_v1_user.destroy\n\n head :no_content\n end",
"def destroy\n user_lab = current_user.user_labs.find_by(lab_id: params[:id])\n user_lab.destroy\n respond_to do |format|\n format.html { redirect_to labs_url, notice: 'unsubscribed.' }\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 @lab_user_info.destroy\n respond_to do |format|\n format.html { redirect_to lab_user_infos_url, notice: 'Lab user info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_user.destroy\n\n head :no_content\n end",
"def destroy\n @lab = Lab.find(params[:id])\n @lab.destroy\n\n respond_to do |format|\n format.html { redirect_to labs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n operations_check = OperationsCheck.find(params[:operations_check_id])\n @lab_check = LabCheck.find(params[:id])\n @lab_check.destroy\n\n respond_to do |format|\n format.html { redirect_to operations_check_path(operations_check.id, tab:\"labs\") }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blab = Blab.find(params[:id])\n @blab.destroy\n\n respond_to do |format|\n format.html { redirect_to blabs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n deletedName = @c14_lab.name\n @c14_lab.destroy\n respond_to do |format|\n format.html { redirect_to c14_labs_url, notice: \"#{deletedName} was deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @vet_lab = VetLab.find(params[:id])\n @vet_lab.destroy\n\n respond_to do |format|\n format.html { redirect_to vet_labs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @collab = Collab.find(params[:id])\n @collab.destroy\n\n respond_to do |format|\n format.html { redirect_to collabs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @slab = Slab.find(params[:id])\n @slab.destroy\n\n respond_to do |format|\n format.html { redirect_to slabs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @lab_test = LabTest.find(params[:id])\n @lab_test.destroy\n\n respond_to do |format|\n format.html { redirect_to client_lab_tests_path(@client), notice: t(:lab_test_deleted) }\n format.json { head :ok }\n end\n end",
"def destroy\n @lab_name = LabName.find(params[:id])\n @lab_name.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_names_url }\n format.json { head :no_content }\n end\n end",
"def delete(user)\n Rails.logger.debug \"Call to election.delete\"\n reqUrl = \"/api/election/#{self.id}\" #Set the request url\n rest_response = MwHttpRequest.http_delete_request(reqUrl,user['email'],user['password']) #Make the DELETE request to the server with the required parameters\n Rails.logger.debug \"Response from server: #{rest_response.code} #{rest_response.message}: #{rest_response.body}\"\n if rest_response.code == \"200\" #Validate if the response from the server is 200, which means OK\n return true, rest_response #Return success\n else\n return false, \"#{rest_response.code} #{rest_response.message}\" #Return error\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /admin/festivals POST /admin/festivals.json | def create
@admin_festival = Festival.new(admin_festival_params)
respond_to do |format|
if @admin_festival.save
format.html { redirect_to admin_festival_path(@admin_festival), notice: 'Festival was successfully created.' }
else
format.html { render :new }
end
end
end | [
"def create\n \n @festival = Festival.new(params[:festival])\n\n respond_to do |format|\n if @festival.save\n format.html { redirect_to '/admin', notice: 'Festival was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n \n end",
"def create\n @fest = Fest.new(fest_params)\n\n respond_to do |format|\n if @fest.save\n format.html { redirect_to @fest, notice: 'Fest was successfully created.' }\n format.json { render :show, status: :created, location: @fest }\n else\n format.html { render :new }\n format.json { render json: @fest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @festa = Festa.new(festa_params)\n\n respond_to do |format|\n if @festa.save\n format.html { redirect_to @festa, notice: 'Festa was successfully created.' }\n format.json { render :show, status: :created, location: @festa }\n else\n format.html { render :new }\n format.json { render json: @festa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @festival = Festival.create(festival_params)\n if @festival.valid?\n redirect_to @festival\n else\n flash[:errors] = @festival.errors.full_messages\n redirect_to new_festival_path\n end\n\n\n\n # respond_to do |format|\n # if @festival.save\n # format.html { redirect_to @festival, notice: 'Festival was successfully created.' }\n # format.json { render :show, status: :created, location: @festival }\n # else\n # format.html { render :new }\n # format.json { render json: @festival.errors, status: :unprocessable_entity }\n # end\n # end\n end",
"def create\n @falta = Falta.new(falta_params)\n\n respond_to do |format|\n if @falta.save\n format.html { redirect_to @falta, notice: \"Falta was successfully created.\" }\n format.json { render :show, status: :created, location: @falta }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @festival = Festival.new(params[:festival])\n @saved = @festival.save\n \n respond_to do |format|\n if @saved\n flash[:notice] = 'Festival was successfully created.'\n format.html { redirect_to(edit_festival_url(@festival)) }\n format.xml { render :xml => @festival, :status => :created, :location => @festival }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @festival.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n authorize! :index, @user, :message => 'Not authorized.'\n @feast = Feast.new(params[:feast])\n\n respond_to do |format|\n if @feast.save\n format.html { redirect_to @feast, notice: 'Feast was successfully created.' }\n format.json { render json: @feast, status: :created, location: @feast }\n else\n format.html { render action: \"new\" }\n format.json { render json: @feast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @festivals = Festival.all\n end",
"def create\n @ragefest = Ragefest.new(params[:ragefest])\n\n respond_to do |format|\n if @ragefest.save\n format.html { redirect_to @ragefest, notice: 'Ragefest was successfully created.' }\n format.json { render json: @ragefest, status: :created, location: @ragefest }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ragefest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @artsfest_detail = ArtsfestDetail.new(artsfest_detail_params)\n\n respond_to do |format|\n if @artsfest_detail.save\n format.html { redirect_to @artsfest_detail, notice: 'Artsfest detail was successfully created.' }\n format.json { render :show, status: :created, location: @artsfest_detail }\n else\n format.html { render :new }\n format.json { render json: @artsfest_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @funeral = Funeral.new(funeral_params)\n\n respond_to do |format|\n if @funeral.save\n format.html { redirect_to @funeral, notice: 'Funeral was successfully created.' }\n format.json { render :show, status: :created, location: @funeral }\n else\n format.html { render :new }\n format.json { render json: @funeral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @famous_testimony = FamousTestimony.new(famous_testimony_params)\n\n if @famous_testimony.save\n render :show, status: :created, location: @famous_testimony\n else\n render json: @famous_testimony.errors, status: :unprocessable_entity\n end\n end",
"def create\n @funeral = Funeral.new(params[:funeral])\n\n respond_to do |format|\n if @funeral.save\n format.html { redirect_to @funeral, notice: 'Funeral was successfully created.' }\n format.json { render json: @funeral, status: :created, location: @funeral }\n else\n format.html { render action: \"new\" }\n format.json { render json: @funeral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @falta = Falta.new(params[:falta])\n\n respond_to do |format|\n if @falta.save\n flash[:notice] = 'Falta was successfully created.'\n format.html { redirect_to(@falta) }\n format.xml { render :xml => @falta, :status => :created, :location => @falta }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @falta.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @fortune = Fortune.new(params[:fortune])\n @fortune.save\n respond_with(@fortune)\n end",
"def create\n @fes = Fes.new(fes_params)\n\n respond_to do |format|\n if @fes.save\n format.html { redirect_to @fes, notice: 'Fes was successfully created.' }\n format.json { render :show, status: :created, location: @fes }\n else\n format.html { render :new }\n format.json { render json: @fes.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fortune = Fortune.new(params[:fortune])\n flash[:notice] = 'Fortune was successfully created.' if @fortune.save\n respond_with(@fortune)\n end",
"def create\n @fadmin = Fadmin.new(fadmin_params)\n\n respond_to do |format|\n if @fadmin.save\n format.html { redirect_to @fadmin, notice: 'Fadmin was successfully created.' }\n format.json { render action: 'show', status: :created, location: @fadmin }\n else\n format.html { render action: 'new' }\n format.json { render json: @fadmin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fiestum = Fiestum.new(fiestum_params)\n\n respond_to do |format|\n if @fiestum.save\n format.html { redirect_to @fiestum, notice: 'Fiestum was successfully created.' }\n format.json { render :show, status: :created, location: @fiestum }\n else\n format.html { render :new }\n format.json { render json: @fiestum.errors, status: :unprocessable_entity }\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /admin/festivals/1 PATCH/PUT /admin/festivals/1.json | def update
respond_to do |format|
if @admin_festival.update(admin_festival_params)
format.html { redirect_to admin_festival_path(@admin_festival), notice: 'Festival was successfully updated.' }
else
format.html { render :edit }
end
end
end | [
"def update\n respond_to do |format|\n if @fadmin.update(fadmin_params)\n format.html { redirect_to @fadmin, notice: 'Fadmin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fadmin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n authorize! :index, @user, :message => 'Not authorized.'\n @feast = Feast.find(params[:id])\n\n respond_to do |format|\n if @feast.update_attributes(params[:feast])\n format.html { redirect_to @feast, notice: 'Feast was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feast.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @festa.update(festa_params)\n format.html { redirect_to @festa, notice: 'Festa was successfully updated.' }\n format.json { render :show, status: :ok, location: @festa }\n else\n format.html { render :edit }\n format.json { render json: @festa.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @festival = Festival.find(params[:id])\n\n respond_to do |format|\n if @festival.update_attributes(params[:festival])\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fest.update(fest_params)\n format.html { redirect_to @fest, notice: 'Fest was successfully updated.' }\n format.json { render :show, status: :ok, location: @fest }\n else\n format.html { render :edit }\n format.json { render json: @fest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @farmako.update(farmako_params)\n format.html { redirect_to @farmako, notice: 'Farmako was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @farmako.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @falta.update(falta_params)\n format.html { redirect_to @falta, notice: \"Falta was successfully updated.\" }\n format.json { render :show, status: :ok, location: @falta }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @falta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @festival.update(festival_params)\n format.html { redirect_to @festival, notice: 'Festival was successfully updated.' }\n format.json { render :show, status: :ok, location: @festival }\n else\n format.html { render :edit }\n format.json { render json: @festival.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n return unless force_group(\"root\")\n @fachschaft = Fachschaft.find(params[:id])\n\n respond_to do |format|\n if @fachschaft.update_attributes(params[:fachschaft])\n format.html { redirect_to @fachschaft, notice: 'Fachschaft was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fachschaft.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fife.update(fife_params)\n format.html { redirect_to @fife, notice: 'Five was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fife.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @faction = Faction.find(params[:id])\n\n respond_to do |format|\n if @faction.update_attributes(params[:faction])\n format.html { redirect_to admin_factions_url, notice: 'Faction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @faction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fun_fact = FunFact.find(params[:id])\n\n respond_to do |format|\n if @fun_fact.update_attributes(params[:fun_fact])\n format.html { redirect_to @fun_fact, notice: 'Fun fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fun_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @appraisal_fee.update(appraisal_fee_params)\n format.html { redirect_to appraisal_fees_path, notice: 'Appraisal fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @appraisal_fee.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\n respond_to do |format|\n if @funeral.update_attributes(params[:funeral])\n format.html { redirect_to @funeral, notice: 'Funeral was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @funeral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @fat.update(fat_params)\n format.html { redirect_to @fat, notice: 'Fat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @fat.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @funeral = Funeral.find(params[:id])\n\n respond_to do |format|\n if @funeral.update_attributes(params[:funeral])\n format.html { redirect_to @funeral, notice: 'Funeral was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @funeral.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_update(factType,factType_params, FactType)\n end",
"def update\n @flesh = Flesh.find(params[:id])\n\n respond_to do |format|\n if @flesh.update_attributes(params[:flesh])\n format.html { redirect_to @flesh, notice: 'Flesh was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @flesh.errors, status: :unprocessable_entity }\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /admin/festivals/1 DELETE /admin/festivals/1.json | def destroy
@admin_festival.destroy
respond_to do |format|
format.html { redirect_to admin_festivals_url, notice: 'Festival was successfully destroyed.' }
end
end | [
"def destroy\n @festival = Festival.find(params[:id])\n @festival.destroy\n\n respond_to do |format|\n format.html { redirect_to festivals_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fest.destroy\n respond_to do |format|\n format.html { redirect_to fests_url, notice: 'Fest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @festa.destroy\n respond_to do |format|\n format.html { redirect_to festa_url, notice: 'Festa was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @ragefest = Ragefest.find(params[:id])\n @ragefest.destroy\n\n respond_to do |format|\n format.html { redirect_to ragefests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @festival.destroy\n respond_to do |format|\n format.html { redirect_to festivals_url, notice: 'Festival was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fadmin.destroy\n respond_to do |format|\n format.html { redirect_to fadmins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @festival = Festival.find_by_slug!(params[:id])\n @festival.destroy\n\n respond_to do |format|\n format.html { redirect_to(festivals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n authorize! :index, @user, :message => 'Not authorized.'\n @feast = Feast.find(params[:id])\n @feast.destroy\n\n respond_to do |format|\n format.html { redirect_to feasts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n request = RestClient.delete File.join(API_SERVER,\"rest-api/departments\",params['id'])\n redirect_to :action => :index\t\n end",
"def destroy\n @fifteen.destroy\n respond_to do |format|\n format.html { redirect_to fifteens_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farmako.destroy\n respond_to do |format|\n format.html { redirect_to farmakos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_foundation.destroy\n respond_to do |format|\n format.html { redirect_to admin_foundations_url, notice: 'Foundation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destroy\n @fa = FacultyAdmin.find(params[:id])\n @fa.destroy\n\n respond_to do |format|\n format.html { redirect_to FacultyAdmins_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fabrica.destroy\n respond_to do |format|\n format.html { redirect_to fabricas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fife.destroy\n respond_to do |format|\n format.html { redirect_to fives_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @avaliacao_festum.destroy\n respond_to do |format|\n format.html { redirect_to avaliacao_festa_url, notice: 'Avaliacao festum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @farmacium.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end",
"def destroy\n @fat.destroy\n respond_to do |format|\n format.html { redirect_to fats_url }\n format.json { head :no_content }\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the full file name including the path | def file_name
File.join(path, name)
end | [
"def file_name_from_path(path)\n path.split(\"/\")[-1]\n end",
"def get_filename (file)\n\t\tif file.is_a? File\n\t\t\tfile = file.path\n\t\tend\n\t\treturn file\n\tend",
"def file_name\n @file_name ||= File.basename tree\n end",
"def original_filename\n if md = /^(?:.*[:\\\\\\/])?(.*)/m.match(full_original_filename)\n md.captures.first\n else\n File.basename full_original_filename\n end\n end",
"def relative_file_name\n @file.sub(%r{\\A#{@base_dir}/}, \"\")\n end",
"def original_filename\n if md = /^(?:.*[:\\\\\\/])?(.*)/m.match(full_original_filename)\n md.captures.first\n else\n File.basename full_original_filename\n end\n end",
"def filename\n return @filename if @filename\n name.downcase.gsub(/\\W/, '_').squeeze('_')\n end",
"def file_name\n return @file_name\n end",
"def filename\n File.basename(self.source, File.extname(self.source))\n end",
"def main_name(path)\n File.basename(path).sub(/\\.[^\\.]+$/,'')\n end",
"def file_name_with_path\n root_path.dup + file_name\n end",
"def get_raw_filename (file)\n\t\n\t\t# convert to string\n\t\tfile = get_filename(file)\n\t\t# remove extension\n\t\tfile.sub(get_ext(file), \"\")\n\t\t\n\tend",
"def fullname\n path.split('.')[0..-2].join('.').gsub(/^#{@site.page_file_dir}\\//, '')\n end",
"def name\n File.basename(@directory.gsub('\\\\', '/'))\n end",
"def basename\n File.basename(filename)\n end",
"def base\n File.basename @filename, extension_with_delimiter\n end",
"def basename\n File.basename(source_path, File.extname(source_path))\n end",
"def original_filename\n return @original_filename if @original_filename\n if @file && @file.respond_to?(:original_filename)\n @file.original_filename\n elsif !path.blank?\n File.basename(path)\n else\n \"\"\n end\n end",
"def file_name\n if source\n source.is_a?(File) ? File.basename(source.path) : File.basename(source)\n else\n object.original_name.nil? ? \"original_file\" : object.original_name\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts all rows of the CSV file belonging to the ContentFile instance into the table of the DwCA represented by the instance's parent Entity instance Will raise an error for _extension_ instances if the _core_ instance is not loaded | def load
return if is_loaded
load_error = 'core needs to be loaded before extension files'
raise load_error unless entity.is_core || entity.core.loaded?
CSV.foreach(file_name) { |row| insert_row(row) }
self.is_loaded = true
save
is_loaded
end | [
"def import_csv\n return if attachment_changes['import_data'].nil?\n\n all_entries = array_of_records\n Entry.insert_all all_entries\n end",
"def write_data\n table = STI[self.class.name]\n table.delete_all\n\n lines = CsvStorage.find_by!(csv_file_type: self.class.name).data_store.lines\n lines.shift(self.class::SKIP_LINES_BEFORE_HEADER)\n\n headers = get_headers(clean_line(lines.shift))\n lines.shift(self.class::SKIP_LINES_AFTER_HEADER)\n\n row = nil\n line = nil\n row_number = 1 + self.class::SKIP_LINES_BEFORE_HEADER +\n self.class::SKIP_LINES_AFTER_HEADER\n\n begin\n ActiveRecord::Base.transaction do\n lines.each do |l|\n row_number += 1\n\n line = clean_line(l) || \"\"\n row = get_row(line, headers)\n\n # Allow a block, if given to determine if row is created\n unless row.values.join.blank?\n table.create!(row) if !block_given? || yield(row)\n end\n end\n end\n rescue StandardError => e\n msg = \"row #{row_number}: #{e.message} '#{line.inspect}' \"\n raise StandardError.new(msg)\n end\n end",
"def import_file(row, obj_identifier, new_obj_id)\n if @insert_file.nil?\n stmt = \"insert into generic_files(file_format, uri, size, identifier, \" +\n \"intellectual_object_id, permissions, state, created_at, updated_at) \" +\n \"values (?,?,?,?,?,?,?,?,?)\"\n @insert_file = @dest_db.prepare(stmt)\n end\n @insert_file.execute(row['file_format'],\n row['uri'],\n row['size'],\n row['identifier'],\n new_obj_id,\n nil,\n row['state'],\n row['created_at'],\n row['updated_at'])\n return last_insert_id\n end",
"def import_file\n @table_class = InverseCsvImporter.new(self.csv.path, self.user.login).table_class\n end",
"def insert_into_core(row)\n return unless entity.is_core\n entity.model_get.create(row_to_hash(row))\n end",
"def import\n @imports.each do |item|\n source = @sources[item['source']] || {}\n source_dir = source['path']\n source_files = item['files'] || []\n target = @targets[item['target']] || {}\n table_name = target['table']\n \n file_list = build_file_list(source_dir, source_files)\n transform = @transforms[item['transform']] || {}\n \n file_list.each do |file_name|\n columns = parse_file(file_name, source_dir, transform)\n \n create_table(target, columns)\n \n data_file_name = File.basename(file_name, '.*') + '.dat'\n data_file_path = File.full_path(@working_dir, data_file_name)\n error_file_name = File.basename(file_name, '.*') + '.err'\n error_file_path = File.full_path(@error_dir, error_file_name)\n \n bcp_file(table_name, data_file_path, error_file_path, target)\n end\n end\n end",
"def import\n CSV.foreach(@file.path, :converters => :all, :return_headers => false, :headers => :first_row) do |row|\n campaign_id, source, tag, created_at, first_name, last_name,\n email, phone, company, title, status, background_info, comments,\n street1, street2, city, state, zip, country = *row.to_hash.values\n\n #TODO: implement smarter_csv and/or resque\n # https://github.com/tilo/smarter_csv\n # https://github.com/resque/resque\n\n # Rails.logger.info \"XXXXXXXX created_at#{created_at}\"\n\n if @make_contact\n # Don't Allow Duplicates\n contact = Contact.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |contact|\n contact.user_id = @assigned.id,\n contact.source = source,\n contact.first_name = first_name,\n contact.last_name = last_name,\n contact.email = email,\n contact.phone = phone,\n # contact.company = company,\n contact.title = title,\n # contact.status = status,\n contact.background_info = process_bg_info(contact.background_info, background_info),\n contact.created_at = created_at.to_time rescue Time.current\n end\n contact.save!\n\n contact.first_name = \"INCOMPLETE\" if contact.first_name.blank?\n contact.last_name = \"INCOMPLETE\" if contact.last_name.blank?\n # contact.access? = \"Private | Public\"\n contact.access = Setting.default_access\n contact.assignee = @assigned if @assigned.present?\n contact.tag_list.add(tag)\n contact.add_comment_by_user(comments, @assigned)\n\n contact.save!\n\n #TODO: Better validation on address fields.\n if zip\n contact.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n contact.save!\n\n #\n if contact.account_contact.nil?\n\n if company\n account_name = company\n else\n account_name = contact.first_name + ' ' + contact.last_name + ' (Individual)'\n end\n\n #TODO: rails 4 Account.find_or_initialize_by(name: account_name)\n account = Account.find_or_initialize_by_name(account_name).tap do |account|\n account.user_id = @assigned.id\n account.assignee = @assigned if @assigned.present?\n account.access = contact.access\n account.category = 'customer'\n end\n account.save!\n\n contact.account_contact = AccountContact.new(:account => account, :contact => contact)\n\n # Rails.logger.info \"XXXXXXXX ACCOUNT CONTACT CREATED! #{contact.account_contact.inspect}\"\n\n # contact_account = { account: { id: account.id }, access: contact.access }\n # @account, @opportunity, @contact = contact.promote(contact_account)\n # contact = Contact.find(@contact)\n end\n\n # Rails.logger.info \"XXXXXXXX CONTACT CREATED! #{contact.inspect}\"\n\n else\n\n # Allow Duplicates\n # lead = Lead.new(\n # :user_id => @assigned.id,\n # :campaign_id => campaign_id.to_i,\n # :source => source,\n # :first_name => first_name,\n # :last_name => last_name,\n # :email => email,\n # :phone => phone,\n # :company => company,\n # :title => title, :status => status,\n # :background_info => background_info,\n # :created_at => created_at.to_time\n # )\n\n\n #TODO: rails 4 Lead.find_or_initialize_by(email: email) without tap\n # Don't Allow Duplicates\n lead = Lead.find_or_initialize_by_first_name_and_last_name_and_email(\n first_name,\n last_name,\n email\n ).tap do |lead|\n lead.user_id = @assigned.id,\n lead.campaign_id = campaign_id.to_i,\n lead.source = source,\n lead.first_name = first_name,\n lead.last_name = last_name,\n lead.email = email,\n lead.phone = phone,\n lead.company = company,\n lead.title = title,\n lead.status = status,\n lead.background_info = process_bg_info(lead.background_info, background_info),\n lead.created_at = created_at.to_time rescue Time.current\n end\n lead.save!\n\n lead.first_name = \"INCOMPLETE\" if lead.first_name.blank?\n lead.last_name = \"INCOMPLETE\" if lead.last_name.blank?\n\n # lead.access? = \"Private | Public\"\n lead.access = Setting.default_access\n lead.assignee = @assigned if @assigned.present?\n lead.tag_list.add(tag)\n lead.add_comment_by_user(comments, @assigned)\n lead.save!\n\n #TODO: Better validation on address fields.\n if zip\n lead.business_address = Address.new(:street1 => street1, :street2 => street2, :city => city, :state => state, :zipcode => zip, :country => country, :address_type => \"Business\")\n else\n puts \"INCOMPLETE ADDRESS\"\n end\n lead.save!\n\n end\n end\n\n\n end",
"def bulk_insert(model, rows, batch_size: 100)\n rows.each_slice(batch_size) do |slice|\n Gitlab::Database.bulk_insert(model.table_name, slice)\n end\n end",
"def insertAllFiles\n \t@files.each do |file|\n \t\tinsertFile file\n \tend\n end",
"def upload_csv_picto\n \n #process_csv_picto\n readCsv = CSV.parse open( params[:edition][:description].path ).read, :headers=>true, :converters=>:numeric\n #session[:firstRowCsv] = readCsv.first\n pathCsv = params[:edition][:description].path\n\n \n counter = 0\n CSV.foreach(pathCsv, headers: true) do |row|\n #binding.pry\n contact = Contact.where( email: row[\"Email\"], edition_id: params[:id] ).first_or_initialize\n contact.assign_attributes(\n telephone: row[\"Telephone\"],\n email: row[\"Email\"],\n dossard: row[\"Doss\"],\n nom: row[\"Nom\"],\n prenom: row[\"Prenom\"],\n edition_id: params[:id]\n )\n if contact.save\n counter += 1\n else\n #show eny error msg\n puts \"#{email} - #{user.errors.full_messages.join(\",\")}\" if user.errors.any?\n end\n\n end\n #after import redirect to Contact page throu .js.erb page\n end",
"def import_csv_full\n \n end",
"def import_submissions\n Submission.transaction do\n umin_rows_each do |ur|\n # No depending object\n # Create new objects\n s = Submission.find_or_create_by_submission_number_and_conference_tag(\n ur.submission_number, \n @conference.database_tag,\n :disclose_at => ur.disclose_at,\n :submission_number => ur.submission_number,\n :en_title => ur.title_en,\n :jp_title => ur.title_jp,\n :jp_abstract => ur.jp_abstract,\n :en_abstract => ur.en_abstract,\n :institutions => ur.institutions.map{|i| Institution.new(:en_name => i[:en_name],\n :jp_name => i[:jp_name])},\n :keywords => ur.keywords\n ) {|submission|\n submission.conference_tag = @conference.database_tag\n submission.batch_import = true\n }\n # Reloading because sometimes we update our parser and we want to update Submission objects.\n s.update_attributes :disclose_at => ur.disclose_at,\n :submission_number => ur.submission_number,\n :en_title => ur.title_en,\n :jp_title => ur.title_jp,\n :jp_abstract => ur.jp_abstract,\n :en_abstract => ur.en_abstract,\n :institutions => ur.institutions.map{|i| Institution.new(:en_name => i[:en_name],\n :jp_name => i[:jp_name])},\n :keywords => ur.keywords \n output_error_unless_persisted(s)\n end\n end\n end",
"def insert_row(row)\n rec = insert_into_core(row) || insert_into_extension(row)\n entity.send(add_related, rec)\n end",
"def import_file\n row_count = 1\n observations = []\n ActiveRecord::Base.transaction do\n CSV.foreach( @observation_file, encoding: \"iso-8859-1:utf-8\", headers: true ) do | row |\n next if skip_row?( row )\n\n # Add the observation file name as a tag for identification purposes.\n tags = row[6].blank? ? [] : row[6].split( \",\" )\n tags << File.basename( @observation_file )\n row[6] = tags.join( \",\" )\n\n obs = new_observation( row )\n # Not sure why but without this the OFVs won't save as of Rails 6 ~~~kueda 20211028\n obs.observation_field_values.to_a\n begin\n # Try to save the observation\n obs.save!\n\n # Add this observation to a list for later importing to the project.\n observations << obs\n\n # Increment the row count so we can tell them where any errors are.\n row_count += 1\n rescue ActiveRecord::RecordInvalid\n raise BulkObservationException.new( \"Invalid record encountered\", row_count )\n end\n end\n\n # Add all of the observations to the project if a project was specified\n if project\n observations.each do | obs |\n project.project_observations.create( observation: obs )\n end\n\n # Manually update counter caches.\n ProjectUser.update_observations_counter_cache_from_project_and_user( project.id, user.id )\n ProjectUser.update_taxa_counter_cache_from_project_and_user( project.id, user.id )\n Project.update_observed_taxa_count( project.id )\n end\n end\n Observation.elastic_index!( ids: observations.map( &:id ), wait_for_index_refresh: true )\n end",
"def insert_into_extension(row)\n row_vals = row_to_hash row\n core_row(row_vals.delete(entity.key)).send(add_related, row_vals)\n end",
"def handle_row_import(_ending_row_context); end",
"def import_from_temp_table\n file = File.join(@data_folder, \"R01_ORGANIZATION_TEMP.csv\")\n CSV.foreach(file, :headers => :first_row) do |row|\n # get organization by name\n if o = Organization.find_by_old_id(row[\"R01_ORG_ID\"].to_i)\n # import pledge\n pledge = row[\"PLEDGE_AMOUNT\"]\n o.pledge_amount = pledge.to_i if pledge.to_i > 0\n # import id in TMP table\n old_tmp_id = row[\"ID\"].to_i\n o.old_tmp_id = old_tmp_id if old_tmp_id.to_i > 0\n\n # save the record\n o.save\n end\n end\n end",
"def process_and_upload_csv\n\n @has_data = get_data_from_db do |data|\n formatted_data = format_data(data)\n c_add formatted_data\n end\n\n if @has_data\n zip_folder\n upload_to_s3\n delete_local_files\n end\n\n end",
"def batch_import\n batch_result = nil\n run_callback(:before_batch_import)\n batch_added = to_be_added\n batch_headers = prepare_headers\n ActiveRecord::Base.connection.reconnect!\n batch_result = @resource.import(batch_headers, batch_added, import_options)\n raise ActiveRecord::Rollback if import_options[:batch_transaction] && batch_result.failed_instances.any?\n batch_result\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a CSV row into the DwCA schema's _core_ table | def insert_into_core(row)
return unless entity.is_core
entity.model_get.create(row_to_hash(row))
end | [
"def import_csv\n return if attachment_changes['import_data'].nil?\n\n all_entries = array_of_records\n Entry.insert_all all_entries\n end",
"def insert_row(row)\n rec = insert_into_core(row) || insert_into_extension(row)\n entity.send(add_related, rec)\n end",
"def load\n return if is_loaded\n load_error = 'core needs to be loaded before extension files'\n raise load_error unless entity.is_core || entity.core.loaded?\n CSV.foreach(file_name) { |row| insert_row(row) }\n self.is_loaded = true\n save\n is_loaded\n end",
"def insert_customer_data\n infile, result, *others = params\n\n outfile = \"#{File.basename(infile, '.*')}-with-customers.csv\"\n source = others[0]\n\n puts; print \"Inserting customers from #{source} into #{infile}\"\n\n Sycsvpro::Join.new(infile: infile,\n outfile: outfile,\n source: source,\n cols: \"0,3;0,3\",\n joins: \"4=19;4=20\",\n cols: \"1,2;1,2\",\n joins: \"0=19;0=20\",\n pos: \"20,21;23;24\",\n insert_header: \"OI_EK_NAME,OI_EK_LAND;OI_AG_NAME,OI_AG_LAND\").execute\n\n puts; puts \"You can find the result in #{outfile}\"\nend",
"def import_csv_full\n \n end",
"def write_data\n table = STI[self.class.name]\n table.delete_all\n\n lines = CsvStorage.find_by!(csv_file_type: self.class.name).data_store.lines\n lines.shift(self.class::SKIP_LINES_BEFORE_HEADER)\n\n headers = get_headers(clean_line(lines.shift))\n lines.shift(self.class::SKIP_LINES_AFTER_HEADER)\n\n row = nil\n line = nil\n row_number = 1 + self.class::SKIP_LINES_BEFORE_HEADER +\n self.class::SKIP_LINES_AFTER_HEADER\n\n begin\n ActiveRecord::Base.transaction do\n lines.each do |l|\n row_number += 1\n\n line = clean_line(l) || \"\"\n row = get_row(line, headers)\n\n # Allow a block, if given to determine if row is created\n unless row.values.join.blank?\n table.create!(row) if !block_given? || yield(row)\n end\n end\n end\n rescue StandardError => e\n msg = \"row #{row_number}: #{e.message} '#{line.inspect}' \"\n raise StandardError.new(msg)\n end\n end",
"def import_from_csv(file)\n entries = Keybox::Convert::CSV.from_file(file)\n entries.each do |entry|\n @db << entry\n end\n hsay \"Imported #{entries.size} records from #{file}.\", :information\n end",
"def store_bluetooth_records device_id, csv\n sql = 'INSERT INTO bluetooth_records (device_id,\n device_bluetooth_record_id, utc_time, bdaddr, rssi)\n VALUES ($1, $2, $3, $4, $5)'\n CSV.parse(csv, headers: false).each do |row|\n $cn.exec(sql, [device_id] + row)\n end\nend",
"def bulk_insert_str\n fields = sql_row_type.field_names\n \"INSERT INTO #{sql_row_type.table_name} (#{fields.map {|f| f.to_s }.join(', ')}) VALUES\\n\"\n end",
"def import_csv(csv)\n csv_rows = CSV.parse(csv, headers: true, header_converters: :symbol)\n # The user attribute is allowed to be set on Import\n # This has the required side-effect that the models being created form the CSV data\n # will get their user at creation time based on this\n self.item_count = csv_rows.length\n self.csv_rows = csv_rows\n return self unless check_csv_columns\n\n build_objects_from_data\n # force retaining of errors, since save will clear them\n duperrors = errors.dup\n save\n unless duperrors.empty?\n duperrors.to_h.each do |k, e|\n errors.add k, e\n end\n end\n self\n end",
"def import_from_csv(file_name)\n csv_text = File.read(file_name)\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\n# #8 Iterate over the CSV::Table object's rows. Create a hash for each row, and convert each row_hash to an Entry by using add_entry method\n csv.each do |row|\n row_hash = row.to_hash\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\n end\n end",
"def convert_csv(path, table_name)\n \n # csv file has a header row\n header_row = true\n\n # delimiter for csv file\n delimiter = ','\n\n # variable used to skip header row\n skip_row = true\n\n\n CSV.open(path, 'r', delimiter ) do |row|\n\n row.each_with_index do |col,index|\n if col==nil then \n row[index]='NULL'\n else\n \n col.gsub!(\"'\",\"`\")\n row[index] = \"'#{ col }'\"\n end\n end\n\n # Are we reading the header row of the csv file?\n if header_row\n row.each_with_index do |col,index|\n row[index] = \"\\\"#{ col.gsub(\"'\",'').gsub(/\\s+/,'') }\\\"\"\n end\n header_row = false\n print \"INSERT INTO #{table_name} (#{row.join delimiter }) VALUES\"\n next\n end\n\n # Only skip the first (header) row\n if skip_row == true\n # dont skip further rows\n skip_row = false\n else\n # Print end of line insert delimeter\n puts delimiter\n end\n \n # Print to stdout\n print \"(#{row.join delimiter})\"\n \n end\nend",
"def load_from_csv(dependencies={})\n\n parser = new_csv_parser(true)\n @csv_id_to_db_id_map = {}\n substitute_values = substitute_field_values\n\n parser.each do |row|\n if row and row.length > 0 and row.include?(:id)\n csv_id = row.field(:id)\n instance = create_new_instance_from_row(dependencies, substitute_values, row)\n save_if_valid(instance, csv_id)\n end\n end\n puts @csv_id_to_db_id_map.length.to_s + \" new entries stored in table: \" + self.table_name\n dependencies[self.table_name.to_sym] = @csv_id_to_db_id_map\n end",
"def store_network_records device_id, csv\n sql = 'INSERT INTO network_records (device_id,\n device_network_record_id, utc_time,\n event_time, latitude, longitude, accuracy)\n VALUES ($1, $2, $3, $4, $5, $6, $7)'\n CSV.parse(csv, headers: false).each do |row|\n $cn.exec(sql, [device_id] + row)\n end\nend",
"def insert_into(colleciton_name, row)\n db[colleciton_name].insert(row)\n end",
"def insert_record(csv, link_name, link_path, protocol, host_url)\n url = URI.parse(\"#{protocol}://#{host_url}#{link_path}\")\n response = open(url.to_s)\n result = [] << fetch_link_name(link_name) <<\n \"#{protocol}://#{host_url}#{link_path}\" <<\n check_status(response.status.first) << response.status.first\n csv << result\n end",
"def import\n @share_data = CSV.open(\"#{Rails.public_path.to_s}/ticker_data/#{@object_key}\", col_sep: \"\\t\", headers: :first_row).map do |row|\n row = row.to_h\n {\n price: row[\"price\"].to_f,\n value_at: Time.at(row[\"value_at\"].to_i),\n company_id: @company_id,\n created_at: DateTime.now,\n updated_at: DateTime.now\n }\n end\n @share_data.sort_by! {|share_data| share_data[:value_at]}\n TimeSeries.insert_all!(@share_data)\n rescue => e\n @errors.push(e.message)\n end",
"def seed_from_csv(migration_class, csv_file)\n migration_class.transaction do\n csv_file.each do |line_values|\n record = migration_class.new\n line_values.to_hash.keys.map do |attribute|\n record.send(\"#{attribute.strip}=\",line_values[attribute].strip) rescue nil\n end\n record.save(:validate => false)\n end\n end\n end",
"def import_csv(csv_filename)\r\n records_inserted = 0\r\n tbl_rec = @table_class.new(self)\r\n\r\n # read with FasterCSV if loaded, or the standard CSV otherwise\r\n (defined?(FasterCSV) ? FasterCSV : CSV).foreach(csv_filename\r\n ) do |row|\r\n tbl_rec.populate([nil] + row)\r\n insert(tbl_rec)\r\n records_inserted += 1\r\n end\r\n return records_inserted\r\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a CSV row into an _extension_ table of the DwCA schema | def insert_into_extension(row)
row_vals = row_to_hash row
core_row(row_vals.delete(entity.key)).send(add_related, row_vals)
end | [
"def import_csv\n return if attachment_changes['import_data'].nil?\n\n all_entries = array_of_records\n Entry.insert_all all_entries\n end",
"def insert_record(csv, link_name, link_path, protocol, host_url)\n url = URI.parse(\"#{protocol}://#{host_url}#{link_path}\")\n response = open(url.to_s)\n result = [] << fetch_link_name(link_name) <<\n \"#{protocol}://#{host_url}#{link_path}\" <<\n check_status(response.status.first) << response.status.first\n csv << result\n end",
"def insert_customer_data\n infile, result, *others = params\n\n outfile = \"#{File.basename(infile, '.*')}-with-customers.csv\"\n source = others[0]\n\n puts; print \"Inserting customers from #{source} into #{infile}\"\n\n Sycsvpro::Join.new(infile: infile,\n outfile: outfile,\n source: source,\n cols: \"0,3;0,3\",\n joins: \"4=19;4=20\",\n cols: \"1,2;1,2\",\n joins: \"0=19;0=20\",\n pos: \"20,21;23;24\",\n insert_header: \"OI_EK_NAME,OI_EK_LAND;OI_AG_NAME,OI_AG_LAND\").execute\n\n puts; puts \"You can find the result in #{outfile}\"\nend",
"def insert_row(row)\n rec = insert_into_core(row) || insert_into_extension(row)\n entity.send(add_related, rec)\n end",
"def write_data\n table = STI[self.class.name]\n table.delete_all\n\n lines = CsvStorage.find_by!(csv_file_type: self.class.name).data_store.lines\n lines.shift(self.class::SKIP_LINES_BEFORE_HEADER)\n\n headers = get_headers(clean_line(lines.shift))\n lines.shift(self.class::SKIP_LINES_AFTER_HEADER)\n\n row = nil\n line = nil\n row_number = 1 + self.class::SKIP_LINES_BEFORE_HEADER +\n self.class::SKIP_LINES_AFTER_HEADER\n\n begin\n ActiveRecord::Base.transaction do\n lines.each do |l|\n row_number += 1\n\n line = clean_line(l) || \"\"\n row = get_row(line, headers)\n\n # Allow a block, if given to determine if row is created\n unless row.values.join.blank?\n table.create!(row) if !block_given? || yield(row)\n end\n end\n end\n rescue StandardError => e\n msg = \"row #{row_number}: #{e.message} '#{line.inspect}' \"\n raise StandardError.new(msg)\n end\n end",
"def store_bluetooth_records device_id, csv\n sql = 'INSERT INTO bluetooth_records (device_id,\n device_bluetooth_record_id, utc_time, bdaddr, rssi)\n VALUES ($1, $2, $3, $4, $5)'\n CSV.parse(csv, headers: false).each do |row|\n $cn.exec(sql, [device_id] + row)\n end\nend",
"def bulk_insert_str\n fields = sql_row_type.field_names\n \"INSERT INTO #{sql_row_type.table_name} (#{fields.map {|f| f.to_s }.join(', ')}) VALUES\\n\"\n end",
"def insert_gift_into_csv(gift, csv)\r\n csv << [\r\n gift['settle_date'],\r\n gift['last_name'],\r\n gift['first_name'],\r\n gift['c_last_name'],\r\n gift['c_first_name'],\r\n gift['banner_id'],\r\n gift['pledge_number'],\r\n gift['designation_amount'],\r\n gift['card_description'],\r\n gift['desg_code'],\r\n gift['other_designation'],\r\n gift['gift_description'],\r\n gift['tribute_type'],\r\n gift['tribute_occasion'],\r\n gift['tribute_notification_name'],\r\n gift['tribute_notification_address'],\r\n gift['tribute_comments'],\r\n gift['anonymous'],\r\n gift['gcls_code_3'],\r\n gift['mem_in_honor'],\r\n gift['next_of_kin'],\r\n gift['comments'],\r\n gift['solc_org'],\r\n gift['solc_code'],\r\n gift['match_received'],\r\n gift['gift_matching'],\r\n gift['tran_type'],\r\n gift['user_id'],\r\n gift['batch_num']\r\n ]\r\nend",
"def import_csv_full\n \n end",
"def add_row(row)\n\n # Delete row if it already exists\n $rows.delete_if { |r| r['file_path'] == row['file_path'] }\n $rows << row\n\n # rewrite csv:\n update_csv($rows)\nend",
"def addRow(name,rowInfo)\n\t\trowInfoArray = [name] + rowInfo.values\n\t\tcsvrow = rowInfoArray.to_csv\n\t\t@arrayOfTransactionsUser.push(csvrow)\n\t\t@arrayOfTransactions.push(csvrow)\n\t\tself.updateCSVFile\n\tend",
"def insert_row filename, lineno, text\n d = _read filename\n d.insert(lineno, text)\n _write filename, d\n 0\n end",
"def write_row(storage_path, csv_record)\n CSV.open(storage_path, 'ab') do |csv|\n csv << csv_record.values\n end\n end",
"def import_file(row, obj_identifier, new_obj_id)\n if @insert_file.nil?\n stmt = \"insert into generic_files(file_format, uri, size, identifier, \" +\n \"intellectual_object_id, permissions, state, created_at, updated_at) \" +\n \"values (?,?,?,?,?,?,?,?,?)\"\n @insert_file = @dest_db.prepare(stmt)\n end\n @insert_file.execute(row['file_format'],\n row['uri'],\n row['size'],\n row['identifier'],\n new_obj_id,\n nil,\n row['state'],\n row['created_at'],\n row['updated_at'])\n return last_insert_id\n end",
"def store_network_records device_id, csv\n sql = 'INSERT INTO network_records (device_id,\n device_network_record_id, utc_time,\n event_time, latitude, longitude, accuracy)\n VALUES ($1, $2, $3, $4, $5, $6, $7)'\n CSV.parse(csv, headers: false).each do |row|\n $cn.exec(sql, [device_id] + row)\n end\nend",
"def convert_csv(path, table_name)\n \n # csv file has a header row\n header_row = true\n\n # delimiter for csv file\n delimiter = ','\n\n # variable used to skip header row\n skip_row = true\n\n\n CSV.open(path, 'r', delimiter ) do |row|\n\n row.each_with_index do |col,index|\n if col==nil then \n row[index]='NULL'\n else\n \n col.gsub!(\"'\",\"`\")\n row[index] = \"'#{ col }'\"\n end\n end\n\n # Are we reading the header row of the csv file?\n if header_row\n row.each_with_index do |col,index|\n row[index] = \"\\\"#{ col.gsub(\"'\",'').gsub(/\\s+/,'') }\\\"\"\n end\n header_row = false\n print \"INSERT INTO #{table_name} (#{row.join delimiter }) VALUES\"\n next\n end\n\n # Only skip the first (header) row\n if skip_row == true\n # dont skip further rows\n skip_row = false\n else\n # Print end of line insert delimeter\n puts delimiter\n end\n \n # Print to stdout\n print \"(#{row.join delimiter})\"\n \n end\nend",
"def insert_into(colleciton_name, row)\n db[colleciton_name].insert(row)\n end",
"def import_from_csv(file)\n entries = Keybox::Convert::CSV.from_file(file)\n entries.each do |entry|\n @db << entry\n end\n hsay \"Imported #{entries.size} records from #{file}.\", :information\n end",
"def import_to_database(record, db)\n loginfo(\"Importing product ref #{record.xpath(\"/record/product/ONIXProductRef\").text}.\\n\", 2)\n names = Array.new\n values = Array.new\n # Read each product child node ignoring those with attribute ignore=\"true\"\n record.xpath(\"/record/product/*\").each do |node|\n if (node.xpath(\"@ignore\").text != \"true\")\n names << node.name\n type = node.xpath(\"@type\").text\n value = Mysql.escape_string(node.text)\n # String-ify if a string value, otherwise, take as is\n case type\n when \"decimal\", \"int\", \"bit\"\n values << ((value != '')? value : \"NULL\")\n else\n values << ((value != '')? \"'#{value}'\" : \"NULL\")\n end\n end\n end\n # Include opened and updated timestamps\n names << \"opened\"\n values << \"'#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")}'\"\n names << \"updated\"\n values << \"'#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S\")}'\"\n \n sql = \"INSERT INTO #{TARGET_TABLE} (#{names.join(',')}) VALUES (#{values.join(',')});\"\n\n loginfo(\"SQL: #{sql}\\n\", 3)\n db.query(sql)\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Inserts a CSV row into the DwCA table represented by the instance's parent Entity instance | def insert_row(row)
rec = insert_into_core(row) || insert_into_extension(row)
entity.send(add_related, rec)
end | [
"def write_data\n table = STI[self.class.name]\n table.delete_all\n\n lines = CsvStorage.find_by!(csv_file_type: self.class.name).data_store.lines\n lines.shift(self.class::SKIP_LINES_BEFORE_HEADER)\n\n headers = get_headers(clean_line(lines.shift))\n lines.shift(self.class::SKIP_LINES_AFTER_HEADER)\n\n row = nil\n line = nil\n row_number = 1 + self.class::SKIP_LINES_BEFORE_HEADER +\n self.class::SKIP_LINES_AFTER_HEADER\n\n begin\n ActiveRecord::Base.transaction do\n lines.each do |l|\n row_number += 1\n\n line = clean_line(l) || \"\"\n row = get_row(line, headers)\n\n # Allow a block, if given to determine if row is created\n unless row.values.join.blank?\n table.create!(row) if !block_given? || yield(row)\n end\n end\n end\n rescue StandardError => e\n msg = \"row #{row_number}: #{e.message} '#{line.inspect}' \"\n raise StandardError.new(msg)\n end\n end",
"def import_csv\n return if attachment_changes['import_data'].nil?\n\n all_entries = array_of_records\n Entry.insert_all all_entries\n end",
"def addRow(name,rowInfo)\n\t\trowInfoArray = [name] + rowInfo.values\n\t\tcsvrow = rowInfoArray.to_csv\n\t\t@arrayOfTransactionsUser.push(csvrow)\n\t\t@arrayOfTransactions.push(csvrow)\n\t\tself.updateCSVFile\n\tend",
"def write_row(storage_path, csv_record)\n CSV.open(storage_path, 'ab') do |csv|\n csv << csv_record.values\n end\n end",
"def write_csv\n original_info = get_original_info\n puts original_info\n updated_info = [\n original_info[\"id\"],\n # Concatenate original and new provenance with dspace special\n # character.\n # If we try to import a csv file with just the updated provenance,\n # it will *overwrite*, not append, so we need to keep the original.\n original_info[\"provenance\"] + \"||\" + METS.provenance\n ]\n CSV.open(@current_csv, \"a\") do |csv|\n csv << updated_info\n end\n end",
"def insert_customer_data\n infile, result, *others = params\n\n outfile = \"#{File.basename(infile, '.*')}-with-customers.csv\"\n source = others[0]\n\n puts; print \"Inserting customers from #{source} into #{infile}\"\n\n Sycsvpro::Join.new(infile: infile,\n outfile: outfile,\n source: source,\n cols: \"0,3;0,3\",\n joins: \"4=19;4=20\",\n cols: \"1,2;1,2\",\n joins: \"0=19;0=20\",\n pos: \"20,21;23;24\",\n insert_header: \"OI_EK_NAME,OI_EK_LAND;OI_AG_NAME,OI_AG_LAND\").execute\n\n puts; puts \"You can find the result in #{outfile}\"\nend",
"def seed_from_csv(migration_class, csv_file)\n migration_class.transaction do\n csv_file.each do |line_values|\n record = migration_class.new\n line_values.to_hash.keys.map do |attribute|\n record.send(\"#{attribute.strip}=\",line_values[attribute].strip) rescue nil\n end\n record.save(:validate => false)\n end\n end\n end",
"def insert_record(csv, link_name, link_path, protocol, host_url)\n url = URI.parse(\"#{protocol}://#{host_url}#{link_path}\")\n response = open(url.to_s)\n result = [] << fetch_link_name(link_name) <<\n \"#{protocol}://#{host_url}#{link_path}\" <<\n check_status(response.status.first) << response.status.first\n csv << result\n end",
"def csv_uploader(infile, organisationid)\n require 'csv'\n require 'timeout'\n# counter = 1\n begin \n CSV.parse(infile).drop(1).each do |row| \n# puts \"************************************\"\n# puts \"Started reading #{counter} row and inserting row in the table\"\n Customer.customer_build_from_csv(row, organisationid) \n# puts \"Ended the process of inserting #{counter} row in the table\"\n# puts \"************************************\"\n# counter += 1 \n end \n rescue\n retry\n# puts \"*****************************************\"\n# puts \"Anup got timeout error\"\n# puts \"*****************************************\" \n end\n end",
"def start_csv\n provenance_dir = get_output_dir\n @current_csv = File.join(provenance_dir, \"provenance_#{@csv_index}.csv\")\n system(\"touch #{@current_csv}\")\n CSV.open(@current_csv, \"wb\") do |csv|\n csv << [\"id\", \"dc.description.provenance\"]\n end\n end",
"def import_file\n @table_class = InverseCsvImporter.new(self.csv.path, self.user.login).table_class\n end",
"def write_record csv = nil\n csv ||= self.csv\n raise 'Record#add_record_to_csv: no associated CSV object.' unless csv\n\n csv << values\n end",
"def csv_write_row(openfile, record, writeHeader)\n csvt,csvd = dict_to_csv(record)\n if writeHeader then \n openfile.write(\"\\n---new---\\n\")\n openfile.write(csvt)\n openfile.write(\"\\n\") \n end\n openfile.write(csvd)\n openfile.write(\"\\n\")\nend",
"def insert_into_core(row)\n return unless entity.is_core\n entity.model_get.create(row_to_hash(row))\n end",
"def load_from_csv(dependencies={})\n\n parser = new_csv_parser(true)\n @csv_id_to_db_id_map = {}\n substitute_values = substitute_field_values\n\n parser.each do |row|\n if row and row.length > 0 and row.include?(:id)\n csv_id = row.field(:id)\n instance = create_new_instance_from_row(dependencies, substitute_values, row)\n save_if_valid(instance, csv_id)\n end\n end\n puts @csv_id_to_db_id_map.length.to_s + \" new entries stored in table: \" + self.table_name\n dependencies[self.table_name.to_sym] = @csv_id_to_db_id_map\n end",
"def insert_into_extension(row)\n row_vals = row_to_hash row\n core_row(row_vals.delete(entity.key)).send(add_related, row_vals)\n end",
"def add_row(row)\n\n # Delete row if it already exists\n $rows.delete_if { |r| r['file_path'] == row['file_path'] }\n $rows << row\n\n # rewrite csv:\n update_csv($rows)\nend",
"def load_from_csv(row)\n payload = {\n emails: [{ email: row['email'] }],\n firstname: row['first_name'],\n lastname: row['last_name'],\n external_ids: { controlshift: row['id'] },\n updated_at: row['updated_at']\n }\n UpsertMember.call(payload)\n end",
"def store_network_records device_id, csv\n sql = 'INSERT INTO network_records (device_id,\n device_network_record_id, utc_time,\n event_time, latitude, longitude, accuracy)\n VALUES ($1, $2, $3, $4, $5, $6, $7)'\n CSV.parse(csv, headers: false).each do |row|\n $cn.exec(sql, [device_id] + row)\n end\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns the row from the DwCA _core_ that matches the foreign key | def core_row(foreign_key)
entity.core.model_get.first(entity.core.key => foreign_key)
end | [
"def core_row\n return nil if entity.is_core\n send(entity.core.name)\n end",
"def load_target!\n if primary_key = @owner.send(@options[:primary_key])\n Relation.new(@association_class.to_s.classify.constantize).where(@options[:foreign_key] => primary_key).limit(1).first\n end\n end",
"def _load_associated_object_via_primary_key(opts)\n opts.associated_class.send(:primary_key_lookup, ((fk = opts[:key]).is_a?(Array) ? fk.map{|c| get_column_value(c)} : get_column_value(fk)))\n end",
"def find(pk)\n if has_primary_key?\n idx = @pk_map[pk]\n @table[idx]\n else nil\n end\n end",
"def primary_key\n associated_object&.id\n end",
"def primary_key_lookup(pk)\n if sql = @fast_pk_lookup_sql\n sql = sql.dup\n ds = dataset\n ds.literal_append(sql, pk)\n ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}\n nil\n elsif dataset.joined_dataset?\n # SEQUEL5: Remove as joined model datasets are not allowed\n dataset.first(qualified_primary_key_hash(pk))\n else\n dataset.first(primary_key_hash(pk))\n end\n end",
"def find_table_by_foreign_key(column_name)\n @opts[:foreign_key][:alias].values_at(column_name).first\n end",
"def get_primary_contact\n #Modified by Ketki 19/10/2010\n first = self.primary_contact_id\n unless first.nil?\n Contact.find_with_deleted(first)\n end\n end",
"def find(id_to_find)\n table = self.to_s.pluralize.downcase\n result = DATABASE.execute(\"SELECT * FROM #{table} WHERE id = #{id_to_find}\")\n results_as_objects(result)[0]\n end",
"def coreteam\n self.teams.where(\"school_id = ? and coreteam = ?\",self.school, true).first\n end",
"def get_by_db4o_id(id)\n obj = database.ext.getByID(id.to_i)\n # Activate depth should be configurable\n database.activate(obj,5)\n obj\n end",
"def lookup_self\n lookup_relation.first\n end",
"def current_row\n return unless ole.CurrentRow\n rows.find {|row| row.get_id == ole.CurrentRow}\n end",
"def load_by_foreign_key(db_class, id, foreign_key_info)\n arel = db_class.where(foreign_key_info.fk_column => id)\n arel = arel.where(foreign_key_info.fk_type_column => foreign_key_info.fk_type) if foreign_key_info.polymorphic?\n arel.to_a\n end",
"def primary_key_lookup(pk)\n if sql = @fast_pk_lookup_sql\n sql = sql.dup\n ds = dataset\n ds.literal_append(sql, pk)\n ds.fetch_rows(sql){|r| return ds.row_proc.call(r)}\n nil\n else\n dataset.first(primary_key_hash(pk))\n end\n end",
"def sql_column\n assoc.association_foreign_key\n end",
"def related(r)\n relation_set(r).first\n end",
"def associated_record\n assoication.active_record\n end",
"def lookup_parent(parent_model, value)\n value = value.to_s.downcase.gsub(/ /, \"_\")\n return send(\"find_by_#{parent_model.table_name.singularize}_id\", parent_model.send(value, :id))\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Instance Methods Process the text, either the HTML or the TEXT version | def get_text(type, data)
return case type
when :html; self.process(self.text_html, data)
when :text; self.process(self.text, data)
when :stripped_html; strip_html self.process(self.text_html, data)
end
end | [
"def process_text(content)\n content\n end",
"def process_text(text, context, processor=TextFilters.default_processor)\n processed_text = nil\n #Comatose.logger.debug \"text before process: #{text}\"\n case\n when processor == :erb\n processed_text = process_with_erb(text, context)\n when processor == :liquid\n processed_text = process_with_liquid(text, context)\n else\n raise \"Unknown Text Processor '#{processor.to_s}'\"\n end\n #Comatose.logger.debug \"text after process: #{processed_text}\"\n return processed_text\n end",
"def process_text(text, context, processor=nil)\n case (processor || TextFilters.default_processor)\n when :erb then process_with_erb(text, context)\n when :liquid then process_with_liquid(text, context)\n else raise \"Unknown Text Processor '#{processor.to_s}'\"\n end\n end",
"def handle_html b, html, plain_text\n html\n end",
"def process_text(text, filter_type = 'Textile', options = {})\n binding = Comatose::ProcessingContext.new(ComatosePage.new, options)\n TextFilters.transform(text, binding, filter_type)\n end",
"def process_text(snip, content, args)\n content\n end",
"def preprocess_text data\n parse_formatted_text data\n end",
"def visit_Text(text, *rest)\n end",
"def process_text(node)\n node\n end",
"def parse_and_process_text(text, parse_options={})\n postprocess(parse_xml(parse_text(text, parse_options)))\n end",
"def process_text(raw, preserve = false)\n raw.gsub!(/\\s+/, ' ') unless preserve\n src = Kramdown::Utils::StringScanner.new(raw)\n result = []\n until src.eos?\n if (tmp = src.scan_until(/(?=#{HTML_ENTITY_RE})/o))\n result << Element.new(:text, tmp)\n src.scan(HTML_ENTITY_RE)\n val = src[1] || (src[2]&.to_i) || src[3].hex\n result << if %w[lsquo rsquo ldquo rdquo].include?(val)\n Element.new(:smart_quote, val.intern)\n elsif %w[mdash ndash hellip laquo raquo].include?(val)\n Element.new(:typographic_sym, val.intern)\n else\n begin\n Element.new(:entity, entity(val), nil, original: src.matched)\n rescue ::Kramdown::Error\n src.pos -= src.matched_size - 1\n Element.new(:entity, ::Kramdown::Utils::Entities.entity('amp'))\n end\n end\n else\n result << Element.new(:text, src.rest)\n src.terminate\n end\n end\n result\n end",
"def text\n text = \"\"\n\n if html_part\n text = html_part.decode_body.to_s\n @is_text_html = true\n end\n\n if !text.present? && text_part\n text = text_part.decode_body.to_s \n @is_text_html = false\n end\n\n if !text.present?\n text = body.decoded.to_s \n @is_text_html = false\n end\n\n text\n end",
"def on_slim_text(type, content); end",
"def inline_html(text)\n # process simple inlines\n for inline in INLINES_HTML\n text.gsub!(/#{inline[0]}/m, inline[1]) if text.match(/#{inline[0]}/m)\n end\n # process link inlines\n if text.match(LINKS_REGEXP)\n text.gsub!(LINKS_REGEXP) do |string|\n match = string.match(LINKS_REGEXP)\n before = match[1]\n body = match[2]\n after = match[3]\n parts = body.split(' ')\n if parts.length > 1\n url = parts.first\n link = parts[1..-1].join(' ')\n else\n url = body\n link = body\n end\n \"#{before}<a href='#{url}'>#{link}</a>#{after}\"\n end\n end\n # process note inlines\n if text.match(NOTES_REGEXP)\n text.gsub!(NOTES_REGEXP) do |string|\n match = string.match(NOTES_REGEXP)\n before = match[1]\n body = match[2]\n after = match[3]\n @document.notes << body\n index = @document.notes.length\n \"#{before}<a href='#note#{index}' name='source#{index}'>\"+\n \"[#{index}]</a>#{after}\"\n end\n end\n # process escapes (that is \\x is replaced with x)\n text.gsub!(/\\\\(.)/, \"\\\\1\") if text.match(/\\\\(.)/)\n text\n end",
"def parse text\n raise \"No parse defined for #{self.class}\"\n end",
"def non_verbatim_text\n end",
"def process_text\n regex_string = '((\\[ (\\/)? ( \\* | (\\w+)) ((=[^\\[\\]]+) | (\\s\\w+=\\w+)* | ([^\\]]*))? \\]) | ([^\\[]+))'\n @text.scan(/#{regex_string}/ix) do |tag_info|\n @ti = TagInfo.new(tag_info, @dictionary)\n\n # if the tag isn't in the @dictionary list, then treat it as text\n @ti.handle_tag_as_text if @ti.element_is_tag? and !@ti.tag_in_dictionary?\n\n validate_element\n\n case @ti.type\n when :opening_tag\n element = {:is_tag => true, :tag => @ti[:tag], :definition => @ti.definition, :errors => @ti[:errors], :nodes => TagCollection.new }\n element[:invalid_quick_param] = true if @ti.invalid_quick_param?\n element[:params] = get_formatted_element_params\n\n @bbtree.retrogress_bbtree if self_closing_tag_reached_a_closer?\n\n @bbtree.build_up_new_tag(element)\n\n @bbtree.escalate_bbtree(element)\n when :text\n tag_def = @bbtree.current_node.definition\n if tag_def and tag_def[:multi_tag] == true\n set_multi_tag_to_actual_tag\n tag_def = @bbtree.current_node.definition\n end\n\n if within_open_tag? and tag_def[:require_between]\n between = get_formatted_between\n @bbtree.current_node[:between] = between\n if use_text_as_parameter?\n value_array = tag_def[:quick_param_format].nil? ? true : between.scan(tag_def[:quick_param_format])[0]\n if value_array.nil?\n if @ti[:invalid_quick_param].nil?\n # Add text element (with error(s))\n add_element = true\n\n # ...and clear between, as this would result in two 'between' texts\n @bbtree.current_node[:between] = \"\"\n end\n else\n # Between text can be used as (first) parameter\n @bbtree.current_node[:params][tag_def[:param_tokens][0][:token]] = between\n end\n end\n # Don't add this text node, as it is used as between (and might be used as first param)\n next unless add_element\n end\n\n create_text_element\n when :closing_tag\n if @ti[:wrong_closing]\n # Convert into text, so it\n @ti.handle_tag_as_text\n create_text_element\n else\n @bbtree.retrogress_bbtree if parent_of_self_closing_tag? and within_open_tag?\n @bbtree.retrogress_bbtree\n end\n end\n end # end of scan loop\n\n validate_all_tags_closed_off\n validate_stack_level_too_deep_potential\n end",
"def render_text(text)\n text.to_html!\n @response[:html] << text\n end",
"def format_plain_text(text)\n # First, escape any HTML that might be in there. Cross-site scripting baaaaad.\n text = h( text )\n\n # Now replace newlines\n text = text.gsub /$/, '<br />'\n\n # Now replace URLs\n text = text.gsub /\\b(http:\\/\\/[A-Za-z0-9_.%\\/?#=-]+)/, '<a href=\"\\1\">\\1</a>'\n text = text.gsub /\\b(https:\\/\\/[A-Za-z0-9_.%\\/?#=-]+)/, '<a href=\"\\1\">\\1</a>'\n text = text.gsub /(?<!:\\/\\/)\\b(www\\.[A-Za-z0-9_.%\\/?#=-]+)/, '<a href=\"http://\\1\">\\1</a>'\n text = text.gsub /([0-9a-z][0-9a-z.-]+[0-9a-z]@[0-9a-z][0-9a-z.-]+[0-9a-z])/xi, '<a href=\"mailto:\\1\">\\1</a>'\n\n raw( text )\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Interesting methods Determines whether a message is meant for sending by checking if it has session parameters. This is useful for example if you have the same handler url for incoming and outgoing messages Example: tropo_object = Tropo::Generator.parse(raw_json) tropo_message = Tropo::Message.new(tropo_object) tropo_message.outgoing? | def outgoing?
tropo_session["session"] && tropo_session["session"]["parameters"]
end | [
"def isMyMessage(message)\r\n return message[:type] == :Sent\r\n end",
"def message_in_session?(message)\n session_message_ids.include?(message.id)\n end",
"def valid_message_type?\n config.request_config[request_method] == 'path' || config.request_config[request_method] == 'params'\n end",
"def send?\n type == 'send'\n end",
"def message_sent?\n message.state == 'sent'\n end",
"def msg_sent?\n true\n end",
"def valid_keys?(message)\n [:sender, :sent_to, :type, :uid] - message.keys == []\n end",
"def body?\n HTTY::Request::METHODS_SENDING_BODY.include? method\n end",
"def message_sent?\n message.sent?\n end",
"def is_request? msg\n msg && msg[:req_id]\n end",
"def booking_in_session?\n session[:booking_request_params].present? && session[:booking_path_params].present?\n end",
"def transfer_given?\n params.has_key?(:is_transfer) || params.has_key?(:transfer_buddy)\n end",
"def want_msg?\r\n msg_type == 'want'\r\n end",
"def talking_to_bot?\n @talking_to_bot\n end",
"def message_to_bot?\n @message.scan(/^\\<\\@#{@client.self.id}\\>/).count.positive? || @channel[0] == \"D\"\n end",
"def outbound_request?\n requester == 'outbound'\n end",
"def has_message?\n has_message\n # && messages.count > 0\n end",
"def smsable?\n properties.include?(\"smsable\")\n end",
"def send session, msg\n session.send msg; true\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns encrypted_password of associated Profile | def encrypted_password
profile.encrypted_password
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(profile)\n profile_element = @repository_xml.root.elements[\"profile[@id='#{profile}']\"]\n if profile_element\n enc_passwd = profile_element.attributes['password']\n return decrypt(enc_passwd) if enc_passwd\n end\n end",
"def password_profile\n return @password_profile\n end",
"def encrypt_password\n self.salt = make_salt if new_record?\n self.encrypted_password = encrypt(password)\n end",
"def encrypted_password\n \treturn sha_pass_hash\n \tend",
"def password_profile=(value)\n @password_profile = value\n end",
"def password\n fetch_password_from_keychain() unless @password\n @password\n end",
"def crypted_password; end",
"def password\n raw_password = read_attribute(:password)\n raw_password.blank? ? nil : crypt.decrypt(raw_password)\n end",
"def password\n aes_key = KeyGenerator.aes_key(GlobalConfig.secret_key)\n AESEncryption.decrypt(aes_key, @encrypted_pwd)\n end",
"def to_s\n password\n end",
"def encrypted_password_before_last_save\n previous_changes['encrypted_password'].try(:first)\n end",
"def crypt_password\r\n write_attribute \"password\", self.class.sha1(password)\r\n end",
"def encrypt_password\n if errors.count == 0 and @new_password and not password.nil?\n # generate a new 10-char long hash only Base64 encoded so things are compatible\n self.password_salt = [Array.new(10){rand(256).chr}.join].pack(\"m\")[0..9]; \n\n # write encrypted password to object property\n write_attribute(:password, hash_string(password))\n\n # mark password as \"not new\" any more\n @new_password = false\n password_confirmation = nil\n \n # mark the hash type as \"not new\" any more\n @new_hash_type = false\n end\n end",
"def get_authentication_password\n @authpass\n end",
"def crypt_password\n write_attribute \"password\", self.class.sha1(password)\n end",
"def password\n [@password, @security_token].join('')\n end",
"def crypt_password\n\t\twrite_attribute \"password\", self.class.sha1(password)\n end",
"def password(**options)\n authenticator = options[:authorization_user] || @authorization_user\n # raise Tarkin::PasswordNotAccessibleException, \"Password can't be accessed at this moment\" if !new_record? && authenticator.nil? \n return \"********\" if !new_record? && authenticator.nil? # for validator\n if new_record? && @password\n @password.force_encoding('utf-8')\n else\n if authenticator\n begin\n meta, group = meta_and_group_for_user authenticator\n rescue Tarkin::ItemNotAccessibleException\n self.errors[:password] << \"can't be decrypted\"\n return nil\n end\n decrypt(self.password_crypted,\n group.private_key(authorization_user: authenticator).private_decrypt(meta.key_crypted),\n group.private_key(authorization_user: authenticator).private_decrypt(meta.iv_crypted)).force_encoding( 'utf-8' )\n else\n self.errors[:password] << \"can't be empty\"\n nil\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
google map place search by text,get lat&lng | def location(query)
query = URI.encode query
key = load_service["google"]["api_key"]
request_url = "https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{query}&key=#{key}&sensor=true"
url = URI.parse(request_url)
response = Net::HTTP.start(url.host, url.port,:use_ssl => url.scheme == 'https') do |http|
http.request(Net::HTTP::Get.new(request_url))
end
data = JSON.parse(response.body)["results"][0]
{
:address => data["formatted_address"],
:lat => data["geometry"]["location"]["lat"],
:lng => data["geometry"]["location"]["lng"]
}
end | [
"def location(query)\n\t\t\tquery = URI.encode query\n\t\t\tkey = load_service[\"google\"][\"api_key\"]\n\t\t\trequest_url = \"https://maps.googleapis.com/maps/api/place/textsearch/json?query=#{query}&key=#{key}&sensor=true\"\n\t\t\turl = URI.parse(request_url)\n\t\t\tresponse = Net::HTTP.start(url.host, url.port,:use_ssl => url.scheme == 'https') do |http|\n\t\t\t\thttp.request(Net::HTTP::Get.new(request_url))\n\t\t\tend\n\t\t\tdata = JSON.parse(response.body)[\"results\"][0]\n\t\t\t{\n\t\t\t\t:address => data[\"formatted_address\"],\n\t\t\t\t:lat => data[\"geometry\"][\"location\"][\"lat\"],\n\t\t\t\t:lng => data[\"geometry\"][\"location\"][\"lng\"]\n\t\t\t}\n\t\tend",
"def get_location(str)\n u=URI.encode(\"http://maps.google.com/maps/api/geocode/xml?sensor=false&address=#{str}\")\n loc=(Hpricot.XML(open(u)))/'//location'\n h={} \n h['lat']=(loc/:lat).inner_text\n h['lng']=(loc/:lng).inner_text\n h\n end",
"def find\n placenames = []\n begin\n placenames = Mapbox::Geocoder.geocode_forward(\n @search_text, \n {:proximity => {:longitude => @lng, :latitude => @lat}}\n )\n rescue Exception => e\n puts \"====================== Exception - MapboxApi - Places - find ======================\"\n puts e.message\n end\n\n return placenames\n end",
"def search_with_coordinates(term, latitude, longitude, options={})\n search_businesses(term, options.merge(:ll=>\"#{latitude},#{longitude}\"))\n end",
"def search_place\n @radius = @params[:radius] if @params[:radius].present?\n @type = @params[:type] if @params[:type].present?\n if @params[:choices].present?\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&name=\"+@params[:choices]+\"&radius=#{@radius}&type=#{@type}\")\n else\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&radius=#{@radius}&type=#{@type}\")\n end\n places[\"results\"] \n end",
"def get_nearby_places_bykeyword(lat, lng, keyword, options={})\n get_info_fromjson = GetInfoFromJson.new\n\n url_params = { :location => \"#{lat},#{lng}\", :keyword => URI.encode(keyword), :key => @api_key, :rankby => \"distance\", :language => \"ja\" }\n url = set_params(@base_url, url_params)\n\n res = http_get(url)\n\n places = get_info_fromjson.get_places_info(res, 3)\n\n return places\n end",
"def search_place\n @radius = @params[:radius] if @params[:radius].present?\n @type = @params[:type] if @params[:type].present?\n if @params[:filters].present?\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&name=\"+@params[:filters]+\"&radius=#{@radius}&type=#{@type}\")\n else\n places=HTTParty.get(\"https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=#{@params[:lat]},#{@params[:lng]}&key=#{ENV['GOOGLE_PLACES_KEY']}&radius=#{@radius}&type=#{@type}\")\n end\n places[\"results\"] \n end",
"def location_search_geo(latitude, longitude, options = {})\n location_search(options.merge(location: \"geo:#{latitude},#{longitude}\"))\n end",
"def find_place(query, items = ['*'])\n # add parenteses if a geoposition is provided\n if query =~ /^(-?\\d+\\.\\d+),\\s?(-?\\d+\\.\\d+)$/\n query = \"(#{query})\"\n end\n\n response = yql(%{\n select #{items.join(',')}\n from geo.places(1)\n where text=\"#{query}\"\n });\n\n return response.parsed_response['query']['results']\n end",
"def get_place_info(keyword)\n uri = URI(@endpoint_textsearch)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n query: keyword,\n key: @places_apikey\n })\n p uri.query\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end",
"def get_place_info(keyword)\n google_places_api_key = ENV['GOOGLE_PLACES_API_KEY']\n uri = URI(BASE_URL_TEXTSEARCH)\n res = nil\n uri.query = URI.encode_www_form({\n language: \"ja\",\n query: keyword,\n key: google_places_api_key\n })\n p uri.query\n p uri\n Net::HTTP.start(uri.host, uri.port, use_ssl: true) do |http|\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n res = http.get(uri)\n end\n\n return res\n end",
"def search(raw_address)\r\n Rails.logger.debug \"search #{raw_address}\"\r\n res = Geocoder.search(raw_address, :sensor => @sensor, :components => @components, :region => @region, :bounds => @bounds)\r\n end",
"def search\n\n\t\t@search_loc = params[:search_loc] # address user searched for\n\t\t@search_lat = params[:search_lat] # the user's current location latitude. If the address searched for fails to give a new latitude, this is used instead\n\t\t@search_long = params[:search_long] # the user's current longitude - same use case as above\n\t\tif @search_loc != nil\n\t\t\taddress = @search_loc.gsub(/\\s/, \"+\")\n\t\t\turi = URI.parse(\"http://maps.googleapis.com/maps/api/geocode/json?address=\" + address + \"&sensor=false\")\n\t\t\thttp = Net::HTTP.get_response(uri)\n\t\t\tresults = JSON.parse(http.body)\n\t\t\t# if address yielded results, override the user's current location coordinates with the searched-for-latitude/longitude\n\t\t\tif results[\"status\"] != \"ZERO_RESULTS\"\n\t\t\t\t@search_lat = results[\"results\"][0][\"geometry\"][\"location\"][\"lat\"]\n\t\t\t\t@search_long = results[\"results\"][0][\"geometry\"][\"location\"][\"lng\"]\n\t\t\tend\n\t\tend\n\n\t\t@search_item = \"\"\n\t\tif params[:search_item] then\n\t\t\t@search_item = params[:search_item]\n\t\tend\n\t\t@search_item.downcase\n\n\t\t# the default search distance (max circular radius of a restaurant from the searched for location) is 5 unless the user specified a search radius\n\t\t@search_distance = DEFAULT_SEARCH_DISTANCE\n\t\tif params[:search_distance] then\n\t\t\t@search_distance = params[:search_distance]\n\t\tend\n\n\t\t@max_results = DEFAULT_MAX_RESULTS\n\t\tif params[:results] then\n\t\t\t@max_results = params[:results].to_i\n\t\tend\n\n\t\t# Based on the Haversine Formula found on google maps API. The below is a Sql query to find all restaurants that has dishes with a dish name containing the search query or a dish description containing the search query,\n\t\t# (independent of case), or the restaurant name or description contains the search query, and the restaurant must be within the circular search\n\t\t# radius of the searched for location.\n\t\t@restaurants = Restaurant.find_by_sql([\"SELECT DISTINCT restaurants.* from foods, restaurants WHERE\n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id LIMIT ?\", @search_lat, @search_long, @search_lat, @search_distance, \"%#{@search_item}%\", \n\t\t\t\"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t# All of the dishes returned below are ordered by average rating from highest to lowest.\n\t\t# Similar to the above query, but returns the dishes that are within restaurants within the given distance radius that has a dish name or description\n\t\t# with the search query, or its restaurant name / description has the search query.\n\t\t@dishes = Food.find_by_sql([\"SELECT DISTINCT foods.* from foods, restaurants WHERE \n\t\t\t(3959*acos(cos(radians(?))*cos(radians(restaurants.latitude))*cos(radians(restaurants.longitude)-radians(?)) + \n\t\t\tsin(radians(?))*sin(radians(restaurants.latitude)))) < ? AND ((lower(restaurants.name) like ? OR \n\t\t\tlower(restaurants.description) like ?) OR (lower(foods.dish_name) like ? OR lower(foods.description) like ?)) AND \n\t\t\tfoods.restaurant_id = restaurants.id ORDER BY foods.rating DESC NULLS LAST OFFSET 2 LIMIT ?\", @search_lat, @search_long, @search_lat, \n\t\t\t@search_distance, \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", \"%#{@search_item}%\", @max_results])\n\n\t\t@num_items_per_row = DEFAULT_NUM_ITEMS_PER_ROW\n\t\t@num_rows_per_page = DEFAULT_NUM_ROWS_PER_PAGE\n\t\tif params[:itemspr] then\n\t\t\t@num_items_per_row = params[:itemspr].to_i\n\t\tend\n\t\tif params[:rowspp] then\n\t\t\t@num_rows_per_page = params[:rowspp].to_i\n\t\tend\n\n\t\t@render = 'default'\n\t\tif params[:render] then\n\t\t\t@render = params[:render]\n\t\tend\n\n\t\tif @render == 'json_only' then\n\t\t\trender :json => {:restaurants => @restaurants, :dishes => @dishes}\n\t\telsif @render == 'partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'partials_and_json_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'all', :dishes => @dishes, :restaurants => @restaurants,\n\t\t\t\t:with_json => true, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'dish_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'dishes_only', :render_restaurants => false, :results => 'dishes',\n\t\t\t\t:dishes => @dishes, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\telsif @render == 'restaurant_partials_only' then\n\t\t\trender :partial => 'shared/results', :locals => {:rend => 'restaurants_only', :results => 'restaurants',\n\t\t\t\t:restaurants => @restaurants, :with_json => false, :num_items_per_row => @num_items_per_row, :num_rows_per_page => @num_rows_per_page}\n\t\tend\n\t\t# else search.html.erb (the default) will be rendered\n\n\tend",
"def search\n @results = Popup.near((params[:geocode]), 1.5)\n respond_to do |f|\n f.html { render :search }\n f.json { render json: @results, :only => [:id, :name, :address, :geocode, :longitude, :latitude, :hours, :day, :website, :price, :description, :image, :category]}\n end\n end",
"def search(search_term, location)\n self.class.get('/places', :query => {:show => search_term, :in => location})\n end",
"def search_place_in_google_api_by_name(place)\n api_client.spots(place.latitude, place.longitude, name: place.name, radius: 1000).detect do |spot|\n spot.name.similar(place.name) >= 80\n end\n end",
"def get_by_lat_lng\n\tend",
"def locate(place)\n locations, = get :q => place\n return locations.first\n end",
"def generate_place_query\n\t\tbase_url = \"https://maps.googleapis.com/maps/api/place/nearbysearch/json?\"\n\t\tsearch_params = \"\"\n\n\t\t# set required fields\n\t\treq_fields = Hash.new\n\t\treq_fields[\"key\"] = ENV['PLAY_GOOGLE_KEY']\n\t\treq_fields[\"location\"] = \"#{self.stop_lat.to_s},#{self.stop_lon.to_s}\"\n\t\treq_fields[\"radius\"] = \"200\" \n\t\treq_fields[\"sensor\"] = \"false\"\n\n\t\t# set optional fields\n\t\topt_fields = Hash.new\n\t\topt_fields[\"rankby\"] = \"prominence\"\n\t\t#opt_fields[\"keyword\"] =\n\t\t#opt_fields[\"language\"] =\n\t\t#opt_fields[\"name\"] =\n\t\t#opt_fields[\"types\"] =\n\n\t\treq_fields.each do |key, value|\n\n\t\t\tsearch_field = key + \"=\" + value\n\n\t\t\t# if not last item in hash, add an '&'\n\t\t\tunless key == req_fields.to_a.last[0]\n\t\t\t\tsearch_field += \"&\"\n\t\t\tend\n\n\t\t\tsearch_params << search_field\n\t\tend\n\n\t\turl = base_url + search_params\n\n\tend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Yields each message in the queue to the provided block, removing the message after the block has processed it. If the block raises an exception, the message will be retained in the queue. | def dequeue_each(&block)
until @messages.empty?
message = @messages.first
yield message
@size -= 1
@bytesize -= message.bytesize
@messages.shift
end
end | [
"def with_next(&block)\n \n messages = @queue.shift || []\n yield(messages) unless block.nil?\n messages\n end",
"def dequeue_chunks\n while chunk = @queue.pop\n yield chunk\n end\n end",
"def each\n fail 'a block is required' unless block_given?\n until @client.llen(@queue_name) <= 0\n job = pop\n break if job.nil?\n Proc.new.call(job)\n end\n end",
"def consume(&block)\n @queue.consume(&block)\n end",
"def each\n while message = read_message\n yield message\n end\n end",
"def next_message(block)\n @mutex.lock\n begin\n super(&block)\n ensure\n begin\n @mutex.unlock\n rescue\n nil\n end\n end\n end",
"def next\n raise StopIteration if @done\n @gate.synchronize do\n @condition.signal\n end\n payload, type = @queue.pop\n case type\n when DONE\n @done = true\n raise StopIteration\n when ERROR\n @done = true\n raise payload\n end\n payload\n end",
"def shutdown\n raise MailboxDead, \"mailbox already shutdown\" if @dead\n\n @mutex.lock\n begin\n yield if block_given?\n messages = @messages\n @messages = []\n @dead = true\n ensure\n begin\n @mutex.unlock\n rescue\n nil\n end\n end\n\n messages.each do |msg|\n dead_letter msg\n msg.cleanup if msg.respond_to? :cleanup\n end\n true\n end",
"def process_queue\n begin\n while blk = Merb::Dispatcher.work_queue.pop\n # we've been blocking on the queue waiting for an item sleeping.\n # when someone pushes an item it wakes up this thread so we \n # immediately pass execution to the scheduler so we don't \n # accidentally run this block before the action finishes \n # it's own processing\n Thread.pass\n blk.call\n end\n rescue Exception => e\n Merb.logger.warn! %Q!Worker Thread Crashed with Exception:\\n#{Merb.exception(e)}\\nRestarting Worker Thread!\n retry\n end\n end",
"def next\n raise StopIteration if @done\n @gate.synchronize do\n @condition.signal\n end\n payload, type = @queue.pop\n case type\n when DONE\n @done = true\n raise StopIteration\n when ERROR\n @done = true\n raise payload\n end\n payload\n end",
"def each_message(&block)\n raise \"Computation #{@handle} is not attached to a channel\" unless @channel\n\n while @channel\n msg = next_message\n block.call(msg, self)\n end\n\n return\n end",
"def receive (&block)\n\t\tmessage = nil\n\t\tfound = false\n\n\t\tif block\n\t\t\tuntil found\n\t\t\t\t@mutex.synchronize {\n\t\t\t\t\tif index = @messages.find_index(&block)\n\t\t\t\t\t\tmessage = @messages.delete_at(index)\n\t\t\t\t\t\tfound = true\n\t\t\t\t\telse\n\t\t\t\t\t\tcond.wait @mutex\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\telse\n\t\t\tuntil found\n\t\t\t\t@mutex.synchronize {\n\t\t\t\t\tif @messages.empty?\n\t\t\t\t\t\tcond.wait @mutex\n\t\t\t\t\tend\n\n\t\t\t\t\tunless @messages.empty?\n\t\t\t\t\t\tmessage = @messages.shift\n\t\t\t\t\t\tfound = true\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\tend\n\t\tend\n\n\t\tmessage\n\tend",
"def consume_each(&block)\r\n @arr = @arr.reject(&block)\r\n end",
"def each(&block)\n @messages.each(&block)\n end",
"def handle_messages(&block)\n msg = queue.receive_messages(:max_number_of_messages => sqs_polling_amount, :attribute_names => ['ApproximateReceiveCount'])\n messages = *msg\n\n messages.each do |message|\n unless duplicate_message?(message.message_id, message.queue_url, queue_timeout)\n block.call(message.message_id, message.receipt_handle, queue_name, queue_timeout, message.body, message.attributes['ApproximateReceiveCount'].to_i - 1)\n end\n Chore.run_hooks_for(:on_fetch, message.receipt_handle, message.body)\n end\n\n messages\n end",
"def remove(queue, &block)\n begin\n # Remove the first item!\n uuid = first_in_queue(queue)\n if uuid\n # If we're not able to remove the key from the set here, it means that\n # some other thread (or evented operation) has done it before us, so\n # the current remove is invalid and we should retry!\n raise MobME::Infrastructure::Queue::RemoveConflictException unless remove_from_queue(queue, uuid)\n \n queue_item = read_value(queue, uuid)\n \n # When a block is given, safely reserve the queue item\n if block_given?\n begin\n block.call(queue_item)\n remove_value(queue, uuid)\n rescue #generic error\n put_back_in_queue(queue, uuid, queue_item)\n \n # And now re-raise the error\n raise\n rescue MobME::Infrastructure::Queue::RemoveAbort\n put_back_in_queue(queue, uuid, queue_item)\n end\n else\n remove_value(queue, uuid)\n queue_item\n end\n else\n nil\n end\n rescue MobME::Infrastructure::Queue::RemoveConflictException\n retry\n end\n end",
"def receive(queue)\n if block_given?\n obj, args = @adapter.pop(queue)\n yield QueueObject.new(obj, args) if obj\n else\n raise 'No block given'\n end\n end",
"def pop(&block)\n opts = options.pop\n @queue.pop(opts) do |metadata, payload|\n thread(Reply.new(self, metadata, (payload.nil?) ? nil : payload)) do |reply|\n block.call(reply)\n end\n end\n end",
"def flush!\n 0.upto(blocks.length) { blocks.pop }\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Create a child process either by running a shell command or by supplying a block to run. When running a shell command that is going to exit on its own, it is often best to call wait, which blocks execution until the command has exited. The second argument to new, if 'true', will call wait for you. | def initialize(command=nil, wait=false, &block)
if block.nil?
@pid = fork { exec(command) }
else
@pid = fork &block
end
Process::detach(@pid)
@status = nil
wait() if wait
end | [
"def fork_child(block)\n child = Verneuil::Process.new(@program, nil)\n child.run_block(block)\n \n @children << child\n \n return child\n end",
"def new_process(process)\n ChildProcess.posix_spawn = true if RUBY_PLATFORM == 'java' # Support JRuby.\n if OS.windows?\n ChildProcess.new('cmd.exe', '/c', process)\n else\n ChildProcess.new('sh', '-c', process)\n end\n end",
"def run_in_new_process\n fork do # rubocop:todo Style/ExplicitBlockArgument\n yield\n end\nend",
"def build_child_process(command)\n reader, writer = IO.pipe\n shell = case RUBY_PLATFORM\n when /(ms|cyg|bcc)win|mingw|win32/\n [\"cmd\", \"/c\"]\n else\n [\"sh\", \"-c\"]\n end\n ChildProcess.posix_spawn = posix_spawn?\n shell_command = shell + [command]\n child = ChildProcess.build(*shell_command)\n child.io.stdout = child.io.stderr = writer\n child.leader = true\n [child, reader, writer]\n end",
"def make_child(block)\n #Forkme.logger.debug \"p: make child\"\n to_child = IO.pipe\n to_parent = IO.pipe\n pid = fork do\n @@children.map do |c|\n c.from.close unless c.from.closed?\n c.to.close unless c.to.closed?\n end\n @from_parent = to_child[0]\n @to_parent = to_parent[1]\n to_child[1].close\n to_parent[0].close\n\n child block\n exit_child\n end\n #Forkme.logger.debug \"p: child pid #{pid}\"\n @@children << Child.new(pid, to_parent[0], to_child[1])\n to_child[0].close\n to_parent[1].close\n end",
"def spawn\n Process.spawn(*spawn_args)\n end",
"def create_process(*args, start: true, wait: true, attach: true, cwd: nil, environment: {})\n process = ChildProcess.build(*args)\n process.io.inherit! if attach\n\n # Set the working directory\n process.cwd = cwd unless cwd.nil?\n\n # Set any passed environment variables\n environment.each do |env, value|\n process.environment[env.to_s] = value\n end\n\n # Start the process if requested\n if start\n process.start\n process.wait if wait\n end\n\n process\nend",
"def spawn(cmd, stdin: nil, stdout: nil, stderr: nil, detach: true, wait: false)\n if stdin\n stdin = make_shared stdin\n else\n stdin = dev_null\n end\n\n if stdout\n stdout = make_shared stdout\n else\n stdout = dev_null\n end\n\n if stderr\n stderr = make_shared stderr\n else\n stderr = dev_null\n end\n\n if pid = fork # parent\n\n log \"#{pid} forked\"\n\n if wait\n log \"wait for #{pid}\"\n Process.waitpid pid\n rc = $?.exitstatus\n log \"pid #{pid} exited => #{rc}\"\n return rc\n end\n\n if detach\n Process.detach pid\n log \"#{pid} detached\"\n return nil\n end\n\n return pid\n\n else # child\n\n log \"stdin => #{stdin.to_i}\"\n log \"stdout => #{stdout.to_i}\"\n log \"stderr => #{stderr.to_i}\"\n log \"exec '#{cmd}'\"\n $stdin.reopen(stdin)\n $stdout.reopen(stdout)\n $stderr.reopen(stderr)\n exec \"#{cmd}\"\n raise \"Unreachable reached\"\n\n end\nend",
"def spawn(*args, &block)\n if @sigchld_source.nil?\n @sigchld_source = add_unix_signal(\"CHLD\") {\n reap_children\n }\n end\n\n pid = Process.spawn(*args)\n @children << {:pid => pid, :block => block}\n pid\n end",
"def spawn_process(args = nil)\n #Used for printing debug-stuff.\n @main = true\n\n if args && args[:exec]\n cmd = \"#{args[:exec]}\"\n else\n if RbConfig::CONFIG[\"bindir\"]\n cmd = \"#{RbConfig::CONFIG[\"bindir\"]}/ruby\"\n else\n cmd = \"ruby\"\n end\n end\n\n cmd << \" \\\"#{File.realpath(File.dirname(__FILE__))}/../scripts/ruby_process_script.rb\\\" --pid=#{@my_pid}\"\n cmd << \" --debug\" if @args[:debug]\n cmd << \" \\\"--title=#{@args[:title]}\\\"\" unless @args[:title].to_s.strip.empty?\n\n #Start process and set IO variables.\n require \"open3\"\n @io_out, @io_in, @io_err = Open3.popen3(cmd)\n @io_out = Tsafe::Proxy.new(obj: @io_out)\n @io_out.sync = true\n @io_in.sync = true\n @io_err.sync = true\n\n started = false\n @io_in.each_line do |str|\n if str == \"ruby_process_started\\n\"\n started = true\n break\n end\n\n debug \"Ruby-process-debug from stdout before started: '#{str}'\\n\" if @debug\n end\n\n raise \"Ruby-sub-process couldnt start: '#{@io_err.read}'.\" unless started\n self.listen\n\n #Start by getting the PID of the process.\n begin\n @pid = self.static(:Process, :pid).__rp_marshal\n raise \"Unexpected PID: '#{@pid}'.\" if !@pid.is_a?(Fixnum) && !@pid.is_a?(Integer)\n rescue => e\n self.destroy\n raise e\n end\n\n if block_given?\n begin\n yield(self)\n ensure\n self.destroy\n end\n\n return self\n else\n return self\n end\n end",
"def fork_exec(command, *args)\n # Remove empty args\n args.select! { |arg| arg != \"\" }\n args.flatten!\n pid = fork do\n Kernel.exec(command, *args)\n end\n Process.wait(pid)\nend",
"def start_new_child(child_spec)\n @child_specs[child_spec.child_id] = child_spec\n self.start_process(child_spec.child_id)\n end",
"def _spawn\n t = Thread.new do\n catch(:die) do\n loop do\n begin\n io = IO.popen(\"#{@ruby} #{@tmp.path}\", 'r')\n cid = Integer(line = io.gets)\n\n @cids.sync {@cids << cid} if cid > 0\n Process.wait cid\n rescue SystemCallError # if the child has already died\n rescue Exception => err\n child_err = Marshal.load(line) rescue nil\n err = child_err unless child_err.nil?\n\n STDERR.puts err.inspect\n STDERR.puts err.backtrace.join(\"\\n\")\n throw :die\n ensure\n line = io.read\n child_err = Marshal.load(line) rescue nil\n\n io.close rescue nil\n @cids.sync {\n @cids.delete cid\n throw :die unless @cids.length < @spawn or child_err\n }\n raise child_err unless child_err.nil?\n end\n\n throw :die if @stop\n sleep @pause\n\n end # loop\n end # catch(:die)\n end # Thread.new\n\n @group.add t\n t\n end",
"def new_command_runner(*args, &block)\n Commander::Runner.instance_variable_set :@instance, Commander::Runner.new(args)\n program :name, 'test'\n program :version, '1.2.3'\n program :description, 'something'\n create_test_command\n yield if block\n Commander::Runner.instance\nend",
"def create_process(command, stdin, stdout, stderror)\n params = [\n 'L', # IN LPCSTR lpApplicationName\n 'P', # IN LPSTR lpCommandLine\n 'L', # IN LPSECURITY_ATTRIBUTES lpProcessAttributes\n 'L', # IN LPSECURITY_ATTRIBUTES lpThreadAttributes\n 'L', # IN BOOL bInheritHandles\n 'L', # IN DWORD dwCreationFlags\n 'L', # IN LPVOID lpEnvironment\n 'L', # IN LPCSTR lpCurrentDirectory\n 'P', # IN LPSTARTUPINFOA lpStartupInfo\n 'P'] # OUT LPPROCESS_INFORMATION lpProcessInformation\n\n startupInfo = [STARTUP_INFO_SIZE, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,\n STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW, 0,\n 0, 0, stdin, stdout, stderror].pack('IIIIIIIIIIIISSIIII')\n\n processInfo = [0, 0, 0, 0].pack('IIII')\n command << 0\n\n createProcess = Win32API.new(\"kernel32\", \"CreateProcess\", params, 'I')\n raise_last_win_32_error if createProcess.call(0,\n command, 0, 0, 1, 0, 0, 0, startupInfo, processInfo).zero?\n\n hProcess, hThread, dwProcessId, dwThreadId = processInfo.unpack('LLLL')\n\n close_handle(hProcess)\n close_handle(hThread)\n\n [dwProcessId, dwThreadId]\n end",
"def fork(&block)\n Kernel.fork(&block)\n end",
"def execute_in_shell(&block)\n self.instance_eval(&block)\n end",
"def do_fork(arg)\n r, w = IO.pipe\n pid = Process.spawn(arg, out: w)\n Process.detach pid\n puts 'spawned process under pid: ' + pid.to_s\n w.close\n r.close\n false\n end",
"def run(*arguments, **options)\n\t\t\tFiber.new do\n\t\t\t\texit_status = self.spawn(*arguments, **options)\n\t\t\t\t\n\t\t\t\tyield exit_status if block_given?\n\t\t\tend.resume\n\t\tend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the status of the pid by calling ps. Returns the recieved values as a Hash. If the process has already completed, the hash contains the Proces::Status object and any keys prefilled that it can.. The optional argument supplies an array of fields to parse. The default fields work on OS X 10.5 and Ubuntu 7. There are few instances where changing them is useful. | def status(fields=['pid','ppid','stat','xstat','%cpu','%mem','rss','etime','ruser','command'])
return {'Process::Status' => @status, 'PID' => @status.pid, 'XSTAT' => @status.exitstatus} if @status
result = `ps -p #{@pid} -o #{fields.join(',')}`
lines = result.split("\n")
if lines[1]
header = lines[0].strip.split(/\s+/)
values = lines[1].strip.split(/\s+/,header.length)
return Hash[ *(header.zip(values).flatten) ]
else
return {}
end
end | [
"def get_status\n # path = option(:path_to_pmta)\n output = `/usr/sbin/pmta --dom show status`\n status = {}\n output.each do |line|\n name, value = line.split('=')\n next if name.nil? or value.nil?\n status[name] = value.chomp[1...-1] # remove trailing LF and quotes\n end\n status\n end",
"def count_processes_by_status(ps_table)\n list_proc = {}\n %w[S R D T t X Z].each do |v|\n list_proc[v] = 0\n end\n list_proc['I'] = 0 if config[:idle_state]\n if ps_table.first.respond_to?(:state)\n ps_table.each do |pr|\n state = pr[:state]\n if state == 'I'\n state = 'D' unless config[:idle_state]\n end\n list_proc[state] += 1\n end\n end\n list_proc\n end",
"def collect_process_info\n process = {}\n cmdline_file = \"/proc/#{Process.pid}/cmdline\"\n\n # If there is a /proc filesystem, we read this manually so\n # we can split on embedded null bytes. Otherwise (e.g. OSX, Windows)\n # use ProcTable.\n if File.exist?(cmdline_file)\n cmdline = IO.read(cmdline_file).split(?\\x00)\n else\n cmdline = ProcTable.ps(Process.pid).cmdline.split(' ')\n end\n\n if RUBY_PLATFORM =~ /darwin/i\n cmdline.delete_if{ |e| e.include?('=') }\n process[:name] = cmdline.join(' ')\n else\n process[:name] = cmdline.shift\n process[:arguments] = cmdline\n end\n\n process[:pid] = Process.pid\n # This is usually Process.pid but in the case of containers, the host agent\n # will return to us the true host pid in which we use to report data.\n process[:report_pid] = nil\n process\n end",
"def get_ps_info args={}, &block\n return if OS.windows?\n\n pid = args[:pid]\n\n EM.system('sh', proc{ |process|\n process.send_data \"ps auxw | grep \" + pid.to_s + \" | grep -v 'grep'\\n\"\n process.send_data \"exit\\n\"\n }) { |output, status|\n if status.exitstatus == 0\n format args, output, &block\n else\n block.call status, nil if block\n end\n }\n end",
"def list_processes\n check_connection\n @fields = @protocol.process_info_command\n @result_exist = true\n store_result\n end",
"def get_proc_stat_info\n hash = {}\n\n File.readlines('/proc/stat').each do |line|\n info = line.split\n unless info.empty?\n if info.first =~ /^cpu/i\n hash[info.first.to_sym] = {\n :user => info[1].to_i,\n :nice => info[2].to_i,\n :system => info[3].to_i,\n :idle => info[4].to_i,\n :iowait => info[5].to_i,\n :irq => info[6].to_i,\n :softirq => info[7].to_i,\n :steal => info[8].to_i,\n :guest => info[9].to_i,\n :guest_nice => info[10].to_i\n }\n elsif info.size > 2\n hash[info.first.to_sym] = info[1..-1].map(&:to_i)\n else\n hash[info.first.to_sym] = info[1].to_i\n end\n end\n end\n\n hash\n end",
"def parse_ps(line)\n\t\tm = line.split(\" \", 6)\n\t\tparams = {}\n\t\tparams[:pid] = m[0]\n\t\tparams[:uid] = m[1]\n\t\tparams[:parent_pid] = m[2].to_i\n\t\tparams[:mem] = m[3].to_i\n\t\tparams[:cpu] = m[4].to_i\n\t\tparams[:cmdline] = m[5]\n\t\tparams[:command] = params[:cmdline].split(\" \").first\n\t\tparams\n\tend",
"def all_processes\n `ps -eo pid,ppid`.lines.reduce(Hash.new []) do |hash, line|\n pid, ppid = line.split.map(&:to_i)\n hash[ppid] = [] unless hash.key?(ppid)\n hash[ppid] << pid\n hash\n end\n end",
"def ps1(field)\n `ps -o #{field}= -p #{pid}`.strip\n end",
"def status\n s = {\n :name => self.name,\n :pid_path => @pid_path,\n :monitor_url => @config[:monitor_url],\n :config_file => @config_file,\n :logs => @logs,\n :env => `env`.split(\"\\n\"),\n :workers => {}\n }\n \n @workers.each do |k,worker|\n s[:workers][k] = worker.status\n end\n \n s\n end",
"def get_process_stat\n self.get_all_pid.each do |pid|\n uid = self.get_uid_of_pid(pid)\n username = Etc::getpwuid(uid).name\n\n statline = IO.read(\"/proc/#{pid}/stat\")\n stat = statline.split(' ')\n #time = stat[13].to_i+stat[14].to_i+stat[15].to_i+stat[16].to_i\n time = stat[13].to_i+stat[14].to_i\n if (!@currprocstat.has_key?(username))\n @currprocstat[username] = 0\n end\n @currprocstat[username] = @currprocstat[username] + time \n\n iowait = stat[41].to_i\n if (!@currprociowait.has_key?(username))\n @currprociowait[username] = 0\n end\n @currprociowait[username] += iowait\n end\n end",
"def get_status\n r = {}\n if have_lock?\n @handle.rewind\n r[:message] = (@handle.eof? ? 'The current process is busy.' : @handle.readline.strip)\n r[:percent] = (@handle.eof? ? '' : @handle.readline.strip)\n r[:locked] = true\n elsif is_locked?\n if File.exist?(status_file_path)\n begin\n File.open(status_file_path, 'r') do |f|\n r[:message] = (f.eof? ? 'The system is busy.' : f.readline.strip)\n r[:percent] = (f.eof? ? '' : f.readline.strip)\n end\n rescue\n r[:message] = 'The system appears busy.'\n r[:percent] = ''\n end\n else\n r[:message] = 'No status file.'\n r[:percent] = ''\n end\n r[:locked] = true\n else\n r[:message] = 'The system is no longer busy.'\n r[:percent] = '-'\n r[:locked] = false\n end\n r\n end",
"def ps\n `ps haxo pid,ppid,cmd`\n end",
"def processes()\n\t\t\t\tprocesses = ProcessList.new()\n\t\t\t\tprocesslist = `ps auxww`\n\t\t\t\tprocessregex = /^(\\S+)\\s+([0-9]+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(\\S+)\\s+(.*)$/\n\t\t\t\tprocesslist.each() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = processregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tinfo = ProcessInfo.new()\n\t\t\t\t\t\tinfo.username = match[1]\n\t\t\t\t\t\tinfo.pid = match[2].to_i()\n\t\t\t\t\t\tinfo.flags = match[8]\n\t\t\t\t\t\tinfo.starttime = match[9]\n\t\t\t\t\t\tinfo.runtime = match[10]\n\t\t\t\t\t\tinfo.program = match[11]\n\t\t\t\t\t\tinfo.cpu = match[3].to_f()\n\t\t\t\t\t\tinfo.mem = match[4].to_f()\n\t\t\t\t\t\tif(processes.has_key?(info.pid))\n\t\t\t\t\t\t\traise(DuplicateProcessError, \"Process #{info.pid} appeared twice in the process listing\")\n\t\t\t\t\t\tend\n\t\t\t\t\t\tprocesses[info.pid] = info\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn(processes)\n\t\t\tend",
"def parse_service_status_struct(lpServiceStatus)\n if lpServiceStatus\n vals = lpServiceStatus.unpack('V*')\n return {\n :type => vals[0],\n :state => vals[1],\n :controls_accepted => vals[2],\n :win32_exit_code => vals[3],\n :service_exit_code => vals[4],\n :check_point => vals[5],\n :wait_hint => vals[6]\n }\n else\n return nil\n end\n end",
"def list_pids\n access_processes do |processes|\n processes.keys\n end\n end",
"def status\n @status = begin\n if pidfile_exists? and process_running?\n 0\n elsif pidfile_exists? # but not process_running\n 1\n else\n 3\n end\n end\n\n return @status\n end",
"def waitpid(pid, opt=1)\n pstatus = (\"\\x00\"*SIZEOFINT).to_ptr\n r = CALLS[\"libc!waitpid:IPI=I\"].call(pid, pstatus, opt).first\n raise SystemCallError.new(\"waitpid\", DL.last_error) if r== -1\n \n # maybe I should return a Hash?\n return [r, pstatus.to_s(SIZEOFINT).unpack('i_').first]\n end",
"def get_full_ps_info(pid)\n ps_fullcmd = @ps_fullcmd_fmt % pid\n # p ps_fullcmd\n output = `#{ps_fullcmd}`\n return output\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Returns true and destroys this instance if the plaintext code is authentic, false otherwise. | def authenticate_code(plaintext_code)
!!(destroy if super)
end | [
"def encrypted?(text); end",
"def encrypted?\r\n if @encrypted\r\n return true\r\n else\r\n return false\r\n end\r\n end",
"def can_decrypt?\n false\n end",
"def encrypted?(text)\n deserialize_message(text)\n true\n rescue Errors::Encoding, *DECRYPT_ERRORS\n false\n end",
"def valid?\n auth = Digest::MD5.digest([@code, @identifier, @length,\n @raw_attributes, @secret].pack(\"CCnx16a*a*\"))\n return auth == @authenticator\n end",
"def close_encrypter\n @encrypter.close if @encrypter\n\n true\n end",
"def challenge_readable?\n cryptography_provider.respond_to? :decrypt\n end",
"def authenticated?(code_token)\n return false if code_digest.nil?\n BCrypt::Password.new(code_digest).is_password?(code_token)\n end",
"def authenticate?\n authenticate != DEFAULT_AUTHENTICATE\n end",
"def decrypt\n return false if !has_cryptographic_variables?\n\n decrypt_result = @backup.decrypter.decrypt(@crypto_salt, \n @crypto_iterations, \n @crypto_key, \n @crypto_iv, \n @crypto_tag, \n @encrypted_data, \n \"Apple Note: #{@note_id}\")\n\n # If we made a decrypt, then kick the result into our normal process to extract everything\n if decrypt_result\n @crypto_password = decrypt_result[:password]\n @compressed_data = decrypt_result[:plaintext]\n decompress_data\n extract_plaintext if @decompressed_data\n replace_embedded_objects if @plaintext\n end\n\n return (plaintext != false)\n end",
"def authenticated?(cleartext_secret)\n Password.new(crypted_secret) == cleartext_secret\n end",
"def secure?\n self.generated_signature == self.signature\n end",
"def authok?\n @authok\n end",
"def valid?\n return false if raw_payload.nil? || raw_payload.empty?\n return false if raw_authentication.nil? || raw_authentication.empty?\n return false unless json_valid?\n\n Authentication.valid?(raw_authentication, json_payload)\n end",
"def authenticate!(passcode)\n\n # Always run bcrypt first so that we incur the time penalty\n bcrypt_valid = BCrypt::Password.new(self.passcode) == passcode\n\n # Reject if currently locked\n return false if self.locked?\n\n # Clear strikes and consume the passcode if the passcode was valid.\n # Reject and incur a strike if the challenge was failed.\n if bcrypt_valid && Time.current < self.passcode_expires_at\n self.consume_passcode!\n return true\n else\n self.accrue_strike!\n return false\n end\n\n end",
"def validate_code_verifier\n return true unless pkce_supported?\n return grant.code_challenge.blank? if code_verifier.blank?\n\n if grant.code_challenge_method == \"S256\"\n grant.code_challenge == generate_code_challenge(code_verifier)\n elsif grant.code_challenge_method == \"plain\"\n grant.code_challenge == code_verifier\n else\n false\n end\n end",
"def validate\n encrypt\n end",
"def encrypted?\n decode_body unless defined?(@salt)\n # The header not matching is a dead giveaway that the file isn't what\n # we're expecting. That, however, probably isn't enough so we'll check\n # the HMAC for presence and length since it's very unlikely that\n # decoding the file body will result in multiple chunks AND the second\n # one being the correct length for a SHA256 HMAC.\n @header == FILE_HEADER && !@hmac.nil? && @hmac.bytesize == 64\n end",
"def encrypted?\n key?('encrypted_data') && self['encrypted_data'].is_a?(Hash)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
def total_salaries total_salaries = 0 | def total_salaries
@reporters.keys.reduce(0) do |sum, name|
sum + salary_for(name)
end
end | [
"def total_salaries\n\t\t\t# What to determine the total salaries as we add any new reporters\n\t\t\t# First get the keys for the reporters\n\t\t\tsalaries = @reporters.keys.map {|reporter| salary_for(reporter)}\n\t\t\tsalaries.each {|salary| @overhead+=salary}\n\t\tend",
"def salary_advance\n advs = @faculty.employee_advance_payments.belongs_to_month(@generation_date.strftime(\"%b\")).belongs_to_year(@generation_date.strftime(\"%Y\"))\n advs.inject(0){|sum, adv| sum+adv.amount_in_rupees}\n end",
"def total_salary(employees)\n total = 0\n employees.each do |employee|\n # Don't know/care what kind of `Employee` (regular, Manager,\n # or CEO) this is. We can treat them all the same.\n total += employee.wage\n end\n total \nend",
"def salary_total\n employees.map {|e| e.salary}.reduce(:+)\n end",
"def salary_advance\n advs = @employee.employee_advance_payments.belongs_to_month(@generation_date.strftime(\"%b\")).belongs_to_year(@generation_date.strftime(\"%Y\"))\n advs.inject(0){|sum, adv| sum+adv.amount_in_rupees}\n end",
"def total_salary(employees)\n total = 0\n employees.each do |employee|\n # Don't know/care what kind of `Employee` (regular, Manager,\n # or CEO) this is. We can treat them all the same.\n total += employee.wage\n end\nend",
"def total\n roll if @total.nil?\n\n @total\n end",
"def calculate_total_salary\n @player[:sueldo].to_i + total_bonus_amount\n end",
"def total_sales\n sales_receipts.sum(\"amount\")\n end",
"def total_age\n reduce(0) { |total, llama|\n total + llama.age\n }\n end",
"def department_raise\n total_salary + 8000\n end",
"def total_calories\n\t\tmy_meals.to_a.sum { |item| item.total_calories }\n\tend",
"def calc_annual_income\n @total_income =+ @rent\n\n end",
"def total_all \n subtotals.sum \n end",
"def total_calorie\n sum = 0\n food_meals.each do |food_meal|\n sum += food_meal.food.calorie\n end\n return sum\n end",
"def total\n @total\n end",
"def total_students\n students = 0\n self.booked_customers.each do |school|\n students += school.number_students\n end\n return students\n end",
"def total\n @total\n end",
"def total\n amount\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
def find_reporters_with_skill(skill) reporters_with_skill = [] | def find_reporters_with_skill(skill)
reporters_with_skill = @reporters.select do |name, skills|
skills.include?(skill)
end
reporters_with_skill.keys
end | [
"def get_skills(locator, freelancer)\n find_all(locator, freelancer).map {|skill| skill.text}\n end",
"def find_skill(name)\r\n find_pokemon(name, 6, GameData::Skill.all)\r\n end",
"def find_matching_partners(options={})\n list = self.want_expertise_list\n Person.find_tagged_with(list, {\n :on => 'have_expertises',\n :conditions => [\"people.id <> ?\", self.id]\n }.merge_finder_options(options.merge_finder_options(Person.find_options_for_partner_status)))\n end",
"def reportable_questions\n self.questions.find_all{|q| q.adequate_responses?}\n end",
"def get_profile_skills\n profile_skills = find_elements PROFILE_SKILLS_LOCATOR\n get_skills profile_skills\n end",
"def qualified_candidates (collection)\n match=[]\n \n collection.each do |x|\n if years_of_experience(x[:years_of_experience]) && github_points(x[:github_points]) && knowledge(x[:languages]) && applied_time(x[:date_applied]) && old_enough(x[:age])\n match << (x)\n end\n end\n\n match\nend",
"def search name_list=nil, skill_list=nil \t\t\n\t\t\tname_matches = name_list ? User.name_search(name_list) : []\n\t\t\t\n\t\t\tif skill_list\n\t\t\t\tskills = User.skill_search(skill_list)\n\t\t\t\tskill_matches = skills.keys\n\t\t\telse\n\t\t\t\tskill_matches = []\n\t\t\tend\n\t\t\tmatches = User.find (name_matches + skill_matches).uniq\n\t\t\tif skill_list\n\t\t\t\tmatches = matches.sort_by do |match|\n\t\t\t\t\tif skills[match.id]\n\t\t\t\t\t\t# += 1?\n\t\t\t\t\t\tskills[match.id]\n\t\t\t\t\telse\n\t\t\t\t\t\t0\n\t\t\t\t\tend\n\t\t\t\tend.reverse.select {|match| skills[match.id]}\n\t\t\t\tif name_list\n\t\t\t\t\tmatches = matches.select do |match| \n\t\t\t\t\t\t!(name_list.map(&:downcase) & (match.name.downcase.split)).empty?\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tmatches\n\t\t\telse\n\t\t\t\tother_skills = User.find(name_matches).map do |user|\n\t\t\t\t\t[user, user.skills.pluck(:name)]\n\t\t\t\tend\n\t\t\t\tsought_skills = needed_skills.pluck(:name)\n\t\t\t\tother_skills = other_skills.sort_by do |user_skill|\n\t\t\t\t\t(user_skill[1] & sought_skills).length\n\t\t\t\tend\n\t\t\t\tother_skills.map {|user_skill| user_skill[0]}.flatten.reverse\n\t\t\tend\t\t\t\n\tend",
"def skillsNeeded\n\t\t[]\n\tend",
"def get_new_skills(level)\n self.skills.select do |skill|\n skill.min_level == level\n end\n end",
"def skills\n skills = Hash.new\n keys = [\"Social innovation\", \"Teaching & training\", \"Consultancy\", \"Practice based research\", \"Creative research\"]\n if(criteria != nil)\n (1..5).map{|n| \n key = keys[n -1]\n value = criteria[\"skill#{n}\"]\n if(value && value.length > 0)\n skills[key] = value\n end\n }\n end\n return skills \n end",
"def recommend_exhibits(patron)\n patron_exhibits = []\n patron.interests.each do |interest|\n @exhibits.each do |exhibit|\n if exhibit.name.include?(interest)\n patron_exhibits << exhibit\n end\n end\n end\n patron_exhibits\n end",
"def do_search_report (report_serach_result, object_type, object_id, ll_id)\n\t\t\t\treport_serach_unique = report_serach_result.select{|report| report['object_type'] == object_type and report[ll_id] == object_id }\n\t\t\t\treturn report_serach_unique.uniq{|x| x['log_id']}\n\t\t\tend",
"def project_matched_skills(matched_volunteers,project)\n @volunteers_fifty = matched_volunteers\n # to remove duplicates from array\n @volunteers_twentyfive = (@volunteers_fifty - @volunteers_twentyfive) \n @fifty = false \n matched_skills = []\n project.skills.each do |project_skill|\n @matched_volunteers.joins(:skills).where(\"skills.id = ?\", project_skill.id).each do |volunteer|\n matched_skills << volunteer.id\n end\n end\n\n if matched_skills.count > 0 \n @matched_volunteers = Volunteer.where(:id => matched_skills)\n else\n @fifty = true #50% match only\n end\n end",
"def professors\n accounts.select! { |account| account['position']['hierarchy'] == 7 }\n end",
"def tiddlers_with_tag(tag)\n @tiddlers.select{|t| t.has_tag(tag)}\n end",
"def matched_skills(volunteer,matched_projects)\n @projects_fifty = matched_projects\n # to remove duplicates from array\n @projects_twentyfive = (@projects_fifty - @projects_twentyfive) \n @fifty = false\n matched_skills = []\n volunteer.skills.each do |volunteer_skill|\n matched_projects.joins(:skills).where(\"skills.id = ?\", volunteer_skill.id).each do |project|\n matched_skills << project.id\n end\n end\n if matched_skills.count > 0\n @matched_projects = Project.where(:id => matched_skills)\n else\n @fifty = true #50% match only\n end\n end",
"def test_supportSkill\n f = SkillFilter.new(\"support\", true)\n new_list = @usableItems.find_all{|x| f.apply(x)}\n return new_list.size == 29\n end",
"def battlers_group(group)\n return (battlers.find_all {|battler| battler.ai.group == group})\n end",
"def find_matching_people(options={})\n list = self.have_expertise_list\n Person.find_tagged_with(list, {\n :on => 'want_expertises',\n :conditions => [\"people.id <> ?\", self.id]\n }.merge_finder_options(options.merge_finder_options(Person.find_options_for_member_status)))\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
provides a way to specify `double.class.name` easily | def classy_double(klass, options)
double(klass, options.merge(class: double_class(klass)))
end | [
"def class_double(doubled_class, *args); end",
"def get_double(attr); end",
"def object_double(object_or_name, *args); end",
"def register_double(double)\n @doubles << double\n end",
"def doubles_by_method_name; end",
"def class_name\n (self.type.to_s || self.class.name).demodulize\n end",
"def classname\n @data['driver-class-name']\n end",
"def set_double(attr, val); end",
"def derive_class_name\n return (options[:class_name] ? options[:class_name].to_s : expanded_name).classify\n end",
"def actual_class_name\n class_name.singularize\n end",
"def full_class_name\n end",
"def class_instrument\n self.class.to_s.downcase.split(\"::\").last.to_sym\n end",
"def quote_class(value)\n quote_string(value.name)\n end",
"def class_by_name name\n # http://stackoverflow.com/questions/14070369/how-to-instantiate-class-from-name-string-in-rails\n Object.const_get name.to_s\n\n end",
"def class_name\n name = @klass.name\n name.name\n end",
"def create_measure_double name:, unit:, description: nil\n MeasureRegistry.register(\n name: name,\n unit: unit,\n type: Measure::DOUBLE_TYPE,\n description: description\n )\n end",
"def method_missing(sym, *args, &block)\n return @klass_hash[sym.to_s]\n end",
"def late_binding_class_option(opts, default)\n case opts[:class]\n when String, Symbol\n # Delete :class to allow late binding\n class_name = opts.delete(:class).to_s\n\n if (namespace = opts[:class_namespace]) && !class_name.start_with?('::')\n class_name = \"::#{namespace}::#{class_name}\"\n end\n\n opts[:class_name] ||= class_name\n when Class\n opts[:class_name] ||= opts[:class].name\n end\n\n opts[:class_name] ||= '::' + ((name || '').split(\"::\")[0..-2] + [camelize(default)]).join('::')\n end",
"def feature_as_class(feature_name)\n \"with_#{feature_name.to_s}\" if has_feature?(feature_name)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Readline History prevent empty and dups records 1. Read a line and append to history 2. Quick Break on nil 3. Remove from history if empty or dup | def readline_with_hist_management
line = Readline.readline('> ', true)
return nil if line.nil?
if line =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == line
Readline::HISTORY.pop
end
line
end | [
"def sanitize_readline_history(line)\n return unless readline_supported? \n # Strip out empty lines\n Readline::HISTORY.pop if line.match(/^\\s*$/)\n # Remove duplicates\n Readline::HISTORY.pop if Readline::HISTORY[-2] == line rescue IndexError\n end",
"def readline_with_hist_management(prompt = \"> \")\n line = Readline.readline(prompt, true)\n return \"\" if line.nil?\n if line =~ /^\\s*$/ or Readline::HISTORY.to_a[-2] == line\n Readline::HISTORY.pop\n end\n line\nend",
"def push(line)\n unless line.empty? || (@history.last && line.strip == @history.last.strip)\n Readline::HISTORY << line\n @history << line\n end\n line\n end",
"def add_to_history(item)\n found = nil\n Readline::HISTORY.each_with_index do |h,i|\n if h == item\n found = i\n break\n end\n end\n Readline::HISTORY.delete_at(found) if found\n Readline::HISTORY.push(item)\nend",
"def history_retrieve()\n lines = []\n open(HISTORY_FILENAME, 'a+') do |fh|\n while line = fh.gets\n lines.push line.strip\n end\n end\n limit = [ lines.length, MAX_HISTORY ].min\n lines[-limit .. -1].each { |line| Readline::HISTORY.push line }\nrescue => e\n STDERR.puts \"Error encountered when reading history from #{HISTORY_FILENAME}: #{e}\"\nend",
"def read_history\n return super if History.disabled?\n File.exist?(history_file_path) && history.empty? &&\n File.readlines(history_file_path).each{ |e| history << e.chomp }\n end",
"def append_history(str)\r\n return if @options[:no_blanks] && str.strip.empty?\r\n\r\n if history.include?(str)\r\n if @options[:no_dups]\r\n return if @options[:no_move]\r\n\r\n history.delete(str)\r\n end\r\n end\r\n\r\n history << str\r\n end",
"def readline_with_history\n line = Readline.readline(@prompt, true)\n return nil if line.nil?\n\n if line =~ /\\A\\s*\\z/ || (Readline::HISTORY.size > 1 &&\n Readline::HISTORY[-2] == line)\n Readline::HISTORY.pop\n end\n\n line\n rescue Interrupt\n # This is raised by Ctrl-C. Remove the line from history then try to\n # read another line.\n puts \"^C\"\n Readline::HISTORY.pop\n @line -= 1\n retry\n end",
"def history_save()\n limit = [ Readline::HISTORY.length, MAX_HISTORY ].min\n open(HISTORY_FILENAME, 'w') do |fh|\n fh.write Readline::HISTORY.entries[-limit .. -1].join(\"\\n\")\n end\nrescue => e\n STDERR.puts \"Error encountered when saving history to #{HISTORY_FILENAME}: #{e}\"\nend",
"def read_history\n\t\thistfile = HISTORY_FILE.expand_path\n\n\t\tif histfile.exist?\n\t\t\tlines = histfile.readlines.collect {|line| line.chomp }\n\t\t\tself.log.debug \"Read %d saved history commands from %s.\" % [ lines.length, histfile ]\n\t\t\tReadline::HISTORY.push( *lines )\n\t\telse\n\t\t\tself.log.debug \"History file '%s' was empty or non-existant.\" % [ histfile ]\n\t\tend\n\tend",
"def read_history\n\t\t\thistfile = HISTORY_FILE.expand_path\n\n\t\t\tif histfile.exist?\n\t\t\t\tlines = histfile.readlines.collect {|line| line.chomp }\n\t\t\t\tself.log.debug \"Read %d saved history commands from %s.\" % [ lines.length, histfile ]\n\t\t\t\tReadline::HISTORY.push( *lines )\n\t\t\telse\n\t\t\t\tself.log.debug \"History file '%s' was empty or non-existant.\" % [ histfile ]\n\t\t\tend\n\t\tend",
"def clear_history\n while ! Readline::HISTORY.empty? do\n Readline::HISTORY.pop\n end\n end",
"def line_repeated?(line)\n if line =~ /^\\s*$/ or Readline::HISTORY.to_a[-2] == line\n Readline::HISTORY.pop\n return true\n else\n return false\n end\n end",
"def readline(message = '> ')\n input = Readline.readline(message, false).strip\n Readline::HISTORY << input unless input.empty?\n input\n end",
"def rl_maybe_save_line()\r\n if @_rl_saved_line_for_history.nil?\r\n @_rl_saved_line_for_history = Struct.new(:line,:timestamp,:data).new\r\n @_rl_saved_line_for_history.line = @rl_line_buffer.dup\r\n @_rl_saved_line_for_history.timestamp = nil\r\n @_rl_saved_line_for_history.data = @rl_undo_list\r\n end\r\n 0\r\n end",
"def history_read column, default=nil\n values = []\n oldstr = \"\"\n if !defined? $history_hash\n require 'readline'\n require 'yaml'\n filename = File.expand_path \"~/.bugzy_history.yml\"\n $history_filename = filename\n # if file exists with values push them into history\n if File.exists? filename\n $history_hash = YAML::load( File.open( filename ) )\n else\n $history_hash = Hash.new\n end\n end\n values.push(*$history_hash[column]) if $history_hash.has_key? column\n # push existing value into history also, so it can be edited\n values.push(default) if default\n values.uniq!\n Readline::HISTORY.clear # else previous values of other fields also come in\n Readline::HISTORY.push(*values) unless values.empty?\n #puts Readline::HISTORY.to_a\n end",
"def copy_history\n history = Readline::HISTORY.entries\n index = history.rindex(\"exit\") || -1\n content = history[(index+1)..-2].join(\"\\n\")\n puts content\n copy content\nend",
"def replace_history_entry (which, line, data)\r\n if (which < 0 || which >= @history_length)\r\n return nil\r\n end\r\n temp = Struct.new(:line,:timestamp,:data).new\r\n old_value = @the_history[which]\r\n temp.line = line.delete(0.chr)\r\n temp.data = data\r\n temp.timestamp = old_value.timestamp.dup\r\n @the_history[which] = temp\r\n old_value\r\n end",
"def push_to_readline(line)\n Readline::HISTORY << line\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a request is made to fetch the historic pricing details for a udprn curl XGET H "ContentType: application/json" ' | def historic_pricing
raise "Error"
details = PropertyDetails.historic_pricing_details(params[:udprn].to_i)
render json: details, status: 200
end | [
"def pricing_history\n history_data = PropertyService.new(params[:udprn].to_i).calculate_pricing_history\n render json: history_data, status: 200\n end",
"def get_warranty(serial = \"\", proxy = \"\")\n serial = serial.upcase\n warranty_data = {}\n raw_data = open('https://selfsolve.apple.com/warrantyChecker.do?sn=' + serial.upcase + '&country=USA', :proxy => \"#{proxy}\")\n warranty_data = JSON.parse(raw_data.string[5..-2])\n\n puts \"\\nSerial Number:\\t\\t#{warranty_data['SERIAL_ID']}\\n\"\n puts \"Product Decription:\\t#{warranty_data['PROD_DESCR']}\\n\"\n puts \"Purchase date:\\t\\t#{warranty_data['PURCHASE_DATE'].gsub(\"-\",\".\")}\"\n\n unless warranty_data['COV_END_DATE'].empty?\n puts \"Coverage end:\\t\\t#{warranty_data['COV_END_DATE'].gsub(\"-\",\".\")}\\n\"\n else\n puts \"Coverage end:\\t\\tEXPIRED\\n\"\n end\n end",
"def free_claim_preview\n @free_discount=JSON.parse RestClient.get $api_service+\"/claims/free_discount_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\" \n end",
"def purchase_return_claim_preview\n #@purchase_return_claims=(JSON.parse RestClient.get $api_service+'/purchasereturn_claim?claim_no='+params[:claim_no])\n @purchase_return_claims=JSON.parse RestClient.get $api_service+\"/claims/purchase_return_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\"\n end",
"def info_premium\n render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200\n end",
"def prepare_http_requests\n {\n label: :uber_prices,\n url: @uber_api_service.estimates_price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @uber_api_service.headers \n }\n }\n end",
"def buyer_profile_stats\n buyer_profile_stats = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).buyer_profile_stats\n render json: buyer_profile_stats, status: 200\n end",
"def fetch_data\n resp = HTTParty.get(\"http://data.mtgox.com/api/1/BTCUSD/ticker\")\n buy = resp[\"return\"][\"buy\"][\"display\"]\n sell = resp[\"return\"][\"sell\"][\"display\"]\n \n return {:buy => buy, :sell => sell}\nend",
"def rate_claim_preview\n \n @rate_change=JSON.parse RestClient.get $api_service+\"/claims/rate_change_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\" \n end",
"def fetch\n HTTP.get(\"https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=#{@symbol}&apikey=NH1E83T56P88YY0U\")\n .then do |resp|\n mutate @status = :success, @price = resp.json[\"Global Quote\"][\"05. price\"]\n @time = Time.now # Time.at(resp.json[:delayedPriceTime] / 1000) No longer provides time\n after(@update_interval) { fetch }\n end\n .fail do |resp|\n mutate @status = :failed, @reason = resp.body.empty? ? 'Network error' : resp.body\n after(@update_interval) { fetch } unless @reason == 'Unknown symbol'\n end\n end",
"def expiry_claim_preview\n @expiry_damage=JSON.parse RestClient.get $api_service+\"/claims/expiry_damage_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\"\n end",
"def retrieve_rates(date)\n path = \"http://openexchangerates.org/api/historical/#{date.to_s}.json?app_id=#{$app_id}\"\n response = Net::HTTP.get_response(URI.parse path)\n # TODO: error handling\n response.body\nend",
"def fetch_test_economy_details\n get('')\n end",
"def read_api\n begin\n uri = URI('https://www.ecb.europa.eu/stats/eurofxref/eurofxref-hist-90d.xml')\n Net::HTTP.start(uri.host, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new uri\n response = http.request request\n response.body\n end\n rescue => e\n print_exception e\n end\n end",
"def http_raw_notify_data\n {\n \"id\"=>\"b9879d2b-052f-4a0a-8a3f-3e72049e4d19\", \n \"event\"=>\"invoice_paid\", \n \"payload\"=> invoice_data\n }.to_json\n end",
"def agent_properties_vendor_buying_reqs\n property_details = PropertyDetails.details(params[:udprn].to_i)[:_source]\n attr_list = [:min_beds, :max_beds, :min_baths, :max_baths, :min_receptions, :max_receptions, :property_types,\n :status, :buying_status, :funding, :biggest_problems, :chain_free, :budget_from, :budget_to, :locations,\n :mortgage_approval ].map(&:to_s)\n buyer_details = PropertyBuyer.where(vendor_id: property_details[:vendor_id].to_i).select(attr_list).last.as_json\n response = nil\n\n if buyer_details\n buyer_details['status'] = PropertyBuyer::REVERSE_STATUS_HASH[buyer_details['status']]\n buyer_details['buying_status'] = PropertyBuyer::REVERSE_BUYING_STATUS_HASH[buyer_details['buying_status']]\n buyer_details['funding'] = PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer_details['funding']]\n buyer_details['property_tracking'] = Events::Track.where(udprn: params[:udprn].to_i).select(:id).last.nil?\n response = {}\n (attr_list- ['property_tracking', 'chain_free', 'budget_from', 'budget_to']).each { |t| response[\"buyer_#{t}\"] = buyer_details[t] }\n response['property_tracking'] = buyer_details['property_tracking']\n response['chain_free'] = buyer_details['chain_free']\n response['buyer_min_budget'] = buyer_details['budget_from']\n response['buyer_max_budget'] = buyer_details['budget_to']\n end\n\n render json: { buyer_details: response }, status: 200\n end",
"def rate_change_adjustment\n @rate_change=JSON.parse RestClient.get $api_service+\"/claims/rate_change_claim_no?claim_no=#{params[:claim_no]}\" \n end",
"def get_profile(xq_publisher_token, xq_client_token)\n\tLOGGER.info \"get researcher profile from Click-Through Service using publisher_token #{xq_publisher_token}\"\n\tbegin\n\t\tresponse = \tRestClient.get(\"https://apps.crossref.org/clickthrough/api/licenses/#{xq_client_token}\", { :cr_clickthrough_publisher_token => xq_publisher_token })\n\trescue Exception => e\n\t\tLOGGER.error \"error looking up license with Click-Through Service: #{e.http_code}\"\n\t\tcase e.http_code\n\t\twhen 404\n\t\t\traise APITokenNotFound\n\t\twhen 500\n\t\t\traise ClickThroughServiceDown\n\t\telse\n\t\t\traise e\n\t\tend\n\tend\n\treturn JSON.parse response\nend",
"def example_response_gadget_quote\n {\n \"package_name\": \"Theft + comprehensive\",\n \"sum_assured\": 1199900,\n \"base_premium\": 14999,\n \"suggested_premium\": 18749,\n \"created_at\": \"2017-10-12T19:30:45+02:00\",\n \"quote_package_id\": \"f4397823-db4a-4d6a-a06b-08e1a2a3172c\",\n \"module\": {\n \"type\": \"root_gadgets\",\n \"make\": \"Apple\",\n \"model\": \"iPhone 6S 64GB LTE\"\n }\n }.to_json\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
When a request is made to fetch the updated historic pricing details for a udprn(sale price, current valuation, dream price etc) curl XGET H "ContentType: application/json" H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" ' | def pricing_history
history_data = PropertyService.new(params[:udprn].to_i).calculate_pricing_history
render json: history_data, status: 200
end | [
"def historic_pricing\n raise \"Error\"\n details = PropertyDetails.historic_pricing_details(params[:udprn].to_i)\n render json: details, status: 200\n end",
"def rate_change_adjustment\n @rate_change=JSON.parse RestClient.get $api_service+\"/claims/rate_change_claim_no?claim_no=#{params[:claim_no]}\" \n end",
"def rate_claim_preview\n \n @rate_change=JSON.parse RestClient.get $api_service+\"/claims/rate_change_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\" \n end",
"def get_warranty(serial = \"\", proxy = \"\")\n serial = serial.upcase\n warranty_data = {}\n raw_data = open('https://selfsolve.apple.com/warrantyChecker.do?sn=' + serial.upcase + '&country=USA', :proxy => \"#{proxy}\")\n warranty_data = JSON.parse(raw_data.string[5..-2])\n\n puts \"\\nSerial Number:\\t\\t#{warranty_data['SERIAL_ID']}\\n\"\n puts \"Product Decription:\\t#{warranty_data['PROD_DESCR']}\\n\"\n puts \"Purchase date:\\t\\t#{warranty_data['PURCHASE_DATE'].gsub(\"-\",\".\")}\"\n\n unless warranty_data['COV_END_DATE'].empty?\n puts \"Coverage end:\\t\\t#{warranty_data['COV_END_DATE'].gsub(\"-\",\".\")}\\n\"\n else\n puts \"Coverage end:\\t\\tEXPIRED\\n\"\n end\n end",
"def purchase_return_claim_preview\n #@purchase_return_claims=(JSON.parse RestClient.get $api_service+'/purchasereturn_claim?claim_no='+params[:claim_no])\n @purchase_return_claims=JSON.parse RestClient.get $api_service+\"/claims/purchase_return_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\"\n end",
"def free_claim_preview\n @free_discount=JSON.parse RestClient.get $api_service+\"/claims/free_discount_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\" \n end",
"def expiry_claim_preview\n @expiry_damage=JSON.parse RestClient.get $api_service+\"/claims/expiry_damage_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\"\n end",
"def fetch\n HTTP.get(\"https://www.alphavantage.co/query?function=GLOBAL_QUOTE&symbol=#{@symbol}&apikey=NH1E83T56P88YY0U\")\n .then do |resp|\n mutate @status = :success, @price = resp.json[\"Global Quote\"][\"05. price\"]\n @time = Time.now # Time.at(resp.json[:delayedPriceTime] / 1000) No longer provides time\n after(@update_interval) { fetch }\n end\n .fail do |resp|\n mutate @status = :failed, @reason = resp.body.empty? ? 'Network error' : resp.body\n after(@update_interval) { fetch } unless @reason == 'Unknown symbol'\n end\n end",
"def prepare_http_requests\n {\n label: :uber_prices,\n url: @uber_api_service.estimates_price_url([@trip.destination.lat, @trip.destination.lng], [@trip.origin.lat, @trip.origin.lng]),\n action: :get,\n options: {\n head: @uber_api_service.headers \n }\n }\n end",
"def policyRenewal\n\t\treqParams = {:client_id => $client_id.to_s, :token => $token.to_s, :mobileNo => \"9820120461\", :emailId => \"avdhut.vaidya@gmail.com\"}\n\t\trequestStr = URI.parse(\"http://generalinsurance.mybluemix.net/banking/icicibank_general_insurance/getRenewalNotice?#{reqParams.to_query}\")\n\t\tputs requestStr\n\t\tresponseHash = Net::HTTP.get(requestStr).gsub(\"\\\\\", \"\")\n\t\t\n render :json => responseHash\n\tend",
"def expiry_damage_adjustment\n @expiry_damage=JSON.parse RestClient.get $api_service+\"/claims/expiry_damage_claim_no?claim_no=#{params[:claim_no]}\"\n end",
"def bookdevice(token, duration = 5 , id)\n\nuri = URI.parse(\"https://device.pcloudy.com/api/book_device\")\n@toSend = {\n \"token\" => token ,\"duration\"=>duration, \"id\"=>id\n}.to_json\n\nhttps = Net::HTTP.new(uri.host,uri.port)\nhttps.use_ssl = true\n\nreq = Net::HTTP::Post.new(uri.path, initheader = {'Content-Type' =>'application/json'})\n\nreq.body = \"#{@toSend}\"\nres = https.request(req)\nputs \"Response #{res.code} #{res.message}: #{res.body}\"\nbookingdetails = JSON.parse(res.body)\n\nrid = bookingdetails[\"result\"][\"rid\"]\nreturn rid\nend",
"def private_info symbol = 'USD'\n #res = post(\"/api/0/info.php\")\n res = post(\"https://mtgox.com/api/1/generic/private/info\")\n res[\"result\"] == \"success\" ? res[\"return\"] : res\n end",
"def historical_prices_request(options)\n url = \"prices/#{instrument.epic}?#{options.map { |key, value| \"#{key}=#{value.to_s.upcase}\" }.join '&'}\"\n\n @dealing_platform.session.get url, API_V3\n end",
"def get_value\n crypto = (HTTParty.get(\"https://api.coinmarketcap.com/v1/ticker/#{self.alert_id}/\")).parsed_response\n crypto[0]['price_usd']\nend",
"def info_premium\n render json: { value: (PropertyBuyer::PREMIUM_COST*100) }, status: 200\n end",
"def fetch_data\n resp = HTTParty.get(\"http://data.mtgox.com/api/1/BTCUSD/ticker\")\n buy = resp[\"return\"][\"buy\"][\"display\"]\n sell = resp[\"return\"][\"sell\"][\"display\"]\n \n return {:buy => buy, :sell => sell}\nend",
"def hq_price\n @client.request_cmd(\n {\n 'hq_move_get_price' => '',\n 'app_version' => @version\n }\n )\n end",
"def fetch_test_economy_details\n get('')\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
This route provides all the details of the recent enquiries made by the users on this property curl XGET H "ContentType: application/json" H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo0MywiZXhwIjoxNDg1NTMzMDQ5fQ.KPpngSimK5_EcdCeVj7rtIiMOtADL0o5NadFJi2Xs4c" ' | def enquiries
#cache_response(params[:udprn].to_i, [params[:page], params[:buyer_id], params[:qualifying_stage], params[:rating], params[:archived], params[:closed], params[:count]]) do
page = params[:page]
page ||= 0
page = page.to_i
udprn = params[:udprn].to_i
count = params[:count].to_s == 'true'
is_premium = @current_user.is_premium rescue false
old_stats_flag = (params[:old_stats_flag].to_s == 'true')
profile = @current_user.class.to_s
event_service = EventService.new(udprn: udprn, buyer_id: params[:buyer_id],
last_time: params[:latest_time], qualifying_stage: params[:qualifying_stage],
rating: params[:rating], archived: params[:archived], is_premium: is_premium,
closed: params[:closed], count: count, profile: profile, old_stats_flag: old_stats_flag)
if @current_user.is_a?(Agents::Branches::AssignedAgent) && event_service.details[:agent_id].to_i != @current_user.id
render json: { message: 'The agent does not belong to the property' }, status: 400
else
enquiries = event_service.property_specific_enquiry_details(page)
render json: enquiries, status: 200
end
#end
end | [
"def index\n @enquiries = Enquiry.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @enquiries\n end",
"def attendeelist\n @eventid = params[:eventId]\n\n @accesstoken = params[:accessToken]\n url = URI(\"https://www.explara.com/api/e/attendee-list\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = 'multipart/form-data; boundary='\n request[\"authorization\"] = \"Bearer #{@accesstoken}\"\n request.body = \"--\\r\\nContent-Disposition: form-data; name=\\\"eventId\\\"\\r\\n\\r\\n#{@eventid}\\r\\n--\\r\\nContent-Disposition: form-data; name=\\\"fromRecord\\\"\\r\\n\\r\\n0\\r\\n--\\r\\nContent-Disposition: form-data; name=\\\"toRecord\\\"\\r\\n\\r\\n50\\r\\n----\"\n\n response = http.request(request)\n attendees = JSON.parse(response.read_body)\n @attendee = attendees[\"attendee\"]\n\n\n end",
"def tickets(zendesk_obj)\n person_obj = zendesk_obj.get_person_by_email\n unless person_obj[\"result\"][\"results\"].blank?\n zendesk_obj.user_id = person_obj[\"result\"][\"results\"][0][\"id\"]\n render :json => zendesk_obj.get_tickets_by_api.to_json, :status => 200 and return\n else\n render :json => exception_message(\"Not Found\",404,\"email address not found\").to_json, :status=>404 and return\n end\n end",
"def tickets_all(options={})\n options.merge!({:basic_auth => @auth})\n JSON::parse(self.class.get(Z_RECENT_VIEW, options).body)\n end",
"def index\n @notifies = Notify.where(:course_id => @course.id).order('created_at DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @course.notifies }\n end\n end",
"def get_ticket(queues, agents)\n params = {\n :queues => queues,\n :agents => agents\n }\n RestClient.post(\"#{@host_addr}/ticket\", params.to_json, :content_type => :json).to_str.gsub('\"', '')\n end",
"def index\n @user_enquiries = UserEnquiry.all\n end",
"def index\n @enquiries = @product.enquiries\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @enquiries }\n end\n end",
"def call_authorization_issue_api(ticket, subject, authTime)\n return call_api(\"/api/auth/authorization/issue\", {\n \"ticket\" => ticket,\n \"subject\" => subject,\n \"authTime\" => authTime\n })\nend",
"def index\n @request_properties = current_user.request_property\n end",
"def external_report_query_jwt\n authorize Portal::PermissionForm\n\n response = {\n token: SignedJWT::create_portal_token(current_user, {}, 3600), # just sets uid\n json: {\n query: params,\n type: \"learners\",\n version: \"2\",\n user: {\n id: url_for(current_user),\n email: current_user.email\n },\n portal_url: root_url,\n learnersApiUrl: external_report_learners_from_jwt_api_v1_report_learners_es_url\n }\n }\n\n render json: response.to_json\n end",
"def expiry_claim_preview\n @expiry_damage=JSON.parse RestClient.get $api_service+\"/claims/expiry_damage_claim_no?claim_no=#{params[:claim_no]}&&supplier_id=#{params[:supplier_id]}\"\n end",
"def index\n @teacher_notifies = Notify.where(:course_id => @course.id).order('created_at desc')\n\t\t@notifies = @teacher_notifies.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @teacher_notifies }\n end\n end",
"def index\n @enquiries = Enquiry.all\n end",
"def view_recent_activity\n requires({'role'=>'admin'})\n \n currentUsers = User.where('current_sign_in_at not null').order(:current_sign_in_at).reverse\n\n render :json => currentUsers.to_json\n end",
"def agents_recent_properties_for_claim\n cache_parameters = []\n #cache_response(params[:agent_id].to_i, cache_parameters) do\n response = {}\n status = 200\n #begin\n results = []\n agent_status = params[:status]\n if params[:agent_id].nil?\n response = { message: 'Agent ID missing' }\n else\n agent = Agents::Branches::AssignedAgent.find(params[:agent_id].to_i)\n if !agent.locked\n owned_property = params[:manually_added] == 'true' ? true : nil\n owned_property = params[:manually_added] == 'false' ? false : owned_property\n count = params[:count].to_s == 'true'\n results, count = agent.recent_properties_for_claim(agent_status, 'Sale', params[:buyer_id], params[:hash_str], agent.is_premium, params[:page], owned_property, count, params[:latest_time])\n response = (!results.is_a?(Fixnum) && results.empty?) ? {\"leads\" => results, \"message\" => \"No leads to show\", 'count' => count } : {\"leads\" => results, 'count' => count }\n else\n lead = Agents::Branches::AssignedAgents::Lead.where(agent_id: agent.id)\n .where(expired: true)\n .order('updated_at DESC')\n .last\n address = PropertyDetails.details(lead.property_id)[:_source][:address]\n deadline = lead.created_at + Agents::Branches::AssignedAgents::Lead::VERIFICATION_DAY_LIMIT\n response = { leads: [], address: address, locked: true, count: 0 }\n status = 400\n end\n end\n# rescue ActiveRecord::RecordNotFound\n# response = { message: 'Agent not found in database' }\n# status = 404\n# rescue => e\n# response = { leads: results, message: 'Error in showing leads', details: e.message}\n# status = 500\n# end\n #Rails.logger.info \"sending response for recent claims property #{response.inspect}\"\n render json: response, status: status\n #end\n end",
"def index\n @email = Admin::Customer::Email.find_by_tracking(params[:email_id]) if @email.nil?\n @admin_customer_offers = @email.offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_customer_offers }\n end\n end",
"def approved_claims\n \n data=RestClient.get $api_service+'/claims/approved_claims'\n @issues=JSON.parse data\n\n end",
"def index\n @help_requests = current_user.help_requests.all\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
For all the pie charts concerning the profile of the buyer, this action can be used. curl XGET H "ContentType: application/json" ' | def buyer_profile_stats
buyer_profile_stats = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).buyer_profile_stats
render json: buyer_profile_stats, status: 200
end | [
"def find_all_charts #(working)\n\t\tid = params[:id]\n\t\t#user_token = params[:user_token]\n\t\turl = \"https://sdpm-appointment-service.herokuapp.com/appointment/#{id}/charts\"\n\t\t#user_token = params[:user_token]\n\t\tresponse = RestClient::Request.execute(\n \t\tmethod: :get, \n \t\t\turl: url\n\t\t)\n\t\trender :json => response\n\tend",
"def report_count_of_action_sid_by_profile_accesses_json(opts={})\r\n @data[:elements] = []\r\n setup_count_of_action_sid_by_profile_accesses_x_axis_json\r\n\r\n report_serie_28_json(opts[:serie1] || {})\r\n\r\n setup_count_of_action_sid_by_profile_accesses_y_axis_json\r\n setup_style_of_count_of_action_sid_by_profile_accesses_json(opts)\r\n return @data\r\n end",
"def get_price_chart\n @price_charts = EmailPriceList.where(category: \"Price Chart\").order(\"updated_at DESC\")\n\n render json: @price_charts , each_serializer: Web::V1::EmailPriceSerializer\n end",
"def piechart (synonym_id, type)\n synonym = Synonym.find(synonym_id)\n if type == @@GENDER\n stats = synonym.get_visual_stats_gender\n header = t(:stats_gender)\n elsif type == @@COUNTRY\n stats = synonym.get_visual_stats_country\n header = t(:stats_country)\n elsif type == @@AGE\n stats = synonym.get_visual_stats_age\n header = t(:stats_age)\n else\n stats = synonym.get_visual_stats_education\n header = t(:stats_education)\n end\n chart = LazyHighCharts::HighChart.new('pie') do |f|\n f.chart({:defaultSeriesType=>\"pie\" , :margin=> [0, 10, 150,25], :width => 157, :hieght => 50} )\n series = {\n :type=> 'pie',\n :name=> 'Browser share',\n :borderWidth => 0.7,\n :data=> stats\n\n }\n f.series(series)\n f.options[:title][:text] = header\n f.options[:title][:x] = 0\n\n f.legend(:layout=> 'vertical',:style=> {:left=> '0px', :bottom=> '0px',:right=> '0px',:top=> '0px'}) \n f.plot_options(:pie=>{\n :allowPointSelect=>true, \n :cursor=>\"pointer\" ,\n :size =>'100%', \n :dataLabels=>{\n :enabled=>false,\n :color=>\"black\",\n :style=>{\n :font=>\"13px Trebuchet MS, Verdana, sans-serif\"\n }\n }\n })\n end\n end",
"def pie_chart_data\n response = api_request(:summary, {group_by: 'keywords'})\n results = extract_and_sort_results(response)\n\n total_other = results.drop(4).map {|row| row['total_calls']}.sum\n pie_segments = results.take(4)\n pie_segments << { \"key\" => \"Other\", \"total_calls\" => total_other }\n\n pie_segments.map { |segment| [segment['key'], segment['total_calls']] }\n end",
"def load_composite_pie\n chart = Ziya::Charts::PieThreed.new( LICENSE, \"comp_pie_threed_chart\" )\n chart.add :axis_category_text, %w[US UK India Japan China]\n chart.add :series , \"Region 1\", [ 50, 70, 55, 60, 30 ]\n chart.add :theme , \"galeria\"\n \n respond_to do |fmt|\n fmt.xml { render :xml => chart.to_xml }\n end\n end",
"def pie_chart_data\n battle = Battle.find(params[:battle_id])\n \n render json: battle.hashtags.map { |h| [h.name, h.get_count_between(before: battle.created_at)] }\n end",
"def index\n #chart = Chart.find(params[:chart_id])\n chart = Chart.where(\"id = ? AND user_id = ?\", params[:chart_id], current_user.id).limit(1)[0]\n details = chart.detail\n\n respond_with(details) do |format|\n \t#response string in specified format\n format.json { render json: { success: true, details: details } }\n end\n end",
"def index\n @charts = Chart.all\n\n render json: @charts\n end",
"def user_chart\n \tif find_and_check_user\n @yAxis = 2\n render_chart(@user.series_json(params, self))\n \tend\n end",
"def data\n month = params[:month].blank? ? '0' : params[:month]\n year = params[:year].blank? ? 0 : params[:year].to_i\n staff_id = get_staff_id\n \n title = 'Hourly Payroll'\n yaxis = 'Total Amount (RM)'\n \n months = I18n.t('date.month_names')\n \n o = Array.new(12) { |x| [months[x + 1], 0] }\n b = Array.new(12) { |x| 0 }\n categories = Array.new(12) { |x| months[x + 1][0..2] }\n \n if year != 0\n listyear = [year]\n title = \"Hourly Payroll for #{year}\"\n \n else\n list = PayRate.select('distinct(year)').all\n listyear = list.collect { |x| x.year }\n end\n \n if month != '0'\n listmonth = month.collect { |x| x.to_i }\n \n else\n list = PayRate.select('distinct(month)').all\n listmonth = list.collect { |x| x.month }\n end\n \n listyear.each do |y|\n listmonth.each do |m|\n filters = { :year => y, :month => m, :staff_id => staff_id }\n total_hours = AttendanceHelper.get_total_hours(filters)\n rate = PayRateHelper.get_pay_rate(filters)\n v = total_hours * rate\n o[m - 1][1] = v\n b[m - 1] += v\n end\n end\n \n c = b.collect { |x| x.round(2) }\n \n @data = { :pie => o, :column => { :data => c, \n :categories => categories, \n :yaxis => yaxis }, \n :title => title }\n \n render :json => @data\n end",
"def pie_chart(resource, usage, generation, use_totals, gen_totals, hours)\n\t\t@chart = LazyHighCharts::HighChart.new(\"pie\") do |f|\n f.chart({\n :type => \"pie\",\n :margin => [30, 5, 5, 5]\n })\n f.title(text: \"Relative \" + resource.capitalize + \" Usage\")\n f.legend(:layout => 'horizontal')\n\t usedata = usage.map {|t, v| [t.capitalize, v.sum]}\n\t series = {\n\t\t\t\t:type=> 'pie',\n\t\t\t\t:name=> resource.capitalize + ' Chart',\n\t\t\t\t:data=> usedata,\n\t\t\t\t:innerSize=> 200}\n\t f.series(series)\n f.plot_options(:pie =>{\n :allowPointSelect => true, \n :cursor => \"pointer\", \n :dataLabels =>{\n :enabled => true,\n :color => \"black\",\n :format => '<b>{point.name}</b>: {point.percentage:.1f} %'\n }\n })\n end\n high_chart(\"today_\" + resource + \"_chart\", @chart)\n end",
"def income\n data = []\n links = []\n bills_by_group = User.get_bills_by_group(session[:user_id])\n pie_names = []\n for group in Bill::Group\n sum_bills_prices = 0\n if bills_by_group[group[1]]\n pie_names << group[1]\n bills_by_group[group[1]].each{|bill|\n sum_bills_prices += bill.price #if bill.category == \"in\"\n }\n data << sum_bills_prices\n end\n end \n \n g = Graph.new\n g.pie(60, '#505050', '{font-size: 10px; color: #404040;}')\n g.pie_values(data, pie_names)\n g.pie_slice_colors(%w(#d01fc3 #ffae50 #356aa0 #c79810 #f54d63 #85f570 #f5ed2b #b8f5f1))\n g.set_tool_tip(\"#val# CZK\")\n g.title(\"Platby podle skupiny\", '{font-size:18px; color: #d01f3c}')\n render :text => g.render\n end",
"def chart_data\n @track=current_user.tracks.find(params[:id])\n respond_to do |format|\n format.json {render :json => @track.as_chart_data}\n end\n end",
"def piechart (stats, header)\n chart = LazyHighCharts::HighChart.new(\"pie\") do |f|\n f.chart({ defaultSeriesType: \"pie\" , margin: [0, 10, 150, 25], \n width: 157, hieght: 50 })\n series = {\n type: \"pie\",\n name: \"voters stats\",\n borderWidth: 0.7,\n data: stats \n }\n f.series(series)\n f.options[:title][:text] = header\n f.options[:title][:x] = 0\n if I18n.locale == :en\n f.options[:title][:style] = {\n fontSize: \"14px\"\n }\n else\n f.options[:title][:style] = {\n fontSize: \"16px\"\n }\n end\n f.tooltip = {\n borderColor: \"null\",\n borderWidth: \"6px\",\n useHTML: true,\n positioner: { x: 0, y: 0 }\n }\n f.legend(layout: \"vertical\", style: { left: \"0px\", \n bottom: \"0px\", right: \"0px\", top: \"0px\" }) \n f.plot_options(pie: {\n allowPointSelect: true, \n cursor: \"pointer\" ,\n size: '100%', \n dataLabels: {\n enabled: false,\n color: \"black\",\n style: {\n font: \"13px Trebuchet MS, Verdana, sans-serif\"\n }\n }\n })\n end\n end",
"def view_charts\n # Query for user_name wise metrics.\n user_metrics = Kitting::KitOrderFulfillment.find_by_sql([\"SELECT user_name,SUM(count_kits_completed) AS kits_completed,\n SUM(Sum_Cups_Filled) AS Cups_Filled\n FROM(SELECT TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY') AS completion_date,\n KITTING_KIT_ORDER_FULFILLMENTS.USER_NAME AS user_name,\n SUM(KIT_FILLING_DETAILS.TURN_COUNT) AS Sum_Cups_Filled, COUNT(DISTINCT KITTING_KIT_ORDER_FULFILLMENTS.KIT_NUMBER) AS count_kits_completed\n FROM KITTING_KIT_ORDER_FULFILLMENTS\n INNER JOIN KIT_FILLING_DETAILS\n ON KITTING_KIT_ORDER_FULFILLMENTS.KIT_FILLING_ID = KIT_FILLING_DETAILS.KIT_FILLING_ID\n WHERE KITTING_KIT_ORDER_FULFILLMENTS.CUST_NO = ?\n AND KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT BETWEEN ? AND ?\n GROUP BY TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY'),KITTING_KIT_ORDER_FULFILLMENTS.USER_NAME)\n GROUP BY user_name\",\n current_customer.cust_no,\n Date.strptime(params[\"kit_fill_metrics_begin_date\"].to_s,\"%m/%d/%Y\").midnight, Date.strptime(params[\"kit_fill_metrics_end_date\"].to_s,\"%m/%d/%Y\").midnight + 1.day\n ])\n # Compute Max Y Axis Range for user wise metrics graph\n @user_names = user_metrics.map(&:user_name)\n @kits_complete = user_metrics.map(&:kits_completed)\n @cups_filled = user_metrics.map(&:cups_filled)\n @user_max_range = [@cups_filled, @kits_complete].flatten.max || 1000\n @user_max_range = (@user_max_range/10)*10 + 10\n\n # Query for date_wise metrics.\n date_metrics = Kitting::KitOrderFulfillment.find_by_sql([\"SELECT completion_date,SUM(count_cups) AS cups_filled,SUM(count_kits) AS kits_completed from\n (SELECT TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY') AS completion_date,\n SUM(KIT_FILLING_DETAILS.TURN_COUNT) AS count_cups, COUNT(DISTINCT KITTING_KIT_ORDER_FULFILLMENTS.KIT_NUMBER) AS count_kits\n FROM KITTING_KIT_ORDER_FULFILLMENTS\n INNER JOIN KIT_FILLING_DETAILS\n ON KITTING_KIT_ORDER_FULFILLMENTS.KIT_FILLING_ID = KIT_FILLING_DETAILS.KIT_FILLING_ID\n WHERE KITTING_KIT_ORDER_FULFILLMENTS.CUST_NO = ?\n AND KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT BETWEEN ? AND ?\n GROUP BY TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY'), KITTING_KIT_ORDER_FULFILLMENTS.USER_NAME\n ORDER BY TO_CHAR(KITTING_KIT_ORDER_FULFILLMENTS.UPDATED_AT, 'MM-DD-YYYY'))\n GROUP BY completion_date\n ORDER BY TO_DATE(completion_date,'MM-DD-YYYY')\",\n current_customer.cust_no,\n Date.strptime(params[\"kit_fill_metrics_begin_date\"].to_s,\"%m/%d/%Y\").midnight, Date.strptime(params[\"kit_fill_metrics_end_date\"].to_s,\"%m/%d/%Y\").midnight + 1.day\n ])\n # Compute Max Y Axis Range for date wise metrics graph\n @kits_complete_date = date_metrics.map(&:kits_completed)\n @cups_filled_date = date_metrics.map(&:cups_filled)\n @date_max_range = [@cups_filled_date, @kits_complete_date].flatten.max || 1000\n @date_max_range = (@date_max_range/10)*10 + 10\n\n #Preparing Object Hash to be passed for morris js data.\n @date_hash = Array.new\n date_metrics.map do |key,value|\n @date_hash << { :date => key.completion_date, :cups_filled => key.cups_filled, :kits_completed => key.kits_completed }\n end\n @user_hash = Array.new\n user_metrics.map do |key,value|\n @user_hash << { :user_name =>key.user_name, :cups_filled => key.cups_filled, :kits_completed => key.kits_completed }\n end\n end",
"def list\n @multi_year_charts = user_multi_year_charts\n .kept\n .includes(:user)\n .order('created_at DESC')\n .page(params[:page])\n .per(50)\n\n respond_to do |format|\n format.html {render :layout => 'application'}\n end\n end",
"def get_chart(time = '1m')\n response = RestClient.get(\"https://api.iextrading.com/1.0/stock/#{self.ticker}/chart/#{time}\")\n JSON.parse(response.body)\n end",
"def chart_responses\n chart = GoogleChart.pie_400x150([\"#{percentage_yes}% yes\", percentage_yes], [\"#{percentage_no}% no\", percentage_no])\n chart.colors = ['BCDEA5', 'E6F9BC']\n return chart\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Ranking stats for the given property curl XGET H "ContentType: application/json" ' | def ranking_stats
ranking_info = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).ranking_stats
render json: ranking_info, status: status
end | [
"def property_stats\n include_archived = (params[:include_archived].to_s == 'true')\n stats = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).enquiry_and_view_stats(@current_user.is_premium, include_archived)\n render json: { property_stats: stats }, status: 200\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end",
"def propstats(response, stats)\n return if stats.empty?\n stats.each do |status, props|\n propstat = Ox::Element.new(D_PROPSTAT)\n prop = Ox::Element.new(D_PROP)\n\n props.each do |element, value|\n\n name = element[:name]\n if prefix = prefix_for(element[:ns_href])\n name = \"#{prefix}:#{name}\"\n end\n\n prop_element = Ox::Element.new(name)\n ox_append prop_element, value, prefix: prefix\n prop << prop_element\n\n end\n\n propstat << prop\n propstat << ox_element(D_STATUS, \"#{http_version} #{status.status_line}\")\n\n response << propstat\n end\n end",
"def ranked_stats_JSON(login)\n\t\tsummoner_id(login)\n\t\turl=\"https://\"+@@region+\".api.pvp.net/api/lol/\"+@@region+\"/v1.3/stats/by-summoner/\"+@@champ_id.to_s+\"/ranked?season=SEASON2015&api_key=28ba1d65-cda8-4e79-90ad-aad6b1ab6326\"\n\t\turi=URI.parse(url)\n\t\tstr=uri.read\n\t\t@@overall_ranked_stats=str;\n\tend",
"def parse_rank\n reg = /all_single_meta_reqs = JSON.decode\\('([^;]+)'\\);/\n match = home_page.scan reg\n all_single_meta_reqs = match[0][ 0]\n\n all_single_meta_reqs = JSON.parse(all_single_meta_reqs)\n hotel_id = ''\n @rank = []\n\n all_single_meta_reqs.each do |single_mata_req|\n data = single_mata_req\n @id = data['hotel_id']\n @rank << data['svc_ops']['locToHACProviders'].values[0]\n end\n end",
"def objecttype_property_count\n puts \"#Object-Type_Property count\"\n @endpoint_stats.each_key do |k|\n next if k==\"_all\"\n @endpoint_stats[k]['objecttype_property'] = []\n g = \"<#{URI.encode(k)}>\"\n q = \"SELECT distinct $p (str($plabel) AS $plabel) $otype (str($otype_label) AS $otype_label) ($n AS $n) ($dn AS $dn) { GRAPH #{g} { SELECT $p $otype (COUNT($o) AS $n) (COUNT(DISTINCT $o) AS $dn) { $s $p $o . $o a $otype . } GROUP BY $p $otype } OPTIONAL {$p rdfs:label $plabel} OPTIONAL {$otype rdfs:label $otype_label}}\"\n new_uri = @sparql_url+\"?query=#{q}&format=json\"\n req = @http.request_get(URI(new_uri))\n res = JSON.parse(req.body)\n res[\"results\"][\"bindings\"].each do |tpl|\n otype_prop = {\n 'otype' => tpl['otype']['value'],\n 'property' => tpl['p']['value'],\n 'count' => tpl['n']['value'].to_i,\n 'distinct_count' => tpl['dn']['value'].to_i,\n 'otype_label' => \"\",\n 'p_label' => \"\"\n } \n otype_prop['otype_label'] = tpl['otype_label']['value'] if tpl.has_key? 'otype_label'\n otype_prop['p_label'] = tpl['p_label']['value'] if tpl.has_key? 'p_label'\n @endpoint_stats[k]['objecttype_property'] << otype_prop\n end\n puts \"\\t[#{k}]\"\n end\n end",
"def getPropertiesByQuery(url)\r\n # Fetch data\r\n uri = URI.parse(URI.encode(url.strip))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n puts json_result[\"results\"].nil? \r\n\r\n # Check to make sure we have results\r\n if json_result[\"results\"].nil?\r\n return {:status => \"No results\"}.to_json\r\n else\r\n # Return results\r\n return json_result.to_json\r\n end\r\n\r\n # Set up storage\r\n # mls_props = Hash.new\r\n # listing_results = json_result[\"results\"]\r\n\r\n # # Loop over listing results\r\n # cnt = 1\r\n # listing_results.each do |r| \r\n # # Gather data\r\n # house_data = getPropertyInfoFromJson(r) # property info \r\n # listing_data = getListingInfoFromJson(r) # listing info\r\n # !r[\"events\"].nil? ? event_data = r[\"events\"] : event_data = nil # events info\r\n\r\n # # Call PDQ to determine if property is pre-qualified\r\n # ##############################################################\r\n # ###### Placeholder to call get_values (PDQ) on property ######\r\n # ##############################################################\r\n\r\n # # Save results for property\r\n # mls_props[cnt] = {:propertyInfo => house_data, \r\n # :mlsInfo => listing_data,\r\n # :events => event_data}\r\n # cnt += 1\r\n # end\r\n\r\n # # Construct total data hash\r\n # all_data = Hash.new\r\n # all_data[:totalNumProperties] = json_result[\"total\"]\r\n # all_data[:results] = mls_props\r\n\r\n # return all_data.to_json\r\n end",
"def index\n @order = 0\n if params[:key]\n # self.check_auth\n if params[:userid] != nil\n @userid = params[:userid]\n @rankings = Ranking.send(\"myrank_#{params[:key]}\", @userid )\n else\n @rankings = Ranking.send(\"top10_#{params[:key]}\")\n end\n else\n @rankings = Ranking.send(\"top10_winpercentage\")\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rankings }\n end\n end",
"def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/Travel/HotelRanking/20131024\", Rakuten::Api.merge(opts))\r\n end",
"def assert_propstat_response response, properties, statuses\n assert_instance_of RubyDav::PropstatResponse, response\n\n assert_equal properties.keys.sort, statuses.keys.sort\n assert_equal properties.keys.sort, response.resources.keys.sort\n\n response.resources.each do |url, results|\n\n successful_results = results.reject do |pk, r|\n r.inner_value.nil? || r.inner_value.strip.empty?\n end\n\n successful_keys = successful_results.keys.sort\n assert_equal properties[url].keys.sort, successful_keys\n\n successful_keys.each do |pk|\n assert_equal properties[url][pk], results[pk].inner_value\n end\n\n keys = results.keys.sort\n assert_equal statuses[url].keys.sort, results.keys.sort\n\n keys.each do |pk|\n assert_equal statuses[url][pk], results[pk].status\n end\n end\n end",
"def rank\n swish_result_property_u_long(@result, \"swishrank\")\n end",
"def genre_ranking\n ranked_albums = SortCollection.sort_albums('genre')\n render json: ranked_albums.sort_by(&:last).reverse.to_h, status: 200\n end",
"def content_match_ranking(opts={})\r\n Yahoo::Request.get(\"http://shopping.yahooapis.jp/ShoppingWebService/V1/json/contentMatchRanking\", Yahoo::Api.merge(opts))\r\n end",
"def object_stat(url, token, container, object)\n url = \"#{url}/#{container}/#{object}\"\n query = {:format => \"json\"}\n HTTParty.head(url, :headers => {\"X-Auth-Token\"=> token}, :query => query).headers\n end",
"def get_array_counts \n get(\"/arrays.json/summary\")\nend",
"def getPokemonStat \n @hp = JSON.parse(@random_pokemon.body)[\"stats\"][0][\"base_stat\"]\n @attack = JSON.parse(@random_pokemon.body)[\"stats\"][1][\"base_stat\"]\n @defense = JSON.parse(@random_pokemon.body)[\"stats\"][2][\"base_stat\"]\n @sp_atk = JSON.parse(@random_pokemon.body)[\"stats\"][3][\"base_stat\"]\n @sp_def = JSON.parse(@random_pokemon.body)[\"stats\"][4][\"base_stat\"]\n @speed = JSON.parse(@random_pokemon.body)[\"stats\"][5][\"base_stat\"]\n\n @base_stat_total = @hp + @attack + @defense + @sp_atk + @sp_def + @speed \n end",
"def subjecttype_property_count\n puts \"#Subject-Type_Property count\"\n @endpoint_stats.each_key do |k|\n next if k==\"_all\"\n @endpoint_stats[k]['subjecttype_property'] = []\n g = \"<#{URI.encode(k)}>\"\n q = \"SELECT DISTINCT $p (str($plabel) AS $plabel) $stype (str($stype_label) AS $stype_label) ($n AS $n) ($dn AS $dn){ GRAPH #{g} { SELECT $p $stype (COUNT($s) AS $n) (COUNT(DISTINCT $s) AS $dn) { $s $p $o . $s a $stype . } GROUP BY $p $stype } OPTIONAL {$p rdfs:label $plabel} OPTIONAL {$stype rdfs:label $stype_label}}\"\n new_uri = @sparql_url+\"?query=#{q}&format=json\"\n req = @http.request_get(URI(new_uri))\n res = JSON.parse(req.body)\n res[\"results\"][\"bindings\"].each do |tpl|\n stype_prop = {\n 'stype' => tpl['stype']['value'],\n 'property' => tpl['p']['value'],\n 'count' => tpl['n']['value'].to_i,\n 'distinct_count' => tpl['dn']['value'].to_i,\n 'stype_label' => \"\",\n 'p_label' => \"\"\n }\n stype_prop['stype_label'] = tpl['stype_label']['value'] if tpl.has_key? 'stype_label'\n stype_prop['p_label'] = tpl['p_label']['value'] if tpl.has_key? 'p_label'\n @endpoint_stats[k]['subjecttype_property'] << stype_prop\n end\n puts \"\\t[#{k}]\"\n end\n end",
"def top\n json_response(Post.top(params[:n].to_i))\n end",
"def rank(url, params={}, cache_for = nil)\n\t\tresult = url_info(url, {:response_groups=>:rank})\n\t\treturn result[:url_info_response][:response][:url_info_result][:alexa][:traffic_data]\n\tend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Gets the properties which satisfy the postcode, or the building name filter curl XGET H "ContentType: application/json" ' | def properties_for_claiming
search_str = params[:str]
postcode = params[:postcode]
search_hash = {}
search_hash[:postcode] = params[:postcode] if params[:postcode] && !params[:postcode].empty?
search_hash[:sub_building_name] = params[:str] if params[:str] && !params[:str].empty?
search_hash[:building_name] = params[:str] if params[:str] && !params[:str].empty?
search_hash[:building_number] = params[:str] if params[:str] && !params[:str].empty?
search_hash[:postcode] = params[:str] if params[:str] && !params[:str].empty?
api = PropertySearchApi.new(filtered_params: search_hash )
api.apply_filters
api.add_not_exists_filter('vendor_id')
api.make_or_filters([:sub_building_name, :building_name, :building_number, :postcode])
body, status = api.fetch_data_from_es
render json: body, status: status
end | [
"def properties\n # vendor = Vendor.find(params[:vendor_id])\n search_params = { vendor_id: params[:vendor_id].to_i, results_per_page: 150 }\n search_params[:p] = params[:p].to_i if params[:p]\n pd = PropertySearchApi.new(filtered_params: search_params )\n pd.query[:size] = 1000\n results, status = pd.filter\n results[:results].each { |e| e[:address] = PropertyDetails.address(e) }\n response = results[:results].map { |e| e.slice(:udprn, :address) }\n response = response.sort_by{ |t| t[:address] }\n #Rails.logger.info \"sending response for vendor properties -> #{response.inspect}\"\n render json: response, status: status\n end",
"def branch_properties\n branch_id = @current_user.branch_id\n filtered_params = { branch_id: branch_id }\n property_search_api = PropertySearchApi.new(filtered_params: filtered_params)\n property_search_api = property_search_api.filter_query\n udprns = property_search_api.fetch_udprns\n bulk_details = PropertyService.bulk_details(udprns)\n render json: bulk_details, status: 200\n end",
"def get_custom_attributes(address)\n get_json \"/api/custom_attributes?address=#{address}\"\n end",
"def getPropertiesByQuery(url)\r\n # Fetch data\r\n uri = URI.parse(URI.encode(url.strip))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n puts json_result[\"results\"].nil? \r\n\r\n # Check to make sure we have results\r\n if json_result[\"results\"].nil?\r\n return {:status => \"No results\"}.to_json\r\n else\r\n # Return results\r\n return json_result.to_json\r\n end\r\n\r\n # Set up storage\r\n # mls_props = Hash.new\r\n # listing_results = json_result[\"results\"]\r\n\r\n # # Loop over listing results\r\n # cnt = 1\r\n # listing_results.each do |r| \r\n # # Gather data\r\n # house_data = getPropertyInfoFromJson(r) # property info \r\n # listing_data = getListingInfoFromJson(r) # listing info\r\n # !r[\"events\"].nil? ? event_data = r[\"events\"] : event_data = nil # events info\r\n\r\n # # Call PDQ to determine if property is pre-qualified\r\n # ##############################################################\r\n # ###### Placeholder to call get_values (PDQ) on property ######\r\n # ##############################################################\r\n\r\n # # Save results for property\r\n # mls_props[cnt] = {:propertyInfo => house_data, \r\n # :mlsInfo => listing_data,\r\n # :events => event_data}\r\n # cnt += 1\r\n # end\r\n\r\n # # Construct total data hash\r\n # all_data = Hash.new\r\n # all_data[:totalNumProperties] = json_result[\"total\"]\r\n # all_data[:results] = mls_props\r\n\r\n # return all_data.to_json\r\n end",
"def ax_properties\n props = {}\n release_policies.each do |rp|\n if rp.type_identifier.match(\"://\")\n props[\"type.#{rp.property}\"] = rp.type_identifier \n props[\"value.#{rp.property}\"] = persona.property(rp.type_identifier )\n end\n end\n props\n end",
"def searchIndividualProperty(address)\r\n address_items = StreetAddress::US.parse([address.street, address.citystatezip].join(\" \"))\r\n # address_items = StreetAddress::US.parse(\"140 OCEAN AVENUE SAN FRANCISCO CA 94112\")\r\n\r\n match_terms = []\r\n match_terms << {:match => {\"primary.address.zipCode\" => address_items.postal_code.capitalize}}\r\n match_terms << {:match => {\"primary.address.state\" => address_items.state}}\r\n match_terms << {:match => {\"primary.address.streetNum\" => address_items.number.capitalize}}\r\n\r\n # Need to capitalize each word\r\n city_terms = address_items.city.split(\" \").collect { |c| c.capitalize }.join(\" \")\r\n match_terms << {:match => {\"primary.address.city\" => city_terms}}\r\n\r\n # Need to capitalize each word\r\n street_name_terms = address_items.street.split(\" \").collect { |c| c.capitalize }.join(\" \")\r\n match_terms << {:match => {\"primary.address.streetName\" => street_name_terms}}\r\n \r\n # Street type regex - just use the first letter in the suffix\r\n if !address_items.street_type.nil?\r\n street_type_regex = [address_items.street_type.capitalize[0], \".+\"].join()\r\n match_terms << {:regexp => {\"primary.address.streetSuffix\" => street_type_regex}}\r\n end\r\n\r\n # Unit number (if applicable)\r\n match_terms << {:match => {\"primary.address.unitNum\" => address_items.unit}} unless address_items.unit.nil?\r\n\r\n # url, headers, query\r\n base_url = \"https://api.mpoapp.com/v1/properties/_search?api_key=#{MLS_TOKEN}\"\r\n h = {\"Content-Type\" => 'application/json; charset=UTF-8', \"Cache-Control\" => \"no-cache\"}\r\n data = {:from => 0, :size => 10}\r\n data[:query] = {:bool => {:minimum_should_match => 1, :must => [match_terms]}}\r\n\r\n response = HTTParty.post(base_url, :body => data.to_json, :headers => h)\r\n json_result = JSON.parse(response.to_json)\r\n return json_result, data.to_json\r\n end",
"def get_building\n if params[:customer].present?\n @buildings = Customer.find(params[:customer]).buildings\n else\n # @buildings = Customer.all\n puts params[:customer]\n end\n # to tell if the request is sent via ajax\n if request.xhr?\n respond_to do |f|\n f.json {\n render json: {buildings: @buildings}\n }\n end\n end\n end",
"def getResponseProps (resp, props)\n doc = Document.new resp.body\n results = []\n props.each { |s|\n doc.root.elements.each {|e| \n if e.attributes['name'] && e.attributes['name'] == s\n results << e.attributes['value']\n break\n end\n }\n }\n results \nend",
"def postcode\n body['postcode']\n end",
"def get_building\n if params[:customer].present?\n @buildings = Customer.find(params[:customer]).buildings\n else\n @buildings = Customer.all\n end\n if request.xhr?\n respond_to do |format|\n format.json {\n render json: {buildings: @buildings}\n }\n end\n end\n end",
"def get_properties\n xml = client.call(\"#{url}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(client, p, branch: self) }\n end",
"def getPropertyDeepSearchResults(address)\r\n # Construct url\r\n esc_street = URI.escape(address.street)\r\n esc_csz = URI.escape(address.citystatezip)\r\n base_url = \"http://www.zillow.com/webservice/GetDeepSearchResults.htm?zws-id=#{ZILLOW_TOKEN}\" \r\n base_url += \"&address=#{esc_street}&citystatezip=#{esc_csz}\"\r\n\r\n # Create response\r\n res = getUrlResponse(base_url)\r\n\r\n # Parse xml\r\n prop_info = Nokogiri::XML(res.body)\r\n\r\n # Return info\r\n return prop_info, URI.parse(base_url).to_s.gsub(\",\",\"THESENTINEL\"), res.body\r\n end",
"def get_transfer_properties(keyword_filter = DEFAULT_PARAMS_FILTER, strip_filter = false)\n result = {}\n STANDARD_PROPERTIES.each{|prop| result[prop.gsub(\"SS_\",\"RPM_\")] = @params[prop] }\n @params.each{|k,v| result[strip_filter ? k.gsub(keyword_filter,\"\") : k] = @rpm.get_param(k) if k.include?(keyword_filter) }\n result\nend",
"def buyer_intent_info\n udprn = @udprn.to_i\n details = PropertyDetails.details(udprn.to_i)['_source']\n\n #### Similar properties to the udprn\n default_search_params = {\n min_beds: details['beds'].to_i,\n max_beds: details['beds'].to_i,\n min_baths: details['baths'].to_i,\n max_baths: details['baths'].to_i,\n min_receptions: details['receptions'].to_i,\n max_receptions: details['receptions'].to_i,\n property_status_types: details['property_status_type']\n }\n\n ### analysis for each of the postcode type\n search_stats = {}\n [ :district, :sector, :unit ].each do |region_type|\n ### Default search stats\n search_stats[region_type] = { green: 0, amber: 0, red: 0 }\n\n search_params = default_search_params.clone\n search_params[region_type] = details[region_type.to_s]\n search_stats[region_type][:value] = details[region_type.to_s] ### Populate the value of sector, district and unit\n api = PropertySearchApi.new(filtered_params: search_params)\n api.apply_filters\n body, status = api.fetch_data_from_es\n udprns = []\n if status.to_i == 200\n udprns = body.map { |e| e['udprn'] }\n end\n\n ### Exclude the current udprn from the result\n udprns = udprns - [ udprn.to_s ]\n # p udprns\n ### Accumulate buyer_id for each udprn\n buyer_ids = []\n event = Event::EVENTS[:save_search_hash]\n query = Event\n buyer_ids = query.where(event: event).where(udprn: udprns).pluck(:buyer_id).uniq\n\n ### Extract status of the buyers in bulk\n buyers = PropertyBuyer.where(id: buyer_ids).select([:id, :status])\n\n buyers.each do |each_buyer_info|\n buyer_status = PropertyBuyer::REVERSE_STATUS_HASH[each_buyer_info.status]\n search_stats[region_type][buyer_status] += 1\n end\n\n search_stats[region_type][:total] = search_stats[region_type][:green] + search_stats[region_type][:red] + search_stats[region_type][:amber]\n\n if search_stats[region_type][:total] > 0\n search_stats[region_type][:green_percent] = ((search_stats[region_type][:green].to_f/search_stats[region_type][:total].to_f)*100).round(2)\n search_stats[region_type][:amber_percent] = ((search_stats[region_type][:red].to_f/search_stats[region_type][:total].to_f)*100).round(2)\n search_stats[region_type][:red_percent] = ((search_stats[region_type][:amber].to_f/search_stats[region_type][:total].to_f)*100).round(2)\n else\n search_stats[region_type][:green_percent] = nil\n search_stats[region_type][:amber_percent] = nil\n search_stats[region_type][:red_percent] = nil\n end\n end\n search_stats\n end",
"def custom_fields\n custom_fields = JSON.parse(connection.get(\"/ContactIndividual/CustomFields\").body )\n end",
"def getProperties\n @widget = Widget.find(params[:id])\n wtype = WidgetType.find(@widget.widget_type_id)\n\n # Return a hash of properties obtained from each source\n # TBD: Currently used for cal widget. Can be used to send authentication tokens\n srcdata = {}\n str2lst(@widget.sources).each do |source_id|\n src = Source.find(source_id)\n sdata = src.getProperties()\n #logger.debug(\"getProperties():sdata = #{sdata}\")\n srcdata[source_id] = sdata\n end\n\n data = {:srcdata => srcdata}\n #logger.debug(\"getProperties():data = #{data}\")\n\n # The final returned hash looks like this\n # data -> {\n # srcdata -> { ... },\n # };\n render :json => {:data => data}\n end",
"def get_properties()\n resp = conn.get('/users/'+name+'/props/')\n \n case resp.code.to_i\n when 200\n return JSON.parse(resp.body)\n when 404\n raise RestAuthUserNotFound.new( resp )\n else\n raise RestAuthUnknownStatus.new( rest )\n end\n end",
"def custom_fields\n custom_fields = JSON.parse(connection.get(\"/Contact/CustomFields\").body )\n end",
"def tracking_details\n buyer = @current_user\n type_of_tracking = (params[:type_of_tracking] || \"property_tracking\").to_sym\n if type_of_tracking == :property_tracking\n udprns = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[:property_tracking]).pluck(:udprn)\n api = PropertySearchApi.new(filtered_params: {})\n body = api.fetch_details_from_udprns(udprns)\n render json: {property_details: body}, status: 200\n else\n if params[\"hash_str\"].present?\n body = Oj.load(Net::HTTP.get(URI.parse(URI.encode(\"http://52.66.124.42/api/v0/properties/search?hash_str=#{params['hash_str']}\"))))\n render json: {property_details: body}, status: 200\n else\n body = []\n search_hashes = Events::Track.where(buyer_id: buyer.id).where(type_of_tracking: Events::Track::TRACKING_TYPE_MAP[type_of_tracking]).pluck(:hash_str).compact\n search_hashes.each do |search_hash|\n ### TODO: Fix this. Use internal methods rather than calling the api\n body = Oj.load(Net::HTTP.get(URI.parse(URI.encode(\"http://api.prophety.co.uk/api/v0/properties/search?hash_str=#{search_hash}\")))) + body\n end\n render json: {search_hashes: search_hashes, property_details: body}\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Get property stats for a property for a vendor and an agent/developer curl XGET H "Authorization: znsa7shajas" ' | def property_stats
include_archived = (params[:include_archived].to_s == 'true')
stats = Enquiries::PropertyService.new(udprn: params[:udprn].to_i).enquiry_and_view_stats(@current_user.is_premium, include_archived)
render json: { property_stats: stats }, status: 200
end | [
"def properties\n # vendor = Vendor.find(params[:vendor_id])\n search_params = { vendor_id: params[:vendor_id].to_i, results_per_page: 150 }\n search_params[:p] = params[:p].to_i if params[:p]\n pd = PropertySearchApi.new(filtered_params: search_params )\n pd.query[:size] = 1000\n results, status = pd.filter\n results[:results].each { |e| e[:address] = PropertyDetails.address(e) }\n response = results[:results].map { |e| e.slice(:udprn, :address) }\n response = response.sort_by{ |t| t[:address] }\n #Rails.logger.info \"sending response for vendor properties -> #{response.inspect}\"\n render json: response, status: status\n end",
"def list_inviting_agent_and_property\n if user_valid_for_viewing?(['Vendor'], params[:udprn].to_i)\n #if true\n @current_user = Vendor.find(533)\n vendor_id = @current_user.id\n invited_vendors = InvitedVendor.where(email: @current_user.email, source: Vendor::INVITED_FROM_CONST[:family]).select([:agent_id, :udprn])\n udprns = invited_vendors.map(&:udprn)\n bulk_details = PropertyService.bulk_details(udprns)\n response = []\n\n bulk_details.each_with_index do |detail, index|\n detail[:address] = PropertyDetails.address(detail)\n response_hash = {}\n response_hash[:udprn] = detail[:udprn]\n response_hash[:address] = detail[:address]\n agent_fields = [:agent_id, :assigned_agent_first_name, :assigned_agent_last_name, :assigned_agent_email, :assigned_agent_mobile,\n :assigned_agent_office_number, :assigned_agent_image_url, :assigned_agent_branch_name, :assigned_agent_branch_number,\n :assigned_agent_branch_address, :assigned_agent_branch_website, :assigned_agent_branch_logo]\n property_attrs = [:beds, :baths, :receptions, :property_type, :property_status_type ]\n agent_fields.each {|field| response_hash[field] = detail[field] }\n property_attrs.each {|field| response_hash[field] = detail[field] }\n response.push(response_hash)\n end\n\n render json: response, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def list_inviting_agents_properties\n agents = []\n user_valid_for_viewing?(['Vendor', 'Agent'], nil)\n if @current_user\n InvitedVendor.where(email: @current_user.email, accepted: nil).select([:created_at, :udprn, :agent_id, :id]).each do |invited_vendor|\n result_hash = {}\n result_hash[:created_at] = invited_vendor.created_at\n result_hash[:udprn] = invited_vendor.udprn\n udprn = invited_vendor.udprn\n details = PropertyDetails.details(udprn)[:_source]\n result_hash[:address] = details[:address]\n result_hash[:agent_id] = invited_vendor.agent_id\n result_hash[:invitation_id] = invited_vendor.id\n agent = Agents::Branches::AssignedAgent.where(id: invited_vendor.agent_id).last\n if agent\n branch = agent.branch\n result_hash[:agent_email] = agent.email\n result_hash[:agent_name] = agent.first_name + ' ' + agent.last_name\n result_hash[:agent_image_url] = agent.image_url\n result_hash[:branch_image_url] = branch.image_url\n result_hash[:branch_address] = branch.address\n result_hash[:branch_website] = branch.website\n result_hash[:branch_phone_number] = branch.phone_number\n result_hash[:title] = agent.title\n result_hash[:mobile_phone_number] = agent.mobile\n result_hash[:office_phone_number] = agent.office_phone_number\n end\n agents.push(result_hash)\n end\n render json: agents, status: 200\n else\n render json: { message: 'Authorization failed' }, status: 401\n end\n end",
"def demand_info(udprn, property_for='Sale')\n details = PropertyDetails.details(udprn.to_i)['_source']\n #### Similar properties to the udprn\n #### TODO: Remove HACK FOR SOME Results to be shown\n # p details['hashes']\n\n ### Get the distribution of properties according to their property types which match\n ### exactly the buyer requirements\n klass = PropertyBuyer\n query = klass\n query = query.where('min_beds <= ?', details[:beds].to_i) if details[:beds]\n query = query.where('max_beds >= ?', details[:beds].to_i) if details[:beds]\n query = query.where('min_baths <= ?', details[:baths].to_i) if details[:baths]\n query = query.where('max_baths >= ?', details[:baths].to_i) if details[:baths]\n query = query.where('min_receptions <= ?', details[:receptions].to_i) if details[:receptions]\n query = query.where('max_receptions >= ?', details[:receptions].to_i) if details[:receptions]\n query = query.where(\" ? = ANY(property_types)\", details[:property_type]) if details[:property_type]\n query = query.where.not(status: nil)\n result_hash = query.group(:status).count\n \n distribution = {}\n PropertyBuyer::STATUS_HASH.each do |key, value|\n distribution[key] = result_hash[PropertyBuyer::REVERSE_STATUS_HASH[value]]\n distribution[key] ||= 0\n end\n distribution\n end",
"def agent_properties_vendor_buying_reqs\n property_details = PropertyDetails.details(params[:udprn].to_i)[:_source]\n attr_list = [:min_beds, :max_beds, :min_baths, :max_baths, :min_receptions, :max_receptions, :property_types,\n :status, :buying_status, :funding, :biggest_problems, :chain_free, :budget_from, :budget_to, :locations,\n :mortgage_approval ].map(&:to_s)\n buyer_details = PropertyBuyer.where(vendor_id: property_details[:vendor_id].to_i).select(attr_list).last.as_json\n response = nil\n\n if buyer_details\n buyer_details['status'] = PropertyBuyer::REVERSE_STATUS_HASH[buyer_details['status']]\n buyer_details['buying_status'] = PropertyBuyer::REVERSE_BUYING_STATUS_HASH[buyer_details['buying_status']]\n buyer_details['funding'] = PropertyBuyer::REVERSE_FUNDING_STATUS_HASH[buyer_details['funding']]\n buyer_details['property_tracking'] = Events::Track.where(udprn: params[:udprn].to_i).select(:id).last.nil?\n response = {}\n (attr_list- ['property_tracking', 'chain_free', 'budget_from', 'budget_to']).each { |t| response[\"buyer_#{t}\"] = buyer_details[t] }\n response['property_tracking'] = buyer_details['property_tracking']\n response['chain_free'] = buyer_details['chain_free']\n response['buyer_min_budget'] = buyer_details['budget_from']\n response['buyer_max_budget'] = buyer_details['budget_to']\n end\n\n render json: { buyer_details: response }, status: 200\n end",
"def getPropertiesByQuery(url)\r\n # Fetch data\r\n uri = URI.parse(URI.encode(url.strip))\r\n response = Net::HTTP.get(uri)\r\n json_result = JSON.parse(response)\r\n\r\n puts json_result[\"results\"].nil? \r\n\r\n # Check to make sure we have results\r\n if json_result[\"results\"].nil?\r\n return {:status => \"No results\"}.to_json\r\n else\r\n # Return results\r\n return json_result.to_json\r\n end\r\n\r\n # Set up storage\r\n # mls_props = Hash.new\r\n # listing_results = json_result[\"results\"]\r\n\r\n # # Loop over listing results\r\n # cnt = 1\r\n # listing_results.each do |r| \r\n # # Gather data\r\n # house_data = getPropertyInfoFromJson(r) # property info \r\n # listing_data = getListingInfoFromJson(r) # listing info\r\n # !r[\"events\"].nil? ? event_data = r[\"events\"] : event_data = nil # events info\r\n\r\n # # Call PDQ to determine if property is pre-qualified\r\n # ##############################################################\r\n # ###### Placeholder to call get_values (PDQ) on property ######\r\n # ##############################################################\r\n\r\n # # Save results for property\r\n # mls_props[cnt] = {:propertyInfo => house_data, \r\n # :mlsInfo => listing_data,\r\n # :events => event_data}\r\n # cnt += 1\r\n # end\r\n\r\n # # Construct total data hash\r\n # all_data = Hash.new\r\n # all_data[:totalNumProperties] = json_result[\"total\"]\r\n # all_data[:results] = mls_props\r\n\r\n # return all_data.to_json\r\n end",
"def vendor_details\n authenticate_request('Vendor')\n if @current_user\n vendor_details = @current_user.as_json\n yearly_quote_count = Agents::Branches::AssignedAgents::Quote.where(vendor_id: @current_user.id).where(\"created_at > ?\", 1.year.ago).group(:property_id).select(\"count(id)\").to_a.count\n vendor_details[:yearly_quote_count] = yearly_quote_count\n vendor_details[:quote_limit] = Agents::Branches::AssignedAgents::Quote::VENDOR_LIMIT\n vendor_details[:is_premium] = @current_user.buyer.is_premium\n render json: vendor_details, status: 200\n end\n end",
"def demand_info\n udprn = @udprn.to_i\n details = PropertyDetails.details(udprn.to_i)['_source']\n #### Similar properties to the udprn\n\n ### Get the distribution of properties according to their property types which match\n ### exactly the buyer requirements\n klass = PropertyBuyer\n query = klass\n query = query.where('min_beds <= ?', details[:beds].to_i) if details[:beds]\n query = query.where('max_beds >= ?', details[:beds].to_i) if details[:beds]\n query = query.where('min_baths <= ?', details[:baths].to_i) if details[:baths]\n query = query.where('max_baths >= ?', details[:baths].to_i) if details[:baths]\n query = query.where('min_receptions <= ?', details[:receptions].to_i) if details[:receptions]\n query = query.where('max_receptions >= ?', details[:receptions].to_i) if details[:receptions]\n query = query.where(\" ? = ANY(property_types)\", details[:property_type]) if details[:property_type]\n query = query.where.not(status: nil)\n result_hash = query.group(:status).count\n \n distribution = {}\n PropertyBuyer::STATUS_HASH.each do |key, value|\n distribution[key] = result_hash[value]\n distribution[key] ||= 0\n end\n distribution\n end",
"def crawled_property_details\n agent = @current_user\n #if true\n crawled_property = Agents::Branches::CrawledProperty.where(id: params[:property_id].to_i).last\n if crawled_property\n details = {}\n details[:beds] = crawled_property.stored_response['beds']\n details[:baths] = crawled_property.stored_response['baths']\n details[:receptions] = crawled_property.stored_response['receptions']\n details[:title] = crawled_property.stored_response['title']\n details[:assigned_agent_image_url] = crawled_property.stored_response['agent_logo']\n details[:assigned_agent_image_url] = crawled_property.stored_response['agent_logo']\n details[:opening_hours] = crawled_property.stored_response['opening_hours']\n details[:listing_category] = crawled_property.additional_details['listings_category']\n details[:price] = crawled_property.additional_details['price']\n details[:floorplan_url] = crawled_property.stored_response['floorplan_url']\n details[:property_type] = crawled_property.additional_details['property_type']\n details[:epc] = crawled_property.additional_details['has_epc']\n details[:total_area] = crawled_property.additional_details['size_sq_feet']\n details[:total_area] ||= (crawled_property.additional_details['size_sq_metres'].to_f*3.280).to_i if crawled_property.additional_details['size_sq_metres']\n details[:price_qualifier] = crawled_property.additional_details['price_qualifier']\n details[:property_style] = crawled_property.additional_details['listing_condition']\n details[:is_retirement_home] = crawled_property.additional_details['is_retirement_home']\n highlights = crawled_property.additional_details['property_highlights'].split('|') rescue []\n main_features = crawled_property.stored_response['features']\n main_features ||= []\n details[:additional_features] = main_features + highlights\n details[:description] = crawled_property.stored_response['description']\n render json: details, status: 200\n else\n render json: { message: 'Property does not exist' }, status: 400\n end\n end",
"def get_property( propname )\n resp = conn.get('/users/'+name+'/props/'+propname+'/')\n \n case resp.code.to_i\n when 200\n return JSON.parse( resp.body )\n when 404\n case resp.header['resource-type']\n when 'user'\n raise RestAuthUserNotFound.new( resp )\n when 'property'\n raise RestAuthPropertyNotFound.new( resp )\n else\n raise RestAuthBadResponse.new( resp, \"Received 404 without Resource-Type header\" )\n end\n else\n raise RestAuthUnknownStatus.new( resp )\n end\n end",
"def getProperty(tree, userAgent, property)\n _getProperty(tree, userAgent, property, false)\n end",
"def properties_for_claiming\n search_str = params[:str]\n postcode = params[:postcode]\n search_hash = {}\n search_hash[:postcode] = params[:postcode] if params[:postcode] && !params[:postcode].empty?\n search_hash[:sub_building_name] = params[:str] if params[:str] && !params[:str].empty?\n search_hash[:building_name] = params[:str] if params[:str] && !params[:str].empty?\n search_hash[:building_number] = params[:str] if params[:str] && !params[:str].empty?\n search_hash[:postcode] = params[:str] if params[:str] && !params[:str].empty?\n api = PropertySearchApi.new(filtered_params: search_hash )\n api.apply_filters\n api.add_not_exists_filter('vendor_id')\n api.make_or_filters([:sub_building_name, :building_name, :building_number, :postcode])\n body, status = api.fetch_data_from_es\n render json: body, status: status\n end",
"def get_properties\n xml = client.call(\"#{url}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(client, p, branch: self) }\n end",
"def propstats(response, stats)\n return if stats.empty?\n stats.each do |status, props|\n propstat = Ox::Element.new(D_PROPSTAT)\n prop = Ox::Element.new(D_PROP)\n\n props.each do |element, value|\n\n name = element[:name]\n if prefix = prefix_for(element[:ns_href])\n name = \"#{prefix}:#{name}\"\n end\n\n prop_element = Ox::Element.new(name)\n ox_append prop_element, value, prefix: prefix\n prop << prop_element\n\n end\n\n propstat << prop\n propstat << ox_element(D_STATUS, \"#{http_version} #{status.status_line}\")\n\n response << propstat\n end\n end",
"def index\n @api_v1_properties = Api::V1::Property.all\n end",
"def assert_propstat_response response, properties, statuses\n assert_instance_of RubyDav::PropstatResponse, response\n\n assert_equal properties.keys.sort, statuses.keys.sort\n assert_equal properties.keys.sort, response.resources.keys.sort\n\n response.resources.each do |url, results|\n\n successful_results = results.reject do |pk, r|\n r.inner_value.nil? || r.inner_value.strip.empty?\n end\n\n successful_keys = successful_results.keys.sort\n assert_equal properties[url].keys.sort, successful_keys\n\n successful_keys.each do |pk|\n assert_equal properties[url][pk], results[pk].inner_value\n end\n\n keys = results.keys.sort\n assert_equal statuses[url].keys.sort, results.keys.sort\n\n keys.each do |pk|\n assert_equal statuses[url][pk], results[pk].status\n end\n end\n end",
"def get_properties\n xml = client.call(\"#{attributes[:url]}/property\").parsed_response\n xml.css('properties property').map { |p| Vebra::Property.new(p, self) }\n end",
"def my_properties\n @api_v1_properties = current_api_v1_user.properties.\n includes(:reservations).\n order(\"reservations.created_at DESC\")\n\n render template: '/api/v1/properties/index', status: 200\n end",
"def verify_udprn_to_crawled_property\n agent_id = params[:id].to_i\n agent = Agents::Branches::AssignedAgent.where(id: agent_id).last\n postcode = nil\n base_url = \"https://s3-us-west-2.amazonaws.com/propertyuk/\"\n response = []\n postcodes = \"\"\n page_no = params[:page].to_i rescue 0\n page_size = 5\n Rails.logger.info(\"GET_CRAWLED_PROPERTY_#{agent_id}\")\n if agent\n branch_id = agent.branch_id\n properties = Agents::Branches::CrawledProperty.where(branch_id: branch_id).select([:id, :postcode, :image_urls, :stored_response, :additional_details, :udprn, :agent_email, :vendor_email, :lettings]).where.not(postcode: nil).where(udprn: nil).limit(page_size).offset(page_no*page_size).order('created_at asc')\n property_count = Agents::Branches::CrawledProperty.where(branch_id: branch_id).where.not(postcode: nil).where(udprn: nil).count\n assigned_agent_emails = Agents::Branches::AssignedAgent.where(branch_id: branch_id).pluck(:email)\n properties.each do |property|\n new_row = {}\n new_row['property_id'] = property.id\n new_row['address'] = property.stored_response['address']\n new_row['image_urls'] = property.image_urls.map { |e| base_url + e }\n new_row['post_code'] = property.postcode\n new_row['property_status_type'] = 'Green'\n\n if property.agent_email\n new_row['assigned_agent_emails'] = [ property.agent_email ]\n new_row['vendor_email'] = property.vendor_email\n new_row['rental_status'] = property.lettings\n else\n new_row['assigned_agent_emails'] = assigned_agent_emails\n new_row['vendor_email'] = nil\n new_row['rental_status'] = nil\n end\n\n new_row['udprn'] = property.udprn\n postcode = property.postcode\n response.push(new_row)\n postcodes = postcodes + \",\" + postcode\n end\n #query = PropertyAddress\n #where_query = postcodes.split(',').map{ |t| t.split(' ').join('') }.map{ |t| \"(to_tsvector('simple'::regconfig, postcode) @@ to_tsquery('simple', '#{t}'))\" }.join(' OR ')\n #results = PropertyAddress.connection.execute(query.where(where_query).select([:udprn, :postcode]).limit(1000).to_sql).to_a\n #results = []\n #Rails.logger.info(results.as_json)\n response.each do |each_crawled_property_data|\n if !each_crawled_property_data['udprn'] \n each_crawled_property_data['last_email_sent'] = nil\n each_crawled_property_data['vendor_email'] = nil\n each_crawled_property_data['is_vendor_registered'] = false\n end\n each_crawled_property_data['udprn'] = each_crawled_property_data['udprn'].to_f\n end\n render json: { response: response, property_count: property_count }, status: 200\n else\n render json: { message: 'Agent not found' }, status: 404\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
New tags for a particular field can be added using this api curl XPOST H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo3LCJleHAiOjE0ODUxODUwMTl9.7drkfFR5AUFZoPxzumLZ5TyEod_dLm8YoZZM0yqwq6U" ' | def add_new_tags
tags = params[:tags]
field = params[:field]
field_type = FieldValueStore::FIELD_TYPE_ARR.index(field.to_sym)
tags ||= [] if !tags.is_a?(Array)
tags.each{ |tag| FieldValueStore.create!(field_type: field_type, name: tag) }
render json: { message: "Tags have been added successfully to the #{field}", tags: tags }, status: 201
end | [
"def add_tags(resource_arn, tags)\n keys = tags.keys.sort\n values = keys.map {|key| tags[key]}\n request({\n 'Action' => 'AddTags',\n 'ResourceArns.member.1' => resource_arn,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new,\n }.merge(Fog::AWS.indexed_param('Tags.member.%d.Key', keys))\n .merge(Fog::AWS.indexed_param('Tags.member.%d.Value', values)))\n end",
"def add_tags(resource_id, tags)\n tags_arr = tags.map { |k, v| { 'Key' => k, 'Value' => v } }\n request({\n 'Action' => 'AddTags',\n 'ResourceArns.member.1' => resource_id,\n :parser => Fog::Parsers::AWS::ELBV2::Empty.new,\n }.merge(Fog::AWS.serialize_keys(tags_arr)))\n end",
"def add_tag_to_resource(id, tag)\n tag.gsub!(\" \", \"_\")\n url = \"#{@api_base_path}/resources/#{id}/tags\"\n\n handle_timeouts do\n response = self.class.post(url, headers: auth_header,\n body: { add: tag })\n JSON.parse(response.body)['new_list']\n end\n end",
"def create(tag)\n api_client.tags.multi_add(resource_hrefs: [api_client.get_instance.href], tags: [tag])\n end",
"def add_tags\n \tunless tags_field.blank?\n\t\t\ttags = tags_field.split(\",\")\n\t\t\ttags.each do |tag|\n self.tags << Tag.find_or_initialize_by_name(tag.strip)\n\t\t\tend\n\t\tend\t\n end",
"def create_tag(tag_name, info = {})\n wrap_response do\n self.class.post \"/api2/tags\",\n { :body => JSON({ :name => tag_name.to_s} | info) } | default_options\n end\n end",
"def create_tag_template_field 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_tag_template_field_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::V1::TagTemplateField.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def create_tag!(params = {})\n cleaned = params.permit(:name)\n create(\"tags\", cleaned)\n end",
"def add_tag(tag)\n Exlibris::Primo::WebService::Request::AddTag.new(user_record_request_attributes.merge :value => tag).call\n reset_tags\n end",
"def create_tag_template_field 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_tag_template_field_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Cloud::DataCatalog::V1beta1::TagTemplateField.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end",
"def add_tags(*new_tags)\n update_tags(new_tags, []) { |raw_response| yield raw_response if block_given? }\n end",
"def post_tag(api, query, set)\n params = { 'api_key' => @apikey, 'query' => query, 'tag' => set }\n url2json(:POST, \"#{@endpoint}#{api}\", params)\n end",
"def create_tags(resource_id, tags)\n # Tags need to be created individually in fog\n tags.each do |k, v|\n @compute_provider.tags.create(:resource_id => resource_id,\n :key => k.to_s, :value => v.to_s)\n end\n end",
"def replace_tag\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end",
"def create\n @post_tag = @post_type.post_tags.new(params.require(:post_tag).permit!)\n args = {post_tag: @post_tag, post_type: @post_type}; hooks_run(\"before_create_post_tag\", args)\n if @post_tag.save\n @post_tag.set_options(params[:meta]) if params[:meta].present?\n @post_tag.set_field_values(params[:field_options])\n hooks_run(\"after_create_post_tag\", args)\n flash[:notice] = t('camaleon_cms.admin.post_type.message.created')\n redirect_to action: :index\n else\n render 'edit'\n end\n end",
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n body[\"tag\"]\n end",
"def set(tags)\n tags = tags.map { |k, v| { :key => k.to_s, :value => v.to_s } }\n client.add_tags api_args.merge(:tags => tags)\n end",
"def add_tags(tag)\n remove_previous_tags\n if @page.find(input_elements[:tag_input_field]).present?\n @page.find(input_elements[:tag_input_field]).set(tag)\n else\n @page.find(input_elements[:tag_input_field2]).set(tag)\n end\n @page.find(input_elements[:tag_selected]).click\n @used_tag = tag\n end",
"def add_tag key, params={}\n opts = {:single_quoted => false}\n params = {\n :body => {\n \"ClientToken\" => self.token,\n \"PersonKey\" => Type::String.safe_value(key, opts),\n \"ElementYear\" => Type::Number.safe_value(params[:year], opts),\n \"ElementName\" => Type::String.safe_value(params[:name], opts),\n \"ElementDescription\" => Type::String.safe_value(params[:desc], opts)\n }\n }\n\n post 'add_tag.php', params\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Show all tags for a particular field curl XGET H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1c2VyX2lkIjo3LCJleHAiOjE0ODUxODUwMTl9.7drkfFR5AUFZoPxzumLZ5TyEod_dLm8YoZZM0yqwq6U" ' | def show_tags
field = params[:field]
field_type = FieldValueStore::FIELD_TYPE_ARR.index(field.to_sym)
tags = FieldValueStore.where(field_type: field_type).pluck(:name)
render json: tags, status: 200
end | [
"def get_tag_list\n # body = {\n # cmd: \"get_tag_list\"\n # }\n\n end",
"def all_tags\n request(:get,\"/tags\")\n end",
"def tagList()\n http, req = initReq(\"tags/\")\n JSON.parse(http.request(req).body)\nend",
"def tags\n _get(\"/query/image/tags\") { |json| json }\n end",
"def show_contact_tags(**params)\n get('contactTags', params)\n end",
"def tags\n get.tagGuids\n end",
"def describe_tags(resource_arns)\n request({\n 'Action' => 'DescribeTags',\n :parser => Fog::Parsers::AWS::ELBV2::DescribeTags.new\n }.merge!(Fog::AWS.indexed_param('ResourceArns.member.%d', [*resource_arns]))\n )\n end",
"def list_tags(options={}) path = \"/api/v2/definitions/tags\"\n get(path, options, AvaTax::VERSION) end",
"def robotags\n object.tags User.super_id\n end",
"def content_by_tag(tags)\n x = tags.gsub(\" \", \"/\")\n JSON.parse(self.class.get(\"/search?tag=\" + \"#{x}\" + \"#{@token}\").body)\n end",
"def tags(query_options = {})\n options = default_options\n options[:query] |= query_options\n wrap_response do\n self.class.get '/api2/tags', options\n end\n end",
"def describe_tags(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'DescribeTags'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\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? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :page_number\n\t\t\traise ArgumentError, 'page_number must be equal or greater than 0' unless optional[:page_number] < 0\n\t\t\targs[:query]['PageNumber'] = optional[:page_number]\n\t\tend\n\t\tif optional.key? :page_size\n\t\t\traise ArgumentError, 'page_size must be equal or greater than 0' unless optional[:page_size] < 0\n\t\t\traise ArgumentError, 'page_size must be equal or less than 100' unless optional[:page_size] > 100\n\t\t\targs[:query]['PageSize'] = optional[:page_size]\n\t\tend\n\t\tif optional.key? :resource_id\n\t\t\targs[:query]['ResourceId'] = optional[:resource_id]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tif optional.key? :resource_type\n\t\t\targs[:query]['ResourceType'] = optional[:resource_type]\n\t\tend\n\t\tif optional.key? :tag_1_key\n\t\t\targs[:query]['Tag.1.Key'] = optional[:tag_1_key]\n\t\tend\n\t\tif optional.key? :tag_1_value\n\t\t\targs[:query]['Tag.1.Value'] = optional[:tag_1_value]\n\t\tend\n\t\tif optional.key? :tag_2_key\n\t\t\targs[:query]['Tag.2.Key'] = optional[:tag_2_key]\n\t\tend\n\t\tif optional.key? :tag_2_value\n\t\t\targs[:query]['Tag.2.Value'] = optional[:tag_2_value]\n\t\tend\n\t\tif optional.key? :tag_3_key\n\t\t\targs[:query]['Tag.3.Key'] = optional[:tag_3_key]\n\t\tend\n\t\tif optional.key? :tag_3_value\n\t\t\targs[:query]['Tag.3.Value'] = optional[:tag_3_value]\n\t\tend\n\t\tif optional.key? :tag_4_key\n\t\t\targs[:query]['Tag.4.Key'] = optional[:tag_4_key]\n\t\tend\n\t\tif optional.key? :tag_4_value\n\t\t\targs[:query]['Tag.4.Value'] = optional[:tag_4_value]\n\t\tend\n\t\tif optional.key? :tag_5_key\n\t\t\targs[:query]['Tag.5.Key'] = optional[:tag_5_key]\n\t\tend\n\t\tif optional.key? :tag_5_value\n\t\t\targs[:query]['Tag.5.Value'] = optional[:tag_5_value]\n\t\tend\n\t\tself.run(args)\n\tend",
"def show_tag(tag_name)\n wrap_response do\n self.class.get \"/api2/tags/#{tag_name}\", default_options\n end\n end",
"def tagPrint(tags)\n tags[\"tags\"].each do |t|\n puts t[\"name\"].to_s + \": \" + t[\"resources\"][\"droplets\"][\"count\"].to_s\n end\nend",
"def all\n response= handle_errors{ self.class.get('/get')}\n response[\"tags\"][\"tag\"].collect do |tag| \n t= Rubycious::Tag.new(tag)\n end\n end",
"def get_contact_tags(contact_id)\n @client.raw('get', \"/crm/contacts/#{contact_id}/tags\")\n end",
"def tag\n @entries = Entry.where({oauth_id: @oauth.id}).tagged_with(params[:tag]).order(\"id DESC\").page(params[:page])\n end",
"def get_tag_list\n args = receive_should_validate?\n get('redtube.Tags.getTagList', {}, [], args[:should_validate])\n end",
"def tags\n klass = Object.const_get(\"Concepts\").const_get(params[:tag_class])\n results = klass.search_for_label_starting_with(params[:term]).map(&:label)\n render :json => results.uniq.sort\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
List of invited friends and family for the vendor curl XGET H "ContentType: application/json" H "Authorization: eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9." ' | def invited_f_and_f_list
invited_f_and_fs = InvitedFandFVendor.where(invitee_id: @current_user.id).select([:email, :created_at])
render json: invited_f_and_fs, status: 200
end | [
"def friend_invitations\n get_call(\"user/#{user_id}/friends/invitations.json\")\n end",
"def friends\n return [] if oauth_token.blank?\n\n self.class.with_https \"#{API_HOST}me/friends?#{{ access_token: oauth_token }.to_param}\" do |uri, http|\n request = Net::HTTP::Get.new(uri.to_s)\n response = http.request(request)\n\n if (200...300).cover? response.code.to_i\n JSON.parse(response.body)['data']\n else\n update_attributes(oauth_token: nil) and []\n end\n end\n end",
"def fetch_friends\n params = { relationship: 'friend', steamid: steam_id64 }\n\n friends_data = WebApi.json 'ISteamUser', 'GetFriendList', 1, params\n @friends = friends_data[:friendslist][:friends].map do |friend|\n SteamId.new(friend[:steamid].to_i, false)\n end\n end",
"def friends\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/list').friends\n end",
"def list\n friends = []\n session[:user].friends.each do |friend|\n \tfriends.push friend.description\n end\n @result = { success: true, friends: friends }\n end",
"def friends\n @friends = response[\"friends\"]\n @friends[\"groups\"].each do |group|\n group[\"items\"].map!{|item| Foursquared::Response::User.new(client, item)}\n end\n @friends\n end",
"def invites_from_family\n invites.where(:created_by => self.head)\n end",
"def list\n user = User.find_by_email params[:email]\n if user\n friendship = Friendship.where user: user\n render json: {success: true, friends: friendship.map {|f| f.friend.email}, count: friendship.count}\n else\n render json: {message: \"email not found\"}\n end\n end",
"def friend_list\n if params[:email].nil?\n raise ActiveRecord::RecordInvalid\n else\n requesting_user = User.find_by(email: params[:email])\n if requesting_user \n friend_list = requesting_user.friend_list.pluck(:email)\n json_response({success: true, friends: friend_list, count: friend_list.size}, :ok)\n else\n raise ActiveRecord::RecordNotFound\n end\n end\n end",
"def list_friendships\n friends = []\n session[:user].friendships.each do |friend|\n friends.push friend.description\n end\n @result = { success: true, friends: friends }\n end",
"def list_favorite_friends\n list_favorite_things(:friend)\n end",
"def get_friends\n @person = Person.find_by_guid(params['user_id'])\n if ! @person\n render_json :status => :not_found and return\n end\n\n if params['sortBy'] == \"status_changed\"\n params['sortOrder'] ||= \"ascending\"\n @friends = @person.contacts.all\n @friends.sort!{|a,b| sort_by_status_message_changed(a, b, params['sortOrder']) }\n else\n @friends = @person.contacts\n end\n @friends.filter_paginate!(params[:per_page], params[:page]){true}\n @friends.collect! { |p| p.to_hash(@user, @client)}\n render_json :entry => @friends, :size => @friends.count_available and return\n end",
"def friends_info(options = {})\n validate_providers! %w[facebook yahoo myspace twitter], options[:enabled_providers]\n params = provider_hash(options)\n params[:user_ids], params[:detail_level] = options[:uids], options[:detailLevel]\n \n response = perform_post(:getFriendsInfo, params)\n friends = []\n response['friends']['friend'].each do |friend|\n friends << Giggly::Friend.new(friend)\n end\n friends\n end",
"def getFriendsList()\n #convert the oauth_tokens array to a hash base on the provider (to easily access the tokens)\n tokenHash = oauth_tokens.index_by(&:provider)\n #get the Facebook Token\n token = tokenHash[FacebookProvider.service_name].access_token\n \n #Define the friends return array and create an HTTPClient.\n friends = Array.new\n client = HTTPClient.new\n \n #Make a HTTP GET Request from the Facebook friends API to get the fields we'll be using in our app\n headers={\"access_token\"=>token}\n requestURL = \"https://graph.facebook.com/me/friends?fields=id,first_name,last_name,picture\"\n response = client.get(requestURL,headers) \n responseJson = JSON.parse(response.body)\n \n #If the data tag is in the returned JSON, we know we got some data bacl\n if responseJson[\"data\"]\n friendsJson = responseJson[\"data\"]\n friendsJson.each do |friendJson|\n friend = Friend.new\n friend.provider = \"Facebook\"\n friend.providerid = friendJson[\"id\"]\n friend.first_name = friendJson[\"first_name\"]\n friend.last_name = friendJson[\"last_name\"]\n if friendJson[\"picture\"][\"data\"] && friendJson[\"picture\"][\"data\"][\"url\"]\n friend.picture_url = friendJson[\"picture\"][\"data\"][\"url\"]\n end\n friends.push(friend)\n end\n #Otherwise raise an excpetion to be handled by the caller.\n else \n raise \"Error getting data from Facebook API\"\n end\n return friends\n end",
"def getFollowers\n\t\tpath = \"/1.1/followers/list.json\"\n\t\tquery = URI.encode_www_form(\"screen_name\" => \"BuzzwordIpsum\")\n\t\taddress = URI(\"#{@@baseurl}#{path}?#{query}\")\n\t\t\n\t\trequest = Net::HTTP::Get.new address.request_uri\n\t\t\n\t\thttp=setupHTTP(address)\n\t\tresponse = sendRequest(request, http)\n\t\t\n\t\tif response.code == '200' then\n\t\t\tusers = JSON.parse(response.body)\t\t\t\n\t\t\treturn users[\"users\"]\n\t\tend\n\tend",
"def get_friends\n @xml['friends']['friends'].map { |f| Friend.build_from_xml(f[1]) }\n end",
"def friends\n @friends_arr = []\n current_user = User.where(id: self.id)\n friends = current_user[0].friendships\n friends.each do |f|\n @friends_arr.push(f.friendee)\n end\n \n @friends_arr\n end",
"def friend_requests\n # Requires authorization\n raise PutioError::AuthorizationRequired if authentication_required!\n\n make_get_call('/friends/waiting-requests').friends\n end",
"def find_facebook_friends_with_accounts\n load_facebook_api\n friends = @facebook_api.get_connections('me', 'friends')\n \n friend_ids = []\n friends.each { |friend| friend_ids << friend['id'] }\n\n auths = Authorization.where(:provider => 'facebook', :uid => friend_ids)\n\n output = []\n auths.each { |auth| output << auth.user }\n\n output\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
GET /reserve_parkings GET /reserve_parkings.json | def index
@reserve_parkings = ReserveParking.all
end | [
"def index\n @parkings = Parking.all\n end",
"def index\n @parks = Park.all\n\n render json: @parks\n end",
"def index\n @parking_slots = ParkingSlot.all\n end",
"def index\n @parks = Park.all\n if params[:name]\n name = params[:name]\n @parks = Park.search_name(name)\n end\n if params[:location]\n location = params[:location]\n @parks = Park.search_location(location)\n end\n if params[:random]\n number= params[:random].to_i\n @parks = Park.random(number)\n end\n json_response(@parks)\n end",
"def create\n @reserve_parking = ReserveParking.new(reserve_parking_params)\n\n respond_to do |format|\n if @reserve_parking.save\n format.html { redirect_to @reserve_parking, notice: 'Reserve parking was successfully created.' }\n format.json { render :show, status: :created, location: @reserve_parking }\n else\n format.html { render :new }\n format.json { render json: @reserve_parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @parkingslots = Parkingslot.all\n end",
"def index\n @parks = Park.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parks }\n end\n end",
"def index\n @parking_lots = ParkingLot.all\n end",
"def index\n @parkinglots = Parkinglot.all\n end",
"def index\n @place_parkings = PlaceParking.all\n end",
"def index\n @parkers = Parker.all\n\t\trespond_with @parkers\n end",
"def index\n @parkingramps = @Parkingramp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @parkingramps }\n end\n end",
"def create\n @parking = Parking.new(parking_params)\n\n if @parking.save\n render :show, status: :created, location: @parking\n else\n render json: @parking.errors, status: :unprocessable_entity\n end\n end",
"def index\n @reserve_statuses = ReserveStatus.all\n end",
"def show\n response = HTTP.get(\"https://developer.nps.gov/api/v1/parks?parkCode=#{params[:parkCode]}&api_key=#{Rails.application.credentials.nps_api_key}\")\n park = response.parse[\"data\"]\n render json: park\n end",
"def index\n @parking_types = ParkingType.all\n end",
"def skier_pings_index \n @pings = Skier.find(params[:id]).pings\n render json: @pings \n end",
"def show\n @parking_lot_booking = ParkingLotBooking.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @parking_lot_booking }\n end\n end",
"def index\n @reserves = Reserve.all\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
POST /reserve_parkings POST /reserve_parkings.json | def create
@reserve_parking = ReserveParking.new(reserve_parking_params)
respond_to do |format|
if @reserve_parking.save
format.html { redirect_to @reserve_parking, notice: 'Reserve parking was successfully created.' }
format.json { render :show, status: :created, location: @reserve_parking }
else
format.html { render :new }
format.json { render json: @reserve_parking.errors, status: :unprocessable_entity }
end
end
end | [
"def create\n @parking = Parking.new(parking_params)\n\n if @parking.save\n render :show, status: :created, location: @parking\n else\n render json: @parking.errors, status: :unprocessable_entity\n end\n end",
"def index\n @reserve_parkings = ReserveParking.all\n end",
"def create\n @parking = Parking.new(parking_params)\n\n respond_to do |format|\n if @parking.save\n format.html { redirect_to @parking, notice: t(:parking_created) }\n format.json { render :show, status: :created, location: @parking }\n else\n format.html { render :new }\n format.json { render json: @parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parking = Parking.new(parking_params)\n\n respond_to do |format|\n if @parking.save\n format.html { redirect_to @parking, notice: 'Parking was successfully created.' }\n format.json { render :show, status: :created, location: @parking }\n else\n format.html { render :new }\n format.json { render json: @parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @park = Park.create!(park_params)\n json_response(@park, :created)\n end",
"def create\n @parking = Parking.new(params[:parking])\n @parking.save\n respond_with(@parking)\n end",
"def create\n \n @rent_parking = RentParking.new(rent_parking_params)\n @type_parkings= TypeParking.all\n\n\n \n respond_to do |format|\n if @rent_parking.save\n format.html { redirect_to @rent_parking, notice: 'Rent parking was successfully created.' }\n format.json { render :show, status: :created, location: @rent_parking }\n else\n format.html { render :new }\n format.json { render json: @rent_parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @park = Park.new(params[:park])\n\n if @park.save\n render json: @park, status: :created, location: @park\n else\n render json: @park.errors, status: :unprocessable_entity\n end\n end",
"def create\n @parking_slot = ParkingSlot.new(parking_slot_params)\n\n respond_to do |format|\n if @parking_slot.save\n format.html { redirect_to @parking_slot, notice: 'Parking slot was successfully created.' }\n format.json { render :show, status: :created, location: @parking_slot }\n else\n format.html { render :new }\n format.json { render json: @parking_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @place_parking = PlaceParking.new(place_parking_params)\n\n respond_to do |format|\n if @place_parking.save\n format.html { redirect_to @place_parking, notice: 'Place parking was successfully created.' }\n format.json { render :show, status: :created, location: @place_parking }\n else\n format.html { render :new }\n format.json { render json: @place_parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parking_lot = ParkingLot.new(parking_lot_params)\n\n if @parking_lot.save\n render json: @parking_lot, status: :created, location: @parking_lot\n else\n render json: @parking_lot.errors, status: :unprocessable_entity\n end\n end",
"def create\n @parking_place = ParkingPlace.new(parking_place_params.merge(parking: @parking))\n\n respond_to do |format|\n if @parking_place.save\n format.html { redirect_to @parking_place, notice: t(:parking_place_created) }\n format.json { render :show, status: :created, location: @parking_place }\n else\n format.html { render :new }\n format.json { render json: @parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n @park_spacerental = ParkSpacerental.new(park_spacerental_params)\r\n\r\n respond_to do |format|\r\n if @park_spacerental.save\r\n format.html { redirect_to @park_spacerental, notice: 'Park spacerental was successfully created.' }\r\n format.json { render :show, status: :created, location: @park_spacerental }\r\n else\r\n format.html { render :new }\r\n format.json { render json: @park_spacerental.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @parking_request = ParkingRequest.new(parking_request_params)\n @parking_request.sid = current_user_id\n @parking_request.app_status = 0 #set pending flag\n\n respond_to do |format|\n if @parking_request.save\n format.html { redirect_to @parking_request, notice: 'Parking request was successfully created.' }\n format.json { render :show, status: :created, location: @parking_request }\n else\n format.html { render :new }\n format.json { render json: @parking_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parkingslot = Parkingslot.new(parkingslot_params)\n\n respond_to do |format|\n if @parkingslot.save\n format.html { redirect_to @parkingslot, notice: 'Parkingslot was successfully created.' }\n format.json { render :show, status: :created, location: @parkingslot }\n else\n format.html { render :new }\n format.json { render json: @parkingslot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parking_type = ParkingType.new(parking_type_params)\n\n respond_to do |format|\n if @parking_type.save\n format.html { redirect_to @parking_type, notice: 'Parking type was successfully created.' }\n format.json { render :show, status: :created, location: @parking_type }\n else\n format.html { render :new }\n format.json { render json: @parking_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @parking_place = ParkingPlace.new(parking_place_params)\n\n if @parking_place.save\n render :show, status: :created, location: @parking_place\n else\n render json: @parking_place.errors, status: :unprocessable_entity\n end\n end",
"def create\n @parkingtype = Parkingtype.new(parkingtype_params)\n\n respond_to do |format|\n if @parkingtype.save\n format.html { redirect_to @parkingtype, notice: 'Parkingtype was successfully created.' }\n format.json { render :show, status: :created, location: @parkingtype }\n else\n format.html { render :new }\n format.json { render json: @parkingtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @parkings = Parking.all\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
PATCH/PUT /reserve_parkings/1 PATCH/PUT /reserve_parkings/1.json | def update
respond_to do |format|
if @reserve_parking.update(reserve_parking_params)
format.html { redirect_to @reserve_parking, notice: 'Reserve parking was successfully updated.' }
format.json { render :show, status: :ok, location: @reserve_parking }
else
format.html { render :edit }
format.json { render json: @reserve_parking.errors, status: :unprocessable_entity }
end
end
end | [
"def update\n @parking = Parking.find(params[:id])\n @parking.update_attributes(params[:parking])\n respond_with(@parking)\n end",
"def update\n @parking = Parking.find(params[:id])\n\n end",
"def update\n @parking_lot = ParkingLot.find(params[:id])\n\n if @parking_lot.update(parking_lot_params)\n head :no_content\n else\n render json: @parking_lot.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @parking.update(parking_params)\n render :show, status: :ok, location: @parking\n else\n render json: @parking.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @parking.update(parking_params)\n format.html { redirect_to @parking, notice: 'Parking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parking_request.update(parking_request_params)\n format.html { redirect_to @parking_request, notice: 'Parking request was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_request }\n else\n format.html { render :edit }\n format.json { render json: @parking_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parking.update(parking_params)\n format.html { redirect_to @parking, notice: 'Parking was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking }\n else\n format.html { render :edit }\n format.json { render json: @parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parking_slot.update(parking_slot_params)\n format.html { redirect_to @parking_slot, notice: 'Parking slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_slot }\n else\n format.html { render :edit }\n format.json { render json: @parking_slot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @parking_lot_booking = ParkingLotBooking.find(params[:id])\n\n respond_to do |format|\n if @parking_lot_booking.update_attributes(params[:parking_lot_booking])\n format.html { redirect_to @parking_lot_booking, notice: 'Parking lot booking was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @parking_lot_booking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\r\n respond_to do |format|\r\n if @park_spacerental.update(park_spacerental_params)\r\n format.html { redirect_to @park_spacerental, notice: 'Park spacerental was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @park_spacerental }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @park_spacerental.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n respond_to do |format|\n if @parking_lot.update(parking_lot_params)\n format.html { redirect_to @parking_lot, notice: 'Parking lot was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_lot }\n else\n format.html { render :edit }\n format.json { render json: @parking_lot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parking_lot.update(parking_lot_params)\n format.html { redirect_to parking_lots_path, notice: 'ParkingLot was successfully updated.' }\n format.json { render :show, status: :ok, location: @parking_lot }\n else\n format.html { render :edit }\n format.json { render json: @parking_lot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_parking.update(type_parking_params)\n format.html { redirect_to @type_parking, notice: 'Type parking was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_parking }\n else\n format.html { render :edit }\n format.json { render json: @type_parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @rent_parking.update(rent_parking_params)\n format.html { redirect_to @rent_parking, notice: 'Rent parking was successfully updated.' }\n format.json { render :show, status: :ok, location: @rent_parking }\n else\n format.html { render :edit }\n format.json { render json: @rent_parking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_parking_lot.update(admin_parking_lot_params)\n format.html { redirect_to admin_parking_lots_url, notice: 'Parking lot was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_parking_lot }\n else\n format.html { render :edit }\n format.json { render json: @admin_parking_lot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @availability_parking_place.update(availability_parking_place_params)\n format.html { redirect_to @availability_parking_place, notice: 'Availability parking place was successfully updated.' }\n format.json { render :show, status: :ok, location: @availability_parking_place }\n else\n format.html { render :edit }\n format.json { render json: @availability_parking_place.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parking_restriction.update(parking_restriction_params)\n format.html { redirect_to @parking_restriction, notice: 'Parking restriction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @parking_restriction.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parked_vehical.update(parked_vehical_params)\n format.html { redirect_to @parked_vehical, notice: 'Parked vehical was successfully updated.' }\n format.json { render :show, status: :ok, location: @parked_vehical }\n else\n format.html { render :edit }\n format.json { render json: @parked_vehical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @parkingevent.update(parkingevent_params)\n format.html { redirect_to @parkingevent, notice: 'Parkingevent was successfully updated.' }\n format.json { render :show, status: :ok, location: @parkingevent }\n else\n format.html { render :edit }\n format.json { render json: @parkingevent.errors, status: :unprocessable_entity }\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
DELETE /reserve_parkings/1 DELETE /reserve_parkings/1.json | def destroy
@reserve_parking.destroy
respond_to do |format|
format.html { redirect_to reserve_parkings_url, notice: 'Reserve parking was successfully destroyed.' }
format.json { head :no_content }
end
end | [
"def destroy\n @parking.destroy\n respond_to do |format|\n format.html { redirect_to parkings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @park.destroy\n respond_to do |format|\n format.html { redirect_to parks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @park = Park.find(params[:id])\n @park.destroy\n\n respond_to do |format|\n format.html { redirect_to parks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parking_lot = ParkingLot.find(params[:id])\n @parking_lot.destroy\n\n respond_to do |format|\n format.html { redirect_to parking_lots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserf = Reserve.find(params[:id])\n @reserf.destroy\n\n respond_to do |format|\n format.html { redirect_to reserves_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserf = Reserve.find(params[:id])\n @reserf.destroy\n\n respond_to do |format|\n format.html { redirect_to reserves_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @place_parking.destroy\n respond_to do |format|\n format.html { redirect_to place_parkings_url, notice: 'Place parking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n # TODO: do not delete just expire validity\n @parking_space.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @parking_lot.destroy\n\n head :no_content\n end",
"def destroy\n @rent_parking.destroy\n respond_to do |format|\n format.html { redirect_to rent_parkings_url, notice: 'Rent parking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parking_restriction.destroy\n respond_to do |format|\n format.html { redirect_to parking_restrictions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @parking_lot_booking = ParkingLotBooking.find(params[:id])\n @parking_lot_booking.destroy\n\n respond_to do |format|\n format.html { redirect_to parking_lot_bookings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @park = Park.find(params[:id])\n @park.destroy\n\n respond_to do |format|\n format.html { redirect_to(parks_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @parked_vehical.destroy\n respond_to do |format|\n format.html { redirect_to parked_vehicals_url, notice: 'Parked vehical was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dog_park = DogPark.find(params[:id])\n @dog_park.destroy\n\n respond_to do |format|\n format.html { redirect_to dog_parks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @park_spacerental.destroy\r\n respond_to do |format|\r\n format.html { redirect_to park_spacerentals_url, notice: 'Park spacerental was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @parkingplane = Parkingplane.find(params[:id])\n @parkingplane.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_parkingramps_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @parking_spot = ParkingSpot.find(params[:id])\n @parking_spot.destroy\n\n respond_to do |format|\n format.html { redirect_to parking_spots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_parking.destroy\n respond_to do |format|\n format.html { redirect_to type_parkings_url, notice: 'Type parking was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Retorna un arreglo de las categorias que conforman esta pelicula | def categorio( )
arry_aux=Array.new()
@categoria.each{|key,value|
if value==true
arry_aux.push(key)
end
}
return arry_aux
end | [
"def get_componente_categorias\n \tcategorias = []\n detalles = self.pedido_compra_detalles\n detalles.each do |d|\n \tcategorias.push(d.componente.componente_categoria_id) unless categorias.include?(d.componente.componente_categoria_id)\n end\n categorias\n end",
"def categories\n categories = []\n @deck.cards.map do |turn|\n categories << turn.category\n end\n categories.uniq!\n end",
"def chosen_categories\n return chosen_options.collect &:category\n end",
"def categories\n taxonomies.all :conditions => { :classification => :category }\n end",
"def categories\n race_categories = races.map(&:category)\n children.inject(race_categories) { |cats, child| cats + child.categories }\n end",
"def categories\n @categories ||= wayfinder.decorated_vocabularies.sort_by(&:label)\n end",
"def categories_by_taxonomy\n\n self.categories.inject({}) do |result, category|\n \n if result.has_key?(category.taxonomy.id.to_sym)\n result[category.taxonomy.id.to_sym] << category\n else\n result[category.taxonomy.id.to_sym] = [category]\n end\n \n result \n end \n\n end",
"def categoria_por_nivel\n if taxon.present? && params[:cat].present? && params[:nivel].present?\n # Aplica el query para los descendientes\n self.taxones = taxones.where(\"#{Especie.attribute_alias(:ancestry_ascendente_directo)} LIKE '%,#{taxon.id},%'\")\n\n # Se limita la busqueda al rango de categorias taxonomicas de acuerdo al nivel\n self.taxones = taxones.nivel_categoria(params[:nivel], params[:cat])\n end\n end",
"def assigned_categories\n cats = quotations.collect { |q| q.categories }.flatten\n cat_ids = cats.collect { |c| c.id }.uniq\n Category.find(cat_ids)\n end",
"def retrieve_distinct_categories\n if @distinct_categories\n categories = @distinct_categories\n else\n categories = []\n @team.season_types.each do |season_type|\n season_type.seasons.sort_season_by_begin_date\n .last\n .category_types.are_not_relays\n .sort_by_age.each do |category_type|\n categories << category_type unless categories.rindex { |e| e.code == category_type.code }\n end\n end\n end\n categories\n end",
"def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end",
"def categories\n _categories = races.map(&:category)\n children.inject(_categories) { |cats, child| cats + child.categories }\n end",
"def category_array(unlistings_set)\n category_array = []\n unlistings_set.each do |unlisting|\n category_array.push(unlisting.category) #unless unlisting.category.nil?\n end\n category_array.sort.uniq\n end",
"def categories_given_items(items)\n\n categorized_items = Array.new\n\n items.each{ |item|\n sub_array = categorized_items.detect{ |sub_item_array| sub_item_array[0].name == item.name }\n if sub_array != nil\n sub_array.push(item)\n else\n new_sub_array = Array.new\n new_sub_array.push(item)\n categorized_items.push(new_sub_array)\n end\n }\n categorized_items\n end",
"def categories_of_family(family_id)\n MoneyOperation.where(family_id: family_id)\n .joins(\"INNER JOIN categories ON(operations.category_id = categories.id)\")\n .order(\"categories.type desc, categories.id\")\n .select(\"categories.id, categories.name, categories.type\").uniq\n end",
"def categories\n categories = Array.new\n unless self.category.nil?\n categories << self.category\n categories += self.category.ancestors\n end # unless\n categories.reverse\n end",
"def category_ids\n returns = []\n self.category_to_trucks.each do |r|\n returns << r.category_id if r.category_id\n end\n returns\n end",
"def asocia_cat_riesgo(especie)\n cat_riesgo = []\n \n especie.catalogos.each do |cat|\n if [2,4].include?(cat.nivel1) && !(Catalogo::EVALUACION + Catalogo::AMBIENTE_EQUIV_MARINO + [\"Riesgo bajo (LR): Dependiente de conservación (cd)\"]).include?(cat.descripcion)\n cat_riesgo << cat.descripcion.estandariza\n end\n end\n\n cat_riesgo.uniq\n end",
"def find_all_categories survey_type_id\n categories = Variable.find_by_sql(\"select distinct(variables.category) from variables, datasets, surveys, survey_types where variables.dataset_id = datasets.id and datasets.survey_id = surveys.id and surveys.survey_type_id = #{survey_type_id}\")\n @all_categories = categories.collect{|var| var.category}\n @all_categories.delete_if{|cat| cat==nil}\n @all_categories.sort!\n all_categories = @all_categories\n return all_categories\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Agrega un nueva copia Delux | def agregar_copia_delux()
copia_pelicula=Copia.new(@num_pelicula,@cantidad.size())
copia_pelicula.establecer_delux()
@cantidad.push(copia_pelicula)
end | [
"def copie_of_css\n suivi('--> Copie des fichiers CSS')\n ['styles','analyse','styles_mobi7_kf8'].each do |affixe|\n src = File.join(folder_templates,\"#{affixe}.css\")\n dst = File.join(film.folder_products, \"#{affixe}.css\")\n FileUtils.copy_entry(src, dst, false, false, true)\n end\nend",
"def force_copy\n add option: \"-force-copy\"\n end",
"def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend",
"def cop_name; end",
"def copie_local\n return unless File.exist? path\n `if [ ! -d \"./xtrash\" ];then mkdir -p \"./xtrash\";fi`\n dest = File.join('.', 'xtrash', basename)\n FileUtils::cp path, dest\n end",
"def addCopy\n\t\t@copies += 1\n\tend",
"def copy!(new_path); end",
"def transferir\n caja.transferir monto, caja_destino\n end",
"def backup; end",
"def backup_custom(_add_name)\r\n puts 'It seems the content is empty'.colorize(:red) + \"\\nTry to establish a empty custom container\".colorize(:light_black)\r\n hash = { \"Custom\": [] }\r\n # helper\r\n save_custom_file(hash)\r\n end",
"def dragged\n $dz.determinate(true)\n $dz.begin(\"Copying files...\")\n Rsync.do_copy($items, ENV['EXTRA_PATH'], false)\n $dz.finish(\"Copy Complete\")\n $dz.url(false)\nend",
"def create_and_copy_backup(backup_options = nil,backup_name = nil)\n\n end",
"def removeCopy\n\t\tif @copies > 0\n\t\t\t@copies -= 1\n\t\tend\n\t\t@copies\n\tend",
"def transfer\n error(\"'heroku pgbackups:transfer' has been removed.\nPlease see 'heroku pg:copy' instead.\nMore Information: https://devcenter.heroku.com/articles/heroku-postgres-backups\")\n end",
"def notify_file_cp(src, dst)\r\n if @files.key?(src)\r\n @files[dst] = @files[src].clone\r\n else\r\n @files[src] = { exist: true }\r\n @files[dst] = { exist: true }\r\n end\r\n register_file_in_dirs(dst)\r\n end",
"def duplicar_registro\n #buscamos el control\n @original = Control.find(params[:id])\n #lo duplicamos\n @control = @original.dup\n #solo queremos la cabecera, ponemos las propiedades a 0\n @control.properties = {}\n #ponemos fecha actual\n @control.datacontrol = Time.now\n end",
"def cop_names; end",
"def dragged\n # Rsync will provide progress updates, so set action to show progress\n $dz.determinate(true)\n \n # Log if we are copying or moving\n bMove = true\n if ENV['OPERATION'] == \"NSDragOperationCopy\"\n strOperation = \"Copying\"\n bMove = false\n else\n strOperation = \"Moving\"\n end\n \n # Rename all passed in files\n astrFileRenamed = Array.new \n for intIndex in 0 ... $items.size\n \n # Display dialog to rename file\n strPashuaConfig = \"\n *.title = Rename File\n p.type = textfield\n p.label = File Name\n p.default = #{File.basename($items[intIndex])}\n \"\n objResult = $dz.pashua(strPashuaConfig)\n \n # Useful for debugging\n puts objResult['p']\n puts $items[intIndex]\n puts File.dirname($items[intIndex])\n \n # Rename the file\n strRenamedFilePath = File.dirname($items[intIndex]) + \"/\" + objResult['p']\n File.rename($items[intIndex], strRenamedFilePath)\n \n # Add the new file path to an array\n astrFileRenamed.push(strRenamedFilePath)\n end\n \n # Move/copy files\n # Uses the new set of file paths in the array\n $dz.begin(\"#{strOperation} files...\")\n Rsync.do_copy(astrFileRenamed, ENV['EXTRA_PATH'], bMove)\n finish_op = (bMove ? \"Move\" : \"Copy\")\n \n # Notification with option to open the file path\n last_component = ENV['EXTRA_PATH'].split('/').last.gsub(/^(.{30,}?).*$/m,'\\1...')\n $dz.finish(\"Click here to open the '#{last_component}' folder\")\n $dz.url(false)\nend",
"def copy!(options = {})\n !!options[:overwrite] == options[:overwrite] ? overwrite = options[:overwrite] : overwrite = RepositoryManager.auto_overwrite_item\n\n new_item = RepositoryManager::RepoFile.new\n new_item.file = File.open(self.file.current_path)\n new_item.name = self.name\n\n options[:owner] ? new_item.owner = options[:owner] : new_item.owner = self.owner\n options[:sender] ? new_item.sender = options[:sender] : new_item.sender = self.sender\n\n if options[:source_folder]\n new_item = options[:source_folder].add!(new_item, do_not_save: true, overwrite: overwrite )\n elsif options[:owner]\n repo_item_with_same_name = options[:owner].get_item_in_root_by_name(new_item.name)\n if repo_item_with_same_name and !overwrite\n self.errors.add(:copy, I18n.t('repository_manager.errors.repo_item.item_exist'))\n raise RepositoryManager::ItemExistException.new(\"copy failed. The repo_file '#{new_item.name}' already exist in root.\")\n elsif repo_item_with_same_name and overwrite\n repo_item_with_same_name.file = new_item.file\n repo_item_with_same_name.sender = new_item.sender\n new_item = repo_item_with_same_name\n end\n else\n repo_item_with_same_name = self.owner.get_item_in_root_by_name(new_item.name)\n if repo_item_with_same_name and !overwrite\n self.errors.add(:copy, I18n.t('repository_manager.errors.repo_item.item_exist'))\n raise RepositoryManager::ItemExistException.new(\"copy failed. The repo_file '#{new_item.name}' already exist in root.\")\n elsif repo_item_with_same_name and overwrite\n repo_item_with_same_name.file = new_item.file\n repo_item_with_same_name.sender = new_item.sender\n new_item = repo_item_with_same_name\n end\n end\n\n new_item.save!\n new_item\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Agrega un nuevo cliente a la estructura | def add_cliente(nombre,apellido,dni,calle,numero,ciudad,cp)
@clientes.push(Cliente.new(nombre,apellido,dni,calle,numero,ciudad,cp))
end | [
"def new_asignar_cliente\n @usuario = Usuario.find(params[:format])\n @usuario.clientes.build\n @clientes = Usuario.where(:admin => 0)\n end",
"def client\n # se intenta encontrar un cliente en payu con el campo payu_customer_id del usuario\n client = PayuLatam::Client.new(@current_user.payu_customer_id)\n # todas las peticiones del modulo eredan de request, eso da acceso al metodo success? indica si sale bien o no\n if client.success?\n # en caso de encontrar el usuario se llena la variable @client con la instancia de clase PayuLatam::Client\n @client = client\n else\n # si el usuario aun no es cliente en payu. se procede a crearlo\n # se sobreescriben los params con los valores del usuario\n client.params[:fullName] = @current_user.name\n client.params[:email] = @current_user.email\n client.create! # llamado al metodo creacion\n if client.success?\n # si la creacion es exitosa se almacena en la variable @client\n @client = client\n # El cliente ha sido creado en payu, esto retorna el id en payu del usuario\n # ese id lo asignamos al usuario en la BD\n @current_user.update_attribute(:payu_customer_id, @client.resource['id'])\n else\n # si la creacion falla, se lanza un error con el mensaje necesario\n # este error es interceptado y controlado\n raise StandardError, 'Error creando cliente/customer: '+ client.error.to_s\n end\n end\n end",
"def create \n\t\t@tienda_cliente = @cliente.tiendas_clientes.build(tienda_cliente_params)\n\n respond_to do |format|\n if @tienda_cliente.save\n format.html { redirect_to @tienda_cliente, notice: 'La tienda se creó exitosamente.' }\n format.json { render :show, status: :created, location: @tienda_cliente }\n else\n format.html { render :new }\n format.json { render json: @tienda_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def addClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact)\n\t\tid = \"0\"\n\t\tunless @sqlQuery.nil? then\n\t\t\tid = @sqlQuery.insertClient(raison_sociale, division, departement, adresse, cp, ville, nom_contact,tel_contact)\n\t\telse\n\t\t\tputs \"SqlQuery wasn't created : database update cannot be performed\"\n\t\tend\n\t\t@clients.addClient(id, raison_sociale, division, departement, adresse, cp, ville, nom_contact, tel_contact) # synchronize local object with DB\n\tend",
"def newCliente\n @endereco = Endereco.new\n @endereco.enderecavel_id = params[:id]\n @endereco.enderecavel_type = 'Cliente'\n\n respond_to do |format|\n format.html { render :action => \"new\" }\n format.json { render :json => @endereco }\n end\n end",
"def create\n\n @cliente = Cliente.find(params[:cliente_id])\n @descuento_cliente = @cliente.descuento_clientes.build(params[:descuento_cliente])\n\n respond_to do |format|\n if @descuento_cliente.save\n #format.html { redirect_to redirigir(@contelefono), :notice => 'El telefono fue ingresado correctamente.' }\n format.json { render json: @descuento_cliente}\n else\n #format.html { render :action => \"new\" }\n format.json { render json: @descuento_cliente.errors }\n end\n end\n end",
"def create_viaje\n #@viaje = Viaje.new(viaje_params)\n #\n #if @viaje.save\n # render json: @viaje, status: :created, location: @viaje, notice: 'Propietario was successfully create.'\n #else\n # render json: @viaje.errors, status: :unprocessable_entity\n #end\n cliente = Cliente.find_by_cedula(params[:cedula])\n if cliente.present?\n attr = cliente.viajes.new({\n :id_auto => nil,\n :cliente_id => cliente.id,\n :tiempo => params[:tiempo],\n :distancia => params[:distancia],\n :valor => params[:valor]\n })\n attr.save!\n #render json: attr, status: :unprocessable_entity\n render_success_format('el viaje se a creado con exito', format_viaje(attr), 200)\n else\n render_default_error(\"el usuario con numero de cedula #{params[:cedula]} no esta registrado\", 400)\n end\n\n end",
"def newCliente\n @telefone = Telefone.new\n @telefone.cooperativa = Cooperativa.find(params[:id])\n @telefone.telefonavel_id = params[:id]\n @telefone.telefonavel_type = 'Cliente'\n\n respond_to do |format|\n format.html #{ render :action => \"new\" }\n format.json { render :json => @telefone }\n end\n end",
"def cria_cliente(nome, cpf)\n # propriedades, atributos...\n { nome: nome, cpf: cpf }\nend",
"def newClient(name, cash)\n client = Client.new(name)\n client.cash = cash\n @clients << client\n end",
"def create_ordem\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n\t@ordem = Ordem.new(:cliente_id => @cliente.id, :user_id => current_user.id)\n\tif @ordem.save\n\t\tformat.html { redirect_to @ordem, notice: 'O cliente foi adicionado com sucesso.' }\n\t\tformat.json { render json: @cliente, status: :created, location: @cliente }\n\telse\n\t\tformat.html { render action: \"index\" }\n \tformat.json { render json: @cliente.errors, status: :unprocessable_entity }\n\tend\n else\n format.html { render action: \"new_for_order\" }\n format.json { render json: @cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ventas_cliente = Ventas::Cliente.new(ventas_cliente_params)\n\n respond_to do |format|\n if @ventas_cliente.save\n format.html { redirect_to @ventas_cliente, notice: 'Cliente was successfully created.' }\n format.json { render :show, status: :created, location: @ventas_cliente }\n else\n format.html { render :new }\n format.json { render json: @ventas_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ventas_cliente = Ventas::Cliente.new(params[:ventas_cliente])\n\n respond_to do |format|\n if @ventas_cliente.save\n format.html { redirect_to @ventas_cliente, notice: 'Cliente was successfully created.' }\n format.json { render json: @ventas_cliente, status: :created, location: @ventas_cliente }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ventas_cliente.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_client\n\t\t\n\n\t\t##we want to create a new client, provided that there is no client for this user id.\n\t\t##if a client already exists, then we dont want to do anything.\n\t\t##when we create the client we want to be sure that \n\t\t##provided that there is no client with this user id.\n\t\t#puts \"called create client.\"\n\n\t\t##first find out if there is already a client for this user id.\n\t\tc = Auth::Client.new(:api_key => SecureRandom.hex(32), :resource_id => self.id)\n\n\t\tputs \"Came to create a client.\"\n\n\t\tc.versioned_create({:resource_id => self.id})\n\t\top_count = 10\n\n\t\tputs \"-------CREATED A CLIENT AS FOLLOWS:-----------\"\n\t\tputs c.attributes.to_s\n\n\t\twhile(true)\n\t\t\t\n\t\t\tif c.op_success?\n\t\t\t\t#puts \"the op was a success\"\n\t\t\t\tbreak\n\t\t\telsif op_count == 0\n\t\t\t\t#puts \"op count was 0\"\n\t\t\t\tbreak\n\t\t\telsif (Auth::Client.where(:resource_id => self.id).count == 0)\n\t\t\t\t#puts \"tried to create here.\"\n\t\t\t\tc.api_key = SecureRandom.hex(32)\n\t\t\t\tc.versioned_create({:resource_id => self.id})\n\t\t\t\top_count-=1\n\t\t\telse\n\t\t\t\t#puts \"finally broke.\"\n\t\t\t\tbreak\n\t\t\tend\n\n\n\t\tend\n\n\tend",
"def create\n @clientetipo = Clientetipo.new(params[:clientetipo])\n\n respond_to do |format|\n if @clientetipo.save\n format.html { redirect_to @clientetipo, notice: 'Clientetipo was successfully created.' }\n format.json { render json: @clientetipo, status: :created, location: @clientetipo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @clientetipo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n # Se crea el cliente\n @client = Client.new(params[:client])\n # Se crean los contactos\n @client.contacts.each do |contact|\n contact.password = contact.name\n contact.language = params[:client][:language]\n end\n if @client.valid? and @client.contacts.map(&:valid?).all?\n # Se salva el cliente\n @client.save\n # Se salvan los contactos\n @client.contacts.each(&:save)\n redirect_to @client, flash: {success: I18n.t('client.create_success')}\n else\n render 'new'\n end\n end",
"def create\n @client = current_client\n @cotizacion = @client.cotizacions.new(cotizacion_params)\n \n if @client.save\n flash[:notice]= \"A agregado una nueva cotizacion\"\n redirect_to client_cotizacions_path(params[:client_id])\n else\n render :new\n end\n end",
"def add_client(client)\n\t\tid = if get_message_ids().length < 2 then 0 else get_message_ids().max end\n\t\t@clients[client] = id\n\tend",
"def create\n @clienteremi = Clienteremi.new(clienteremi_params)\n\n respond_to do |format|\n if @clienteremi.save\n format.html { redirect_to clienteremis_path, notice: 'Cliente creado correctamente' }\n format.json { render :show, status: :created, location: @clienteremi }\n else\n format.html { render :new }\n format.json { render json: @clienteremi.errors, status: :unprocessable_entity }\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return true for header | def header?
true
end | [
"def header?\n @header\n end",
"def has_header?\n @has_header\n end",
"def exth_header?\n exth_flag == 1\n end",
"def header?\n @header_complete\n end",
"def has_header?()\r\n @options[:header] \r\n end",
"def header?(key)\n return true if @args[:headers].key?(key) && @args[:headers][key].first.to_s.length > 0\n false\n end",
"def header?(key)\n return true if headers.key?(key) && !headers[key].first.to_s.empty?\n\n false\n end",
"def is_header?(); @type == GRT_HEADER; end",
"def header_contains\n return @header_contains\n end",
"def has_headers\n return @has_headers\n end",
"def isHeader\n @RecordType == HEADER\n end",
"def has_header(name)\n return !@headers[name].nil?\n end",
"def header_row?\n @use_headers and @headers.nil?\n end",
"def headers?\n @headers.empty?\n end",
"def is_header? (string)\n if(string.match(/>/))\n return true\n end\n return false\n end",
"def has_header? name\n @headers[MessageParser.headerize(name)] && true\n end",
"def has_header?(header)\n !!headers[header]\n end",
"def write_headers?() @write_headers end",
"def has_extended_header?\n @flags[1] == \"1\"\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Return false for footer | def footer?
false
end | [
"def footer?\n true\n end",
"def footer?\r\n\t\tfalse\r\n\tend",
"def footer?\r\n\t\ttrue\r\n\tend",
"def is_footer_shown\n return @is_footer_shown\n end",
"def is_footer?\n idx == parent.rows.size - 1\n end",
"def large_footer?\n !user_signed_in?\n end",
"def is_footer_shown=(value)\n @is_footer_shown = value\n end",
"def Footer\n end",
"def should_apply_email_engagement_footer?\n return false if master?\n if buyer? && !provider? # no idea what I'm doing.\n provider_account.settings.skip_email_engagement_footer.denied?\n else\n settings.skip_email_engagement_footer.denied?\n end\n end",
"def show_footer_items?\r\n controller_name == 'listings' && %w(index category local).detect {|x| action_name == x}\r\n end",
"def footer(footer)\n\t\tfrench_footer = 'layouts/frenchfooter'\n\t\tif footer.empty?\n\t\t\tfrench_footer\n\t\telse \n\t\t\tfooter\n\t\tend\n\tend",
"def footer_check(locators)\n puts \"checking footer\"\n passing = false\n locators.where(offer: 'footer').each do |locator|\n passing = true if browser.first(locator.css)\n end\n raise \"Could Not Find Footer\" if passing == false\n end",
"def footer_line?(hash)\n hash[:line_definition].footer\n end",
"def box_panel_use_footer?(suffix)\n box_panel_params(suffix)[:use_footer]\n end",
"def footer_check(locators)\n passing = false\n locators.where(offer: 'footer').each do |locator|\n passing = true if browser.first(locator.css)\n end\n raise \"Could Not Find Footer\" if passing == false\n end",
"def render_footer\n if large_footer?\n render 'layouts/large_footer'\n else\n render 'layouts/small_footer'\n end\n end",
"def kopal_layout_before_page_footer\n\n end",
"def add_footer=(_arg0); end",
"def footer\n @footer ||= find_sub_page(:footer)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fullBath : Integer Number of full baths in the property | def full_bath
self.dig_for_integer("fullBath")
end | [
"def partial_bath\n self.dig_for_integer(\"partialBath\")\n end",
"def half_bath\n self.dig_for_integer(\"halfBath\")\n end",
"def length_in_bp_within_path\n return 0 if @trail.empty?\n reduce(0) do |total, onode|\n total + onode.node.length_alone\n end\n end",
"def total_bath\n self.dig_for_integer(\"listingSummary\", \"totalBath\")\n end",
"def set_FullBathrooms(value)\n set_input(\"FullBathrooms\", value)\n end",
"def value_is_full_field?\n @path_pattern.segments.count == 1\n end",
"def path_length\n @path_length ||= if (match = @node.inner_text.match(/pathlen:(\\d+)/))\n match[1].to_i\n end\n end",
"def path_length\n @path_length ||= if (match = value.match(/pathlen:(\\d+)/))\n match[1].to_i\n end\n end",
"def max_breadcrumbs; end",
"def critical_path_length\n @critical_path_length ||= @project.activities.last.earliest_start\n end",
"def length_alone\n @ends_of_kmers_of_node.length\n end",
"def minimal_pathlength_to(object, length = 0, curr_min_length = self.depth)\n if (@object == object) && (length < curr_min_length) then\n curr_min_length = length\n end\n @children.each do |c|\n curr_min_length = c.minimal_pathlength_to(object, length + 1,\n curr_min_length)\n end\n curr_min_length\n end",
"def get_longest_path_length(x)\n compute_longest_paths\n @longest_path[x].length - 1\n end",
"def actual_path_length\n folders.count\n end",
"def path_root_length # :nodoc:\n @path_root_length ||= begin\n length = @path_root.length\n unless @path_root == File::SEPARATOR\n length += File::SEPARATOR.length\n end\n length\n end\n end",
"def length\n @parts.length\n end",
"def level\n self[acts_as_materialized_path_options[:path_column]].count(\".\")\n end",
"def no_of_bedrooms\n self.dig_for_integer(\"listingSummary\", \"noOfBedrooms\")\n end",
"def height\n self[:base].height\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
halfBath : Integer Number of half baths in the property | def half_bath
self.dig_for_integer("halfBath")
end | [
"def set_HalfBathrooms(value)\n set_input(\"HalfBathrooms\", value)\n end",
"def w_half\n w.half\n end",
"def get_t_half\n\t\thalf = (self.length) / 2\n\t\tif self.length % 2 == 0\n\t\t\tself[half..-1]\n\t\telse\n\t\t\tself[(half+1)..-1]\n\t\tend\n\tend",
"def partial_bath\n self.dig_for_integer(\"partialBath\")\n end",
"def length_of_sides\n @length\n end",
"def calculate_half\n if(self.number.even? && self.number >= 2)\n self.number / 2\n else\n 0\n end\nend",
"def left_half\n self[0...length / 2]\n end",
"def round_to_half\n fraction = ((self - self.floor) * 100).to_i\n if fraction < 25\n self.floor.to_f\n elsif fraction < 75\n self.floor + 0.5\n else\n self.ceil.to_f\n end\n end",
"def full_bath\n self.dig_for_integer(\"fullBath\")\n end",
"def length_in_bp_within_path\n return 0 if @trail.empty?\n reduce(0) do |total, onode|\n total + onode.node.length_alone\n end\n end",
"def half( side )\n case side\n when :u; size.dup.y * ( 0.5 )\n when :d; size.dup.y * ( 0.5 )\n when :l; size.dup.x * ( 0.5 )\n when :r; size.dup.x * ( 0.5 )\n when :v; size.dup.y * ( 0.5 )\n when :h; size.dup.x * ( 0.5 )\n end\n end",
"def halves(_start = nil, _num_halves = nil)\n #This is a stub, used for indexing\nend",
"def half_range\n\t\treturn (self.day_range / 2)\n\tend",
"def side_length\n\t\ttop = (@num_sides - 2) * Math::PI\n\t\tangle = top / (2 * @num_sides)\n\t\t@side_length = 2 * Math.cos(angle)\n\tend",
"def half_number(number)\n puts \"Half of #{number} is #{number / 2.0}\"\nend",
"def ceiling_height\n self.dig_for_string(\"ceilingHeight\")\n end",
"def post_divide; end",
"def outer_height; rect.height + @border_thickness * 2; end",
"def down_half_line\n Kernel.raise NotImplementedError\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
quarterBath : Integer Number of quarter baths in the property | def quarter_bath
self.dig_for_integer("quarterBath")
end | [
"def three_quarter_bath\n self.dig_for_integer(\"threeQuarterBath\")\n end",
"def quarter\n (month / 3.0).ceil\n end",
"def quarter\n @interval = 'quarter'\n self\n end",
"def current_quarter\n\n case self.month\n\n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n\n end",
"def current_quarter\n \n case self.month\n \n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n \n end",
"def quarter\n @quarter ||= calendar.quarter(merch_month)\n end",
"def quarter\n case merch_month\n when 7,8,9\n return 1\n when 10,11,12\n return 2\n when 1,2,3\n return 3\n else\n return 4\n end\n end",
"def quarter\n organization_quarter.quarter unless organization_quarter.nil?\n end",
"def project(value)\n return value * 4 / line[:quarter]\n end",
"def all_quarter\n beginning_of_quarter..end_of_quarter\n end",
"def count_quarters(date)\n (date.year-2010)*4 + date.quarter - 1\n end",
"def fourth_quarter\n return @fourth_quarter if @fourth_quarter\n\n @fourth_quarter = self.class.new(\n Point.new(upper_left.x + quarter_length + LAMBDA, upper_left.y - quarter_height - LAMBDA),\n Point.new(bottom_right.x, bottom_right.y)\n )\n @fourth_quarter.areas = @fourth_quarter.areas_within(areas)\n @fourth_quarter.points = @fourth_quarter.points_within(points)\n @fourth_quarter\n end",
"def prior_quarter(num = 1)\n next_quarter(-num)\n end",
"def quarter_wind; end",
"def quarter_of(month)\n case month\n when 1..3\n return 1\n when 4..6\n return 2\n when 7..9\n return 3\n when 10..12\n return 4\n end\nend",
"def end_of_quarter(year, quarter)\n case quarter\n when 1\n end_of_month(year, 9)\n when 2\n end_of_month(year, 12)\n when 3\n end_of_month(year, 3)\n when 4\n end_of_month(year, 6)\n end\n end",
"def quarter(merch_month)\n case merch_month\n when 1,2,3\n return QUARTER_1\n when 4,5,6\n return QUARTER_2\n when 7,8,9\n return QUARTER_3\n when 10,11,12\n return QUARTER_4\n else\n raise \"invalid merch month\"\n end\n end",
"def to_quarter_period\n return self if quarter?\n self.class.quarter(value)\n end",
"def lookup_quarter(x, y)\n return 1 if x >= 0 && y <= -1\n return 2 if x < 0 && y <= -1\n return 3 if x < 0 && y > -1\n return 4\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
threeQuarterBath : Integer Number of three quarter baths in the property | def three_quarter_bath
self.dig_for_integer("threeQuarterBath")
end | [
"def quarter_bath\n self.dig_for_integer(\"quarterBath\")\n end",
"def quarter\n (month / 3.0).ceil\n end",
"def quarter\n case merch_month\n when 7,8,9\n return 1\n when 10,11,12\n return 2\n when 1,2,3\n return 3\n else\n return 4\n end\n end",
"def current_quarter\n\n case self.month\n\n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n\n end",
"def current_quarter\n \n case self.month\n \n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n \n end",
"def quarter\n @interval = 'quarter'\n self\n end",
"def quarter\n @quarter ||= calendar.quarter(merch_month)\n end",
"def quarters_since(date)\n\t\t\t(months_since(date) / 3).to_i\n\t\tend",
"def project(value)\n return value * 4 / line[:quarter]\n end",
"def count_quarters(date)\n (date.year-2010)*4 + date.quarter - 1\n end",
"def fourth_quarter\n return @fourth_quarter if @fourth_quarter\n\n @fourth_quarter = self.class.new(\n Point.new(upper_left.x + quarter_length + LAMBDA, upper_left.y - quarter_height - LAMBDA),\n Point.new(bottom_right.x, bottom_right.y)\n )\n @fourth_quarter.areas = @fourth_quarter.areas_within(areas)\n @fourth_quarter.points = @fourth_quarter.points_within(points)\n @fourth_quarter\n end",
"def quarter_wind; end",
"def quarter\n organization_quarter.quarter unless organization_quarter.nil?\n end",
"def quarter_of(month)\n case month\n when 1..3\n return 1\n when 4..6\n return 2\n when 7..9\n return 3\n when 10..12\n return 4\n end\nend",
"def three_within_thirty\n first = @orders[0]\n third = @orders[2]\n if first - third > 30\n false\n else\n true\n end\n end",
"def in_quarts\n @size / 192\n end",
"def num_quarter_hours=(new_quarter_hours)\n @num_quarter_hours = new_quarter_hours\n post_initialize\n @num_quarter_hours\n end",
"def three_months\n return 60 * 60 * 24 * 90\n end",
"def three_pt_pct\n return 0.0 if three_p.zero? || three_p_a.zero? \n\n (three_p.to_f/three_p_a).round(3)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
partialBath : Integer Number of partial baths in the property | def partial_bath
self.dig_for_integer("partialBath")
end | [
"def full_bath\n self.dig_for_integer(\"fullBath\")\n end",
"def half_bath\n self.dig_for_integer(\"halfBath\")\n end",
"def length_in_bp_within_path\n return 0 if @trail.empty?\n reduce(0) do |total, onode|\n total + onode.node.length_alone\n end\n end",
"def partial_path=(path)\n @partial_path = [path].flatten\n end",
"def test_partial_exists\n @blast = Blast.find(1)\n assert @blast.partial_exists?\n\n @blast.partial = \"2g1c\" # you're a sick puppy if you named a partial this ;)\n assert !@blast.partial_exists?\n\n @blast.partial = nil #use the default for this blast which is User association\n assert @blast.partial_exists?\n \n end",
"def path_length\n @path_length ||= if (match = @node.inner_text.match(/pathlen:(\\d+)/))\n match[1].to_i\n end\n end",
"def critical_path_length\n @critical_path_length ||= @project.activities.last.earliest_start\n end",
"def path_length\n @path_length ||= if (match = value.match(/pathlen:(\\d+)/))\n match[1].to_i\n end\n end",
"def max_breadcrumbs; end",
"def total_bath\n self.dig_for_integer(\"listingSummary\", \"totalBath\")\n end",
"def set_partial_path\n @partial_path = params[:partial_path]\n end",
"def pathmap_partial(n)\n target = File.dirname(self)\n dirs = target.pathmap_explode\n if n > 0\n File.join(dirs[0...n])\n elsif n < 0\n partial = dirs[n..-1]\n if partial.nil? || partial.empty?\n target\n else\n File.join(partial)\n end\n else\n \".\"\n end\n end",
"def path_captures\n return 0 unless conditions[:path]\n Behavior.count_parens_up_to(conditions[:path], conditions[:path].size)\n end",
"def level\n self[acts_as_materialized_path_options[:path_column]].count(\".\")\n end",
"def value_is_full_field?\n @path_pattern.segments.count == 1\n end",
"def minimal_pathlength_to(object, length = 0, curr_min_length = self.depth)\n if (@object == object) && (length < curr_min_length) then\n curr_min_length = length\n end\n @children.each do |c|\n curr_min_length = c.minimal_pathlength_to(object, length + 1,\n curr_min_length)\n end\n curr_min_length\n end",
"def portion? = unit == 'portion'",
"def get_longest_path_length(x)\n compute_longest_paths\n @longest_path[x].length - 1\n end",
"def rdfs_sub_property_of\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
parkingPlaces : Integer Number of parking places in the property | def parking_places
self.dig_for_integer("parkingPlaces")
end | [
"def number_of_places_within(bounding_box)\n PublicEarth::Db::Category.one.number_of_places(self.id, bounding_box[:sw][:latitude], bounding_box[:sw][:longitude], \n bounding_box[:ne][:latitude], bounding_box[:ne][:longitude])['number_of_places'].to_i\n end",
"def nb_place\n\t\treturn place.length\n\tend",
"def number_of_places\n Atlas::Place.count(:conditions => [\"category_id in (select family_member_id from category_family_trees where category_id = ?)\", self.id])\n end",
"def number_of_slots\n @number_of_slots ||= placements.size\n end",
"def places=(value)\n @places = value\n end",
"def total_number_of_parcels\n end",
"def test_nb_place\n\t\tassert_equal(NBNIV*NBPLACENIV, @parking.nb_place, \"Erreur : nombre de place total incorrect\")\n\tend",
"def open_places\n useable_places - used_places.count\n end",
"def number_of_planets\n return get_size\n end",
"def nb_place_libre\n\t\tassert_equal(NBNIV*NBPLACENIV, @parking.nb_place_libre, \"Erreur : nombre de place libre incorrect\")\n\t\t@parking.place[0].vehicule=@vehiculeFake\n\t\tassert_equal(NBNIV*NBPLACENIV-1, @parking.nb_place_libre, \"Erreur : nombre de place libre apres attribution incorrect\")\n\tend",
"def number_of_slots_filled\n @number_of_slots_filled ||= placements.filled.size\n end",
"def available_spots\n return nil unless max_spots\n max_spots - lesson_bookings.size\n end",
"def set_neighborhood_counts\n @uptown_count = Neighborhood.nb_buildings_count(pop_neighborhoods, NYCBorough.uptown_sub_borough)\n @brooklyn_count = Building.city_count(pop_nb_buildings, 'Brooklyn', NYCBorough.brooklyn_sub_borough)\n @queens_count = Building.city_count(pop_nb_buildings, 'Queens', NYCBorough.queens_borough)\n @bronx_count = Building.city_count(pop_nb_buildings, 'Bronx', NYCBorough.bronx_sub_borough)\n end",
"def index\n @place_parkings = PlaceParking.all\n end",
"def number_of_ballrooms\n self.dig_for_integer(\"numberOfBallrooms\")\n end",
"def places=(v)\n store[\"lunch_places\"] = v\n end",
"def nbr_active_parties()\n return @game_parties.size\n end",
"def number_of_slots_unallocated\n @number_of_slots_unallocated ||= placements.unallocated.size\n end",
"def number_of_slots=(number)\n number = number.to_i\n return if number == number_of_slots\n if number > number_of_slots\n (number - number_of_slots).times { |i| placements.build }\n else\n (number_of_slots - number).times do\n placements.find(:all, :conditions => \"person_id IS NULL OR person_id = 0\").pop.destroy rescue nil\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
lotDimension : String The dimensions of the Lot that the property is located in | def lot_dimension
self.dig_for_string("lotDimension")
end | [
"def dimension=(new_dimension)\n @dimension = new_dimension\n end",
"def dimension\n @unit.to_s\n end",
"def dimension(val = nil)\n return @properties[\"dimension\"] if !val\n @properties[\"dimension\"] = val\n return self\n end",
"def dimension\n raise Error::UnsupportedOperation, \"Method Geometry#dimension not defined.\"\n end",
"def dimensions\n option[:dimensions]\n end",
"def dimensions(val); @dimensions = val; self; end",
"def dimension\n postgis_calculate(:dimension, self).to_i\n end",
"def set_ObjectDimension(value)\n set_input(\"ObjectDimension\", value)\n end",
"def dimension\n map { |qnt, exp| qnt.dimension * exp }.reduce SY::Dimension.zero, :+\n end",
"def inspect\n \"#<SY::Dimension: #{self} >\"\n end",
"def lot_size\n self.dig_for_string(\"listingSummary\", \"lotSize\")\n end",
"def dimensions\n data[:dimensions]\n end",
"def dimensions_caption dimension = nil\n dimension.nil? ? response.dimensions :\n response.dimensions.collect{|d|\n next unless dimension == d[:name]\n d\n }.compact\n end",
"def set_label_dimensions width, height, unit = \"\"\n\t\tinstruction (\"SIZE \" + width.to_s + \" \" + unit.to_s + \", \" + height.to_s + \" \" + unit.to_s)\n\tend",
"def new\n @quality_lot = QualityLot.find(params[:quality_lot_id])\n @quality_lot_dimension = QualityLotDimension.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @quality_lot_dimension }\n end\n end",
"def dimension_names\n two_dimensions | three_dimensions\n end",
"def dimensions\n data.dimensions\n end",
"def [](dimname)\n @dimensions[dimname]\n end",
"def get_units(dimension)\n nil\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
levels : Integer The number of levels (or storeys) in the Property | def levels
self.dig_for_integer("levels")
end | [
"def item_levels; end",
"def levels=(levels)\n @levels = levels\n clear_levels_cache!\n end",
"def level_count_required\n 10\n end",
"def depth\n @levels.size\n end",
"def increaseLevels(levels)\n @level += levels\n end",
"def levels\n # divide total points available in to X tiers\n # set up a hash\n # Beginner - 1\n # Good start - 2\n # Moving Up - 3\n # good - 4\n # Solid - 5\n # Nice - 6\n # Great - 7\n # Amazing - 8\n # Genius - 9\n # Queen Bee - 10\n end",
"def load_levels\n @levels = @course.numbered_levels\n end",
"def levels\n Access::Core.levels_hash.keys\n end",
"def level=(value)\n @level = value\n end",
"def level\n @level\n end",
"def power_levels\n get_state('m.room.power_levels')\n end",
"def levels?\n @levels\n end",
"def levels\n response = JSON.parse(@client.get(\"/api/v1/levels\").body)\n return response[\"levels\"] || response\n end",
"def increment_levels(i)\n @level += i\n end",
"def level() end",
"def level(*) end",
"def levels(levels)\n # need to keep nils, so don't remove them\n\n # flatten nested arrays\n levels = [levels].flatten\n\n # make array of levels unique and validate each\n # return the array of validated levels\n levels.uniq.map { |i| Access::Validate.level(i) }\n end",
"def set_reporting_levels(levels)\n self.report_levels = []\n available = self.class.names['levels']\n\n levels.each do |level|\n report_levels << available[level] if available[level]\n end\n end",
"def growl_level_num( level )\n level = Integer(level)\n if level < -2 or level > 2\n raise ArgumentError, \"level '#{level}' is not in range -2..2\"\n end\n level\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
yearBuilt : String The year in which the property was built | def year_built
self.dig_for_integer("yearBuilt")
end | [
"def get_built_year\n return @built_year\n end",
"def set_default_year_built\n self.yearBuilt = 1965 if self.yearBuilt.blank?\n end",
"def rebuild_year=(num)\n unless num.blank?\n self[:rebuild_year] = sanitize_to_int(num)\n end\n end",
"def yearstring\n if year\n \"(#{year})\"\n end\n end",
"def year=(value)\n @year = value\n end",
"def year_name(number); end",
"def year() end",
"def test_house_year_built\n house = House.new(color: \"Gray\", floors: 2, year_built: 2003, address: '274 Baker St', lights: true, safe_mode:true)\n actual = house.year_built\n assert_equal(2003, actual, \"2003 as an integer should be returned\")\n\n house.year_built = 2007\n actual = house.year_built\n assert_equal(2007, actual, \"2007 as an integer should be returned\")\n end",
"def year\n @year.to_s\n end",
"def new_year(g_year = self.year)\n date(g_year, JANUARY, 1)\n end",
"def year\n return @year\n end",
"def cwyear\n end",
"def w_year; end",
"def set_ConstructionYear(value)\n set_input(\"ConstructionYear\", value)\n end",
"def year= num\n #This is a stub, used for indexing\n end",
"def production_year\n document[\"productionYear\"]\n end",
"def year(input) = new_year(input).year - 621",
"def year=(value)\n @year = value\n end",
"def build_header_year\n \"#{begin_date.year}/#{end_date.year}\"\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
yearRenovated : String The year in which the property was last renovated | def year_renovated
self.dig_for_integer("yearRenovated")
end | [
"def year_change\n \"Happy new year! It is now #{@year} years past an arbitrary date!\"\n end",
"def year(input) = new_year(input).year - 621",
"def cwyear\n end",
"def year() end",
"def year\n return @year\n end",
"def w_year; end",
"def year=(newyear)\n @t_year = newyear.to_i\n end",
"def year\n @year.to_s\n end",
"def graduation_year=(value)\n @graduation_year = value\n end",
"def year=(value)\n @year = value\n end",
"def truck_year\n if self.truck.present? \n return self.truck.year.strftime(\"%Y\")\n else\n return \"\"\n end\n end",
"def yearstring\n if year\n \"(#{year})\"\n end\n end",
"def year_built\n self.dig_for_integer(\"yearBuilt\")\n end",
"def years_experience\n Time.now.year - rookie_year\n end",
"def rebuild_year=(num)\n unless num.blank?\n self[:rebuild_year] = sanitize_to_int(num)\n end\n end",
"def year\n current_year = Date.today.year\n\n case raw_year\n when current_year; \"this year\"\n when current_year.next; \"next year\"\n when current_year.pred; \"last year\"\n else; raw_year.to_s\n end\n end",
"def get_model_year\n @model_year\n end",
"def year\n @year ||= calendar.merch_year_from_date(date)\n end",
"def year\n return @year\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
totalRooms : Integer Number of total rooms in the property | def total_rooms
self.dig_for_integer("totalRooms")
end | [
"def total_guests_in_rooms()\n guests_in_bar = 0\n for room in @rooms\n guests_in_bar += room.guests_in_room()\n end\n return guests_in_bar\n end",
"def no_of_bedrooms\n self.dig_for_integer(\"listingSummary\", \"noOfBedrooms\")\n end",
"def set_PropertyRooms(value)\n set_input(\"PropertyRooms\", value)\n end",
"def total_rent\n count = 0\n self.offices.map do |office|\n count+= office.building.rent_per_floor\n end\n count\n end",
"def capacity\n\t\tcapacity = 0\n\t\trooms.all.each do |room|\n\t\t\tcapacity += room.capacity\n\t\tend\n\t\tcapacity\n\tend",
"def number_of_guests()\n return @guests_in_room.count()\n end",
"def property_rooms\n self.dig_for_array(\"propertyRooms\")\n end",
"def num_rooms_next_round\n \tif self.hasRounds?\n \t\treturn 1; #self.next_round.room_draws.count;\n \telse\n \t\treturn 0;\n \tend\n end",
"def total_visitors\n room.group_by{|v| v.visitor}.count.to_i\n end",
"def number_of_conference_rooms\n self.dig_for_integer(\"numberOfConferenceRooms\")\n end",
"def total_guests\n guests.count\n end",
"def list_available_rooms\n p \"Available Rooms:\"\n available_rooms.each do |room_type, rooms|\n p \"#{room_type} = #{rooms.length}\"\n end\n p\n end",
"def number_of_ballrooms\n self.dig_for_integer(\"numberOfBallrooms\")\n end",
"def number_of_bookings\n\t\troom_reservations.empty? ? 0 : capacity - min_disponibility\n\tend",
"def total_sightings\n num_sights = 0\n \n unless object.nil? or !object.respond_to?(:total_sightings)\n num_sights = object.total_sightings\n end\n \n return num_sights\n end",
"def number_of_game_room_completed_missions(game_room)\n game_room_completed_missions(game_room).count\n end",
"def size\n count = 0\n @properties.each do |gid, values|\n if ! values.empty?\n count += 1\n end\n end\n return count\n end",
"def set_Rooms(value)\n set_input(\"Rooms\", value)\n end",
"def list_all_rooms\n return @rooms\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
taxRollNumber : String An identifier for a property within a given jurisdiction, such as a city or county, that can be taxed | def tax_roll_number
self.dig_for_string("taxRollNumber")
end | [
"def tax_id_number\n self.dig_for_string(\"taxIdNumber\")\n end",
"def polish_taxpayer_identification_number; end",
"def tax_year\n self.dig_for_integer(\"taxYear\")\n end",
"def tax_code\n @fields[15]\n end",
"def annual_property_tax\n raise NotImplementedError, \"TODO: Implement me in a subclass!\"\n end",
"def russian_tax_number(region: nil, type: :legal)\n inn_number(region, type)\n end",
"def tax_identification_number\n element_with_value('TaxIdentificationNumber', opts[:sender_vat_number] || '')\n end",
"def tax_multiplier\n multiplier = (tax_percentage.to_f / 100) + 1.0\n end",
"def taxrate\n 0.10\n end",
"def sales_tax\n\n\t\tb = 10%\n\t\ti = 5%\n\t\tt = 0%\n\n\t\twhen tax_type == i\n\t\t\titem_price * 0.05\n\t\tend",
"def compute_tax(line); end",
"def tax_index\n\n end",
"def invoice_tax\n if address.present?\n self.invoice_tax_amount, self.tax_description = address.invoice_tax(invoice_items_amount)\n else\n self.invoice_tax_amount = 0\n end\n self.invoice_tax_amount\n end",
"def tax_rate\n Store::settings.tax_rate/100\n end",
"def annual_tax\n self.dig_for_decimal(\"annualTax\")\n end",
"def tax_rate\n Store.settings.tax_rate/100\n end",
"def tax_percentage\n 0\n end",
"def write_tax_p(pdf,count,tax_p) \n @prefix = \"ATSAT\" + count.to_s + \" \"\n @optname = tax_p.nameOfBank.to_s #+ tax_p.nameOfBranch.to_s\n pdftext( (@prefix + \"Amount\") , amount_to_pdf_string(tax_p.amt))\n pdftext( (@prefix + \"Name of Bank & Branch\") , @optname)\n pdftext( (@prefix + \"BSR Code\") , number_to_pdf_string(tax_p.bsrCode))\n pdftext( (@prefix + \"DoD\") , date_to_pdf_string(tax_p.dateDep))\n pdftext( (@prefix + \"Serial Number of Challan\") , number_to_pdf_string(tax_p.srlNoOfChaln))\n \n end",
"def tax(tax, options = {})\n get(\"taxes/#{tax}\", options).pop\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
zoning : String Property in terms of permitted usage of land based on mapped zones by the authorities | def zoning
self.dig_for_string("zoning")
end | [
"def zone_name\n caz_data['name']\n end",
"def zone_setting(resource)\n resource.multi_az ? 'multi_az' : 'standard'\n end",
"def zone_number\n end",
"def utm_zone\n if srid == 4326\n geom = centroid\n else\n geomdup = transform(4326)\n mezzo = geomdup.length / 2\n geom = case geomdup\n when Point then geomdup\n when LineString then geomdup[mezzo]\n else\n geomgeog[mezzo][geomgeo[mezzo]/2]\n end\n\n end\n\n pref = geom.y > 0 ? 32700 : 32600\n zone = ((geom.x + 180) / 6 + 1).to_i\n zone + pref\n end",
"def zone_listing\n zone_listing = self.zones.map { |z| z.name }.join ','\n end",
"def zone_letter\n end",
"def zone(resource)\n resource.availability_zone.chop\n end",
"def zone\n fetch('games.final_fantasy_xiv.zones')\n end",
"def zone_for(px, pz, sz_bot, sz_top)\n # puts \"calculating zone: #{px}, #{pz}, #{sz_bot}, #{sz_top}\"\n zone = [-0.70833, -0.23611, 0.23611, 0.70833, 100].index{|lower_bound| lower_bound > px} + 1\n zone += 5 * [sz_top, (2*sz_top/3 + sz_bot/3), (2*sz_bot/3 + sz_top/3), sz_bot, -100].index{|bound| bound < pz}\n # puts zone\n return zone\n end",
"def zone_name\n l = location\n l ? l.zone_name : state[\"zone\"]\n end",
"def climate_zone_to_short\n return {\n 'CEC T24-CEC1' => 'CZ01',\n 'CEC T24-CEC2' => 'CZ02',\n 'CEC T24-CEC3' => 'CZ03',\n 'CEC T24-CEC4' => 'CZ04',\n 'CEC T24-CEC5' => 'CZ05',\n 'CEC T24-CEC6' => 'CZ06',\n 'CEC T24-CEC7' => 'CZ07',\n 'CEC T24-CEC8' => 'CZ08',\n 'CEC T24-CEC9' => 'CZ09',\n 'CEC T24-CEC10' => 'CZ10',\n 'CEC T24-CEC11' => 'CZ11',\n 'CEC T24-CEC12' => 'CZ12',\n 'CEC T24-CEC13' => 'CZ14',\n 'CEC T24-CEC14' => 'CZ14',\n 'CEC T24-CEC15' => 'CZ15',\n 'CEC T24-CEC16' => 'CZ16'\n }\n end",
"def zones\n client.list_zones(secrets['compartment_id']).data.map(&:name)\n end",
"def canonical_zone\n self\n end",
"def zone\n p = period\n p ? p.abbreviation.to_s : super\n end",
"def zoneinfo_dir; end",
"def based_near\n descMetadata.has_location #.map(&:location_name).flatten\n end",
"def zone\n ip.octets[0..-(1+significant_octets)].reverse.join('.')\n end",
"def SafeZoneX \n \"SafeZoneX\" \n end",
"def zone_info(zone_name)\n parameters = \"zone=#{zone_name}\"\n request(:get, \"/api/zone?#{parameters}\")\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
providerName : String The name of the provider of the listing information | def provider_name
self.dig_for_string("providerName")
end | [
"def name\n @provider_name\n end",
"def provider_name=(value)\n @provider_name = value\n end",
"def provider_name\n return @provider_name\n end",
"def name\n @provider[:name]\n end",
"def provider_name\n object.provider_id.titleize\n end",
"def provider_name\n object.provider_name.to_s.underscore\n end",
"def provider_name\n provider.titleize\n end",
"def provider_name\n params[:provider] || provider_name_from_state || browser.providers.each_key.to_a.first\n end",
"def provider_name=(provider)\n unless provider.nil?\n @provider_name = provider.downcase\n end\n end",
"def display_provider_link\n regexp = /^\\/Providers\\/\\d+$/\n if regexp.match request.fullpath\n link = link_to session[:provider_name], edit_provider_path(session[:provider])\n else\n link = link_to session[:provider_name], provider_path(session[:provider])\n end\n return (\"Provider: \" + link).html_safe\n end",
"def set_provider\n PROVIDERS.each do |name|\n regex_string = PROVIDERS.first.eql?(name) ? name[0..-3] : name\n self.provider = name if link =~ /#{regex_string}/\n end\n end",
"def is_provider?; @name.nil? end",
"def generate_puppet_provider_list\n @items = Registry.all(:puppet_provider).sort_by { |p| p.name.to_s }\n @list_title = 'Provider List'\n @list_type = 'puppet_provider'\n generate_list_contents\nend",
"def providers\n\t@title = \"Valid Service Providers\"\n end",
"def get_provider(name)\n provider = nil\n @providers.each do |p|\n provider = p if p[:id].eql?(name.to_sym)\n end\n provider\n end",
"def provider_key\n self.dig_for_string(\"providerKey\")\n end",
"def index\n @provider_infos = ProviderInfo.all\n end",
"def provider_url\n self.dig_for_string(\"providerURL\")\n end",
"def provider_category\n self.dig_for_string(\"providerCategory\")\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
providerCategory : String The category of the provider of the listing information | def provider_category
self.dig_for_string("providerCategory")
end | [
"def provider_name\n object.provider_id.titleize\n end",
"def provider_name\n provider.titleize\n end",
"def provider_name\n self.dig_for_string(\"providerName\")\n end",
"def provider_name\n object.provider_name.to_s.underscore\n end",
"def provider_collections(options = {})\n collections = get_provider_collections(params.merge(options).permit(:provider, :keyword, :page_size, :page_num, :short_name, concept_id: []))\n\n render_collections_for_chooser(collections)\n rescue\n collections\n end",
"def provider_name\n return @provider_name\n end",
"def get_technology_link(provider)\n request = Net::HTTP::Get.new(\"#{@conf.location}/config/hypervisortypes\")\n request.add_field('accept','application/vnd.abiquo.hypervisortypes+json')\n puts \"Searching for provider #{provider}...\"\n response = send_request(request)\n provider_type = JSON.parse(response.body)[\"collection\"].select{ |x| x[\"name\"] == provider }[0]\n link = provider_type[\"links\"].select{ |l| l[\"rel\"] == \"self\" }[0]\n link['rel'] = 'hypervisortype'\n link\n end",
"def display_provider_link\n regexp = /^\\/Providers\\/\\d+$/\n if regexp.match request.fullpath\n link = link_to session[:provider_name], edit_provider_path(session[:provider])\n else\n link = link_to session[:provider_name], provider_path(session[:provider])\n end\n return (\"Provider: \" + link).html_safe\n end",
"def provider_specifics\n @provider_specifics\n end",
"def provider_name=(value)\n @provider_name = value\n end",
"def name\n @provider_name\n end",
"def category\n if params[:city] == \"sf\"\n @city = \"San Francisco\"\n elsif params[:city] == \"ny\"\n @city = \"New York\"\n end\n @listings = Listing.find_all_by_city(@city)\n end",
"def set_provider\n PROVIDERS.each do |name|\n regex_string = PROVIDERS.first.eql?(name) ? name[0..-3] : name\n self.provider = name if link =~ /#{regex_string}/\n end\n end",
"def providers\n\t@title = \"Valid Service Providers\"\n end",
"def category_name\n Participant::FILTER_CATEGORIES[category.to_sym] if category\n end",
"def property_category\n self.dig_for_string(\"listingSummary\", \"propertyCategory\")\n end",
"def provider_name=(provider)\n unless provider.nil?\n @provider_name = provider.downcase\n end\n end",
"def provider=(value)\n @provider = value\n end",
"def generate_puppet_provider_list\n @items = Registry.all(:puppet_provider).sort_by { |p| p.name.to_s }\n @list_title = 'Provider List'\n @list_type = 'puppet_provider'\n generate_list_contents\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
providerURL : String The URL of the provider of the listing information | def provider_url
self.dig_for_string("providerURL")
end | [
"def display_provider_link\n regexp = /^\\/Providers\\/\\d+$/\n if regexp.match request.fullpath\n link = link_to session[:provider_name], edit_provider_path(session[:provider])\n else\n link = link_to session[:provider_name], provider_path(session[:provider])\n end\n return (\"Provider: \" + link).html_safe\n end",
"def provider_url\n attribute(mapping['provider_url']) || @provider.endpoint\n end",
"def get_provider_uri\n return @data['providerUri'] if @data['providerUri']\n response = @client.rest_get(PROVIDERS_URI)\n providers = @client.response_handler(response)['members']\n desired_provider = providers.find { |provider| provider['displayName'] == @data['providerDisplayName'] }\n desired_provider['uri']\n end",
"def set_provider\n PROVIDERS.each do |name|\n regex_string = PROVIDERS.first.eql?(name) ? name[0..-3] : name\n self.provider = name if link =~ /#{regex_string}/\n end\n end",
"def list_url; end",
"def base_uri\n \"#{api}/provider\"\n end",
"def provider_name\n self.dig_for_string(\"providerName\")\n end",
"def listing_url\n self.dig_for_string(\"listingSummary\", \"listingURL\")\n end",
"def providers\n\t@title = \"Valid Service Providers\"\n end",
"def get_technology_link(provider)\n request = Net::HTTP::Get.new(\"#{@conf.location}/config/hypervisortypes\")\n request.add_field('accept','application/vnd.abiquo.hypervisortypes+json')\n puts \"Searching for provider #{provider}...\"\n response = send_request(request)\n provider_type = JSON.parse(response.body)[\"collection\"].select{ |x| x[\"name\"] == provider }[0]\n link = provider_type[\"links\"].select{ |l| l[\"rel\"] == \"self\" }[0]\n link['rel'] = 'hypervisortype'\n link\n end",
"def external_provider\n @external_provider\n end",
"def index\n @provider_infos = ProviderInfo.all\n end",
"def provider_name\n return @provider_name\n end",
"def provider=(value)\n @provider = value\n end",
"def generate_puppet_provider_list\n @items = Registry.all(:puppet_provider).sort_by { |p| p.name.to_s }\n @list_title = 'Provider List'\n @list_type = 'puppet_provider'\n generate_list_contents\nend",
"def provider_name\n params[:provider] || provider_name_from_state || browser.providers.each_key.to_a.first\n end",
"def name\n @provider_name\n end",
"def provider_name=(value)\n @provider_name = value\n end",
"def provider\n @resource.provider\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
providerKey : String The unique identifier for the listing in the provider's system | def provider_key
self.dig_for_string("providerKey")
end | [
"def provider_id\n return @provider_id\n end",
"def provider_name\n self.dig_for_string(\"providerName\")\n end",
"def provider_id=(value)\n @provider_id = value\n end",
"def provider_name\n object.provider_id.titleize\n end",
"def provider_name\n return @provider_name\n end",
"def provider_identity\n [self.source.name, self.uid].compact.join('_')\n end",
"def provider_name\n object.provider_name.to_s.underscore\n end",
"def provider_resource_id\n return @provider_resource_id\n end",
"def name\n @provider_name\n end",
"def display_provider_link\n regexp = /^\\/Providers\\/\\d+$/\n if regexp.match request.fullpath\n link = link_to session[:provider_name], edit_provider_path(session[:provider])\n else\n link = link_to session[:provider_name], provider_path(session[:provider])\n end\n return (\"Provider: \" + link).html_safe\n end",
"def provider_install_key(name)\n \"provider_install_#{name}\".to_sym\n end",
"def provider_name\n params[:provider] || provider_name_from_state || browser.providers.each_key.to_a.first\n end",
"def provider_by_id(provider_id)\n provider_map[provider_id.to_i] if provider_id.to_i > 0\n end",
"def provider_category\n self.dig_for_string(\"providerCategory\")\n end",
"def mrn_key\n if self.provider_id.present?\n provider_id.to_s\n elsif ENROLLMENT_ROLES.include?(self.role)\n 'primary'\n end\n end",
"def provider_name=(value)\n @provider_name = value\n end",
"def provider_name\n provider.titleize\n end",
"def lookup_key(uid, provider=nil)\n [provider, uid].compact.join('_').to_sym\n end",
"def provider_url\n self.dig_for_string(\"providerURL\")\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
leadEmail : String The email address that leads for this Listing should be sent to TODO EXIST? | def lead_email
self.dig_for_string("leadEmail")
end | [
"def lead_email_address\n self.dig_for_string(\"leadEmailAddress\")\n end",
"def lead_email_address\n self.dig_for_string(\"agentSummary\", \"leadEmailAddress\")\n end",
"def new_lead_notification(lead)\n @lead = lead\n\n # mg_client = Mailgun::Client.new ENV['mailgun_key']\n # message_params = {:from => 'noctiflow@gmail.com',\n # # :to => 'jmacdonald404@gmail.com', #lead.email when mailgun plan setup\n # :to => @lead.email,\n # # :bcc => 'noctiflow@gmail.com',\n # :subject => 'Contact Form',\n # :text => \"Thanks for signing up #{lead.first_name}! We are currently reviewing your information regarding real estate in #{lead.cityname}, and will be in touch with you soon! this was generated from #{lead.source}. now to add you to the mailing list\",\n # \"o:deliverytime\" => 30.seconds.from_now.rfc2822\n # }\n # mg_client.send_message ENV['mailgun_url'], message_params\n\n\n mail({\n :from => \"noreply@jameswangcrm.ca\",\n :to => @lead.email,\n :subject => \"Your information has been sent.\",\n :text => \"Thank you for contacting us. We will be in touch with you shortly.\"\n })\n end",
"def proms_mailing_list_email\n \"#{gadz_tabagns}#{gadz_ans}@gadz.org\"\n end",
"def inbound_email; end",
"def lead_owner_email\n # The 'other' option on the signup form should be accessible here too.\n # So if we see the keyword 'other' in the mapping, we match that to anything\n # except the item on the list we have.\n university_name_lookup = university_name\n # Blank doesn't count as other - it just means they didn't fill in this field at all\n # (they are probably the wrong applicant_type for it to be applicable)\n if !university_name_lookup.nil? && university_name_lookup != ''\n unless List.find_by_friendly_name('universities').items.include? university_name_lookup\n university_name_lookup = 'other'\n end\n end\n # Ditto, just other for bz_region.\n bz_region_lookup = bz_region\n if !bz_region_lookup.nil? && bz_region_lookup != ''\n unless List.find_by_friendly_name('bz_regions').items.include? bz_region_lookup\n bz_region_lookup = 'other'\n end\n end\n\n mapping = LeadOwnerMapping.where(\n :university_name => university_name_lookup,\n :bz_region => bz_region_lookup,\n :applicant_type => applicant_type\n )\n logger.debug \"########## Found Lead Owner: #{mapping.inspect} for university_name_lookup = #{university_name_lookup}, bz_region_lookup = #{bz_region_lookup}, applicant_type = #{applicant_type}\"\n\n # IF all else fails, assign it to Abby and she'll handle it manually\n if mapping.empty?\n return Rails.application.secrets.default_lead_owner\n end\n mapping.first.lead_owner\n end",
"def contact_email\n TESTING_EMAIL || @comment[:email]\n end",
"def email_to(email)\n env = :live\n\n if env == :live\n email\n else\n email_test = 'lienptb@elarion.com'\n end\n end",
"def email_link\n mail_to contact_me.email\n end",
"def email_to(email)\n env = :live\n\n if env == :live1\n email\n else\n email_test = 'lienptb@elarion.com'\n end\n end",
"def follow_up_alert(email, name, body, body_part2, location_link)\n @name = name \n @body = body\n @body_part2 = body_part2\n @location_link = location_link\n\n mail to: email, subject: \"Follow-up info from Grapevine\", from: \"erik@pickgrapevine.com\", reply_to: \n \"erik@pickgrapevine.com\"\n\n end",
"def member_invite_2(invite, sending_bus)\n unless invite.invitee.opted_out?\n @invite = invite\n @personal_message = invite.message\n @inviter = invite.inviter\n @business_id = invite.company_id #business of recipient\n @invitee_id = invite.invitee_id #recipient's id in Invite db record\n if !@business_id.nil? && !@invitee_id.nil?\n @business = sending_bus\n @invitee = Contact.find(invite.invitee_id)\n @invite_company = Company.find(@business_id)\n subject = \"Free marketing for #{@invite_company.try(:name) || \"you\"} in and around #{@invite_company.location.city_and_state}\"\n mail to: invite.invitee.email, from: \"#{@business.name} <#{Rails.application.secrets.invite_email}>\", subject: subject\n elsif !@invitee_id.nil?\n @business = sending_bus\n @invitee = Contact.find(invite.invitee_id)\n subject = \"Free marketing for you\"\n track extra: {business_id: @business.id}\n mail to: invite.invitee.email, from: \"#{@business.name} <#{Rails.application.secrets.invite_email}>\", subject: subject\n end\n end\n end",
"def get_lead_by_email email_id\n query = %Q{leads.id in\n (select email_addr_bean_rel.bean_id \n from email_addr_bean_rel \n where email_addr_bean_rel.bean_module = 'Leads'\n and email_addr_bean_rel.email_address_id = '#{email_id}'\n )\n }\n sugar_resp = @client.get_entry_list(MODULE_NAME, {\n :query => query,\n :order_by => '', # the SQL ORDER BY clause without the phrase “order by”.\n :offset => '0', # the record offset from which to start.\n :select_fields => ['id', 'description'],\n :max_results => '1',\n :deleted => 0, # exclude deleted records\n :favorites => false # if only records marked as favorites should be returned.\n })\n return {:lead_id => nil, :lead_desc => \"\"} if sugar_resp[\"entry_list\"].length == 0\n {:lead_id => sugar_resp[\"entry_list\"][0][\"id\"], :lead_desc => sugar_resp[\"entry_list\"][0][\"name_value_list\"][\"description\"][\"value\"]}\n end",
"def app_email\n dflt = Rails.application.routes.url_helpers.contact_us_url || ''\n Rails.configuration.x.organisation.fetch(:helpdesk_email, dflt)\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 add_member_email(email)\n\n end",
"def deliver_invite_email(template = offering.early_mentor_invite_email_template)\n link = mentor_offering_map_url(:host => CONSTANTS[:base_url_host], :offering_id => offering.id, :mentor_id => id, :token => token)\n #mentor_map_url(:host => CONSTANTS[:base_url_host], :mentor_id => id, :token => token)\n \n if EmailContact.log(person_id, ApplyMailer.deliver_mentor_status_update(self, template, email, nil, link), application_for_offering.status)\n update_attribute(:invite_email_sent_at, Time.now)\n end\n end",
"def recruiting_email_address\n self.dig_for_string(\"recruitingEmailAddress\")\n end",
"def listing_notifier(user, supplier, listing)\n\t @user = user\n\t @supplier = supplier\n\t @listing = listing\n\t @login_url = \"http://www.mylmp.herokuapp.com/signin\"\n\t mail(:to => user.email,\n\t :subject => \"#{supplier.first_name} just listed a new #{listing}\")\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
agriculturalPropertyNumber : String A unique identifier given for the agriculture property | def agricultural_property_number
self.dig_for_string("agriculturalPropertyNumber")
end | [
"def property_number(property)\n if @vocabulary.properties.has_key?(property)\n @vocabulary.properties[property][:num]\n else\n @vocabulary.properties[:any][:num]\n end\n end",
"def swedish_organisation_number; end",
"def next_ant_property_name(name_base)\n $next_ant_property_counts[name_base] ||= 0\n val = $next_ant_property_counts[name_base] += 1\n \"%s_%d\" % [ name_base, val ]\n end",
"def czech_organisation_number; end",
"def property_id\n @property_id ||= Avantio::PropertyId.from_avantio_ids(\n accommodation_code, user_code, login_ga\n ).property_id\n end",
"def norwegian_organisation_number; end",
"def prodid_property\n @prodid_property ||= RiCal::PropertyValue::Text.convert(self, \"-//com.denhaven2/NONSGML ri_cal gem//EN\")\n end",
"def national\n return @national_number unless valid?\n format, prefix, rule = get_formatting_data\n\n # add space to format groups, change first group to rule,\n # change rule's constants to values\n format_string = format[:format].gsub(/(\\d)\\$/, '\\\\1 $').gsub('$1', rule)\n .gsub(/(\\$NP|\\$FG)/, '$NP' => prefix, '$FG' => '$1')\n\n if matches = @national_number.match(/#{format[Core::PATTERN]}/)\n format_string.gsub(/\\$\\d/) { |el| matches[el[1].to_i] }\n else\n @national_number\n end\n end",
"def amenity_id(index)\n '%03d' % index\n end",
"def national_number\n @phone.national\n end",
"def display_value\n human_number = \"#{country_code}- #{number}\"\n human_number << \" ext. #{extension}\" if extension\n human_number\n end",
"def spanish_foreign_citizen_number; end",
"def south_african_listed_company_registration_number; end",
"def polish_taxpayer_identification_number; end",
"def update_property_id(prop)\n val_ref = prop[\"valueReference\"]\n val_ref.map do |vr|\n {\n \"@type\" => \"DefinedTerm\",\n \"@value\" => \"annotated_property_name\",\n }\n end\n rescue NoMethodError\n nil\n end",
"def translate rule_number\n rules[rule_number].gsub(/\\d+/){ tr_rules[_1.to_i] }.gsub(/[ \"]/, '')\n end",
"def routing_number_with_format; end",
"def format_identifier\n self.identifier.to_s\n end",
"def south_african_listed_company_registration_number\n generate(:string) do |g|\n g.int(length: 4)\n g.lit('/')\n g.int(ranges: [1000..9_999_999_999])\n g.lit('/06')\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
anchorStores : String The stores within the shopping complex that draw traffic to the location | def anchor_stores
self.dig_for_string("anchorStores")
end | [
"def stores\n unless @stores\n page = request(store_url)\n raise StoreRequestError unless page.code == \"200\"\n\n xml = Nokogiri::XML(page.body)\n \n @stores = {}\n \n xml.css('GotoURL SetFontStyle').each do |name_node|\n name = name_node.text\n url = name_node.parent.parent['url']\n store_id = url.match(/storeFrontId=([0-9]+)/)[1] rescue nil\n @stores[name] = store_id if store_id && name\n end\n end\n @stores\n end",
"def store_link\n client = Bitly.client\n store_link = \"#{ENV['PORTAL_LINK']}/display_store/#{self.id}\"\n return \"\\nButik:\" + client.shorten( store_link ).short_url\n end",
"def purchase_in_store_list\n stores = []\n if macys?\n purchase_in_store_container_elements.each do |container|\n\n city, state = container.span_element(:class => 'line', :index => 4).text.split(',')\n state.strip!\n\n stores << {\n 'store_name' => container.span_element(:index => 0).text,\n 'address_line_1' => container.span_element(:class => 'line', :index => 0).text,\n 'address_line_2' => container.span_element(:class => 'line', :index => 1).text,\n 'address_city' => city,\n 'address_state' => state,\n 'address_zip_code' => container.span_element(:class => 'line', :index => 4).text,\n 'distance' => container.span_element(:class => 'miles-bops').text,\n 'store_hours' => container.div_element(:class =>'store-hours').text,\n }\n end\n else\n instore_availability = false\n store_header = store_container_element.div_elements(:class => 'bops_so_storeAvailability').map(&:text)\n store_header.each do |header|\n if header.include?('not available for our buy online')\n instore_availability = true\n break\n end\n end\n raise 'No in-store available stores are found' unless instore_availability\n\n store_count = 0\n container = store_container_element.div_elements(:class => 'bops_so_storeResultWrapper')\n\n if store_availability_message.include?('Buy online')\n store_count = store_count_div[/(\\d+)/, 1].to_i\n total_store_count = container.count - 1\n elsif store_availability_message.include?('not available for our buy online')\n total_store_count = container.count - 1\n end\n\n not_available_stores = false\n store_header.each do |header|\n if header.include?('Not available at')\n not_available_stores = true\n break\n end\n end\n\n if not_available_stores\n total_store_count -= 1\n end\n\n (store_count..total_store_count).each do |i|\n location_container = container[i].div_element(:class => 'bops_so_storeLocation')\n hours_container = container[i].div_element(:class => 'bops_so_storeHoursContainer')\n city_state_zip = location_container.div_element(:index => 2).text\n\n stores << {\n 'store_name' => location_container.div_element(:index => 0).text,\n 'address_line_1' => location_container.div_element(:index => 1).text,\n 'address_line_2' => '',\n 'address_city' => city_state_zip[/([^,]+)/, 1], # Everything up to the first ,\n 'address_state' => city_state_zip[/,(\\w{2})/, 1], # First two characters after the ,\n 'address_zip_code' => city_state_zip[/(\\d{5}(-\\d{4})?)$/, 1], # Last 5 digits (plus optional 4 digits)\n 'phone_number' => location_container.div_element(:index => 3).text,\n 'distance' => location_container.span_element(:class => 'bops_so_storeMiles').text.sub(' View Map', '').sub(' Hide Map', ''),\n 'store_hours' => hours_container.text\n }\n end\n end\n stores\n end",
"def store_name_link\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.div.className(create_ats_regex_string(\"ats-storetitle\")).a, format_method(__method__))\n end",
"def active_stores\n @active_stores ||= {}\n end",
"def term_stores=(value)\n @term_stores = value\n end",
"def anchors; end",
"def find_a_store_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-findstore\")), __method__)\n end",
"def find_store_link\n $tracer.trace(__method__)\n return ToolTag.new(a.className(create_ats_regex_string(\"ats-findstore\")), __method__, self)\n end",
"def view_map(store, store_type)\n index = store_index(store, store_type)\n if macys?\n element = store_type == 'bops_store' ?\n select_store_button_elements[index] :\n purchase_in_store_container_elements[index].image_element\n element.click\n else\n view_map_link_elements[index].click\n end\n end",
"def get_alternate_stores(query_obj=nil)\n uri = URI.parse(@uri + \"/AlternateStores\")\n results = get(uri,query_obj)\n end",
"def stores\n _system[:stores] || []\n end",
"def get_store_names\n\n sname = params[:store]\n sname ? sname.split(',') : nil\n end",
"def stores\r\n return self._stores if not self._stores.empty?\r\n response = api_get(\"Stores.egg\")\r\n stores = JSON.parse(response.body)\r\n stores.each do |store|\r\n self._stores << Newegg::Store.new(store['Title'], store['StoreDepa'], store['StoreID'], store['ShowSeeAllDeals'])\r\n end\r\n self._stores\r\n end",
"def store_title_link\n $tracer.trace(__method__)\n return ToolTag.new(div.className(create_ats_regex_string(\"ats-storetitle\")).find.a, __method__, self)\n end",
"def mgs_hops_stores_section\n $tracer.trace(__method__)\n return ToolTag.new(section.id(\"hops_store_list\"), __method__, self)\n\tend",
"def anchor_types\n ANCHOR_LIST_KEYS\n end",
"def store_url\n \"#{DEFAULT_URL}/#{store_id}\"\n end",
"def index\n @anchors = Anchor.all\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
annualTax : Decimal The annualTax associated with the listing | def annual_tax
self.dig_for_decimal("annualTax")
end | [
"def total_tax\n (doc/\"total-tax\").to_money\n end",
"def tax_total\n conv_tax.round(2)\n end",
"def net_tax\n net_amount() * self.vat_tax.to_f\n end",
"def tax_total\n self.tax_amount = line_items.inject(Money.new(0, self.currency || Money.default_currency)) {|sum,l| sum + l.tax_amount }\n self.tax_rate # calculates average rate, leave for compatibility reasons\n self.tax_amount\n end",
"def tax_total\n self.tax_amount = line_items.inject(0.to_money) {|sum,l| sum + l.tax_amount }\n self.tax_amount\n end",
"def tax_rate\n self[:tax_rate] ||= Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size\n end",
"def provincial_tax_rate\n PROVINCIAL_TAX_RATE\n end",
"def tax_total\n included_tax_total + additional_tax_total\n end",
"def tax_amount\n return 0 if tax.nil? || tax <= 0\n amount = 0\n items.each { |item| amount += item.total if item.taxable? }\n amount * ( tax / 100 )\n end",
"def vat_tax_percent\n self.vat_tax.to_f * 100\n end",
"def tax_rate\n write_attribute( :tax_rate, Float(line_items.inject(0) {|sum, l| sum + l.tax_rate}) / line_items.size)\n end",
"def tax_percentage\n 0\n end",
"def total_tax\n @total_tax || line_items.inject(BigDecimal.new('0')) { | sum, line_item | sum + BigDecimal.new(line_item.tax_amount.to_s) }\n end",
"def annual_property_tax\n raise NotImplementedError, \"TODO: Implement me in a subclass!\"\n end",
"def unit_amount_inc_tax\n unit_amount + unit_tax\n end",
"def taxrate\n 0.10\n end",
"def tax_amount\n self.taxes.values.reduce(0, :+)\n end",
"def tax_rate\n Store.settings.tax_rate/100\n end",
"def share_of_tax\n (bill_w_tax - subtotal) / persons\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
availableFloors : Integer The total number of floors available within a property's Listing | def available_floors
self.dig_for_integer("availableFloors")
end | [
"def number_of_floors\n @floors.count\n end",
"def number_of_floors\n\t\t@floors.count\n\tend",
"def floppies\n @floppies\n end",
"def property_floors\n self.dig_for_array(\"propertyFloors\")\n end",
"def floors_available\n available_floors_array = all_floors\n self.offices.each do |office|\n available_floors_array.delete(office.floor)\n end\n available_floors_array\n end",
"def floors_available_and_curr_company_floors(company_id)\n total_available = floors_available + current_company_floors(company_id)\n total_available.sort!\n total_available\n end",
"def tier_multiple\n b = self.listings.billable\n b.size == 0 ? 1 : b.size\n end",
"def shippable_count_for_sf\n in_field_cnt = lis_in_field.select { |li| li.order.university_id.nil? }.size\n recently_shipped_cnt = recently_shipped.select { |li| li.order.university_id.nil? }.size\n [ [ship_rate - recently_shipped_cnt, \n (ship_rate * 2) - in_field_cnt,\n ship_rate].min,\n 0].max\n end",
"def floors\n # start with a range of all the floors\n # collect a hash of the apartments on that floor and the floor number\n (1..@number_of_floors).collect{ |floor_number| {:apartments=>floor(floor_number), :floor=>floor_number}}\n end",
"def ratio_res_to_listings\n self.reservations.count.to_f / self.listings.count\n end",
"def no_of_bedrooms\n self.dig_for_integer(\"listingSummary\", \"noOfBedrooms\")\n end",
"def fish_in_river()\n return @fishes.length()\n end",
"def number_of_bookings\n\t\troom_reservations.empty? ? 0 : capacity - min_disponibility\n\tend",
"def num_paintings\n self.paintings.count \n end",
"def fish_count\n return @fish_in_river.count\n end",
"def floors\n self.dig_for_array(\"floors\")\n end",
"def available_spots\n return nil unless max_spots\n max_spots - lesson_bookings.size\n end",
"def ratio_res_to_listings\n (count_listings != 0) ? calculate_ratio : 0\n end",
"def total_number_of_parcels\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
availableSpace : Decimal The space available in the commercial property | def available_space
self.dig_for_decimal("availableSpace")
end | [
"def free_space\n sum = 0\n\n mount_points.each do |mount_point, values|\n sum += RelayRegister::Converter.convert_to_gb(values['size_available'])\n end\n\n \"#{sum.round(1)} GB\"\n end",
"def total_free_space\n self.free_spaces.reduce(0, :+)\n end",
"def get_free_capacity \n return @capacity - @total_weight;\n end",
"def space_available(path)\n send_request(FXP_EXTENDED, :string, \"space-available\", :string, path)\n end",
"def available_input_capacity\n @available_input_capacity ||=\n input_capacity_per_unit * availability * number_of_units\n end",
"def get_free_capacity\n cap = self.get_capacity - self.get_amount_of_ressources\n if cap < 0\n 0\n else\n cap\n end\n end",
"def free_space; @free_space ||= path_store.free_space; end",
"def available_units\n return 0 if status == NO_SPACE\n\n 999\n end",
"def total_storage_space_in_bytes\n return @total_storage_space_in_bytes\n end",
"def energy_capacity\n\t\t\t@ship.capacity :deuterium\n\t\tend",
"def used_space\n size - free_space\n end",
"def get_capacity\n rpc_get_fact_direct('capacity').to_f\n end",
"def percent_available\n\t\t\t\treturn nil unless meminfo?\n\t\t\t\tmemory = IO.foreach('/proc/meminfo').first(3)\n\t\t\t\tmemory[2].split[1].to_i.*(100).fdiv(memory[0].split[1].to_i).round(2)\n\t\t\tend",
"def get_space_disk_usage\n get('space/diskUsage')\n end",
"def free_storage_space_in_bytes\n return @free_storage_space_in_bytes\n end",
"def spaceAvailable\n\t\treturn @maxElements > @weapons.length + @shieldBoosters.length\n\tend",
"def available_slots()\n return @size - @used_spaces\n end",
"def available_capacity(point)\n local_producers(point, @abroad.price_curve.get(point))\n .reduce(0.0) do |sum, prod|\n sum + (prod.max_load_at(point) - prod.load_curve.get(point))\n end\n end",
"def capacity_to_demand_multiplier\n 8760.0\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
averageFloorSize : Decimal The size of the floor in an average. A calculation of the total building area divided by the number of stories or levels within the building | def average_floor_size
self.dig_for_decimal("averageFloorSize")
end | [
"def average_tenants_per_floor\n (@tenants.to_f / @floors.to_f).round(2)\n end",
"def get_floor_area\n return @total_floor_area\n end",
"def average_tenant_per_floor\n @number_of_tenants.to_f / @number_of_floors.to_f\n end",
"def get_building_occupancy_hours(building_sections)\n if building_sections.count == 1\n return building_sections[0].typical_occupant_usage_value_hours.to_f\n end\n occupancy_hours = nil\n count = 0.0\n building_sections.each do |section|\n occupancy_hours = 0.0 if occupancy_hours.nil?\n occupancy_hours += section.typical_occupant_usage_value_hours.to_f if section.typical_occupant_usage_value_hours.nil?\n count += 1 if section.typical_occupant_usage_value_hours.nil?\n end\n return nil if occupancy_hours.nil?\n return occupancy_hours / count\n end",
"def avg_capacity\n @sectors.collect { |s| s.total_capacity }.sum/@sectors.length.to_f\n end",
"def getHeatedFloorArea( elements )\n # Initialize vars\n areaRatio = 0\n heatedFloorArea = 0\n\n # Get XML file version that \"elements\" came from. The version can be from the original file (pre-processed inputs)\n # or from the post-processed outputs (which will match the version of the H2K CLI used), depending on the \"elements\"\n # passed to this function.\n versionMajor = elements[\"HouseFile/Application/Version\"].attributes[\"major\"].to_i\n versionMinor = elements[\"HouseFile/Application/Version\"].attributes[\"minor\"].to_i\n versionBuild = elements[\"HouseFile/Application/Version\"].attributes[\"build\"].to_i\n\n if (versionMajor == 11 && versionMinor >= 5 && versionBuild >= 8) || versionMajor > 11 then\n # \"House\", \"Multi-unit: one unit\", or \"Multi-unit: whole building\"\n buildingType = elements[\"HouseFile/House/Specifications\"].attributes[\"buildingType\"]\n areaAboveGradeInput = elements[\"HouseFile/House/Specifications/HeatedFloorArea\"].attributes[\"aboveGrade\"].to_f\n areaBelowGradeInput = elements[\"HouseFile/House/Specifications/HeatedFloorArea\"].attributes[\"belowGrade\"].to_f\n else\n buildingType = \"House\"\n areaAboveGradeInput = elements[\"HouseFile/House/Specifications\"].attributes[\"aboveGradeHeatedFloorArea\"].to_f\n areaBelowGradeInput = elements[\"HouseFile/House/Specifications\"].attributes[\"belowGradeHeatedFloorArea\"].to_f\n end\n\n areaUserInputTotal = areaAboveGradeInput + areaBelowGradeInput\n\n case elements[\"HouseFile/House/Specifications/Storeys\"].attributes[\"code\"].to_f\n when 1\n numStoreysInput = 1\n when 2\n numStoreysInput = 1.5 # 1.5 storeys\n when 3\n numStoreysInput = 2\n when 4\n numStoreysInput = 2.5 # 2.5 storeys\n when 5\n numStoreysInput = 3\n when 6..7\n numStoreysInput = 2 # Split level or Spli entry/raised basement\n end\n\n # Get house area estimates from the first XML <results> section - these are totals of multiple surfaces\n if ( elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"ceiling\"]!= nil ) then\n ceilingAreaOut = elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"ceiling\"].to_i\n else\n ceilingAreaOut = 0\n end\n\n if ( elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"slab\"]!= nil ) then\n slabAreaOut = elements[\"HouseFile/AllResults/Results/Other/GrossArea\"].attributes[\"slab\"].to_f\n else\n slabAreaOut = 0\n end\n\n if ( elements[\"HouseFile/AllResults/Results/Other/GrossArea/Basement\"].attributes[\"floorSlab\"] != nil ) then\n basementSlabAreaOut = elements[\"HouseFile/AllResults/Results/Other/GrossArea/Basement\"].attributes[\"floorSlab\"].to_f\n else\n basementSlabAreaOut = 0\n end\n\n if numStoreysInput == 1 then\n # Single storey house -- avoid counting a basement heated area\n areaEstimateTotal = ceilingAreaOut\n else\n # Multi-storey houses add area of \"heated\" basement & crawlspace (check if heated!)\n loc = \"HouseFile/House/Temperatures/Basement\"\n loc2 = \"HouseFile/House/Temperatures/Crawlspace\"\n if elements[loc].attributes[\"heated\"] == \"true\" || elements[loc].attributes[\"heatingSetPoint\"] == \"true\" || elements[loc2].attributes[\"heated\"] == \"true\"\n areaEstimateTotal = ceilingAreaOut * numStoreysInput + basementSlabAreaOut\n else\n areaEstimateTotal = ceilingAreaOut * numStoreysInput\n end\n end\n\n if areaEstimateTotal > 0\n areaRatio = areaUserInputTotal / areaEstimateTotal\n else\n stream_out(\"\\nNote: House area estimate from results section is zero.\\n\")\n end\n\n if buildingType.include? \"Multi-unit\" then\n # For multis using the \"new\" MURB method assume that heated area comes from a valid user input (not an estimate form ceiling/basement areas)\n heatedFloorArea = areaUserInputTotal\n elsif areaRatio > 0.50 && areaRatio < 2.0 then\n # Accept user input area if it's between 50% and 200% of the estimated area!\n heatedFloorArea = areaUserInputTotal\n else\n # Use user input area for Triplexes (type 4), Apartments (type 5), or\n # row house (end:6 or middle:8) regardless of area ratio (but non-zero)\n houseType = elements[\"HouseFile/House/Specifications/HouseType\"].attributes[\"code\"].to_i\n if (houseType == 4 || houseType == 5 || houseType == 6 || houseType == 8) && areaUserInputTotal > 0\n heatedFloorArea = areaUserInputTotal\n else\n heatedFloorArea = areaEstimateTotal\n end\n end\n\n return heatedFloorArea\nend",
"def average_length(entry)\n entry.values.inject(0.0) { |sum, e| sum + e.length } / entry.size\n end",
"def size_ratio(geom)\n if geom && geom.geometry_type == RGeo::Feature::Polygon && geom.area > 0\n return size.to_f / geom.area\n else\n return 0.0\n end\n end",
"def set_FloorspaceEstimate(value)\n set_input(\"FloorspaceEstimate\", value)\n end",
"def average_width\n width_sum / widths.size.to_f\n end",
"def size\n if !location.try(:geometry_type)\n return 0.0\n else\n case location.geometry_type\n when RGeo::Feature::Polygon\n return location.area.to_f\n else\n return 0.0\n end\n end\n end",
"def size\n if location.nil?\n return 0.0\n else\n case location.geometry_type\n when RGeo::Feature::Polygon\n return location.area.to_f\n else\n return 0.0\n end\n end\n end",
"def average_line_length\n if lines.any?\n lines.inject(0) { |n, l| n += l.length } / lines.length\n else\n 0\n end\n end",
"def get_area\n\n # get the keyword for the shape of the floor\n case get_keyword_value(\"SHAPE\")\n\n # if the keyword value is \"BOX\", the width and depth values are defined\n when \"BOX\"\n return get_keyword_value(\"WIDTH\").to_f * get_keyword_value(\"DEPTH\").to_f\n\n # if the keyword value is \"POLYGON\", the get_area is defined as the area of the\n # given polygon\n when \"POLYGON\"\n return @polygon.get_area\n\n # if the keyword value of the floor is \"No-SHAPE\", the get_area is given as the\n # get_area keyword value\n when \"NO-SHAPE\"\n return get_keyword_value(\"AREA\").to_f\n else\n raise \"Error: The area could not be evaluated. Please check inputs\\n \"\n end\n end",
"def avg_offsprings\n return 0.0 if @couples.empty?\n\n (@offsprings.length / @couples.length.to_f)\n .round(Parameters::FLOAT_PRECISION)\n end",
"def level_size level\n\t\t\t@unit_size * tile_size(level)\n\t\tend",
"def normalized_size\n\t\t\ttile_size(max_level) * @unit_size\n\t\tend",
"def average_box_length(array)\n\tall_box_lengths = []\n\tfor box in array\n\t\tall_box_lengths << polychop_lentest(box['polygons'], box['bbox'])\n\tend\n\taverage(all_box_lengths)\nend",
"def average(decimal_places = nil)\n if decimal_places.nil?\n return (count / MAX)/(count % MAX).to_f\n else\n return ((count / MAX)/(count % MAX).to_f).round(decimal_places)\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
averageOccupancyRate : Decimal The number of units in a building that have been rented out as compared to the total number of units in the building | def average_occupancy_rate
self.dig_for_decimal("averageOccupancyRate")
end | [
"def avg_capacity\n @sectors.collect { |s| s.total_capacity }.sum/@sectors.length.to_f\n end",
"def average_rent\n rents = @units.map {|unit| unit.monthly_rent}\n (rents.sum.to_f / x.length.to_f)\n end",
"def calculate_released_average\n total_marks = 0\n num_released = 0\n\n grade_entry_students = self.grade_entry_students\n .where(released_to_student: true)\n grade_entry_students.each do |grade_entry_student|\n total_mark = grade_entry_student.total_grade\n\n unless total_mark.nil?\n total_marks += total_mark\n num_released += 1\n end\n end\n\n # Watch out for division by 0\n return 0 if num_released.zero?\n ((total_marks / num_released) / out_of_total) * 100\n end",
"def average_rent(units = @units)\n average_rent = 0\n units.each do |unit|\n average_rent += unit.monthly_rent.to_f\n end\n average_rent / units.length.to_f\n end",
"def average_calories\n total = 0\n self.desserts.each do |dessert|\n total + dessert.calories / dessert.ingreidents.length\n end\n total\n end",
"def average\n\t\tif 2 < course.users.length and 0 < grades.length and 0 < worth\n\t\t\taverage = (grades.sum(:grade) / grades.length);\n\t\t\taverage = (average.to_f / worth) * 100;\n\t\t\treturn average\n\t\tend\n\tend",
"def average_calories\n\n # A bakery has many desserts - use methods in Dessert class!\n desserts.inject(0) {|sum, dessert| sum + dessert.calories} / desserts.size.to_f\n\n #total_calories = ingredients.inject(0) {|sum, ingredient| sum + ingredient.calorie_count}\n #total_calories.to_f / ingredients.size\n end",
"def percent_of_house\n percent_of(house_capacity)\n end",
"def book_avg_rating\n y = 0.0\n self.rating.each do |x|\n y += x\n end\n puts (y/(self.rating.length)).round(1)\n end",
"def occupancy_rate\n self.dig_for_integer(\"occupancyRate\")\n end",
"def getAverageAwesomeness\n sum = 0\n @persons.each do |person|\n sum += person.awesomeness.to_i\n end\n return sum/@persons.length\n end",
"def withdrawal_rate\n (youngest_person_retirement_age - 15.0) / 1000.0\n end",
"def calculate_avg_earnings(bookings)\n result = 0\n if !bookings.blank?\n total = 0\n bookings.each do |booking|\n total = total + booking.amount_in_base_currency\n end\n result = (total * 1.0) / bookings.size\n end\n result\n end",
"def overall_grade_adjusted\n total = 0\n\n self.all_adjusted_scores.each do |n|\n total += n\n end\n\n unrounded = (total / Assignment.count)\n\n return unrounded.round(2)\n\n end",
"def average_tenants_per_floor\n (@tenants.to_f / @floors.to_f).round(2)\n end",
"def percent_of_house\n house_capacity.zero? ? 100 : (100.0 * total_sales.size / house_capacity).floor\n end",
"def grade_average\n @grades.inject(:+) / @grades.size\n end",
"def average_credit_score\n if tenants.length > 0\n tenants.map{ |person| person.credit_score }.reduce(0, &:+)/tenants.length\n else\n 0\n end\n end",
"def value\n (\n 0.7 * (annual_income / average_income) +\n 0.3 * (base_manpower / avearge_manpower)\n ).round(6)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
bayDepth : String The distance from the front to the back of the bay | def bay_depth
self.dig_for_string("bayDepth")
end | [
"def bush_depth\n # タイルの場合、または最前面に表示フラグが ON の場合\n if @tile_id > 0 or @always_on_top\n return 0\n end\n # return 12 if @in_swamp #> Ajout des marais\n if @jump_count == 0 and $game_map.bush?(@x, @y)\n return 12\n else\n return 0\n end\n end",
"def bit_depth\n ng_xml.css(\"fits > metadata > audio > bitDepth\").map(&:text)\n end",
"def used_depth\n self.info[\"DP4\"].split(\",\").inject {|sum,n| sum.to_f + n.to_f} rescue 0.0\n end",
"def depth\n breadcrumbs.size\n end",
"def space_depth()\n #This is a stub, used for indexing\n end",
"def bush_depth\n # return 0 tile exists and not on bottom and not bush, else 12\n return ((@jump_count == 0 && $game_map.pixel_bush?(@x, @y) &&\n @tile_id == 0 && !@always_on_top) ? 12 : 0)\n end",
"def height\n 12 * effective_octave + \"C D EF G A B\".index(letter) + effective_accidental + transposition\n end",
"def length_height_b\n point_b.distance_to_line(get_line_ac)\n end",
"def depthPercent; end",
"def length_in_bp_within_path\n return 0 if @trail.empty?\n reduce(0) do |total, onode|\n total + onode.node.length_alone\n end\n end",
"def depth_percent; end",
"def depth\n unit.depth + 1\n end",
"def depth\n chart.depth\n end",
"def test_it_reports_accurate_depth_of\n skip\n @tree.insert(61, \"Bill & Ted\")\n @tree.insert(16, \"Johnny English\")\n @tree.insert(92, \"Sharknado 3\")\n @tree.insert(50, \"Hannibal Buress: Animal Furnace\")\n\n assert_equal 1, @tree.depth_of(92)\n assert_equal 2, @tree.depth_of(50)\n end",
"def depth\n if (@onNode) then\n return @node.valueDepth\n else\n return @node.parent.valueDepth + @incomingEdgeOffset - @node.incomingEdgeStartOffset\n end\n end",
"def distance_given_bays(string_of_bays)\n bays = string_of_bays.split(\", \")\n numbers = []\n for x in bays\n numbers << index_for_bay(x)\n end\n distance = numbers.max - numbers.min\n item_list = \"#{list_of_bays(string_of_bays)} are #{distance} bays apart\"\n return item_list\nend",
"def height\n if @alive\n @height.round(1)\n else\n 'A dead tree is not very tall. :('\n end\n end",
"def depth\n @traversal_position.depth\n end",
"def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
buildingClass : String The Subjective quality rating of buildings which indicates the competitive ability of each building to attract similar types of tenants | def building_class
self.dig_for_string("buildingClass")
end | [
"def set_bldg_and_system_type_for_building_and_section\n @building_sections.each(&:set_bldg_and_system_type)\n\n set_bldg_and_system_type(xget_text('OccupancyClassification'), @total_floor_area, num_stories, true)\n end",
"def get_space_types_from_building_type(building_type,template,whole_building = true)\n\n hash = {}\n\n # todo - Confirm that these work for all standards\n\n if building_type == 'SecondarySchool'\n hash['Auditorium'] = {:ratio => 0.0504, :space_type_gen => true, :default => false}\n hash['Cafeteria'] = {:ratio => 0.0319, :space_type_gen => true, :default => false}\n hash['Classroom'] = {:ratio => 0.3528, :space_type_gen => true, :default => true}\n hash['Corridor'] = {:ratio => 0.2144, :space_type_gen => true, :default => false}\n hash['Gym'] = {:ratio => 0.1646, :space_type_gen => true, :default => false}\n hash['Kitchen'] = {:ratio => 0.0110, :space_type_gen => true, :default => false}\n hash['Library'] = {:ratio => 0.0429, :space_type_gen => true, :default => false} # not in prototype\n hash['Lobby'] = {:ratio => 0.0214, :space_type_gen => true, :default => false}\n hash['Mechanical'] = {:ratio => 0.0349, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0543, :space_type_gen => true, :default => false}\n hash['Restroom'] = {:ratio => 0.0214, :space_type_gen => true, :default => false}\n elsif building_type == 'PrimarySchool'\n hash['Cafeteria'] = {:ratio => 0.0458, :space_type_gen => true, :default => false}\n hash['Classroom'] = {:ratio => 0.5610, :space_type_gen => true, :default => true}\n hash['Corridor'] = {:ratio => 0.1633, :space_type_gen => true, :default => false}\n hash['Gym'] = {:ratio => 0.0520, :space_type_gen => true, :default => false}\n hash['Kitchen'] = {:ratio => 0.0244, :space_type_gen => true, :default => false}\n # todo - confirm if Library is 0.0 for all templates\n hash['Library'] = {:ratio => 0.0, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.0249, :space_type_gen => true, :default => false}\n hash['Mechanical'] = {:ratio => 0.0367, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0642, :space_type_gen => true, :default => false}\n hash['Restroom'] = {:ratio => 0.0277, :space_type_gen => true, :default => false}\n elsif building_type == 'SmallOffice'\n # todo - populate Small, Medium, and Large office for whole_building false\n if whole_building\n hash['WholeBuilding - Sm Office'] = {:ratio => 1.0, :space_type_gen => true, :default => true}\n else\n hash['BreakRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['ClosedOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Conference'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Corridor'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Elec/MechRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['IT_Room'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['OpenOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => true}\n hash['PrintRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Restroom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Stair'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Storage'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Vending'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['WholeBuilding - Sm Office'] = {:ratio => 0.0, :space_type_gen => true, :default => false}\n end\n elsif building_type == 'MediumOffice'\n if whole_building\n hash['WholeBuilding - Md Office'] = {:ratio => 1.0, :space_type_gen => true, :default => true}\n else\n hash['BreakRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['ClosedOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Conference'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Corridor'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Elec/MechRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['IT_Room'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['OpenOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => true}\n hash['PrintRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Restroom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Stair'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Storage'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Vending'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['WholeBuilding - Md Office'] = {:ratio => 0.0, :space_type_gen => true, :default => false}\n end\n elsif building_type == 'LargeOffice'\n if ['DOE Ref Pre-1980','DOE Ref 1980-2004'].include?(template)\n if whole_building\n hash['WholeBuilding - Lg Office'] = {:ratio => 1.0, :space_type_gen => true, :default => true}\n else\n hash['BreakRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['ClosedOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Conference'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Corridor'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Elec/MechRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['IT_Room'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['OpenOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => true}\n hash['PrintRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Restroom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Stair'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Storage'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Vending'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['WholeBuilding - Lg Office'] = {:ratio => 0.0, :space_type_gen => true, :default => false}\n end\n else\n if whole_building\n hash['WholeBuilding - Lg Office'] = {:ratio => 0.9737, :space_type_gen => true, :default => true}\n hash['OfficeLarge Data Center'] = {:ratio => 0.0094, :space_type_gen => true, :default => false}\n hash['OfficeLarge Main Data Center'] = {:ratio => 0.0169, :space_type_gen => true, :default => false}\n else\n hash['BreakRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['ClosedOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Conference'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Corridor'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Elec/MechRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['IT_Room'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['OpenOffice'] = {:ratio => 0.99, :space_type_gen => true, :default => true}\n hash['PrintRoom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Restroom'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Stair'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Storage'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Vending'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['WholeBuilding - Lg Office'] = {:ratio => 0.0, :space_type_gen => true, :default => false}\n hash['OfficeLarge Data Center'] = {:ratio => 0.0, :space_type_gen => true, :default => false}\n hash['OfficeLarge Main Data Center'] = {:ratio => 0.0, :space_type_gen => true, :default => false}\n end\n end\n elsif building_type == 'SmallHotel'\n if ['DOE Ref Pre-1980','DOE Ref 1980-2004'].include?(template)\n hash['Corridor'] = {:ratio => 0.1313, :space_type_gen => true, :default => false}\n hash['Elec/MechRoom'] = {:ratio => 0.0038, :space_type_gen => true, :default => false}\n hash['ElevatorCore'] = {:ratio => 0.0113, :space_type_gen => true, :default => false}\n hash['Exercise'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['GuestLounge'] = {:ratio => 0.0406, :space_type_gen => true, :default => false}\n hash['GuestRoom'] = {:ratio => 0.6313, :space_type_gen => true, :default => true}\n hash['Laundry'] = {:ratio => 0.0244, :space_type_gen => true, :default => false}\n hash['Mechanical'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['Meeting'] = {:ratio => 0.0200, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0325, :space_type_gen => true, :default => false}\n hash['PublicRestroom'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['StaffLounge'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['Stair'] = {:ratio => 0.0400, :space_type_gen => true, :default => false}\n hash['Storage'] = {:ratio => 0.0325, :space_type_gen => true, :default => false}\n else\n hash['Corridor'] = {:ratio => 0.1313, :space_type_gen => true, :default => false}\n hash['Elec/MechRoom'] = {:ratio => 0.0038, :space_type_gen => true, :default => false}\n hash['ElevatorCore'] = {:ratio => 0.0113, :space_type_gen => true, :default => false}\n hash['Exercise'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['GuestLounge'] = {:ratio => 0.0406, :space_type_gen => true, :default => false}\n hash['GuestRoom123Occ'] = {:ratio => 0.4081, :space_type_gen => true, :default => true}\n hash['GuestRoom123Vac'] = {:ratio => 0.2231, :space_type_gen => true, :default => false}\n hash['Laundry'] = {:ratio => 0.0244, :space_type_gen => true, :default => false}\n hash['Mechanical'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['Meeting'] = {:ratio => 0.0200, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0325, :space_type_gen => true, :default => false}\n hash['PublicRestroom'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['StaffLounge'] = {:ratio => 0.0081, :space_type_gen => true, :default => false}\n hash['Stair'] = {:ratio => 0.0400, :space_type_gen => true, :default => false}\n hash['Storage'] = {:ratio => 0.0325, :space_type_gen => true, :default => false}\n end\n elsif building_type == 'LargeHotel'\n hash['Banquet'] = {:ratio => 0.0585, :space_type_gen => true, :default => false}\n hash['Basement'] = {:ratio => 0.1744, :space_type_gen => false, :default => false}\n hash['Cafe'] = {:ratio => 0.0166, :space_type_gen => true, :default => false}\n hash['Corridor'] = {:ratio => 0.1736, :space_type_gen => true, :default => false}\n hash['GuestRoom'] = {:ratio => 0.4099, :space_type_gen => true, :default => true}\n hash['Kitchen'] = {:ratio => 0.0091, :space_type_gen => true, :default => false}\n hash['Laundry'] = {:ratio => 0.0069, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.1153, :space_type_gen => true, :default => false}\n hash['Mechanical'] = {:ratio => 0.0145, :space_type_gen => true, :default => false}\n hash['Retail'] = {:ratio => 0.0128, :space_type_gen => true, :default => false}\n hash['Storage'] = {:ratio => 0.0084, :space_type_gen => true, :default => false}\n elsif building_type == 'Warehouse'\n hash['Bulk'] = {:ratio => 0.6628, :space_type_gen => true, :default => true}\n hash['Fine'] = {:ratio => 0.2882, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0490, :space_type_gen => true, :default => false}\n elsif building_type == 'RetailStandalone'\n hash['Back_Space'] = {:ratio => 0.1656, :space_type_gen => true, :default => false}\n hash['Entry'] = {:ratio => 0.0052, :space_type_gen => true, :default => false}\n hash['Point_of_Sale'] = {:ratio => 0.0657, :space_type_gen => true, :default => false}\n hash['Retail'] = {:ratio => 0.7635, :space_type_gen => true, :default => true}\n elsif building_type == 'RetailStripmall'\n hash['Strip mall - type 1'] = {:ratio => 0.25, :space_type_gen => true, :default => false}\n hash['Strip mall - type 2'] = {:ratio => 0.25, :space_type_gen => true, :default => false}\n hash['Strip mall - type 3'] = {:ratio => 0.50, :space_type_gen => true, :default => true}\n elsif building_type == 'QuickServiceRestaurant'\n hash['Dining'] = {:ratio => 0.5, :space_type_gen => true, :default => true}\n hash['Kitchen'] = {:ratio => 0.5, :space_type_gen => true, :default => false}\n elsif building_type == 'FullServiceRestaurant'\n hash['Dining'] = {:ratio => 0.7272, :space_type_gen => true, :default => true}\n hash['Kitchen'] = {:ratio => 0.2728, :space_type_gen => true, :default => false}\n elsif building_type == 'MidriseApartment'\n hash['Apartment'] = {:ratio => 0.8727, :space_type_gen => true, :default => true}\n hash['Corridor'] = {:ratio => 0.0991, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0282, :space_type_gen => true, :default => false}\n elsif building_type == 'HighriseApartment'\n hash['Apartment'] = {:ratio => 0.8896, :space_type_gen => true, :default => true}\n hash['Corridor'] = {:ratio => 0.0991, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0113, :space_type_gen => true, :default => false}\n elsif building_type == 'Hospital'\n hash['Basement'] = {:ratio => 0.1667, :space_type_gen => false, :default => false}\n hash['Corridor'] = {:ratio => 0.1741, :space_type_gen => true, :default => false}\n hash['Dining'] = {:ratio => 0.0311, :space_type_gen => true, :default => false}\n hash['ER_Exam'] = {:ratio => 0.0099, :space_type_gen => true, :default => false}\n hash['ER_NurseStn'] = {:ratio => 0.0551, :space_type_gen => true, :default => false}\n hash['ER_Trauma'] = {:ratio => 0.0025, :space_type_gen => true, :default => false}\n hash['ER_Triage'] = {:ratio => 0.0050, :space_type_gen => true, :default => false}\n hash['ICU_NurseStn'] = {:ratio => 0.0298, :space_type_gen => true, :default => false}\n hash['ICE_Open'] = {:ratio => 0.0275, :space_type_gen => true, :default => false}\n hash['ICU_PatRm'] = {:ratio => 0.0115, :space_type_gen => true, :default => false}\n hash['Kitchen'] = {:ratio => 0.0414, :space_type_gen => true, :default => false}\n hash['Lab'] = {:ratio => 0.0236, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.0657, :space_type_gen => true, :default => false}\n hash['NurseStn'] = {:ratio => 0.1723, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.0286, :space_type_gen => true, :default => false}\n hash['OR'] = {:ratio => 0.0273, :space_type_gen => true, :default => false}\n hash['PatCorridor'] = {:ratio => 0.0, :space_type_gen => true, :default => false} # not in prototype\n hash['PatRoom'] = {:ratio => 0.0845, :space_type_gen => true, :default => true}\n hash['PhysTherapy'] = {:ratio => 0.0217, :space_type_gen => true, :default => false}\n hash['Radiology'] = {:ratio => 0.0217, :space_type_gen => true, :default => false}\n elsif building_type == 'Outpatient'\n hash['Anesthesia'] = {:ratio => 0.0026, :space_type_gen => true, :default => false}\n hash['BioHazard'] = {:ratio => 0.0014, :space_type_gen => true, :default => false}\n hash['Cafe'] = {:ratio => 0.0103, :space_type_gen => true, :default => false}\n hash['CleanWork'] = {:ratio => 0.0071, :space_type_gen => true, :default => false}\n hash['Conference'] = {:ratio => 0.0082, :space_type_gen => true, :default => false}\n hash['DresingRoom'] = {:ratio => 0.0021, :space_type_gen => true, :default => false}\n hash['Elec/MechRoom'] = {:ratio => 0.0109, :space_type_gen => true, :default => false}\n hash['ElevatorPumpRoom'] = {:ratio => 0.0022, :space_type_gen => true, :default => false}\n hash['Exam'] = {:ratio => 0.1029, :space_type_gen => true, :default => true}\n hash['Hall'] = {:ratio => 0.1924, :space_type_gen => true, :default => false}\n hash['IT_Room'] = {:ratio => 0.0027, :space_type_gen => true, :default => false}\n hash['Janitor'] = {:ratio => 0.0672, :space_type_gen => true, :default => false}\n hash['Lobby'] = {:ratio => 0.0152, :space_type_gen => true, :default => false}\n hash['LockerRoom'] = {:ratio => 0.0190, :space_type_gen => true, :default => false}\n hash['Lounge'] = {:ratio => 0.0293, :space_type_gen => true, :default => false}\n hash['MedGas'] = {:ratio => 0.0014, :space_type_gen => true, :default => false}\n hash['MRI'] = {:ratio => 0.0107, :space_type_gen => true, :default => false}\n hash['MRI_Control'] = {:ratio => 0.0041, :space_type_gen => true, :default => false}\n hash['NurseStation'] = {:ratio => 0.0189, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.1828, :space_type_gen => true, :default => false}\n hash['OR'] = {:ratio => 0.0346, :space_type_gen => true, :default => false}\n hash['PACU'] = {:ratio => 0.0232, :space_type_gen => true, :default => false}\n hash['PhysicalTherapy'] = {:ratio => 0.0462, :space_type_gen => true, :default => false}\n hash['PreOp'] = {:ratio => 0.0129, :space_type_gen => true, :default => false}\n hash['ProcedureRoom'] = {:ratio => 0.0070, :space_type_gen => true, :default => false}\n hash['Reception'] = {:ratio => 0.0365, :space_type_gen => true, :default => false}\n hash['Soil Work'] = {:ratio => 0.0088, :space_type_gen => true, :default => false}\n hash['Stair'] = {:ratio => 0.0146, :space_type_gen => true, :default => false}\n hash['Toilet'] = {:ratio => 0.0193, :space_type_gen => true, :default => false}\n hash['Undeveloped'] = {:ratio => 0.0835, :space_type_gen => false, :default => false}\n hash['Xray'] = {:ratio => 0.0220, :space_type_gen => true, :default => false}\n elsif building_type == 'SuperMarket'\n # todo - populate ratios for SuperMarket\n hash['Deli/Bakery'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['DryStorage'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Office'] = {:ratio => 0.99, :space_type_gen => true, :default => false}\n hash['Sales/Produce'] = {:ratio => 0.99, :space_type_gen => true, :default => true}\n else\n return false\n end\n\n return hash\n\n end",
"def building_form_defaults(building_type)\n\n hash = {}\n\n # calculate aspect ratios not represented on Table 4.2\n primary_aspet_ratio = calc_aspect_ratio(73958.0,2060.0)\n secondary_aspet_ratio = calc_aspect_ratio(128112.0,2447.0)\n outpatient_aspet_ratio = calc_aspect_ratio(14782.0,588.0)\n supermarket_a = 45001.0\n supermarket_p = 866.0\n supermarket_wwr = 1880.0/(supermarket_p * 20.0)\n supermarket_aspet_ratio = calc_aspect_ratio(supermarket_a,supermarket_p)\n\n hash['SmallOffice'] = {:aspect_ratio => 1.5, :wwr => 0.15, :typical_story => 10.0}\n hash['MediumOffice'] = {:aspect_ratio => 1.5, :wwr => 0.33, :typical_story => 13.0}\n hash['LargeOffice'] = {:aspect_ratio => 1.5, :wwr => 0.15, :typical_story => 13.0}\n hash['RetailStandalone'] = {:aspect_ratio => 1.28, :wwr => 0.07, :typical_story => 20.0}\n hash['RetailStripmall'] = {:aspect_ratio => 4.0, :wwr => 0.11, :typical_story => 17.0}\n hash['PrimarySchool'] = {:aspect_ratio => primary_aspet_ratio.round(1), :wwr => 0.35, :typical_story => 13.0}\n hash['SecondarySchool'] = {:aspect_ratio => secondary_aspet_ratio.round(1), :wwr => 0.33, :typical_story => 13.0}\n hash['Outpatient'] = {:aspect_ratio => outpatient_aspet_ratio.round(1), :wwr => 0.20, :typical_story => 10.0}\n hash['Hospital'] = {:aspect_ratio => 1.33, :wwr => 0.16, :typical_story => 14.0}\n hash['SmallHotel'] = {:aspect_ratio => 3.0, :wwr => 0.11, :typical_story => 9.0,:first_story => 11.0}\n hash['LargeHotel'] = {:aspect_ratio => 5.1, :wwr => 0.27, :typical_story => 10.0, :first_story => 13.0}\n # wwr for Warehouse is just for Office space type, all others is building wide\n hash['Warehouse'] = {:aspect_ratio => 2.2, :wwr => 0.71, :typical_story => 28.0}\n hash['FullServiceRestaurant'] = {:aspect_ratio => 1.0, :wwr => 0.18, :typical_story => 10.0}\n hash['MidriseApartment'] = {:aspect_ratio => 2.75, :wwr => 0.15, :typical_story => 10.0}\n hash['HighriseApartment'] = {:aspect_ratio => 2.75, :wwr => 0.15, :typical_story => 10.0}\n # SuperMarket inputs come from prototype model\n hash['SuperMarket'] = {:aspect_ratio => supermarket_aspet_ratio.round(1), :wwr => supermarket_wwr.round(2), :typical_story => 20.0}\n\n return hash[building_type]\n\n end",
"def map_to_cctray_activity(builder_state)\n case builder_state.to_s\n when 'checking_for_modifications' then 'CheckingModifications' \n when 'building' then 'Building'\n when 'sleeping', 'builder_down' then 'Sleeping'\n else 'Unknown'\n end\n end",
"def building=(value)\n @building = value\n end",
"def feature_type\n 'Building'\n end",
"def set_bldg_and_system_type\n super(xget_text('OccupancyClassification'), @total_floor_area, @number_floors, false)\n end",
"def bar_from_building_type_ratios(model, runner, user_arguments)\n\n # prep arguments\n args = bar_arg_check_setup(model,runner,user_arguments)\n if !args then return false end\n\n # check that sum of fractions for b,c, and d is less than 1.0 (so something is left for primary building type)\n bldg_type_a_fract_bldg_area = 1.0 - args['bldg_type_b_fract_bldg_area'] - args['bldg_type_c_fract_bldg_area'] - args['bldg_type_d_fract_bldg_area']\n if bldg_type_a_fract_bldg_area <= 0.0\n runner.registerError('Primary Building Type fraction of floor area must be greater than 0. Please lower one or more of the fractions for Building Type B-D.')\n return false\n end\n\n # Make the standard applier\n standard = Standard.build((args['template']).to_s)\n\n # report initial condition of model\n runner.registerInitialCondition(\"The building started with #{model.getSpaces.size} spaces.\")\n\n # determine of ns_ew needs to be mirrored\n mirror_ns_ew = false\n rotation = model.getBuilding.northAxis\n if rotation > 45.0 && rotation < 135.0\n mirror_ns_ew = true\n elsif rotation > 45.0 && rotation < 135.0\n mirror_ns_ew = true\n end\n\n # remove non-resource objects not removed by removing the building\n remove_non_resource_objects(runner, model)\n\n # rename building to infer template in downstream measure\n name_array = [args['template'], args['bldg_type_a']]\n if args['bldg_type_b_fract_bldg_area'] > 0 then name_array << args['bldg_type_b'] end\n if args['bldg_type_c_fract_bldg_area'] > 0 then name_array << args['bldg_type_c'] end\n if args['bldg_type_d_fract_bldg_area'] > 0 then name_array << args['bldg_type_d'] end\n model.getBuilding.setName(name_array.join('|').to_s)\n\n # hash to whole building type data\n building_type_hash = {}\n\n # gather data for bldg_type_a\n building_type_hash[args['bldg_type_a']] = {}\n building_type_hash[args['bldg_type_a']][:frac_bldg_area] = bldg_type_a_fract_bldg_area\n # building_type_hash[args['bldg_type_a']][:num_units] = args['bldg_type_a_num_units']\n building_type_hash[args['bldg_type_a']][:space_types] = get_space_types_from_building_type(args['bldg_type_a'], args['template'], true)\n\n # gather data for bldg_type_b\n if args['bldg_type_b_fract_bldg_area'] > 0\n building_type_hash[args['bldg_type_b']] = {}\n building_type_hash[args['bldg_type_b']][:frac_bldg_area] = args['bldg_type_b_fract_bldg_area']\n # building_type_hash[args['bldg_type_b']][:num_units] = args['bldg_type_b_num_units']\n building_type_hash[args['bldg_type_b']][:space_types] = get_space_types_from_building_type(args['bldg_type_b'], args['template'], true)\n end\n\n # gather data for bldg_type_c\n if args['bldg_type_c_fract_bldg_area'] > 0\n building_type_hash[args['bldg_type_c']] = {}\n building_type_hash[args['bldg_type_c']][:frac_bldg_area] = args['bldg_type_c_fract_bldg_area']\n # building_type_hash[args['bldg_type_c']][:num_units] = args['bldg_type_c_num_units']\n building_type_hash[args['bldg_type_c']][:space_types] = get_space_types_from_building_type(args['bldg_type_c'], args['template'], true)\n end\n\n # gather data for bldg_type_d\n if args['bldg_type_d_fract_bldg_area'] > 0\n building_type_hash[args['bldg_type_d']] = {}\n building_type_hash[args['bldg_type_d']][:frac_bldg_area] = args['bldg_type_d_fract_bldg_area']\n # building_type_hash[args['bldg_type_d']][:num_units] = args['bldg_type_d_num_units']\n building_type_hash[args['bldg_type_d']][:space_types] = get_space_types_from_building_type(args['bldg_type_d'], args['template'], true)\n end\n\n # call bar_from_building_space_type_ratios to generate bar\n bar_from_space_type_ratios(model, runner, user_arguments, args, building_type_hash)\n\n return true\n\n end",
"def consolidate_classes(original_line, list_of_classes)\n record = {\n :original_ocr => original_line,\n :attributes_parsed => {\n :subject =>\n [\n #{:value => \"Curran Sarah\", :type => \"primary\", :occupation => \"widowed\"},\n #{:value => \"Richard\", :type => \"widower of primary\"}\n ],\n :location =>\n [\n #{:value => \"7 Sixth\", :position => \"rear\", :type => \"home\"}\n ]\n }\n }\n\n list_of_classes.each_with_index do |classed_token, index|\n parsed_class = classed_token[1][0]\n value = classed_token[0]\n if index == 0 && parsed_class == :name_component\n record[:attributes_parsed][:subject] << {:value => value, :type => 'primary'}\n end\n if index > 0\n case parsed_class\n when :job_component\n unless record[:attributes_parsed][:subject].count < 1\n record[:attributes_parsed][:subject][0][:occupation] = value\n end\n when :predicate\n case value\n when \"wid\"\n unless record[:attributes_parsed][:subject].count < 1\n record[:attributes_parsed][:subject][0][:occupation] = 'widow'\n end\n deceased_name = look_for_name_of_deceased(list_of_classes,index)\n unless deceased_name.nil?\n record[:attributes_parsed][:subject] << {:value => deceased_name, :type => 'deceased spouse of primary'}\n end\n #attach_to_next(list_of_classes, index, :name_component, [{:type => 'deceased spouse of primary'}])\n when \"h\"\n attach_to_next(list_of_classes, index, :address_component, [{:type => 'home'}])\n when \"r\"\n attach_to_next(list_of_classes, index, :address_component, [{:position => 'rear'}])\n else\n end\n ## inner case\n when :address_component\n loc = {:value => value}\n classed_token[2..-1].each do |xtra_attr| ## add in any additional attributes from predicates\n xtra_attr.each do |k, v|\n loc[k] = v\n end\n end\n unless merge_if_directly_subsequent_is_alike(list_of_classes, index, classed_token)\n record[:attributes_parsed][:location] << loc\n end\n else\n end\n end ## indices after 0\n end ## loop of classes\n\n return record\nend",
"def classrating\r\n classtype = self.name\r\n case \r\n when classtype ==\"Document\" then\r\n return DocumentRating.new\r\n when classtype ==\"Question\" then\r\n return QuestionRating.new\r\n\t when classtype ==\"Event\" then\r\n return EventRating.new\r\n when classtype ==\"Answer\" then\r\n return AnswerRating.new\r\n when classtype == \"CommentDocument\" then\r\n return CommentDocumentRating.new\r\n\t when classtype == \"CommentEvent\" then\r\n return CommentEventRating.new\r\n end\r\n end",
"def add_constructions(building_type, building_vintage, climate_zone)\n\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started applying constructions')\n is_residential = \"No\" #default is nonresidential for building level\n\n # Assign construction to adiabatic construction\n # Assign a material to all internal mass objects\n cp02_carpet_pad = OpenStudio::Model::MasslessOpaqueMaterial.new(self)\n cp02_carpet_pad.setName('CP02 CARPET PAD')\n cp02_carpet_pad.setRoughness(\"VeryRough\")\n cp02_carpet_pad.setThermalResistance(0.21648)\n cp02_carpet_pad.setThermalAbsorptance(0.9)\n cp02_carpet_pad.setSolarAbsorptance(0.7)\n cp02_carpet_pad.setVisibleAbsorptance(0.8)\n\n normalweight_concrete_floor = OpenStudio::Model::StandardOpaqueMaterial.new(self)\n normalweight_concrete_floor.setName('100mm Normalweight concrete floor')\n normalweight_concrete_floor.setRoughness('MediumSmooth')\n normalweight_concrete_floor.setThickness(0.1016)\n normalweight_concrete_floor.setConductivity(2.31)\n normalweight_concrete_floor.setDensity(2322)\n normalweight_concrete_floor.setSpecificHeat(832)\n\n nonres_floor_insulation = OpenStudio::Model::MasslessOpaqueMaterial.new(self)\n nonres_floor_insulation.setName('Nonres_Floor_Insulation')\n nonres_floor_insulation.setRoughness(\"MediumSmooth\")\n nonres_floor_insulation.setThermalResistance(2.88291975297193)\n nonres_floor_insulation.setThermalAbsorptance(0.9)\n nonres_floor_insulation.setSolarAbsorptance(0.7)\n nonres_floor_insulation.setVisibleAbsorptance(0.7)\n\n floor_adiabatic_construction = OpenStudio::Model::Construction.new(self)\n floor_adiabatic_construction.setName('Floor Adiabatic construction')\n floor_layers = OpenStudio::Model::MaterialVector.new\n floor_layers << cp02_carpet_pad\n floor_layers << normalweight_concrete_floor\n floor_layers << nonres_floor_insulation\n floor_adiabatic_construction.setLayers(floor_layers)\n\n g01_13mm_gypsum_board = OpenStudio::Model::StandardOpaqueMaterial.new(self)\n g01_13mm_gypsum_board.setName('G01 13mm gypsum board')\n g01_13mm_gypsum_board.setRoughness('Smooth')\n g01_13mm_gypsum_board.setThickness(0.0127)\n g01_13mm_gypsum_board.setConductivity(0.1600)\n g01_13mm_gypsum_board.setDensity(800)\n g01_13mm_gypsum_board.setSpecificHeat(1090)\n g01_13mm_gypsum_board.setThermalAbsorptance(0.9)\n g01_13mm_gypsum_board.setSolarAbsorptance(0.7)\n g01_13mm_gypsum_board.setVisibleAbsorptance(0.5)\n\n wall_adiabatic_construction = OpenStudio::Model::Construction.new(self)\n wall_adiabatic_construction.setName('Wall Adiabatic construction')\n wall_layers = OpenStudio::Model::MaterialVector.new\n wall_layers << g01_13mm_gypsum_board\n wall_layers << g01_13mm_gypsum_board\n wall_adiabatic_construction.setLayers(wall_layers)\n\n m10_200mm_concrete_block_basement_wall= OpenStudio::Model::StandardOpaqueMaterial.new(self)\n m10_200mm_concrete_block_basement_wall.setName('M10 200mm concrete block basement wall')\n m10_200mm_concrete_block_basement_wall.setRoughness('MediumRough')\n m10_200mm_concrete_block_basement_wall.setThickness(0.2032)\n m10_200mm_concrete_block_basement_wall.setConductivity(1.326)\n m10_200mm_concrete_block_basement_wall.setDensity(1842)\n m10_200mm_concrete_block_basement_wall.setSpecificHeat(912)\n\n basement_wall_construction = OpenStudio::Model::Construction.new(self)\n basement_wall_construction.setName('Basement Wall construction')\n basement_wall_layers = OpenStudio::Model::MaterialVector.new\n basement_wall_layers << m10_200mm_concrete_block_basement_wall\n basement_wall_construction.setLayers(basement_wall_layers)\n\n basement_floor_construction = OpenStudio::Model::Construction.new(self)\n basement_floor_construction.setName('Basement Floor construction')\n basement_floor_layers = OpenStudio::Model::MaterialVector.new\n basement_floor_layers << m10_200mm_concrete_block_basement_wall\n basement_floor_layers << cp02_carpet_pad\n basement_floor_construction.setLayers(basement_floor_layers)\n\n self.getSurfaces.each do |surface|\n if surface.outsideBoundaryCondition.to_s == \"Adiabatic\"\n if surface.surfaceType.to_s == \"Wall\"\n surface.setConstruction(wall_adiabatic_construction)\n else\n surface.setConstruction(floor_adiabatic_construction)\n end\n elsif surface.outsideBoundaryCondition.to_s == \"OtherSideCoefficients\"\n # Ground\n if surface.surfaceType.to_s == \"Wall\"\n surface.setOutsideBoundaryCondition(\"Ground\")\n surface.setConstruction(basement_wall_construction)\n else\n surface.setOutsideBoundaryCondition(\"Ground\")\n surface.setConstruction(basement_floor_construction)\n end\n end\n end\n\n # Make the default construction set for the building\n bldg_def_const_set = self.add_construction_set(building_vintage, climate_zone, building_type, nil, is_residential)\n\n if bldg_def_const_set.is_initialized\n self.getBuilding.setDefaultConstructionSet(bldg_def_const_set.get)\n else\n OpenStudio::logFree(OpenStudio::Error, 'openstudio.model.Model', 'Could not create default construction set for the building.')\n return false\n end\n \n # Make a construction set for each space type, if one is specified\n self.getSpaceTypes.each do |space_type|\n \n # Get the standards building type\n stds_building_type = nil\n if space_type.standardsBuildingType.is_initialized\n stds_building_type = space_type.standardsBuildingType.get\n else\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', \"Space type called '#{space_type.name}' has no standards building type.\")\n end\n \n # Get the standards space type\n stds_spc_type = nil\n if space_type.standardsSpaceType.is_initialized\n stds_spc_type = space_type.standardsSpaceType.get\n else\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', \"Space type called '#{space_type.name}' has no standards space type.\")\n end \n \n # If the standards space type is Attic,\n # the building type should be blank.\n if stds_spc_type == 'Attic'\n stds_building_type = ''\n end\n\n # Attempt to make a construction set for this space type\n # and assign it if it can be created.\n spc_type_const_set = self.add_construction_set(building_vintage, climate_zone, stds_building_type, stds_spc_type, is_residential)\n if spc_type_const_set.is_initialized\n space_type.setDefaultConstructionSet(spc_type_const_set.get)\n end\n \n end\n \n # Add construction from story level, especially for the case when there are residential and nonresidential construction in the same building\n if building_type == 'SmallHotel'\n self.getBuildingStorys.each do |story|\n next if story.name.get == 'AtticStory'\n puts \"story = #{story.name}\"\n is_residential = \"No\" #default for building story level\n exterior_spaces_area = 0\n story_exterior_residential_area = 0\n \n # calculate the propotion of residential area in exterior spaces, see if this story is residential or not\n story::spaces.each do |space|\n next if space.exteriorWallArea == 0\n space_type = space.spaceType.get\n if space_type.standardsSpaceType.is_initialized\n space_type_name = space_type.standardsSpaceType.get\n end\n data = self.find_object(self.standards['space_types'], {'template'=>building_vintage, 'building_type'=>building_type, 'space_type'=>space_type_name})\n exterior_spaces_area += space.floorArea\n story_exterior_residential_area += space.floorArea if data['is_residential'] == \"Yes\" # \"Yes\" is residential, \"No\" or nil is nonresidential\n end\n is_residential = \"Yes\" if story_exterior_residential_area/exterior_spaces_area >= 0.5\n next if is_residential == \"No\"\n \n # if the story is identified as residential, assign residential construction set to the spaces on this story.\n building_story_const_set = self.add_construction_set(building_vintage, climate_zone, building_type, nil, is_residential)\n if building_story_const_set.is_initialized\n story::spaces.each do |space|\n space.setDefaultConstructionSet(building_story_const_set.get)\n end\n end\n end\n # Standars: For whole buildings or floors where 50% or more of the spaces adjacent to exterior walls are used primarily for living and sleeping quarters\n \n end \n \n # Make skylights have the same construction as fixed windows\n # sub_surface = self.getBuilding.defaultConstructionSet.get.defaultExteriorSubSurfaceConstructions.get\n # window_construction = sub_surface.fixedWindowConstruction.get\n # sub_surface.setSkylightConstruction(window_construction)\n\n\n # Assign a material to all internal mass objects\n material = OpenStudio::Model::StandardOpaqueMaterial.new(self)\n material.setName('Std Wood 6inch')\n material.setRoughness('MediumSmooth')\n material.setThickness(0.15)\n material.setConductivity(0.12)\n material.setDensity(540)\n material.setSpecificHeat(1210)\n material.setThermalAbsorptance(0.9)\n material.setSolarAbsorptance(0.7)\n material.setVisibleAbsorptance(0.7)\n construction = OpenStudio::Model::Construction.new(self)\n construction.setName('InteriorFurnishings')\n layers = OpenStudio::Model::MaterialVector.new\n layers << material\n construction.setLayers(layers)\n\n # Assign the internal mass construction to existing internal mass objects\n self.getSpaces.each do |space|\n internal_masses = space.internalMass\n internal_masses.each do |internal_mass|\n internal_mass.internalMassDefinition.setConstruction(construction)\n end\n end\n\n # get all the space types that are conditioned\n conditioned_space_names = find_conditioned_space_names(building_type, building_vintage, climate_zone)\n \n # add internal mass\n unless (building_type == 'SmallHotel') &&\n (building_vintage == '90.1-2004' or building_vintage == '90.1-2007' or building_vintage == '90.1-2010' or building_vintage == '90.1-2013')\n internal_mass_def = OpenStudio::Model::InternalMassDefinition.new(self)\n internal_mass_def.setSurfaceAreaperSpaceFloorArea(2.0)\n internal_mass_def.setConstruction(construction)\n conditioned_space_names.each do |conditioned_space_name|\n space = self.getSpaceByName(conditioned_space_name)\n if space.is_initialized\n space = space.get\n internal_mass = OpenStudio::Model::InternalMass.new(internal_mass_def)\n internal_mass.setName(\"#{space.name} Mass\") \n internal_mass.setSpace(space)\n end\n end\n end\n\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Finished applying constructions')\n \n return true\n\n end",
"def defensive_building\n fetch('games.clash_of_clans.defensive_buildings')\n end",
"def process_bldg_and_system_type(building_and_system_types, occupancy_classification, total_floor_area, total_number_floors)\n OpenStudio.logFree(OpenStudio::Info, 'BuildingSync.SpatialElement.process_bldg_and_system_type', \"Element ID: #{xget_id} started with occupancy_classification #{occupancy_classification} and total floor area: #{total_floor_area}\")\n puts \"Element ID: #{xget_id} started with occupancy_classification #{occupancy_classification} and total floor area: #{total_floor_area}\"\n min_floor_area_correct = false\n max_floor_area_correct = false\n building_and_system_types[:\"#{occupancy_classification}\"]&.each do |occ_type|\n if !occ_type[:standards_building_type].nil?\n if occ_type[:min_floor_area] || occ_type[:max_floor_area]\n if occ_type[:min_floor_area] && occ_type[:min_floor_area].to_f < total_floor_area\n min_floor_area_correct = true\n end\n if occ_type[:max_floor_area] && occ_type[:max_floor_area].to_f > total_floor_area\n max_floor_area_correct = true\n end\n if (min_floor_area_correct && max_floor_area_correct) || (!occ_type[:min_floor_area] && max_floor_area_correct) || (min_floor_area_correct && !occ_type[:max_floor_area])\n puts \"selected the following standards_building_type: #{occ_type[:standards_building_type]}\"\n return sets_occupancy_bldg_system_types(occ_type)\n end\n elsif occ_type[:min_number_floors] || occ_type[:max_number_floors]\n if occ_type[:min_number_floors] && occ_type[:min_number_floors].to_i <= total_number_floors\n puts \"selected the following standards_building_type: #{occ_type[:standards_building_type]}\"\n return sets_occupancy_bldg_system_types(occ_type)\n elsif occ_type[:max_number_floors] && occ_type[:max_number_floors].to_i > total_number_floors\n puts \"selected the following standards_building_type: #{occ_type[:standards_building_type]}\"\n return sets_occupancy_bldg_system_types(occ_type)\n end\n else\n # otherwise we assume the first one is correct and we select this\n puts \"selected the following standards_building_type: #{occ_type[:standards_building_type]}\"\n return sets_occupancy_bldg_system_types(occ_type)\n end\n else\n # otherwise we assume the first one is correct and we select this\n return sets_occupancy_bldg_system_types(occ_type)\n end\n end\n raise \"BuildingSync Occupancy type #{occupancy_classification} is not available in the building_and_system_types.json dictionary\"\n return false\n end",
"def weight_class\n if @weight < 215\n \"Lightweight\"\n elsif @weight < 230\n \"Cruiserweight\"\n elsif @weight < 300\n \"Heavyweight\"\n elsif @weight > 300\n \"Super Heavyweight\"\n else\n \"Heavyweight\"\n end\n end",
"def print_building(building)\n ceiling = \" -------- \"\n building.all_apartments_in_floors.each do |all_apartments_in_one_floor|\n print ceiling * building.apts_by_floor\n print \"\\n\"\n all_apartments_in_one_floor.each do |apartment|\n print Helper.format(apartment)\n end\n print \"\\n\"\n all_apartments_in_one_floor.each do |apartment|\n if apartment.rented == \"true\"\n print \" |rented| \"\n else\n print \" | | \"\n end\n end\n print \"\\n\"\n print ceiling * building.apts_by_floor\n print \"\\n\"\n end\n\n end",
"def change_classification(new_str)\n root = below_genus? && genus || self\n root.update_attributes(classification: new_str)\n root.description.update_attributes(classification: new_str) if\n root.description_id\n root.propagate_classification if root.rank == :Genus\n end",
"def building_area\n self.dig_for_string(\"listingSummary\", \"buildingArea\")\n end",
"def add_occupancy_sensors(building_type, building_vintage, climate_zone)\n \n # Only add occupancy sensors for 90.1-2010\n return true unless building_vintage == '90.1-2010'\n \n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Started Adding Occupancy Sensors')\n\n space_type_reduction_map = {\n 'SecondarySchool' => {'Classroom' => 0.32}\n }\n \n # Loop through all the space types and reduce lighting operation schedule fractions as-specified\n self.getSpaceTypes.each do |space_type|\n # Skip space types with no standards building type\n next if space_type.standardsBuildingType.empty?\n stds_bldg_type = space_type.standardsBuildingType.get\n \n # Skip space types with no standards space type\n next if space_type.standardsSpaceType.empty?\n stds_spc_type = space_type.standardsSpaceType.get\n \n # Skip building types and space types that aren't listed in the hash\n next unless space_type_reduction_map.has_key?(stds_bldg_type)\n next unless space_type_reduction_map[stds_bldg_type].has_key?(stds_spc_type)\n \n # Get the reduction fraction multiplier\n red_multiplier = 1 - space_type_reduction_map[stds_bldg_type][stds_spc_type]\n \n lights_sch_names = []\n lights_schs = {}\n reduced_lights_schs = {}\n\n # Get all of the lights in this space type\n # and determine the list of schedules they use.\n space_type.lights.each do |light|\n # Skip lights that don't have a schedule\n next if light.schedule.empty?\n lights_sch = light.schedule.get\n lights_schs[lights_sch.name.to_s] = lights_sch\n lights_sch_names << lights_sch.name.to_s \n end\n\n # Loop through the unique list of lighting schedules, cloning\n # and reducing schedule fraction before and after the specified times\n lights_sch_names.uniq.each do |lights_sch_name|\n lights_sch = lights_schs[lights_sch_name]\n # Skip non-ruleset schedules\n next if lights_sch.to_ScheduleRuleset.empty?\n\n # Clone the schedule (so that we don't mess with lights in\n # other space types that might be using the same schedule).\n new_lights_sch = lights_sch.clone(self).to_ScheduleRuleset.get\n new_lights_sch.setName(\"#{lights_sch_name} OccSensor Reduction\")\n reduced_lights_schs[lights_sch_name] = new_lights_sch\n\n # Method to multiply the values in a day schedule by a specified value\n def multiply_schedule(day_sch, multiplier) \n # Record the original times and values\n times = day_sch.times\n values = day_sch.values\n \n # Remove the original times and values\n day_sch.clearValues\n \n # Create new values by using the multiplier on the original values\n new_values = []\n for i in 0..(values.length - 1)\n new_values << values[i] * multiplier\n end\n \n # Add the revised time/value pairs to the schedule\n for i in 0..(new_values.length - 1)\n day_sch.addValue(times[i], new_values[i])\n end\n end #end reduce schedule\n\n # Reduce default day schedule\n multiply_schedule(new_lights_sch.defaultDaySchedule, red_multiplier)\n \n # Reduce all other rule schedules\n new_lights_sch.scheduleRules.each do |sch_rule|\n multiply_schedule(sch_rule.daySchedule, red_multiplier)\n end\n \n end #end of lights_sch_names.uniq.each do\n\n # Loop through all lights instances, replacing old lights\n # schedules with the reduced schedules.\n space_type.lights.each do |light|\n # Skip lights that don't have a schedule\n next if light.schedule.empty?\n old_lights_sch_name = light.schedule.get.name.to_s\n if reduced_lights_schs[old_lights_sch_name]\n light.setSchedule(reduced_lights_schs[old_lights_sch_name])\n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', \"Occupancy sensor reduction added to '#{light.name}'\")\n end\n end\n \n end\n \n OpenStudio::logFree(OpenStudio::Info, 'openstudio.model.Model', 'Finished Adding Occupancy Sensors')\n \n return true\n \n end",
"def class_type= (class_type)\r\n\t\t@class_type = class_type\r\n\t\t#TODO - needs to be extended\r\n\t\tif(class_type==\"attempted-admin\")\r\n\t\t\t@class_type_long = \"Attempted Administrator Privilege Gain\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"policy-violation\")\r\n\t\t\t@class_type_long = \"Policy Violation\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"attempted-user\")\r\n\t\t\t@class_type_long = \"Attempted User Privilege Gain\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"shellcode-detect\")\r\n\t\t\t@class_type_long = \"Executable code was detected\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"successful-admin\")\r\n\t\t\t@class_type_long = \"Successful Administrator Privilege Gain\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"successful-user\")\r\n\t\t\t@class_type_long = \"Successful User Privilege Gain\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"trojan-activity\")\r\n\t\t\t@class_type_long = \"A Network Trojan was detected\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"unsuccessful-user\")\r\n\t\t\t@class_type_long = \"Unsuccessful User Privilege Gain\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"web-application-attack\")\r\n\t\t\t@class_type_long = \"Web Application Attack\"\r\n\t\t\t@priority = 1\r\n\t\telsif(class_type==\"bad-unknown\")\r\n\t\t\t@class_type_long = \"Potentially Bad Traffic\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"denial-of-service\")\r\n\t\t\t@class_type_long = \"Detection of a Denial of Service Attack\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"misc-attack\")\r\n\t\t\t@class_type_long = \"Misc Attack\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"non-standard-protocol\")\r\n\t\t\t@class_type_long = \"Detection of a non-standard protocol or event\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"rpc-portmap-decode\")\r\n\t\t\t@class_type_long = \"Decode of an RPC Query\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"successful-dos\")\r\n\t\t\t@class_type_long = \"Denial of Service\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"successful-recon-largescale\")\r\n\t\t\t@class_type_long = \"Large Scale Information Leak\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"successful-recon-limited\")\r\n\t\t\t@class_type_long = \"Information Leak\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"suspicious-filename-detect\")\r\n\t\t\t@class_type_long = \"A suspicious filename was detected\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"suspicious-login\")\r\n\t\t\t@class_type_long = \"An attempted login using a suspicious username was detected\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"system-call-detect\")\r\n\t\t\t@class_type_long = \"A system call was detected\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"unusual-client-port-connection\")\r\n\t\t\t@class_type_long = \"A client was using an unusual port\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"web-application-activity\")\r\n\t\t\t@class_type_long = \"access to a potentially vulnerable web application\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"icmp-event\")\r\n\t\t\t@class_type_long = \"Generic ICMP event\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"misc-activity\")\r\n\t\t\t@class_type_long = \"Misc activity\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"network-scan\")\r\n\t\t\t@class_type_long = \"Detection of a Network Scan\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"not-suspicious\")\r\n\t\t\t@class_type_long = \"Not Suspicious Traffic\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"protocol-command-decode\")\r\n\t\t\t@class_type_long = \"Generic Protocol Command Decode\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"string-detect\")\r\n\t\t\t@class_type_long = \"A suspicious string was detected\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"unknown\")\r\n\t\t\t@class_type_long = \"Unknown Traffic\"\r\n\t\t\t@priority = 3\r\n\t\telsif(class_type==\"attempted-dos\")\r\n\t\t\t@class_type_long = \"Attempted Denial of Service\"\r\n\t\t\t@priority = 2\r\n\t\telsif(class_type==\"attempted-recon\")\r\n\t\t\t@class_type_long = \"Attempted Information Leak\"\r\n\t\t\t@priority = 2\r\n\t\tend\r\n\tend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
capRatePercent : Decimal The capitalization rate on the property in percentage | def cap_rate_percent
self.dig_for_decimal("capRatePercent")
end | [
"def purchase_cap_rate\n\t\t(noi / purchase_price * 100).round(2)\n\tend",
"def percent_charged\n \"%.2f%%\" % ((charge_remaining.to_f / charge_capacity.to_f) * 100)\n end",
"def pro_forma_cap_rate\n\t\t(noi / arv * 100).round(2)\n\tend",
"def cap_rate=(val)\n\t\tsuper val.to_f * 10\n\tend",
"def price_percent\n subr = Recipe.find(self.sub_id)\n\t\t((subr.kilo_cost * self.weight / 1000) * 100 / self.recipe.total_cost).round(2)\n\tend",
"def cap_ex_dollars\n\t\t(cap_ex / 100.00) * total_income\n\tend",
"def percent\n advanced(0)\n end",
"def new_response_rate_in_percent\n\n end",
"def percent_of_parent_base_rate\n super\n end",
"def bakers_percent weight\n weight / bakers_percent_100.to_f\n end",
"def default_rate_in_pounds\n default_rate_pence / 100\n end",
"def benefits_rate\n result = (100 * (benefits / Event.average_benefits.to_f)) - 100\n result.round(1)\n end",
"def percentage\n \tamount / expense.cost\n end",
"def paid_back_perc\n if(paid_back>0)\n (((paid_back*1.0/total_money))*100).round(2)\n else\n 0\n end\n end",
"def pct(whole, part) (100 * part.to_f / whole).round(1).to_s + \"%\" end",
"def percent()\n ''\n end",
"def format_pct_value(ror)\n (ror * 100).round(1)\n end",
"def percentage\n amount / expense.cost\n end",
"def penalty_percentage\n return 0 if ahead?\n amount = cash.abs\n percentage = amount / 20\n percentage = 50 if percentage > 50\n percentage\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
cashFlow : Decimal The amount of cash flow the property brings in if its on sale | def cash_flow
self.dig_for_decimal("cashFlow")
end | [
"def cash_on_cash_roi\n\t\t(cash_flow * 12 / total_cash_needed * 100).round(2)\n\tend",
"def total_cash_needed\n\t\t(cash_purchase? ? purchase_price : loans.map(&:down_payment).reduce(:+)) + closing_costs + estimated_repairs + loans.map(&:points_payment).reduce(:+)\n\tend",
"def cash\n @cash ||= Money.new(0)\n end",
"def profit\n revenue - total_costs\n end",
"def profit_calculation\r\n @total_profit = @cocktail_profit + @beer_profit + @water_profit\r\n end",
"def fee_as_percentage\n (merchant.fee * 100).to_i\n end",
"def cash_amount(accounting_element)\n\t\t\t\t payment_form = accounting_element[:payment_info][:payment][:form]\n\t\t\t\t if payment_form == \"CA\" then\n\t\t\t\t return (ticket_base_fare(accounting_element).to_f + ticket_tax(accounting_element).to_f).round(2)\n\t\t\t\t else\n return 0\n\t\t\t\t end\n\t\t\t end",
"def set_fee_amount\n self.fee_amount_in_cents = (self.actual_amount_in_cents * self.fee_percentage.to_f).floor \n end",
"def stake_to_profit profit\n profit / @fractional_odds\n end",
"def ah_deposit\n msv = item.sell_price\n base_deposit = msv * 0.15\n (base_deposit * recipe_group.ah_deposit_multiplier).to_i\n end",
"def fee\n (amount * 0.005) if amount\n end",
"def trading_fee\n return exchange_trading_fee if exchange_trading_fee > 0\n system_calculated_trading_fee\n end",
"def consumption_total_period_to_invoice\n ctp = consumption_total_period\n meter.is_shared? ? (ctp / meter.shared_coefficient).round : ctp\n end",
"def cash_up\n total = 0\n items.each { |item| total += item.price if item.sold? }\n\n provision = if total > 19 \n Calculator.round_base(total * event.provision / 100, 0.5)\n else\n 0\n end\n\n fee = total > 19 ? event.fee : 0\n\n payback = total - provision + fee\n\n [total, provision, fee, payback] \n end",
"def profit\n @profit ||= odd.profit(@amount)\n end",
"def change_calc(cash_amount, item_price)\n\n # Item price can be eqaul to 0 in case it is free.\n\n if (item_price >= 0 && cash_amount > 0)\n\n if (item_price < cash_amount)\n\n change = cash_amount.to_f - item_price.to_f\n\n return change.to_f\n\n else\n return \"Item costs more than $#{cash_amount.to_f}\"\n end\n end\nend",
"def profit\r\n\t\traw_profit = @selling_price - @aquisition_cost\r\n\tend",
"def owed_total\n case owed_type\n when \"even\" then bill.even_share\n when \"zero\" then 0\n when \"all\" then bill.total\n when \"percentage\" then bill.total * owed_percent.to_f / 100\n when \"fixed\" then owed_amount\n else 0\n end.to_f\n end",
"def property_management_dollars\n\t\t(property_management / 100.00) * total_income\n\tend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
ceilingHeight : String The distance from the floor to the lowest hanging ceiling member or hanging objects of the industrial work area | def ceiling_height
self.dig_for_string("ceilingHeight")
end | [
"def get_height\n height = get_keyword_value(\"FLOOR-HEIGHT\")\n height = height.to_f\n return height\n end",
"def get_height\n return get_keyword_value(\"FLOOR-HEIGHT\").to_f\n end",
"def floor_height(floor)\n\t\tfloors.index(floor)\n\tend",
"def height_inches\n parts = height.split(\"'\")\n return (parts[0].to_i * 12) + (parts[1].chop.to_i)\n end",
"def calculate_grid_height\n if @height.nil?\n if @env.grid_min_height.to_i < 350\n @env.grid_min_height.to_i - 40\n else\n 350\n end\n else\n @height\n end\n end",
"def height_str\n unless self[:height]\n return '0'\n else\n temp = self[:height]\n feet = temp / 12\n inch = temp % 12\n end\n \"\" + feet.to_s + \"'\" + inch.to_s + \"\\\"\"\n end",
"def height\n if @alive\n @height.round(1)\n else\n 'A dead tree is not very tall. :('\n end\n end",
"def height_range\n\t\tmax_feet = max_height.to_i / 12\n\t\tmax_inches = max_height.to_i % 12\n\t\tmin_feet = min_height.to_i / 12\n\t\tmin_inches = min_height.to_i % 12\n\t\tif min_height == 1\n\t\t\t\"≤ #{max_feet}'#{max_inches}\\\"\"\n\t\telsif max_height > 500\n\t\t\t\"≥ #{min_feet}'#{min_inches}\\\"\"\n\t\telse\n\t\t\t\"#{min_feet}'#{min_inches}\\\" - #{max_feet}'#{max_inches}\\\"\"\n\t\tend\n\tend",
"def pokedex_height\n # @type [String]\n text = ext_text(9000, 71)\n using_retard_unit = !text.downcase.end_with?('m')\n if using_retard_unit\n inches = (height * 39.3701).to_i\n feet = inches / 12\n inches -= feet * 12\n format(text, feet, inches)\n else\n return format(text, height)\n end\n end",
"def height_unit\n return \"meters\" if current_user.pilot.preferences.height_unit == UNITS[:meters]\n return \"feet\" if current_user.pilot.preferences.height_unit == UNITS[:feet]\n return current_user.pilot.preferences.height_unit\n end",
"def height\n # TODO: auto unit conversion\n measurement(1).try(:measurement)\n end",
"def maximum_height\n max_height = self.heights.max_by {|x| x.value}\n end",
"def height\n {:feet => self[:height] / 12, :inches => self[:height] % 12}\n end",
"def height_cm\n return nil unless source_record['300']\n\n if source_record['300']['c'] =~ /(\\d{1,4}) ?cm(?:[\\. ]|\\Z)/\n return $1\n elsif source_record['300']['c'] =~ /(\\d{1,4}) ?in\\./\n # inches? why not convert to cm\n return $1.to_i * 2.5\n end\n\n return nil\n end",
"def height\n type = Terrain.where(generation_type: 'mountain')\n type.each do |category|\n grid = Tile.where(terrain: category.terrain)\n grid.each do |mountain|\n (-4..4).each do |xpos|\n (-4..4).each do |ypos|\n tile = Tile.where(x: xpos + mountain.x, y: ypos + mountain.y)\n tile.each do |height|\n distance = (((xpos.abs) / 2).floor - 3).abs + (((ypos.abs) / 2).floor - 3).abs / 2\n if distance > height.height\n height.height = distance.abs\n height.save\n end\n end\n end\n end\n end\n end\n end",
"def height\n\t\t## works only in ruby 2.0\n\t\treturn Math.log2(@heap.length).ceil\n\tend",
"def cost_of_two_banners_when_max_is_the_last\n (@buildings_calculator.max_height * 1) +\n (@buildings_calculator.max_left * (@buildings_calculator.width - 1))\n end",
"def height\n @max_y - @min_y\n end",
"def scale_height( w )\n s = split_unit( w )\n \"#{( s[:size] / width * height ).round(2)}#{s[:unit]}\"\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
clearance : String The distance from the floor to the lowest hanging ceiling member or hanging objects, beams, joists or truss work descending down into a substantial portion of the industrial work area | def clearance
self.dig_for_string("clearance")
end | [
"def gc\n s = codons.map { |c| c.nuc_codon[2] }.join\n ((s.count('G')+s.count('C')).to_f/codons.count).round(4)\n end",
"def contents_of cell:\n\t\tif distances && distances[cell]\n\t\t\tdistances[cell].to_s(36)[-1]\n\t\telse\n\t\t\t\" \"\n\t\tend\n\tend",
"def for_cs_sake(string)\n string = string.gsub(/[[:punct:]]/, '')\n string = string.split\n string = string.reject { |word| c_distance(word) == nil }\n string.sort_by { |word| c_distance(word) }[0]\n\n #too long\n # closest = \"\"\n # split_string = string.split\n # c_distance = 0\n #\n # (0...split_string.length).each do |idx|\n # next if c_distance(split_string[idx]) == nil\n # if c_distance(split_string[idx]) > c_distance\n # c_distance = c_distance(split_string[idx])\n # closest = split_string[idx]\n # end\n # end\n # closest\nend",
"def for_cs_sake(string)\n closest_word = \"\"\n closest_distance = 9999\n str_arr = string.split(\" \")\n str_arr.each do |curr_word|\n curr_distance = c_distance(curr_word)\n if curr_distance < closest_distance\n closest_distance = curr_distance\n closest_word = remove_punctuation(curr_word)\n end\n end\n return closest_word\nend",
"def phonetic_coverage\n 1 - phones_in_word_list/@initial_phones.to_f\n end",
"def measure_DNA\n show do\n title \"Measure DNA Concentration\"\n check \"Elute DNA into 1.5 mL tubes by spinning at 17.0 xg for one minute, keep the columns.\"\n check \"Pipette the flow through (30 uL) onto the center of the column, spin again at 17.0 xg for one minute. Discard the columns this time.\"\n # check \"Go to B9 and nanodrop all of 1.5 mL tubes, enter DNA concentrations for all tubes in the following:\"\n table operations.start_table\n .output_item(OUTPUT)\n .get(:conc, type: 'number', heading: \"Concentration (ng/uL)\", default: 7)\n .get(:note, type: 'text', heading: \"Notes\")\n .end_table\n end\n end",
"def consonants(text)\n return 0 if @emphasis[:consonants] == 0\n \n percent = text.consonants.length / text.length.to_f\n percent * @emphasis[:consonants]\n end",
"def coat_length; end",
"def discordant_chastity\n arr = self.non_refs.to_a.sort {|a,b| b.last <=> a.last }\n @top_non_ref_count, @second_non_ref_count, @third_non_ref_count = arr.collect {|c| c.last}\n case\n when self.non_ref_count == 0 then 0.0\n when @top_non_ref_count == @coverage then 1.0\n when @second_non_ref_count > 0 then @top_non_ref_count.to_f / (@top_non_ref_count + @second_non_ref_count).to_f\n else @top_non_ref_count.to_f / @coverage.to_f\n end\n end",
"def get_absorptance()\n begin\n if (not @construction.check_keyword?(\"ABSORPTANCE\") )\n @construction.set_keyword_value(\"ABSORPTANCE\", \"0.2\" )\n end\n return @construction.get_keyword_value(\"ABSORPTANCE\")\n rescue\n raise(\"Could not get absortance, is this really an exterior wall?\\n #{output}\") \n end\n end",
"def climb_descent_ground_distance(roc, speed, alt)\n climb_time = alt.to_d / roc.to_d\n climb_distance = (speed.to_d / 60) * climb_time\n alt_in_nm = Distance.new(alt, DistanceType::FOOT).inNauticalMiles\n ground_covered_sq = BigDecimal(climb_distance**2 - alt_in_nm **2)\n \n return ground_covered_sq.sqrt(2)\nend",
"def gc_content\n\t\t\t\talphabet = @alphabet\n\t\t\t\tgc_total = 0.0\n\t\t\t\ttotal = 0.0\n\t\t\t\t(0...@length).each do |i|\n\t\t\t\t\talphabet.letters.each do |letter|\n\t\t\t\t\t\tif letter =~ /C|G/\n\t\t\t\t\t\t\tgc_total += self[letter][i]\n\t\t\t\t\t\tend\n\t\t\t\t\t\ttotal += self[letter][i]\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\treturn gc_total / total\n\t\t\tend",
"def consonants(text)\n percent = text.consonants.length / text.length.to_f\n percent * @emphasis[:consonants]\n end",
"def relative_length(id)\n @article = Article.find(id)\n char = @article.body.length\n \n if char <= 50\n return \"short\"\n elsif char > 50 && char <=100\n return \"medium\"\n elsif char > 100 && char <=300\n return \"long\"\n else\n return \"not sure what is goin on!\"\n end\n end",
"def getCeilingArea( elements, ceilingType, ceilingCodeName )\n area = 0.0\n locationText = \"HouseFile/House/Components/Ceiling\"\n elements.each(locationText) do |element|\n if ceilingType == \"Attics\"\n # Check if construction type (element 3) is Attic/gable (2), Attic/hip (3) or Scissor (6)\n if element[3][1].attributes[\"code\"] == \"2\" || element[3][1].attributes[\"code\"] == \"3\" || element[3][1].attributes[\"code\"] == \"6\"\n if ceilingCodeName == \"NA\"\n area += element[5].attributes[\"area\"].to_f\n else\n if element[3][3].text == ceilingCodeName\n area += element[5].attributes[\"area\"].to_f\n end\n end\n end\n elsif ceilingType == \"Flat\"\n # Check if construction type (element 3) is Flat (5)\n if element[3][1].attributes[\"code\"] == \"5\"\n if ceilingCodeName == \"NA\"\n area += element[5].attributes[\"area\"].to_f\n else\n if element[3][3].text == ceilingCodeName\n area += element[5].attributes[\"area\"].to_f\n end\n end\n end\n elsif ceilingType == \"Cathedral\"\n # Check if construction type (element 3) is Cathedral (4)\n if element[3][1].attributes[\"code\"] == \"4\"\n if ceilingCodeName == \"NA\"\n area += element[5].attributes[\"area\"].to_f\n else\n if element[3][3].text == ceilingCodeName\n area += element[5].attributes[\"area\"].to_f\n end\n end\n end\n elsif ceilingType == \"All\"\n if ceilingCodeName == \"NA\"\n area += element[5].attributes[\"area\"].to_f\n else\n if element[3][3].text == ceilingCodeName\n area += element[5].attributes[\"area\"].to_f\n end\n end\n end\n end\n return area\nend",
"def calc_cadence\n # formula to calculate rpm of a wheel\n @cadence = 25 / (3 * 3.14 * 0.305) * get_speed\n return @cadence\n end",
"def relacion_cc\n\t\t(ccintura / ccadera).round(2)\n\tend",
"def index_of_coincidence(text)\r\n sum = frequency_sum(text)\r\n size = (text.size * (text.size - 1))\r\n (sum.to_f / size.to_f)\r\n end",
"def cityarea(h)\n nearestcity(h) < $cityseparation\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
columnSpacing : String The distance between posts or vertical supporting beams in an industrial building | def column_spacing
self.dig_for_string("columnSpacing")
end | [
"def spacing\r\n return 8\r\n end",
"def column_gutter\n @row_gutter ||= MM2PT*hs\n end",
"def spacing\r\n return 32\r\n end",
"def width_of_column\n bare_column_width + @spacer\n end",
"def word_spacing_for_this_line\n if @align == :justify &&\n @line_wrap.space_count > 0 &&\n !@line_wrap.paragraph_finished?\n (@width - @line_wrap.width) / @line_wrap.space_count\n else\n 0\n end\n end",
"def free_spacing; end",
"def with_spaces\n add_spacing( with_cut_symbols )\n end",
"def text_column_width\n (width - (columns - 1) * gutter_width) / columns\n end",
"def spacing= value\r\n value = value.to_s\r\n @attributes['spacing'] = value\r\n value.to_number\r\n end",
"def indent_spaces(count)\n ' ' * count\n end",
"def calculate_columns!\n\n\n\n span_count = columns_span_count\n\n\n\n columns_count = children.size\n\n\n\n\n\n\n\n all_margins_width = margin_size * (span_count - 1)\n\n\n\n column_width = (100.00 - all_margins_width) / span_count\n\n\n\n\n\n\n\n columns.each_with_index do |column, i|\n\n\n\n is_last_column = i == (columns_count - 1)\n\n\n\n column.set_column_styles(column_width, margin_size, is_last_column)\n\n\n\n end\n\n\n\n end",
"def letter_spacing\n @info[:spacing]\n end",
"def div_gutter\n div :class => \"column span-1\" do \n nbsp\n end\n end",
"def indent_spaces(count)\r\n ' ' * count\r\n end",
"def spacing_size(params)\n return rel_to_dim(params['spacing'] || 0)\n end",
"def cell_padding\n @padding ||= if stylized? \n pad = 16\n pad -= 3 if background_color.nil?\n pad -= 2 if text_color.nil?\n pad -= 1 if background_color.nil? && text_color.nil?\n pad\n else\n 2\n end\n end",
"def breakable_space; end",
"def five_spaces\n 5.times do\n nbsp\n end\n end",
"def Columnize( text, width, indent )\n\treturn indent + text.scan(/(.{1,#{width}})(?: |$)/).join(\"\\n#{indent}\")\nend"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
commonAreaFactor : Decimal The shared spaces on a single floor, and within a building in its entirety | def common_area_factor
self.dig_for_decimal("commonAreaFactor")
end | [
"def min_divisible_area\n self.dig_for_decimal(\"minDivisibleArea\")\n end",
"def calc_area (base1,base2,height)\r\n\tarea = height * (base1 + base2) / 2.0\r\n\treturn area\r\nend",
"def common_area(rect)\n return 0 if (!intersects?(rect))\n \n x = 0\n if (@right > rect.left && @right < rect.right)\n x = @right - rect.left\n elsif (rect.right > @left && rect.right < @right)\n x = rect.right - @left\n end\n\n y = 0\n if (@top > rect.bottom && @top < rect.top)\n y = @top - rect.bottom\n elsif (rect.top > @bottom && rect.top < @top)\n y = rect.top - @bottom\n end\n\n return @area + rect.area - (x * y)\n end",
"def get_floor_area\n return @total_floor_area\n end",
"def gallons\n (area / ONE_GALLON_COVERS).ceil\n end",
"def percent_place_land_area\n land_area / place.land_area\n end",
"def area_in_sqm\n (self.area * 0.09290304).round\n end",
"def percent_county_subdivision_land_area\n land_area / county_subdivision.land_area\n end",
"def percent_county_land_area\n land_area / county.land_area\n end",
"def area\n return @base * @altura\n end",
"def area\n (Math::PI * @radius * @radius).round(1)\n end",
"def cost_with_max_global_in_left_side\n (@buildings_calculator.max_height * (@buildings_calculator.left_width + 1)) +\n (@buildings_calculator.max_right * @buildings_calculator.right_width)\n end",
"def calculate_area\n\n \tarea = 3.14*@radius*@radius\n\n end",
"def percent_land\n land_area / total_area if land_area\n end",
"def overlap_fraction(anotherRectangle)\n\t\tr = anotherRectangle\n\t\txOverlap = [0, ([@x2, r.x2].min - [@x0, r.x0].max)].max\n\t\tyOverlap = [0, ([@y1, r.y1].min - [@y0, r.y0].max)].max\n\t\treturn (1.0 * xOverlap * yOverlap / (@width * @height)).round(1)\n\tend",
"def max_contiguous_area\n self.dig_for_decimal(\"maxContiguousArea\")\n end",
"def percent_urban_area_land_area\n land_area / urban_area.land_area\n end",
"def percent_place_total_area\n total_area / place.total_area\n end",
"def land_area_km\n land_area * SQUARE_MILES_TO_KILOMETERS if land_area\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
dockHeight : String The amount of distance the height of the slab at the bottom of an overhead door is from the ground level | def dock_height
self.dig_for_string("dockHeight")
end | [
"def window_height\n 180\n end",
"def g_height \n Config.ground_height\n end",
"def outer_height; rect.height + @border_thickness * 2; end",
"def height\n return @window_height # outer height\nend",
"def height=(size)\n self.bottom = top + size.to_f\n end",
"def make_dock\n\n lowest = @map.first\n @map.each do |tile|\n if more_south(tile, lowest)\n lowest = tile\n end\n end\n\n @map.push(Dock.create(:x => lowest.x, :y => (lowest.y + 1*@height) ))\n end",
"def paper_height; end",
"def visible_height\n @win.maxy - 2\n end",
"def window_height\n fitting_height(11)\n end",
"def d_dn\n geometry.bordered_height\n end",
"def ceiling_height\n self.dig_for_string(\"ceilingHeight\")\n end",
"def compute_height(pad = 2, factor = 13)\n (max_actions + pad) * factor\n end",
"def height\n canvas_height - top_margin - bottom_margin\n end",
"def bottom_draw_y\n @window.height - @left_i.height\n end",
"def jump_height\r\r\n (@jump_peak * @jump_peak - (@jump_count * CXJ::FREE_MOVEMENT::JUMP_SPEED - @jump_peak).abs ** 2) / 2\r\r\n end",
"def max_height\n end",
"def number_of_docks\n self.dig_for_integer(\"numberOfDocks\")\n end",
"def footer_height\n 55\n end",
"def height\n dimensions()[:y]\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
downPayment : Decimal The down payment required by the current owner for a commercial listing | def down_payment
self.dig_for_decimal("downPayment")
end | [
"def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end",
"def set_DownPaymentAmount(value)\n set_input(\"DownPaymentAmount\", value)\n end",
"def minimum_downpayment\n return 0.1\n end",
"def net_amount; debit; end",
"def payment(amount)\n @balance -= amount\n end",
"def debt\n subtotal - _normed_balance\n end",
"def unpaid_amount\n gross_amount - paid_amount\n end",
"def loan_payment\n self.dig_for_decimal(\"loanPayment\")\n end",
"def balance\n amount_paid - amount_due\n end",
"def minimum_down_payment(asking_price)\n minimum_dp = 0.05 * 500_000\n minimum_dp += 0.1 * (asking_price - 500_000) unless asking_price < 500_000\n minimum_dp\n end",
"def payment_amount(discount = 0)\n total_amount() * (1 - discount / 100)\n end",
"def debits_balance\n debit_amounts.balance\n end",
"def total_debt\n self.amount\n end",
"def outstanding_balance\n paid? ? 0.to_d : price - (amount_paid || 0.to_d)\n end",
"def deductible_price\n (400 * rental_days if @deductible_reduction).to_i\n end",
"def deduct_from_credit\n if self.account.has_credit? && self.payment_method != Charge::COMPED_PAYMENT\n credit_amount_string = ActionController::Base.helpers.number_to_currency(self.account.credit)\n charge_amount_string = ActionController::Base.helpers.number_to_currency(self.amount)\n\n # credit > charge\n # subtract charge amount from credit amount, pay charge completely\n if self.account.credit >= self.amount\n self.update_attribute(:payment_method, Charge::COMPED_PAYMENT)\n self.update_attribute(:paid_at, Time.now)\n self.update_attribute(:description, self.description + \" (#{charge_amount_string} paid by lab credit)\")\n self.account.update_attribute(:credit, self.account.credit - self.amount)\n\n\n # charge > credit: \n # split charge into two charges -- covered by credit and not covered\n # pay charge covered by credit\n else\n paid_amount = self.account.credit \n unpaid_amount = self.amount - self.account.credit\n\n self.account.update_attribute(:credit, 0)\n\n Charge.create(amount: paid_amount, \n payment_method: Charge::COMPED_PAYMENT,\n paid_at: Time.now,\n charge_type: self.charge_type,\n account: self.account,\n description: \"Parital lab credit payment (original charge #{charge_amount_string}, #{credit_amount_string} paid by lab credit)\" \n )\n\n self.update_attribute(:amount, unpaid_amount)\n self.update_attribute(:description, self.description + \" (original charge #{charge_amount_string}, #{credit_amount_string} paid by lab credit)\")\n end\n end\n end",
"def deduct_money_from_account(balance_to_deduct)\n self.balance -= balance_to_deduct\n self.save\n end",
"def deduct_wallet\n user = User::find(self.user_id)\n user.budget -= self.pending_money\n user.save\n\n self.pending_money = 0\n self.save\n end",
"def debit_amount\n sum( debits )\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
fullyLeasedIncome : Decimal The income that the owner currently receives if the property is fully leased | def fully_leased_income
self.dig_for_decimal("fullyLeasedIncome")
end | [
"def estimate(down_payment, annual_income, options={})\n down_payment = down_payment.gsub(',', '').strip\n annual_income = annual_income.gsub(',', '').strip\n hash = self.calculate_affordability(down_payment, 0, annualincome: annual_income)\n return unless hash && hash['affordabilityAmount']\n rounded = hash['affordabilityAmount'].to_i.round(-4) # round to nearist 10k\n rounded < 10000 ? 10000 : rounded\n end",
"def calc_gross_taxable_property_income_amount(simulation, deductible_expenses, postponed_negative_taxable_property_income_from_previous_fiscal_year)\n simulation[:house_rent_amount_per_year] - deductible_expenses - postponed_negative_taxable_property_income_from_previous_fiscal_year\n end",
"def undisbursed_amount_factor\n disbursement_remaining.to_f / Country.max_disbursement_remaining\n end",
"def calculate_loyality_discount\n (@discountable_amount * LOYALITY_DISCOUNT / 100).to_f.round(2)\n end",
"def disbursement_remaining_percentage\n disbursement_remaining_factor * 100\n end",
"def amount_remaining\n @desired_amount - @bought_amount\n end",
"def disbursement_remaining_factor\n approved_amount == 0 ? 0 : 1 - (disbursed_amount / approved_amount.to_f)\n end",
"def profit\n @profit ||= odd.profit(@amount)\n end",
"def disbursement_percentage\n disbursement_factor * 100\n end",
"def calc_gross_taxable_property_income_amount(simulation, deductible_expenses, amortization_property, amortization_first_works, postponed_negative_taxable_property_income_from_previous_fiscal_year)\n simulation[:house_rent_amount_per_year] - deductible_expenses - amortization_property - amortization_first_works - postponed_negative_taxable_property_income_from_previous_fiscal_year\n end",
"def income\n @income ||= Plaid::Income.new(self)\n end",
"def property_management_dollars\n\t\t(property_management / 100.00) * total_income\n\tend",
"def deductible_price\n (400 * rental_days if @deductible_reduction).to_i\n end",
"def loyalty_allowance\n if @employee.eligible_for_loyality_allowance?(@generation_date)\n ((component_criterias[:loyalty_allowance]/100)*basic) #* eligibility_fraction)\n end\n end",
"def savings_portion_needed\n adjusted_target_income - (self.social_security + self.pensions + self.other_income)\n end",
"def penalty_percentage\n return 0 if ahead?\n amount = cash.abs\n percentage = amount / 20\n percentage = 50 if percentage > 50\n percentage\n end",
"def calc_annual_income\n @total_income =+ @rent\n\n end",
"def present_value\n # Payoff amount = 0, we’re assuming a fully amortizing loan\n payoff_amount = 0\n end",
"def unpaid_amount_within_tolerance?\n reimbursement_count = reimbursement_models.size do |model|\n model.total_amount_reimbursed_for(self) > 0\n end\n leniency = if reimbursement_count > 0\n (reimbursement_count - 1) * 0.01.to_d\n else\n 0\n end\n unpaid_amount.abs.between?(0, leniency)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
grossIncome : Decimal The gross income that the owner currently receives if the property is fully leased | def gross_income
self.dig_for_decimal("grossIncome")
end | [
"def calc_gross_taxable_property_income_amount(simulation, deductible_expenses, postponed_negative_taxable_property_income_from_previous_fiscal_year)\n simulation[:house_rent_amount_per_year] - deductible_expenses - postponed_negative_taxable_property_income_from_previous_fiscal_year\n end",
"def gross_price\n @gross_price = @net_price *(100 +VAT_RATE)/100\n end",
"def gross_amount\n get_awards[:gross_amt]\n end",
"def calc_gross_taxable_property_income_amount(simulation, deductible_expenses, amortization_property, amortization_first_works, postponed_negative_taxable_property_income_from_previous_fiscal_year)\n simulation[:house_rent_amount_per_year] - deductible_expenses - amortization_property - amortization_first_works - postponed_negative_taxable_property_income_from_previous_fiscal_year\n end",
"def gross_total\n self.gross_amount = self.net_total + self.tax_total\n end",
"def gross_total\n gross_total_base.round(2)\n end",
"def gross\n BigDecimal.new(params['payload']['base_price'], 8)\n end",
"def stake_to_profit profit\n profit / @fractional_odds\n end",
"def gross_score\n spread_credit.to_i + (right_antler.lg_antler + right_antler.lg_points.to_i) + (left_antler.lg_antler + left_antler.lg_points.to_i)\n end",
"def profit\n revenue - total_costs\n end",
"def gross_revenue\n purchases.inject(0) { |sum, purchase| sum + purchase.gross_revenue }\n end",
"def gross_price\n if componentized?\n gross_price = component_gross_price\n else\n absolutely_priced? ? gross_price = sales_price : gross_price = calculated_gross_price\n end\n\n return gross_price\n end",
"def profit\n\t\t# defined as the gross amount, minus transaction fees\n\t\t# could also subtract shipping and tax here as well, but we don't have to deal with\n\t\t# any of that yet\n\t\tself.amount - self.payment_fee\n\tend",
"def gross_profit_statement(profit)\r\n return \"The total profit you will make from your current order queue is $%.2f\" % profit\r\n end",
"def get_gross_sum\n gross_sum = 0.to_f\n accountinvoicepositions.each do |accountinvoiceposition|\n gross_sum = gross_sum.to_f + accountinvoiceposition.gross_price.to_f\n end\n gross_sum.to_f\n end",
"def fully_leased_income\n self.dig_for_decimal(\"fullyLeasedIncome\")\n end",
"def gross_check(payroll)\n @gross_check_total = 0\n payroll.payperiods.each do |payperiod|\n @gross_check_total += payperiod.check.gross_total if payperiod.check\n end\n @gross_check_total\n end",
"def profit\n @profit ||= odd.profit(@amount)\n end",
"def gross_price\n if @vat_included\n @price\n else\n net_price + vat_sum\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
hasRailAccess : Boolean Indicates whether the property has the industrial rail access to it | def has_rail_access?
self.dig_for_boolean("hasRailAccess")
end | [
"def HasPortalAccess # rubocop:disable Style/MethodName\n @attrs[:HasPortalAccess] == 'True' ? true : false\n end",
"def for_leveling?\n return (@property & PONY::Bitset[5]).to_bool\n end",
"def viewable?\n !!status[:viewable]\n end",
"def accessible?\n !!@accessible\n end",
"def permit_access?\n !!@person\n end",
"def has_accessories\n if self.accessories != []\n self.accessories.each{|accessory| return true if accessory.typ == :accessory}\n else\n return false\n end\n end",
"def has_access_to_planning?\n (force_access_to_planning? || (has_payment_solution_sepa? && !has_late_payments_retry?)) && !forbid_access_to_planning?\n end",
"def is_accessory?\n families = self.product_families.map{|pf| pf.tree_names}.join(\" \")\n !!!(families.match(/controller/)) ? false : !!(families.match(/accessor/i))\n end",
"def conditional_access\n return @conditional_access\n end",
"def can_do_commercial_business?\n self.dig_for_boolean(\"companySummary\", \"canDoCommercialBusiness\")\n end",
"def utilizes?(property)\n return false if property.class != Property\n property = Property.find_by(id: property.id)\n return false if property.nil?\n self.properties.include?(property)\n end",
"def is_reviewer?\n self.reviewer_role != nil\n end",
"def enabled?\n config.roadie.enabled\n end",
"def has_accessories_percept\n if (self.has_accessories && self.has_services)\n return false\n else\n return true\n end\n end",
"def defines_read?(attribute)\n self.class.defines_read?( attribute )\n end",
"def is_reader?(user)\n public || permitted?(readers_join_table, user)\n end",
"def can_current_member_access_property?(property_id)\n if current_member and !Property.active_only.find_by_id_and_account_id(property_id, current_member.account.id).blank?\n if (current_member.super_member?) or\n !MemberPropertyAccess.find_by_member_id_and_property_id(current_member.id, property_id).blank?\n true\n else\n false\n end\n else\n false\n end\n end",
"def readable?(attribute)\n test_permission(:let_read, attribute)\n end",
"def public?\n return true if self.capacity.nil? && self.registration == false\n false\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isAllowMapping : Boolean Indicates whether or not the property address should be displayed on a map | def mapping_allowed?
self.dig_for_boolean("isAllowMapping")
end | [
"def xy_mapping?\n @mapping == :xy\n end",
"def should_appear_on_map?\n return false if self['Activity'] == 'Inactive'\n return false unless self['Map?'] == true\n return false unless self['Latitude'] && self['Longitude']\n return false unless self['City'] && self['Name']\n true\n end",
"def isMapping\n @refType.kind_of?(DataMetaDom::Mapping) && !@refType.kind_of?(DataMetaDom::BitSet)\n end",
"def mappable?\n self.send(_geolocatable_geometry_attribute_name).present?\n end",
"def use_only_mapped(type)\n false\n end",
"def xy_mapping=(enable)\n if enable\n set_xy_mapping\n else\n set_drum_rack_mapping\n end\n end",
"def map?\n _c_slaw_is_map\n end",
"def using_no_mapping?\n\t\t\t\taccount_mapping_mode_used == :none\n\t\t\tend",
"def geo_resource?\n false\n end",
"def using_internal_mapping?\n\t\t\t\taccount_mapping_mode_used == :internal\n\t\t\tend",
"def geo_resource?\n true\n end",
"def restricted_scanned_map?\n @document.local_restricted? && @document['layer_geom_type_s'] == 'Image'\n end",
"def map_flag\n flag = 0\n flag |= CL_MAP_READ if self.in?\n flag |= CL_MAP_WRITE if self.out?\n # The value of above statement is nil if self.out? is false.\n flag\n end",
"def has_mappings()\n return @mappings.has_data()\n end",
"def explicit_map_processor?\n settings[:mapper]\n end",
"def mappable?\n ! geometry.nil?\n end",
"def use_hidden_geometry?\n end",
"def latlng_good?\n self.addr_latlng && self.addr_latlng.lat && self.addr_latlng.lng\n end",
"def geo_coded?\n !!(self.lat && self.lng)\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isCrossDocks : Boolean Indicates whether the property has the CrossDocks associated with it | def has_cross_docks?
self.dig_for_boolean("isCrossDocks")
end | [
"def has_docks?\n n = @buildings.select { |b| [Docks_1, Docks_2, Docks_3].include? b.type }\n return n.length > 0\n end",
"def available_docks\n self['availableDocks']\n end",
"def property_multiple_pool?\n !property.single_pool?\n end",
"def can_dock?(planet)\n calculate_distance_between(planet) <= planet.radius + Game::Constants::DOCK_RADIUS + Game::Constants::SHIP_RADIUS\n end",
"def composite?\n !shapes.empty?\n end",
"def crop?\n @crop\n end",
"def pivot_on_hierarchical_dimension?\n dimension_classes.each do |dimension|\n return true if dimension.hierarchical_dimension?\n end\n return false\n end",
"def has_parents?\n \n return @parent ? true : false\n \n end",
"def complete_property_checkups?\n nil\n end",
"def parent_missing?\n has_field?(:crossref) && !has_parent?\n end",
"def crop_hints?\n crop_hints.any?\n end",
"def sidebar_visible?\n @options[:visible] = :visible\n end",
"def is_accessory?\n return true if self.accessory_to_products.size > 0\n families = self.product_families.map{|pf| pf.tree_names}.join(\" \")\n !!!(families.match(/controller/)) ? false : !!(families.match(/accessor/i))\n end",
"def window_scrolled?\r\n left_margin > 0\r\n end",
"def is_accessory?\n families = self.product_families.map{|pf| pf.tree_names}.join(\" \")\n !!!(families.match(/controller/)) ? false : !!(families.match(/accessor/i))\n end",
"def sidebar_groups?\n !sidebar_groups.empty?\n end",
"def dependencies_satisfied?(deps)\n deps.all? do |dep|\n depprop = Proposal.where(barclamp: dep[\"barclamp\"], name: dep[\"inst\"]).first\n depprop_queued = depprop[\"deployment\"][dep[\"barclamp\"]][\"crowbar-queued\"] rescue false\n depprop_deployed = (depprop[\"deployment\"][dep[\"barclamp\"]][\"crowbar-status\"] == \"success\") rescue false\n\n depprop && !depprop_queued && depprop_deployed\n end\n end",
"def composite?\n\t\t\t\t@types.any?{|type| type.composite?}\n\t\t\tend",
"def crop_gravity?\n crop_gravity_x.present? && crop_gravity_y.present?\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isGroundLevel : Boolean The Industrial ground level of the property | def ground_level?
self.dig_for_boolean("isGroundLevel")
end | [
"def for_leveling?\n return (@property & PONY::Bitset[5]).to_bool\n end",
"def type_ground?\n return type?(GameData::Types::GROUND)\n end",
"def floor?\n @type == :ground_border\n end",
"def has_own_level?\n !@level.nil?\n end",
"def contact_with_ground?\n \n end",
"def feature_delivery_ground?\n feature_delivery_ground == 'true'\n end",
"def is_alive?\n @food.level > 0\n end",
"def formHasGf?\n if params.has_key?('is_ground_floor') and \n params[:is_ground_floor] == 'Y'\n return true\n end\n return false\n end",
"def levels?\n @levels\n end",
"def has_any_levels?\n @data_object.cha_levels != 0\n end",
"def ground_y\n @ground.y\n end",
"def level_up?\n true unless @level_up.nil?\n end",
"def default_level?\n experience_points_threshold == 0\n end",
"def ground_height\n @ground.height\n end",
"def on_damage_floor?\r\n $game_map.damage_floor?(@x, @y) && !in_airship?\r\n end",
"def type_grass?\n return type?(GameData::Types::GRASS)\n end",
"def tall_grass?\n return $game_player.system_tag == TGrass\n end",
"def country?\n 'country' == self.level\n end",
"def is_top_level?\n @level == 1\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isSprinkler : Boolean Indicates whether property has the industrial sprinkler to it | def has_sprinkler?
self.dig_for_boolean("isSprinkler")
end | [
"def has_sl_property?(softlayer_property)\n softlayer_hash && softlayer_hash.has_key?(softlayer_property.to_s)\n end",
"def require_target_property?\n !!@require_target_property\n end",
"def sneaking_sprites?\n return BlizzABS::Config::SNEAKING_SPRITES\n end",
"def supervised?\n get_prop('isSupervised')\n end",
"def sloth?\n\t\ttrue\n\tend",
"def weapon_sprites?\n return BlizzABS::Config::A_WEAPON_SPRITES\n end",
"def watching?(product)\n\t\twatching.include?(product)\n\tend",
"def utilizes?(property)\n return false if property.class != Property\n property = Property.find_by(id: property.id)\n return false if property.nil?\n self.properties.include?(property)\n end",
"def complete_property_checkups?\n nil\n end",
"def is_on_paasmaker?()\n return @is_on_paasmaker\n end",
"def promoter?\n current_person.try :promoter?\n end",
"def not_single_sku?\n return self.product && self.product.skus.map(&:active).count == 1 && self.product.single ? false : true\n end",
"def prod?\n is_prod\n end",
"def has_associated_swimmer?\n !swimmer.nil?\n end",
"def charge_skill_sprites?\n return BlizzABS::Config::E_CHARGE_SKILL_SPRITES\n end",
"def strong_mode_enabled?\n MSPhysics::Newton::Spring.strong_mode_enabled?(@address)\n end",
"def weapon_sprites?\n return false\n end",
"def sloth?\n\t\tfalse\n\tend",
"def charge_skill_sprites?\n return BlizzABS::Config::A_CHARGE_SKILL_SPRITES\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
isSubLease : Boolean The value indicating whether the listing is a sublease | def sub_lease?
self.dig_for_boolean("isSubLease")
end | [
"def has_sub?\n #note: if the later part of a shift has been taken, self.sub still returns true so we also need to check self.sub.new_user.nil?\n !self.sub_requests.empty? #and sub.new_user.nil? #new_user in sub is only set after sub is taken. shouldn't check new_shift bcoz a shift can be deleted from db. -H\n end",
"def is_sub?\n @sub\n end",
"def sub?\n bool_property(:rnp_key_is_sub)\n end",
"def lease?\n @flbt_type == 'LEASERET'\n end",
"def expanding?\n @expanding ||= (!journal? && (from_aleph? || expanded_holdings.any?))\n end",
"def check_request_subdued?(check)\n if check[:subdue] && check[:subdue][:at] == \"publisher\"\n action_subdued?(check[:subdue])\n else\n false\n end\n end",
"def is_subtask?\n return @data.fields.issuetype.subtask\n end",
"def is_short_sale?\n self.dig_for_boolean(\"listingSummary\", \"isShortSale\")\n end",
"def whole_meal?\n @whole_meal\n end",
"def show_in_child_list?\n\t\t\ttrue\n\t\tend",
"def isSubmachineState\n ! ! @submachine\n end",
"def subclients?\n subclients.any?\n end",
"def removable?\n if self.status == 0 && self.postings_count == 0 #move expired posts to another database 7 days after expiration date to get an accurate count\n return true\n elsif self.location_id ==0 && Subcategory.find_all_by_subname_id(self.subname_id).size == 1\n return true\n else\n return false \n end\n end",
"def shortlist?\n !shortlist_complete\n end",
"def is_a_substate_of? x\n self.ancestors.include?(x)\n end",
"def subscription?\n @item.type == 'subscription'\n end",
"def in_renewal_span?\n (0..7).include?(end_date.to_date - Time.zone.now.to_date)\n end",
"def subtasks?\n !@issue.fields[\"subtasks\"].empty?\n end",
"def single_plan?\n !multiple_plans?\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
leaseTerm : String Indicates the Measurement. List price or Lease rate or rental value at which the sub unit is available | def lease_term
self.dig_for_string("leaseTerm")
end | [
"def find_lease(lease_descr, authorizer)\n debug \"central find_lease: '#{lease_descr.inspect}'\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def lease_type\n self.dig_for_string(\"leaseType\")\n end",
"def create_term\n puts \"Create term with name:'#{@name}', description:'#{@description}', available:'#{@available}' duration:'#{@duration}'\"\n bb_click TermsPage.create_term_btn\n bb_type CreateTermPage.name_txf, @name\n bb_click CreateTermPage.description_txf\n bb_type CreateTermPage.description_txf, @description\n if @available then bb_click CreateTermPage.available_yes_rdb else bb_click CreateTermPage.available_no_rdb end\n if @duration.is_a? String\n if @duration.downcase.eql?('continuous') then bb_click CreateTermPage.continuous_rdb end\n elsif @duration.is_a? DateDuration\n bb_click CreateTermPage.select_date_rdb\n bb_check CreateTermPage.start_date_ckb\n bb_check CreateTermPage.end_date_ckb\n\n bb_clear CreateTermPage.start_date_txf\n bb_clear CreateTermPage.end_date_txf\n bb_type CreateTermPage.start_date_txf, @duration.start_date\n bb_type CreateTermPage.end_date_txf, @duration.end_date\n elsif @duration.is_a? Fixnum\n bb_click CreateTermPage.days_from_end_enrollment_rdb\n bb_type CreateTermPage.days_from_end_enrollment_txf, @duration\n end\n bb_click CreateTermPage.submit_btn\n accept_alert\n end",
"def modify_lease(lease_properties, lease, authorizer)\n debug \"central modify_lease: '#{lease_properties.inspect}' - '#{lease.inspect}'\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def add_lease(l_id)\n @leases = (@leases || '') + \"#{l_id} \"\n end",
"def subscription_term; end",
"def source_term; @terms[@source]; end",
"def term=(value)\n @term = value\n end",
"def update_lease_from_rspec(lease_el, authorizer)\n debug \"central update_lease_from_rspec: leases:'#{lease_el.inspect}'\"\n if (lease_el[:valid_from].nil? || lease_el[:valid_until].nil?)\n raise UnavailablePropertiesException.new \"Cannot create lease without ':valid_from' and 'valid_until' properties\"\n end\n\n begin\n raise UnavailableResourceException unless UUID.validate(lease_el[:id])\n lease = find_lease({:uuid => lease_el[:id]}, authorizer)\n return { lease_el[:id] => lease }\n rescue UnavailableResourceException\n domain = lease_el[:component_manager_id].split('+')[1]\n subauthority = @subauthorities[domain]\n raise UnknownResourceException.new \"At least one of the requested components do not belong in a known subauthority.\" if subauthority.nil? || subauthority.empty?\n\n url = \"#{subauthority[:address]}resources/leases\"\n\n options = {}\n options[:name] = lease_el[:client_id] if lease_el[:client_id]\n options[:urn] = lease_el[:urn] if lease_el[:urn]\n options[:account] = lease_el[:account]\n options[:valid_from] = lease_el[:valid_from]\n options[:valid_until] = lease_el[:valid_until]\n options[:components] = lease_el[:components]\n\n http, request = prepare_request(\"POST\", url, authorizer, subauthority, options)\n\n begin\n out = http.request(request)\n o = JSON.parse(out.body, symbolize_names: true)\n if o[:exception]\n error \"lease '#{lease_el[:client_id]}' failed: code: #{o[:exception][:code]} msg: #{o[:exception][:reason]}\"\n raise UnavailableResourceException.new \"Cannot create '#{lease_el[:client_id]}', #{o[:exception][:reason]}\"\n else\n o = o[:resource_response][:resource] || o[:resource_response][:resources]\n o[:component_manager_id] = lease_el[:component_manager_id]\n end\n lease = {(\"#{lease_el[:component_manager_id]}_#{lease_el[:client_id]}\") => o}\n rescue Errno::ECONNREFUSED\n debug \"connection to #{url} refused.\"\n end\n lease\n end\n end",
"def enable_lease(lease, component)\n debug \"enable_lease: lease: '#{lease.inspect}' component: '#{component.inspect}'\"\n\n @leases ||= {}\n\n OmfCommon.comm.subscribe(component.name) do |resource|\n unless resource.error?\n\n create_timer = EventMachine::Timer.new(lease[:valid_from] - Time.now) do\n @leases[lease] = {} unless @leases[lease]\n @leases[lease] = { component.id => {:start => create_timer} }\n\n #create_resource(resource, lease, :node, {hrn: component.name, uuid: component.uuid})\n create_resource(resource, lease, component)\n end\n else\n raise UnknownResourceException.new \"Cannot find resource's pubsub topic: '#{resource.inspect}'\"\n #error res.inspect\n end\n end\n end",
"def release_lease(lease)\n debug \"release_lease: lease:'#{lease.inspect}'\"\n unless lease.is_a? OMF::SFA::Model::Lease\n raise \"Expected Lease but got '#{lease.inspect}'\"\n end\n\n slice = OMF::SFA::Model::Slice.first({account_id: lease.account.id})\n slice_components = if slice then slice.components else [] end\n slice_component_ids = []\n slice_components.each do |sc|\n slice_component_ids << sc.id\n end\n lease.components.each do |c|\n c.destroy unless (c.parent_id.nil? or slice_component_ids.include? c.id)# Destroy all the children and leave the parent intact\n c.remove_lease(lease) unless c.parent_id.nil?\n lease.remove_component(c) unless c.parent_id.nil?\n end\n \n if lease.status == 'active'\n @liaison.on_lease_end(lease)\n end\n\n lease.valid_until <= Time.now ? lease.status = \"past\" : lease.status = \"cancelled\"\n l = lease.save\n delete_lease_events_from_event_scheduler(lease) if l\n l\n end",
"def find_lease(lease_descr, lease_oproperties, authorizer)\n if lease_oproperties.empty?\n lease = OMF::SFA::Resource::OLease.first(lease_descr)\n raise UnavailableResourceException.new \"Unknown lease '#{lease_descr.inspect}'\" if lease.nil?\n authorizer.can_view_lease?(lease)\n return lease\n end\n leases = OMF::SFA::Resource::OLease.all(lease_descr)\n leases.each do |l|\n if (l[:valid_from] == lease_oproperties[:valid_from] &&\n l[:valid_until] == lease_oproperties[:valid_until])\n authorizer.can_view_lease?(l)\n return l\n end\n end\n raise UnavailableResourceException.new \"Unknown lease '#{lease_descr.inspect}'\"\n end",
"def term\n return @term\n end",
"def find_or_create_lease(lease_descr, authorizer)\n debug \"central find_or_create_lease: '#{lease_descr.inspect}'\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def enrollment_term\n self.course.enrollment_term\n end",
"def request_calc_lease_rent(lbtt)\n # Pass annual rent if all the rent values are declared to be the same, else pass the individual years' data\n if lbtt.rent_for_all_years == 'Y'\n { 'ins1:AnnualRent': lbtt.annual_rent }\n else\n { 'ins1:RentalYears': { 'ins1:Years': lbtt.yearly_rents.map(&:request_save_for_calc) } }\n end\n end",
"def to_term\n Upl::Term.new to_term_t\n end",
"def find_or_create_lease(lease_descr, authorizer)\n debug \"find_or_create_lease: '#{lease_descr.inspect}'\"\n begin\n return find_lease(lease_descr, authorizer) # an uparxei epistrepse to\n rescue UnavailableResourceException\n end\n raise InsufficientPrivilegesException unless authorizer.can_create_resource?(lease_descr, 'lease') # am_authorizer\n lease = OMF::SFA::Model::Lease.create(lease_descr) # alliws dimiourgise to\n\n raise UnavailableResourceException.new \"Cannot create '#{lease_descr.inspect}'\" unless lease\n @scheduler.add_lease_events_on_event_scheduler(lease) \n @scheduler.list_all_event_scheduler_jobs #debug messages only\n lease\n # lease = create_resource(lease_descr, 'Lease', lease_properties, authorizer)\n end",
"def update_lease_from_rspec(lease_el, authorizer)\n\n lease_properties = {:valid_from => Time.parse(lease_el[:valid_from]), :valid_until => Time.parse(lease_el[:valid_until])}\n\n begin\n raise UnavailableResourceException unless UUID.validate(lease_el[:id])\n lease = find_lease({:uuid => lease_el[:id]}, {}, authorizer)\n if lease.valid_from != lease_properties[:valid_from] || lease.valid_until != lease_properties[:valid_until]\n lease = modify_lease(lease_properties, lease, authorizer)\n return { lease_el[:id] => lease }\n else\n return { lease_el[:id] => lease }\n end\n rescue UnavailableResourceException\n lease_descr = {:name => authorizer.account.name}\n lease = find_or_create_lease(lease_descr, lease_properties, authorizer)\n return { lease_el[:id] => lease }\n end\n\n #unless lease_el[:uuid].nil?\n # lease = find_lease({:uuid => lease_el[:uuid]}, {}, authorizer)\n # raise UnavailableResourceException.new \"Unknown lease uuid'#{lease_el[:uuid]}'\" unless lease\n # if lease.valid_from != lease_properties[:valid_from] || lease.valid_until != lease_properties[:valid_until]\n # lease = modify_lease(lease_properties, lease, authorizer)\n # { lease_el[:leaseID] => lease }\n # else\n # { lease_el[:leaseID] => lease }\n # end\n #else\n # lease_descr = {:name => authorizer.account.name}\n # lease = find_or_create_lease(lease_descr, lease_properties, authorizer)\n # { lease_el[:leaseID] => lease }\n #end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
leaseType : String The type of lease for a listing | def lease_type
self.dig_for_string("leaseType")
end | [
"def lease_term\n self.dig_for_string(\"leaseTerm\")\n end",
"def add_lease(l_id)\n @leases = (@leases || '') + \"#{l_id} \"\n end",
"def determine_lease_type\n return \"user\" if self.inherited_read_users.present?\n group = self.inherited_read_groups.first\n return nil if group.nil?\n return \"ip\" if IPAddr.new(group) rescue false\n return \"local\" if Admin::Group.exists? group\n return \"external\"\n end",
"def lease?\n @flbt_type == 'LEASERET'\n end",
"def find_lease(lease_descr, lease_oproperties, authorizer)\n if lease_oproperties.empty?\n lease = OMF::SFA::Resource::OLease.first(lease_descr)\n raise UnavailableResourceException.new \"Unknown lease '#{lease_descr.inspect}'\" if lease.nil?\n authorizer.can_view_lease?(lease)\n return lease\n end\n leases = OMF::SFA::Resource::OLease.all(lease_descr)\n leases.each do |l|\n if (l[:valid_from] == lease_oproperties[:valid_from] &&\n l[:valid_until] == lease_oproperties[:valid_until])\n authorizer.can_view_lease?(l)\n return l\n end\n end\n raise UnavailableResourceException.new \"Unknown lease '#{lease_descr.inspect}'\"\n end",
"def listing_type\n self.dig_for_string(\"listingSummary\", \"listingType\")\n end",
"def lease\n @watch.objects.find { |o| o.name == \"lease\" }.val\n end",
"def lease_id\n properties[\"x-ms-lease-id\"]\n end",
"def lease\n @lease\n end",
"def request_calc_lease(output, lbtt, calc_type)\n Rails.logger.info(\"Sending lease type calculation request for #{calc_type}\")\n\n # put basic request together\n lease_details = output['ins1:LeaseDetails'] = {\n 'ins1:PropertyType': lbtt.lookup_ref_data_value(:property_type, lbtt.property_type || '3'),\n 'ins1:Reliefs': request_reliefs(lbtt, calc_type),\n 'ins1:LeaseStartDate': DateFormatting.to_xml_date_format(lbtt.lease_start_date),\n 'ins1:LeaseEndDate': DateFormatting.to_xml_date_format(lbtt.lease_end_date)\n }.merge!(request_calc_lease_rent(lbtt))\n\n # child part of the request\n lease_details['ins1:TransactionDetails'] = request_calc_lease_tr_details(lbtt, calc_type)\n end",
"def update_lease_from_rspec(lease_el, authorizer)\n\n lease_properties = {:valid_from => Time.parse(lease_el[:valid_from]), :valid_until => Time.parse(lease_el[:valid_until])}\n\n begin\n raise UnavailableResourceException unless UUID.validate(lease_el[:id])\n lease = find_lease({:uuid => lease_el[:id]}, {}, authorizer)\n if lease.valid_from != lease_properties[:valid_from] || lease.valid_until != lease_properties[:valid_until]\n lease = modify_lease(lease_properties, lease, authorizer)\n return { lease_el[:id] => lease }\n else\n return { lease_el[:id] => lease }\n end\n rescue UnavailableResourceException\n lease_descr = {:name => authorizer.account.name}\n lease = find_or_create_lease(lease_descr, lease_properties, authorizer)\n return { lease_el[:id] => lease }\n end\n\n #unless lease_el[:uuid].nil?\n # lease = find_lease({:uuid => lease_el[:uuid]}, {}, authorizer)\n # raise UnavailableResourceException.new \"Unknown lease uuid'#{lease_el[:uuid]}'\" unless lease\n # if lease.valid_from != lease_properties[:valid_from] || lease.valid_until != lease_properties[:valid_until]\n # lease = modify_lease(lease_properties, lease, authorizer)\n # { lease_el[:leaseID] => lease }\n # else\n # { lease_el[:leaseID] => lease }\n # end\n #else\n # lease_descr = {:name => authorizer.account.name}\n # lease = find_or_create_lease(lease_descr, lease_properties, authorizer)\n # { lease_el[:leaseID] => lease }\n #end\n end",
"def update_lease(lease, description)\n debug \"modify_lease: lease:'#{lease.inspect}' - #{description.inspect}\"\n unless lease.is_a? OMF::SFA::Model::Lease\n raise \"Expected Lease but got '#{lease.inspect}'\"\n end\n description[:valid_until] = Time.parse(description[:valid_until]) if description[:valid_until] && description[:valid_until].kind_of?(String)\n description[:valid_from] = Time.parse(description[:valid_from]) if description[:valid_from] && description[:valid_from].kind_of?(String)\n\n if (description[:valid_until] && description[:valid_until] < lease.valid_until) || (description[:valid_from] && description[:valid_from] > lease.valid_from)\n lease.update(description)\n return\n elsif description[:valid_until] && description[:valid_from]\n timeslot_from1 = description[:valid_from]\n timeslot_until1 = lease.valid_from\n timeslot_from2 = lease.valid_until\n timeslot_until2 = description[:valid_until]\n\n lease.components.each do |comp|\n next unless comp.parent.nil? # only unmanaged components should be checked\n unless component_available?(comp, timeslot_from1, timeslot_until1)\n raise UnavailableResourceException.new \"Resource '#{comp.name}' is not available for the requested timeslot.\"\n end\n unless component_available?(comp, timeslot_from2, timeslot_until2)\n raise UnavailableResourceException.new \"Resource '#{comp.name}' is not available for the requested timeslot.\"\n end\n end\n lease.update(description)\n return\n elsif description[:valid_from]\n timeslot_from = description[:valid_from]\n timeslot_until = lease.valid_from\n elsif description[:valid_until]\n timeslot_from = lease.valid_until\n timeslot_until = description[:valid_until]\n else\n raise \"Cannot update lease without valid_from or valid_until in the description.\"\n end \n\n lease.components.each do |comp|\n next unless comp.parent.nil? # only unmanaged components should be checked\n unless component_available?(comp, timeslot_from, timeslot_until)\n raise UnavailableResourceException.new \"Resource '#{comp.name}' is not available for the requested timeslot.\"\n end\n end\n\n lease.update(description)\n\n lease\n end",
"def type\n read_attribute(:type) || Figaro.env.meal_types.split.first\n end",
"def offering_type\n data.offering_type\n end",
"def find_or_create_lease(lease_descr, authorizer)\n debug \"find_or_create_lease: '#{lease_descr.inspect}'\"\n begin\n return find_lease(lease_descr, authorizer) # an uparxei epistrepse to\n rescue UnavailableResourceException\n end\n raise InsufficientPrivilegesException unless authorizer.can_create_resource?(lease_descr, 'lease') # am_authorizer\n lease = OMF::SFA::Model::Lease.create(lease_descr) # alliws dimiourgise to\n\n raise UnavailableResourceException.new \"Cannot create '#{lease_descr.inspect}'\" unless lease\n @scheduler.add_lease_events_on_event_scheduler(lease) \n @scheduler.list_all_event_scheduler_jobs #debug messages only\n lease\n # lease = create_resource(lease_descr, 'Lease', lease_properties, authorizer)\n end",
"def find_lease(lease_descr, authorizer)\n debug \"central find_lease: '#{lease_descr.inspect}'\"\n raise 'Method not implemented because the Central Manager just need to pass the same requisition to the other' \\\n ' brokers and create the concatenated results'\n end",
"def release_lease(lease)\n debug \"release_lease: lease:'#{lease.inspect}'\"\n unless lease.is_a? OMF::SFA::Model::Lease\n raise \"Expected Lease but got '#{lease.inspect}'\"\n end\n\n slice = OMF::SFA::Model::Slice.first({account_id: lease.account.id})\n slice_components = if slice then slice.components else [] end\n slice_component_ids = []\n slice_components.each do |sc|\n slice_component_ids << sc.id\n end\n lease.components.each do |c|\n c.destroy unless (c.parent_id.nil? or slice_component_ids.include? c.id)# Destroy all the children and leave the parent intact\n c.remove_lease(lease) unless c.parent_id.nil?\n lease.remove_component(c) unless c.parent_id.nil?\n end\n \n if lease.status == 'active'\n @liaison.on_lease_end(lease)\n end\n\n lease.valid_until <= Time.now ? lease.status = \"past\" : lease.status = \"cancelled\"\n l = lease.save\n delete_lease_events_from_event_scheduler(lease) if l\n l\n end",
"def update_lease_from_rspec(lease_el, authorizer)\n debug \"central update_lease_from_rspec: leases:'#{lease_el.inspect}'\"\n if (lease_el[:valid_from].nil? || lease_el[:valid_until].nil?)\n raise UnavailablePropertiesException.new \"Cannot create lease without ':valid_from' and 'valid_until' properties\"\n end\n\n begin\n raise UnavailableResourceException unless UUID.validate(lease_el[:id])\n lease = find_lease({:uuid => lease_el[:id]}, authorizer)\n return { lease_el[:id] => lease }\n rescue UnavailableResourceException\n domain = lease_el[:component_manager_id].split('+')[1]\n subauthority = @subauthorities[domain]\n raise UnknownResourceException.new \"At least one of the requested components do not belong in a known subauthority.\" if subauthority.nil? || subauthority.empty?\n\n url = \"#{subauthority[:address]}resources/leases\"\n\n options = {}\n options[:name] = lease_el[:client_id] if lease_el[:client_id]\n options[:urn] = lease_el[:urn] if lease_el[:urn]\n options[:account] = lease_el[:account]\n options[:valid_from] = lease_el[:valid_from]\n options[:valid_until] = lease_el[:valid_until]\n options[:components] = lease_el[:components]\n\n http, request = prepare_request(\"POST\", url, authorizer, subauthority, options)\n\n begin\n out = http.request(request)\n o = JSON.parse(out.body, symbolize_names: true)\n if o[:exception]\n error \"lease '#{lease_el[:client_id]}' failed: code: #{o[:exception][:code]} msg: #{o[:exception][:reason]}\"\n raise UnavailableResourceException.new \"Cannot create '#{lease_el[:client_id]}', #{o[:exception][:reason]}\"\n else\n o = o[:resource_response][:resource] || o[:resource_response][:resources]\n o[:component_manager_id] = lease_el[:component_manager_id]\n end\n lease = {(\"#{lease_el[:component_manager_id]}_#{lease_el[:client_id]}\") => o}\n rescue Errno::ECONNREFUSED\n debug \"connection to #{url} refused.\"\n end\n lease\n end\n end",
"def enable_lease(lease, component)\n debug \"enable_lease: lease: '#{lease.inspect}' component: '#{component.inspect}'\"\n\n @leases ||= {}\n\n OmfCommon.comm.subscribe(component.name) do |resource|\n unless resource.error?\n\n create_timer = EventMachine::Timer.new(lease[:valid_from] - Time.now) do\n @leases[lease] = {} unless @leases[lease]\n @leases[lease] = { component.id => {:start => create_timer} }\n\n #create_resource(resource, lease, :node, {hrn: component.name, uuid: component.uuid})\n create_resource(resource, lease, component)\n end\n else\n raise UnknownResourceException.new \"Cannot find resource's pubsub topic: '#{resource.inspect}'\"\n #error res.inspect\n end\n end\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
loanPayment : Decimal The current loan payment value on the property being paid by the owner | def loan_payment
self.dig_for_decimal("loanPayment")
end | [
"def loan_amount\n if amount.to_f > property_value.to_f\n errors.add(:amount,'loan amount may not be greater than the property value')\n end\n end",
"def update_loan\n loan.own_investment_property = own_investment_property\n amount = CalculateLoanAmountService.call(loan)\n\n if loan.refinance? && loan.cash_out.present?\n if amount - loan.amount + loan.cash_out >= 0\n loan.cash_out = loan.cash_out + amount - loan.amount\n else\n loan.cash_out = 0\n end\n end\n\n loan.amount = amount\n loan.save!\n end",
"def debt_payment\n loan_proceeds = 0\n debt_rate * loan_proceeds\n end",
"def present_value\n # Payoff amount = 0, we’re assuming a fully amortizing loan\n payoff_amount = 0\n end",
"def monthly_payment(loan_years, interest_rate)\n downpayment = minimum_downpayment * asking_price\n\n mortgage = (asking_price - downpayment) * ((1.0 + interest_rate) ** loan_years)\n\n annual_price = mortgage / loan_years\n annual_price += annual_property_tax\n\n return annual_price / 12\n end",
"def payment_value\n currency.to_int(selected_payment)\n end",
"def set_payment_amount\n payment.amount = total if payment\n end",
"def pay(payment)\n if payment >= @total\n change = payment - @total\n @total = 0.0\n \"Your change is #{format_money(change)}\"\n else\n @total -= payment\n \"Your new total is #{format_money(@total)}\"\n end\n end",
"def sum_paid_to_owner\n return nil if object.sum_paid_to_owner.nil?\n h.integer_to_decimal( object.sum_paid_to_owner )\n end",
"def amount_paid\n amount = Monkey::Accounting::Amount.zero\n if paid?\n (e = payment_entry).transactions.select { |t|\n t.account != business_account\n }.each { |t|\n amount += t.amount || e.null_amount\n }\n end\n amount\n end",
"def paid_balance\n average = average_amount\n paid_infos.each do |k, v|\n paid_infos[k] = v - average\n end\n end",
"def calculate_payment\n x = @periodic_rate * @principal * ((1 + @periodic_rate)**@periods)\n y = ((1 + @periodic_rate)**@periods) - 1\n (x / y).round(2)\n end",
"def points_payment\n\t\t(points || 0) * amount / 100\n\tend",
"def outstanding_balance\n paid? ? 0.to_d : price - (amount_paid || 0.to_d)\n end",
"def apr\n payment_ratio = self.monthly_payment_with_fees / self.loan_amount\n f = lambda { |k| (k**(self.period + 1) - (k**self.period * (payment_ratio + 1)) + payment_ratio) }\n f_deriv = lambda { |k| ((self.period + 1) * k**self.period) - (self.period * (payment_ratio + 1) * k**(self.period - 1)) }\n\n root = newton_raphson(f, f_deriv, self.monthly_interest_rate + 1)\n 100 * 12 * (root - 1).to_f\n end",
"def current_payment_fee\n payment.try(:fee) || 0\n end",
"def balance\n amount_paid - amount_due\n end",
"def payment_amount\n params['asking_price'] = params['asking_price'].to_f\n params['down_payment'] = params['down_payment'].to_f\n params['amortization_period'] = params['amortization_period'].to_f\n\n insurance_cost = calculate_insurance_amount(params)\n payment_amount = calculate_payment_amount(params, insurance_cost, @@interest_rate)\n json_response(amount: payment_amount)\n end",
"def set_amount\n self.amount = input_invoice.payment_amount\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
maxContiguousArea : Decimal The largest amount of open space available in a commercial building | def max_contiguous_area
self.dig_for_decimal("maxContiguousArea")
end | [
"def cost_with_max_global_in_left_side\n (@buildings_calculator.max_height * (@buildings_calculator.left_width + 1)) +\n (@buildings_calculator.max_right * @buildings_calculator.right_width)\n end",
"def cost_with_max_global_in_right_side\n (@buildings_calculator.max_left * @buildings_calculator.left_width) +\n (@buildings_calculator.max_height * (@buildings_calculator.right_width + 1))\n end",
"def max_capacity\n CAPACITY\n end",
"def common_area_factor\n self.dig_for_decimal(\"commonAreaFactor\")\n end",
"def does_not_exceed_max_resistance?\n total_resistance <= area.max_resistance\n end",
"def max_completeness\n\t\t\tmc = 0\n\t\t\teach_domain do |domain|\n\t\t\t\tsmc = domain.completeness\n\t\t\t\tmc = smc if smc > mc\n\t\t\tend\n\t\t\tmc\n\t\tend",
"def max_resistance\n 50 # Currently there is no requirement to allow deviating from this value.\n end",
"def gallons\n (area / ONE_GALLON_COVERS).ceil\n end",
"def max_completeness\n\t\t\tmc = 0\n\t\t\teach_sequencehit do |subhit|\n\t\t\t\tsmc = subhit.max_completeness\n\t\t\t\tmc = smc if smc > mc\n\t\t\tend\n\t\t\tmc\n\t\tend",
"def maximum_capacity\n read_attribute(:maximum_capacity) || room.try(:capacity)\n end",
"def min_divisible_area\n self.dig_for_decimal(\"minDivisibleArea\")\n end",
"def cost_of_two_banners_when_max_is_the_last\n (@buildings_calculator.max_height * 1) +\n (@buildings_calculator.max_left * (@buildings_calculator.width - 1))\n end",
"def cbl_max\n return actor_block_settings(:max_cbl) * 0.01 if actor?\n return enemy_block_settings(:max_cbl) * 0.01\n end",
"def max_cell_number\n _cell_number MAX_CONFLUENCY\n end",
"def max_production\n @max_production ||= max_load_curve.sum\n end",
"def compute_free_places\n max_participants - compute_occupied_places\n end",
"def suggested_nodes_per_district(node_capacity, active_gear_pct)\n # note that integer division gets us the floor value\n max = MAX_DISTRICT_GEARS * active_gear_pct / (100 * node_capacity)\n max = 1 if max < 1 # should always at least have 1\n max\n end",
"def largest_area(input_array)\n max = 0\n \n input_array.each do |item|\n area = item[0] * item[1] # 1 * 2\n if area > max\n max = area\n end\n end\n return max\n end",
"def get_floor_area\n return @total_floor_area\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
maximumLeaseRate : Decimal The Maximum Lease Rate associated with the listing | def maximum_lease_rate
self.dig_for_decimal("maximumLeaseRate")
end | [
"def minimum_lease_rate\n self.dig_for_decimal(\"minimumLeaseRate\")\n end",
"def max_price\n Money.new(MAX_OFFER_CENTS, self.default_currency)\n end",
"def autosizedMaximumOutdoorAirFlowRate\n\n return self.model.getAutosizedValue(self, 'Maximum Outdoor Air Flow Rate', 'm3/s')\n \n end",
"def max_salary\n approx_salaries.maximum(:max_salary)\n end",
"def autosizedMaximumFlowRate\n\n return self.model.getAutosizedValue(self, 'Design Size Maximum Flow Rate', 'm3/s')\n \n end",
"def max_price\n (self.Original_Price / 100) * 150 if self.Original_Price\n end",
"def max_reward_price\n @max_reward_price_cache ||= if self.offers_reward?\n result = Money.new(0, self.default_currency)\n self.rewards.visible.each {|reward| result = Money.max(result, reward.price)} # # .convert_to(self.default_currency)\n result\n end\n end",
"def max_rating\n configuration.max_rating\n end",
"def get_max_gain\n ((get_amount * @target) - @volume - get_total_commission).round(2)\n end",
"def maximum_weight\n max = 0\n self.configuration.shipping_costs.each do |sc|\n max = sc[:weight_max] if sc[:weight_max] > max\n end\n return max.to_f\n end",
"def maximum_discount_price\n return self.quantity_price(self.existing_discount_quantity_range.max)\n end",
"def dealer_cap()\n\tmax = 18\n\treturn max\nend",
"def max_consumption_price\n dataset_get(:max_consumption_price) || marginal_costs\n end",
"def max_card_value\n Maximizer.call(prices, balance, capacity)\n end",
"def max_speed\n @max_speed ||= read_attribute('max_speed').to_i\n end",
"def max_rate_value\n options[:stars]\n end",
"def calculate_max_mortgage(params, interest_rate)\n number_of_payments = SCHEDULE_MAP[params['payment_schedule']] * params['amortization_period']\n nominal_interest_rate = (interest_rate / SCHEDULE_MAP[params['payment_schedule']]) / 100\n\n numerator = params['payment_amount'] * ((1 + nominal_interest_rate)**number_of_payments - 1)\n denominator = nominal_interest_rate * (1 + nominal_interest_rate)**number_of_payments\n\n max_mortgage = (numerator / denominator).round(2)\n max_mortgage += params['down_payment'] if params['down_payment'].present?\n max_mortgage\n end",
"def maximum_price(price)\n set_limiting_value(:maximum, :price, price)\n end",
"def max_resistance\n 50 # Currently there is no requirement to allow deviating from this value.\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
minDivisibleArea : Decimal The minimum space which can be leased | def min_divisible_area
self.dig_for_decimal("minDivisibleArea")
end | [
"def smallest_denomination; end",
"def smallest_area\n [side_1_area, side_2_area, side_3_area].min\n end",
"def smallest_multiple\n\tlcm = 1\n\n\t(2..20).each do |x|\n\t\tlcm *= x / gcd(lcm, x)\n\tend\n\n\tlcm\n\t\nend",
"def area_in_sqm\n (self.area * 0.09290304).round\n end",
"def min_district_fe(required_capacity, fm_capacity)\n # How many scooters left after FM is done?\n fm_oversubscription = required_capacity - fm_capacity\n\n # (Whole) FEs needed to complete the work\n (fm_oversubscription.to_f / @fleet_engineer_capacity).ceil\n end",
"def does_not_exceed_max_resistance?\n total_resistance <= area.max_resistance\n end",
"def common_area_factor\n self.dig_for_decimal(\"commonAreaFactor\")\n end",
"def min_size_heuristic(amount,comb,coins)\n rem = amount-comb.sum\n return Infinity if rem < 0\n comb.size+rem.to_f/(coins.select{|c|c<=rem&&c<=comb.max}.max) rescue comb.size\nend",
"def score_area(area)\n 50\n end",
"def adjusted_granule_count\n [DEFAULT_MAX_ORDER_SIZE, granule_count].min\n end",
"def find_optimal_divisor(num_of_students)\n case num_of_students\n when num_of_students % 5 == 0\t\n \treturn 5\n when num_of_students % 4 == 0\n \treturn 4\n end\n\n if (num_of_students % 5) > (num_of_students % 4)\n \treturn 5\n else return 4\n end\nend",
"def min_submissions(total_workload, num_submissions)\n (num_submissions * @workload / total_workload).to_i\n end",
"def total_paper\n surface_area + smallest_area\n end",
"def d_min\n min, max = @b_min, @d\n \n binary_cut(min, max) do |val|\n get_newton_sum(val, @b) { |sum| sum > @f }\n end\n end",
"def mp_divisor(max_width)\n pmmp = $game_party.mmp\n if H87HUD_SETTINGS::HP_WIDTH_VAR > 0\n rate = H87HUD_SETTINGS::MP_WIDTH_VALUES[$game_variables[H87HUD_SETTINGS::HP_WIDTH_VAR]]\n else\n rate = 0.5\n end\n if pmmp * rate > max_width\n max_width.to_f / $game_party.mmp\n else\n rate\n end\n end",
"def constrain(size)\n if size < @floor\n @floor\n else\n @ceiling && size > @ceiling ? @ceiling : size\n end\n end",
"def round(value)\n ( (value.to_f + @min_margin) / @multiple_of ).ceil * @multiple_of\n end",
"def land_area_km\n land_area * SQUARE_MILES_TO_KILOMETERS if land_area\n end",
"def minimum_disk_size\n @partition_layout.inject(0) { |memo, elem|\n if elem.size_mb.is_a?(Integer)\n memo + elem.size_mb\n else\n memo + 1 # open ended partitions need to be at least 4MiB (arbitrary)\n end\n } \\\n + FIRST_PARTITION_OFFSET \\\n + 1\n end"
] | {
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.