query
stringlengths 7
9.5k
| document
stringlengths 10
1.07M
| negatives
listlengths 19
19
| metadata
dict |
---|---|---|---|
GET /api/v1/user_to_progresses GET /api/v1/user_to_progresses.json
|
def index
@api_v1_user_to_progresses = Api::V1::UserToProgress.all
end
|
[
"def index\n @progresses = @task.progresses\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @progresses }\n end\n end",
"def index\n @api_v1_progresses = Api::V1::Progress.all\n end",
"def index\n @progresses = Progress.all\n end",
"def index\n @goal_progresses = GoalProgress.all\n end",
"def index\n @requests = @user.requests\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requests }\n end\n end",
"def index\n @user_addresses = current_user.user_addresses\n end",
"def index\n @wish_progresses = WishProgress.all\n end",
"def index\n @borrow_requests = current_user.borrow_requests.actionable\n @pending_approvals = current_user.approvals.where(\"status = 'pending'\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @borrow_requests }\n end\n end",
"def user_addresses\n Endpoints::UserAddresses.new\n end",
"def index\n @user_reserve_stats = UserReserveStat.order('id DESC').page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @user_reserve_stats }\n end\n end",
"def pending \n @pending_users = User.where(isApproved:false).where(isDenied:false).paginate(:page => params[:pending_users_page], :per_page => 10)\n end",
"def index\n @week_availabilities = WeekAvailability.where(\"user_id = ?\", params[:user_id])\n @user = User.find(params[:user_id])\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @week_availabilities }\n end\n end",
"def index\n\t@user_reserves = UserReserve.all\n end",
"def retrieve_user_consents(user_id)\n start.uri('/api/user/consent')\n .url_parameter('userId', user_id)\n .get()\n .go()\n end",
"def user_report\n user = User.find_by_username(params[:username])\n raise Discourse::InvalidParameters.new(:username) if !user\n\n ignored_ids = DiscourseFingerprint.get_ignores(user)\n\n fingerprints =\n Fingerprint\n .where(user: user)\n .where.not(value: FlaggedFingerprint.select(:value).where(hidden: true))\n .order(updated_at: :desc)\n\n user_ids =\n Fingerprint\n .matches\n .where(value: fingerprints.pluck(:value))\n .to_h { |match| [match.value, match.user_ids - [user.id]] }\n\n users = User.where(id: user_ids.values.flatten.uniq).or(User.where(id: ignored_ids))\n\n render json: {\n user: BasicUserSerializer.new(user, root: false),\n ignored_ids: ignored_ids,\n fingerprints:\n serialize_data(fingerprints, FingerprintSerializer, scope: { user_ids: user_ids }),\n users: users.map { |u| [u.id, BasicUserSerializer.new(u, root: false)] }.to_h,\n }\n end",
"def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend",
"def show\n @progress = @task.progresses.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @progress }\n end\n end",
"def pending\n @user = User.find(params[:id])\n end",
"def index\n @job_progresses = JobProgress.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /api/v1/user_to_progresses/1 DELETE /api/v1/user_to_progresses/1.json
|
def destroy
@api_v1_user_to_progress.destroy
respond_to do |format|
format.html { redirect_to api_v1_user_to_progresses_url, notice: 'User to progress was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @ipaddr.destroy\n respond_to do |format|\n format.html { redirect_to ipaddrs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @progress = @task.progresses.find(params[:id])\n @progress.destroy\n\n respond_to do |format|\n format.html { redirect_to task_progresses_url(@task) }\n format.json { head :no_content }\n end\n end",
"def delete_guest_access_portal(args = {}) \n delete(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend",
"def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend",
"def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_progress.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_progresses_url, notice: 'Progress was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @useracct = Useracct.find(params[:id])\n @useracct.destroy\n\n respond_to do |format|\n format.html { redirect_to useraccts_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_request = UserRequest.find(params[:id])\n @user_request.destroy\n\n respond_to do |format|\n format.html { redirect_to user_requests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_reserve_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to user_reserve_stats_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reserve_stat_has_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(reserve_stat_has_users_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_reserve_stat.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reserve_stats_url) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_visit = UserVisit.find(params[:id])\n @user_visit.destroy\n\n respond_to do |format|\n format.html { redirect_to user_visits_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @address = current_user.addresses.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_path(current_user) }\n format.json { head :no_content }\n end\n end",
"def destroy\n if @api_v1_address.destroy\n render json: 'deletado'\n end\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @userreq = Userreq.find(params[:id])\n @userreq.destroy\n\n respond_to do |format|\n format.html { redirect_to current_user }\n format.json { head :no_content }\n end\n end",
"def delete(user)\n Rails.logger.debug \"Call to user.delete\"\n reqUrl = \"/api/user/#{self.email}\" #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",
"def destroy\n @api_v1_pending.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_pendings_url, notice: 'Pending was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /supports GET /supports.json
|
def index
@supports = Support.all
end
|
[
"def index \n @supports = Support.all\n end",
"def index\n @functionalsupports = FunctionalSupport.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @functionalsupports }\n end\n end",
"def supports_json?; end",
"def supports_json?\n false\n end",
"def supports?(feature)\n adapter.supports? feature\n end",
"def supported?\n Serializer.supported?(resource)\n end",
"def index\n respond_to do |format|\n format.html{ @case_supports = CaseSupport.visible}\n end\n end",
"def prefer_json?\n prefered_http_accept == \"application/json\"\n end",
"def supports?(feature)\n case feature.to_sym\n when :list_terms then true\n when :rdfstar then true\n when :snapshots then false\n else super\n end\n end",
"def supported?(format)\n case format.to_s\n when 'json'\n JSON.supported?\n when 'xml'\n XML.supported?\n else\n raise OEmbed::FormatNotSupported, format\n end\n end",
"def json_request?()\n request.format.json?\n end",
"def responds_with_json?\n response.content_type == mime_type(:json)\n end",
"def index\n @settlebuddy_supports = SettlebuddySupport.all\n end",
"def supports?(feature)\n features.include?(feature)\n end",
"def is_supported\n return @is_supported\n end",
"def supports_api\n license = License.get\n\n if license and not license.supports_api?\n errors.add :license, \" - this product does not support API access\"\n end\n end",
"def accepted_api_formats\n @accepted_api_formats || [:xml, :json]\n end",
"def get_featured\n render json: Event.where(is_featured: true), status: :ok\n end",
"def supported?\n support_type?\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Wait for a request, process it, publish the response and exit
|
def process_request!
job = Thread.current[:redis_blocking].brpop(Scales::Storage::REQUEST_QUEUE, 0).last
id, response = nil, nil
Thread.current[:post_process_queue] = []
id, response = process!(job)
post_process!(job)
@status.put_response_in_queue!(response)
Thread.current[:redis_nonblocking].publish(Scales::Storage::RESPONSE_CHANNEL, JSON.generate(response))
[id, response]
end
|
[
"def process!\n @start = Time.now\n http = EventMachine::HttpRequest.new(url,\n connect_timeout: timeout,\n inactivity_timeout: timeout,\n )\n\n @request = http.public_send(method,\n request_options\n )\n\n @request.callback { @completed = true; @runtime = Time.now - @start; @start = nil }\n @request.errback { @completed = @error = true; @runtime = Time.now - @start; @start = nil}\n self\n end",
"def wait(request)\n @mutex.synchronize { internal_wait(request) }\n end",
"def service(request, response)\n process(request, response)\n end",
"def finish_response; end",
"def response_thread\n @responses_count.increment\n\n Thread.new do\n yield\n ensure\n @responses_count.decrement\n @eof_lock.synchronize do\n @eof_wait.signal if @responses_count.value == 0\n end\n end\n end",
"def listen\n while true\n data = $BLIX_REQUEST.pop\n response = do_handle(body)\n if response\n puts \"[DummyServer] response: data=#{data}, options=#{options}\" if $DEBUG\n $BLIX_RESPONSE.push(data)\n end\n end\n end",
"def request_loop\n @request_queue.receive_messages.each do |msg|\n yield(get_request(msg))\n end\n end",
"def process_response\n job = message.job\n job.data = message.data\n job.message = message.message\n\n if message.ok?\n job.proceed!\n else\n job.error!\n end\n end",
"def execute_streaming(request, options: {}, &block)\n redirector = Puppet::HTTP::Redirector.new(options.fetch(:redirect_limit, @default_redirect_limit))\n\n basic_auth = options.fetch(:basic_auth, nil)\n unless basic_auth\n if request.uri.user && request.uri.password\n basic_auth = { user: request.uri.user, password: request.uri.password }\n end\n end\n\n redirects = 0\n retries = 0\n response = nil\n done = false\n\n while !done do\n connect(request.uri, options: options) do |http|\n apply_auth(request, basic_auth)\n\n # don't call return within the `request` block\n http.request(request) do |nethttp|\n response = Puppet::HTTP::ResponseNetHTTP.new(request.uri, nethttp)\n begin\n Puppet.debug(\"HTTP #{request.method.upcase} #{request.uri} returned #{response.code} #{response.reason}\")\n\n if redirector.redirect?(request, response)\n request = redirector.redirect_to(request, response, redirects)\n redirects += 1\n next\n elsif @retry_after_handler.retry_after?(request, response)\n interval = @retry_after_handler.retry_after_interval(request, response, retries)\n retries += 1\n if interval\n if http.started?\n Puppet.debug(\"Closing connection for #{Puppet::HTTP::Site.from_uri(request.uri)}\")\n http.finish\n end\n Puppet.warning(_(\"Sleeping for %{interval} seconds before retrying the request\") % { interval: interval })\n ::Kernel.sleep(interval)\n next\n end\n end\n\n if block_given?\n yield response\n else\n response.body\n end\n ensure\n # we need to make sure the response body is fully consumed before\n # the connection is put back in the pool, otherwise the response\n # for one request could leak into a future response.\n response.drain\n end\n\n done = true\n end\n end\n end\n\n response\n end",
"def pre_process\n Goliath::Connection::AsyncResponse\n end",
"def process!(response_data={})\n @client.post(\"#{path}/process\", response_data)\n end",
"def wait_for_response(options)\n until !@buffer.empty? do\n end\n @buffer.each { |resp| puts_message(resp) }\n @buffer.clear\n input unless !!options[:background]\n end",
"def handle_async(request,response,handle,&read_block)\n if EM::reactor_running? \n process_request(request,response,true,&read_block) \n else\n EM.synchrony do\n process_request(request,response,true,&read_block)\n EM.stop\n end\n end\n end",
"def wait_until_finished\n @active_requests.dup.each do |n|\n n.join\n end\n end",
"def run\n @response ||= build_response catch_halt{ @handler.run }\n end",
"def process_request req, res\n req_headers = req.header\n req_query = req.query\n req_body = Oaf::HTTPServer.get_request_body req\n file = Oaf::Util.get_request_file(@options[:path], req.path,\n req.request_method, @options[:default_response])\n out = Oaf::Util.get_output(file, req.path, req_headers, req_body,\n req_query)\n res_headers, res_status, res_body = Oaf::HTTPServer.parse_response out\n Oaf::HTTPServer.set_response! res, res_headers, res_body, res_status\n end",
"def wait_all\n while outstanding > 0\n wait_for_reply\n end\n end",
"def run(sock)\n while true\n req = create_request(@config)\n res = create_response(@config)\n server = self\n begin\n timeout = @config[:RequestTimeout]\n while timeout > 0\n break if sock.to_io.wait_readable(0.5)\n break if @status != :Running\n timeout -= 0.5\n end\n raise HTTPStatus::EOFError if timeout <= 0 || @status != :Running\n raise HTTPStatus::EOFError if sock.eof?\n req.parse(sock)\n res.request_method = req.request_method\n res.request_uri = req.request_uri\n res.request_http_version = req.http_version\n res.keep_alive = req.keep_alive?\n server = lookup_server(req) || self\n if callback = server[:RequestCallback]\n callback.call(req, res)\n elsif callback = server[:RequestHandler]\n msg = \":RequestHandler is deprecated, please use :RequestCallback\"\n @logger.warn(msg)\n callback.call(req, res)\n end\n server.service(req, res)\n rescue HTTPStatus::EOFError, HTTPStatus::RequestTimeout => ex\n res.set_error(ex)\n rescue HTTPStatus::Error => ex\n @logger.error(ex.message)\n res.set_error(ex)\n rescue HTTPStatus::Status => ex\n res.status = ex.code\n rescue StandardError => ex\n @logger.error(ex)\n res.set_error(ex, true)\n ensure\n if req.request_line\n if req.keep_alive? && res.keep_alive?\n req.fixup()\n end\n res.send_response(sock)\n server.access_log(@config, req, res)\n end\n end\n break if @http_version < \"1.1\"\n break unless req.keep_alive?\n break unless res.keep_alive?\n end\n end",
"def outlet\n loop do\n http = Net::HTTP.new(@logplex_url.host, @logplex_url.port)\n http.set_debug_output($stdout) if ENV['DEBUG']\n http.use_ssl = true if @logplex_url.scheme == 'https'\n begin\n http.start do |conn|\n num_reqs = 0\n while num_reqs < @max_reqs_per_conn\n #Blocks waiting for a request.\n req = @request_queue.deq\n @req_in_flight += 1\n resp = nil\n begin\n Timeout::timeout(@conn_timeout) {resp = conn.request(req)}\n rescue => e\n $stdout.puts(\"at=req-error msg=#{e.message}\") if ENV['DEBUG']\n next\n ensure\n @req_in_flight -= 1\n end\n num_reqs += 1\n $stdout.puts(\"at=req-sent status=#{resp.code}\") if ENV['DEBUG']\n end\n end\n rescue => e\n $stdout.puts(\"at=req-error msg=#{e.message}\") if ENV['DEBUG']\n ensure\n http.finish if http.started?\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Allows adding a new message to the Flash hash in controllers by providing a single type argument which will use translations to build the message. There are 2 ways of storing flash messages in translations : The first is to place translations under : flash... Ex: flash.tasks.create.success The second is to use a shared controller key : flash... Ex: flash.shared.create.success If no controller specific key exists, then the shared one will be picked up Translation options : All options passed to the `flash_message` helper will be forwarded to the `I18n::translate` call, except for the `:model` option that will be first converted to a string with .class.model_name.human, which will use default activerecord translations Example : In TasksControllercreate :
|
def flash_message(type, options = {})
controller_path = "flash.#{ params[:controller] }.#{ params[:action] }.#{ type }"
shared_path = "flash.shared.#{ params[:action] }.#{ type }"
options[:model] = options[:model].class.model_name.human if options[:model]
options[:default] = I18n.t(shared_path, options)
flash[type] = I18n.t(controller_path, options)
end
|
[
"def flash_message(type, text)\n flash[type.to_sym] ||= []\n flash[type.to_sym] << text\n end",
"def flash_message(type, message)\n flash[type] ||= []\n flash[type] << message\n end",
"def add_flash_message(type, msg)\n if flash[type].nil?\n flash[type] = msg\n elsif flash[type].is_a?(Array)\n if msg.is_a?(Array)\n msg.each { |m| flash[type] << m }\n else\n flash[type] << msg\n end\n else\n f = [ flash[type] ]\n if msg.is_a?(Array)\n msg.each { |m| f << m }\n else\n f << msg\n end\n flash[type] = f\n end\n end",
"def localized_flash_message(kind, options = {})\n scope = options.delete(:scope) || self.class.flash_scope\n if scope\n options[:scope] = scope =~ /^controllers/ ? scope : \"controllers.#{scope}\"\n else\n options[:scope] = \"controllers.#{controller_name}\"\n end\n options[:default] = Array(options[:default]).unshift(kind.to_sym)\n message = I18n.t(kind, options)\n message.html_safe if message.present?\n end",
"def set_flash_message(key, kind, options = {})\n return unless flashing_format?\n\n message = find_message(kind, options)\n return if message.blank?\n\n if options[:now]\n flash.now[key] = message\n else\n flash[key] = message\n end\n end",
"def append_flash(kind, message)\n kind = kind.to_sym\n if leaf = flash[kind]\n flash[kind] = \"#{leaf} #{message}\"\n else\n flash[kind] = \"#{message}\"\n end\n end",
"def regular_now(type:, message:)\n @flash.now[type.to_sym] = message\n end",
"def set_flash_message(key, kind, options = {})\n message = find_message(kind, options)\n if options[:now]\n flash.now[key] = message if message.present?\n else\n flash[key] = message if message.present?\n end\n end",
"def set_flash_message(key, kind, now=false)\n flash_hash = now ? flash.now : flash\n flash_hash[key] = I18n.t(:\"#{resource_name}.#{kind}\",\n :scope => [:devise, controller_name.to_sym], :default => kind)\n end",
"def store_flash_message(message, type)\n if request.xhr?\n flash.now[type] = message\n else\n flash[type] = message\n end\n end",
"def set_flash_message!(key, kind, options = {})\n if is_flashing_format?\n set_flash_message(key, kind, options)\n end\n end",
"def otp_set_flash_message(key, kind, options = {})\n options[:scope] ||= \"devise.otp.#{controller_name}\"\n options[:default] = Array(options[:default]).unshift(kind.to_sym)\n options[:resource_name] = resource_name\n options = devise_i18n_options(options) if respond_to?(:devise_i18n_options, true)\n message = I18n.t(\"#{options[:resource_name]}.#{kind}\", **options)\n flash[key] = message if message.present?\n end",
"def set_flash_message!(key, kind, options = {})\n if is_flashing_format?\n set_flash_message(key, kind, options)\n end\n end",
"def set_flash_message(key, kind, options={})\n options[:scope] = \"devise.#{controller_name}\"\n options[:default] = Array(options[:default]).unshift(kind.to_sym)\n options[:resource_name] = resource_name\n options = devise_i18n_options(options) if respond_to?(:devise_i18n_options, true)\n message = I18n.t(\"#{resource_name}.#{kind}\", options)\n flash[key] = message if message.present?\nend",
"def flash_it(key = :success, style=nil)\n\n # default style is \"success\"\n (style = (key == :error ? :error : :success)) unless style\n\n # namespace lookup\n # User::SomethingController\n # => [\"user\", \"something\"]\n namespacing = self.class.to_s.split(\"::\").map{|x| x.underscore.gsub(\"_controller\", \"\")}\n\n #looking in flash_messages.user.something.action.key\n lookup = \"flash_messages.\"\n lookup << namespacing.join(\".\") << \".\"\n lookup << \"#{action_name}.\"\n lookup << \"#{key}\"\n\n #set the flash message\n flash[style] = t(lookup)\n end",
"def flash_message(type, message)\n \"<div class=\\\"alert-message #{type}\\\"><p>#{message}</p></div>\".html_safe\n end",
"def flash_t(k, v, global: false)\n log_flash k, v\n flash[k] = case\n when global\n I18n.t(\"flash.#{v}\")\n when (Symbol === v)\n tc(v)\n else\n v\n end\n end",
"def t_action_flash(name)\n t(\"flash.#{params[:controller].gsub('/', '.')}.#{params[:action]}.#{name}\")\n end",
"def flash_created_message\n flash_message_builder(:create, flash_status_type, 'created')\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Public: Defines the conditions for a document to be Lazyable. doc the Jekyll::Document or Jekyll::Page Returns true if the doc is written & is HTML.
|
def Lazyable?(doc)
(doc.is_a?(Jekyll::Page) || doc.write?) &&
doc.output_ext == ".html" || (doc.permalink && doc.permalink.end_with?("/"))
end
|
[
"def processable?(doc)\n\t\t\t\t(doc.is_a?(Jekyll::Page) || doc.write?) &&\n\t\t\t\t\tdoc.output_ext == \".html\" || (doc.permalink&.end_with?(\"/\"))\n\t\t\tend",
"def tagable?(doc)\n (doc.is_a?(Jekyll::Page) || doc.write?) &&\n doc.output_ext == \".html\" || (doc.permalink&.end_with?(\"/\"))\n end",
"def issueable?(doc)\n (doc.is_a?(Jekyll::Page) || doc.write?) &&\n doc.output_ext == \".html\" || (doc.permalink && doc.permalink.end_with?(\"/\"))\n end",
"def embedable?(doc)\n (doc.is_a?(Jekyll::Page) || doc.write?) &&\n doc.output_ext == \".html\" || (doc.permalink && doc.permalink.end_with?(\"/\"))\n end",
"def doc?\r\n not self.doc.nil?\r\n end",
"def doc?\n not self.doc.nil?\n end",
"def can_read_document?(doc = nil)\r\n true\r\n end",
"def is_document?\n @type == :document\n end",
"def allows_document?\n self.allows_title? && ![TITLE, COVER].include?(self.kind)\n end",
"def document?\n self.type == \"Document\"\n end",
"def html_doc?\r\n node_type == HTML_DOCUMENT_NODE\r\n end",
"def html_doc?\n node_type == HTML_DOCUMENT_NODE\n end",
"def document?\n self.type == \"Assetabler::Document\"\n end",
"def emojiable?(doc)\n (doc.is_a?(Jekyll::Page) || doc.write?) &&\n doc.output_ext == \".html\" || (doc.permalink&.end_with?(\"/\"))\n end",
"def document?\r\n node_type == DOCUMENT_NODE\r\n end",
"def doc?(doc)\n url = doc.respond_to?(:url) ? doc.url : doc\n h = { 'url' => url }\n @@client[:documents].find(h).any?\n end",
"def document?\n node_type == DOCUMENT_NODE\n end",
"def mentionable?(doc)\n (doc.is_a?(Jekyll::Page) || doc.write?) &&\n (doc.output_ext == \".html\" || (doc.permalink&.end_with?(\"/\"))) &&\n (doc.data[\"jekyll-mentions\"] != false)\n end",
"def html?\n Page.html? content_type\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /admin/shirt_colors/new GET /admin/shirt_colors/new.json
|
def new
@shirt_color = ShirtColor.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @shirt_color }
end
end
|
[
"def create\n @shirt_color = ShirtColor.new(params[:shirt_color])\n\n respond_to do |format|\n if @shirt_color.save\n format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' }\n format.json { render json: @shirt_color, status: :created, location: @shirt_color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shirt_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @color = Admin::Color.new(color_params)\n\n if @color.save\n render json: @color, status: :created#, location: @color\n else\n render json: @color.errors, status: :unprocessable_entity\n end\n end",
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @color = Color.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color }\n end\n end",
"def new\r\n @color = Color.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @color }\r\n end\r\n end",
"def create\n @color = Color.new(color_params)\n\n respond_to do |format|\n if @color.save\n format.html { redirect_to root_path }\n format.json { render json: @color, status: :created, location: @color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n \r\n @color = Color.new(params[:color])\r\n\r\n respond_to do |format|\r\n if @color.save\r\n format.html { redirect_to colors_url, notice: 'Color was successfully created.' }\r\n format.json { render json: @color, status: :created, location: @color }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @color.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def new\n @product_color = ProductColor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_color }\n end\n end",
"def new\n @color_hue = ColorHue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color_hue }\n end\n end",
"def new\n @product_color = ProductColor.new params[:product_color]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @product_color }\n end\n end",
"def create\n @item_color = ItemColor.new(item_color_params)\n\n respond_to do |format|\n if @item_color.save\n format.html { redirect_to @item_color, notice: 'Item color was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_color }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @green = Green.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @green }\n end\n end",
"def create\n @admin_products_color = ProductsColor.new(admin_products_color_params)\n\n respond_to do |format|\n if @admin_products_color.save\n format.html { redirect_to @admin_products_color, notice: 'Products color was successfully created.' }\n format.json { render :show, status: :created, location: @admin_products_color }\n else\n format.html { render :new }\n format.json { render json: @admin_products_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @color_saturation = ColorSaturation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color_saturation }\n end\n end",
"def new\n @disc_color = DiscColor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @disc_color }\n end\n end",
"def create\n @variants_color = VariantsColor.new(variants_color_params)\n\n respond_to do |format|\n if @variants_color.save\n format.html { redirect_to @variants_color, notice: 'Variants color was successfully created.' }\n format.json { render action: 'show', status: :created, location: @variants_color }\n else\n format.html { render action: 'new' }\n format.json { render json: @variants_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @color_pallet = ColorPallet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @color_pallet }\n end\n end",
"def create\n @my_color = MyColor.new(my_color_params)\n\n respond_to do |format|\n if @my_color.save\n format.html { redirect_to @my_color, notice: 'My color was successfully created.' }\n format.json { render action: 'show', status: :created, location: @my_color }\n else\n format.html { render action: 'new' }\n format.json { render json: @my_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reform_color = ReformColor.new(reform_color_params)\n\n respond_to do |format|\n if @reform_color.save\n format.html { redirect_to admin_reform_colors_path, notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.reform_color', count: 1)) }\n else\n format.html { render :new }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /admin/shirt_colors POST /admin/shirt_colors.json
|
def create
@shirt_color = ShirtColor.new(params[:shirt_color])
respond_to do |format|
if @shirt_color.save
format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' }
format.json { render json: @shirt_color, status: :created, location: @shirt_color }
else
format.html { render action: "new" }
format.json { render json: @shirt_color.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @color = Admin::Color.new(color_params)\n\n if @color.save\n render json: @color, status: :created#, location: @color\n else\n render json: @color.errors, status: :unprocessable_entity\n end\n end",
"def create\n @item_color = ItemColor.new(item_color_params)\n\n respond_to do |format|\n if @item_color.save\n format.html { redirect_to @item_color, notice: 'Item color was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_color }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\r\n \r\n @color = Color.new(params[:color])\r\n\r\n respond_to do |format|\r\n if @color.save\r\n format.html { redirect_to colors_url, notice: 'Color was successfully created.' }\r\n format.json { render json: @color, status: :created, location: @color }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @color.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def create\n @variants_color = VariantsColor.new(variants_color_params)\n\n respond_to do |format|\n if @variants_color.save\n format.html { redirect_to @variants_color, notice: 'Variants color was successfully created.' }\n format.json { render action: 'show', status: :created, location: @variants_color }\n else\n format.html { render action: 'new' }\n format.json { render json: @variants_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @color = Color.new(color_params)\n\n respond_to do |format|\n if @color.save\n format.html { redirect_to root_path }\n format.json { render json: @color, status: :created, location: @color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @preset_color = PresetColor.create(hue: params[:hue], saturation: params[:saturation], brightness: params[:brightness])\n @preset_colors = PresetColor.all\n render :preset_colors\n end",
"def list_colors\n colors_raw = search_colors_shopstyle\n colors = formats_colors_hash(colors_raw)\n render json: { status: 0, data: {colors: colors} }\n end",
"def create\n @admin_products_color = ProductsColor.new(admin_products_color_params)\n\n respond_to do |format|\n if @admin_products_color.save\n format.html { redirect_to @admin_products_color, notice: 'Products color was successfully created.' }\n format.json { render :show, status: :created, location: @admin_products_color }\n else\n format.html { render :new }\n format.json { render json: @admin_products_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @palette_color = PaletteColor.new(palette_color_params)\n respond_to do |format|\n if @palette_color.save\n flash[:success] = 'Palette color was successfully created.'\n format.html { redirect_to @palette_color }\n format.json { render :show, status: :created, location: @palette_color }\n else\n format.html { render :new }\n format.json { render json: @palette_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sample_color = SampleColor.new(sample_color_params)\n\n respond_to do |format|\n if @sample_color.save\n format.html { redirect_to @sample_color, notice: 'Sample color was successfully created.' }\n format.json { render :show, status: :created, location: @sample_color }\n else\n format.html { render :new }\n format.json { render json: @sample_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @suitcolor = Suitcolor.new(suitcolor_params)\n\n respond_to do |format|\n if @suitcolor.save\n format.html { redirect_to @suitcolor, notice: \"Suitcolor was successfully created.\" }\n format.json { render :show, status: :created, location: @suitcolor }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @suitcolor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def apply_custom_colors(colors); end",
"def create\n @product_color = ProductColor.new(product_color_params)\n\n respond_to do |format|\n if @product_color.save\n format.html { redirect_to @product_color, notice: 'Product color was successfully created.' }\n format.json { render :show, status: :created, location: @product_color }\n else\n format.html { render :new }\n format.json { render json: @product_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @reform_color = ReformColor.new(reform_color_params)\n\n respond_to do |format|\n if @reform_color.save\n format.html { redirect_to admin_reform_colors_path, notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.reform_color', count: 1)) }\n else\n format.html { render :new }\n end\n end\n end",
"def create\n @disc_color = DiscColor.new(params[:disc_color])\n\n respond_to do |format|\n if @disc_color.save\n format.html { redirect_to @disc_color, notice: 'Disc color was successfully created.' }\n format.json { render json: @disc_color, status: :created, location: @disc_color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @disc_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_profile_colors(colors)\n return unless colors.is_a?(Hash)\n post_data = {}\n \n colors.each_pair do |key, value|\n post_data.store(\"profile_#{key}\", value.gsub(/#/, ''))\n end\n \n post \"account/update_profile_colors\", :post => post_data\n end",
"def create\n @my_color = MyColor.new(my_color_params)\n\n respond_to do |format|\n if @my_color.save\n format.html { redirect_to @my_color, notice: 'My color was successfully created.' }\n format.json { render action: 'show', status: :created, location: @my_color }\n else\n format.html { render action: 'new' }\n format.json { render json: @my_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @secondary_color = SecondaryColor.new(secondary_color_params)\n\n respond_to do |format|\n if @secondary_color.save\n format.html { redirect_to @secondary_color, notice: 'Secondary color was successfully created.' }\n format.json { render :show, status: :created, location: @secondary_color }\n else\n format.html { render :new }\n format.json { render json: @secondary_color.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /admin/shirt_colors/1 PUT /admin/shirt_colors/1.json
|
def update
@shirt_color = ShirtColor.find(params[:id])
respond_to do |format|
if @shirt_color.update_attributes(params[:shirt_color])
format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @shirt_color.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n require 'rest-client'\n response = RestClient.put('localhost:3001/colores/'+@color.id.to_s, color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n\n format.html { redirect_to @color, notice: \"Color was successfully updated.\" }\n format.json { render :show, status: :ok, location: @color }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shirt_color = ShirtColor.new(params[:shirt_color])\n\n respond_to do |format|\n if @shirt_color.save\n format.html { redirect_to admins_shirt_colors_url, notice: 'Shirt color was successfully created.' }\n format.json { render json: @shirt_color, status: :created, location: @shirt_color }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shirt_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_color.update(admin_color_params)\n format.html { redirect_to admin_colors_path, notice: 'Color was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_color }\n else\n format.html { render :edit }\n format.json { render json: @admin_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @color_hue = ColorHue.find(params[:id])\n\n respond_to do |format|\n if @color_hue.update_attributes(params[:color_hue])\n format.html { redirect_to @color_hue, notice: 'Color hue was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @color_hue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def colorupdate\n respond_to do |format|\n @location = params[:location]\n @index = params[:index].to_f\n @color = params[:color]\n @grid = Grid.find_by_location(@location)\n @newColorArray = @grid.colors\n @newColorArray[@index] = @color\n \n @grid.colors = @newColorArray\n @grid.save\n \n format.json {render json: @grid.colors, status: :ok, location: @grid}\n end\n end",
"def update\n @animal_color = AnimalColor.find(params[:id])\n @animal_color.update_attributes(params[:animal_color])\n \n respond_with(@animal_color, :location => admin_animal_color_path(@animal_color)) \n end",
"def update\n @color_saturation = ColorSaturation.find(params[:id])\n\n respond_to do |format|\n if @color_saturation.update_attributes(params[:color_saturation])\n format.html { redirect_to @color_saturation, notice: 'Color saturation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @color_saturation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @variants_color.update(variants_color_params)\n format.html { redirect_to @variants_color, notice: 'Variants color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @variants_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @color = Color.find(params[:id])\n\n respond_to do |format|\n if @color.update_attributes(params[:color])\n format.html { redirect_to @color, notice: 'Color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @color_scheme.update(color_scheme_params)\n format.html { redirect_to [:admin, @color_scheme], notice: 'Color scheme was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @color_scheme.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_app_color\n\t\t# update the color values with params of color\n\t\tif setting.update(type_app_color: params[:color])\n\t\t# response to the JSON\n\t\t render json: { success: true,message: \"Color Successfully Updated.\",response: {color: setting.type_app_color.as_json }},:status=>200\n\t else\n\t render :json=> { success: false, message: setting.errors },:status=> 203\n\t end\t\t\n\tend",
"def update\n respond_to do |format|\n if @item_color.update(item_color_params)\n format.html { redirect_to @item_color, notice: 'Item color was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @secondary_color.update(secondary_color_params)\n format.html { redirect_to @secondary_color, notice: 'Secondary color was successfully updated.' }\n format.json { render :show, status: :ok, location: @secondary_color }\n else\n format.html { render :edit }\n format.json { render json: @secondary_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shirt_style.update(shirt_style_params)\n format.html { redirect_to [@store,@customer,@order], notice: 'Shirt style was successfully updated.' }\n format.json { render :show, status: :ok, location: @shirt_style }\n else\n format.html { render :edit }\n format.json { render json: @shirt_style.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n respond_to do |format|\n require 'rest-client'\n response = RestClient.post('localhost:3001/colores/', color_params.as_json, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'})\n if response.code == 200\n @color = JSON.parse(response.body)\n format.html { redirect_to @color, notice: \"Color was successfully created.\" }\n format.json { render :show, status: :created, location: @color }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @primary_color.update(primary_color_params)\n format.html { redirect_to @primary_color, notice: 'Primary color was successfully updated.' }\n format.json { render :show, status: :ok, location: @primary_color }\n else\n format.html { render :edit }\n format.json { render json: @primary_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @five_color.update(five_color_params)\n format.html { redirect_to @five_color, notice: 'Five color was successfully updated.' }\n format.json { render :show, status: :ok, location: @five_color }\n else\n format.html { render :edit }\n format.json { render json: @five_color.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @shirt_color = ShirtColor.find(params[:id])\n @shirt_color.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_shirt_colors_url }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @sample_color.update(sample_color_params)\n format.html { redirect_to @sample_color, notice: 'Sample color was successfully updated.' }\n format.json { render :show, status: :ok, location: @sample_color }\n else\n format.html { render :edit }\n format.json { render json: @sample_color.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /admin/shirt_colors/1 DELETE /admin/shirt_colors/1.json
|
def destroy
@shirt_color = ShirtColor.find(params[:id])
@shirt_color.destroy
respond_to do |format|
format.html { redirect_to admins_shirt_colors_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n \n respond_to do |format|\n RestClient.delete 'localhost:3001/colores/'+@color.id.to_s, {:Authorization => 'admin irizREhyoG6Ejwr4AcjsQME9'}\n format.html { redirect_to colors_url, notice: \"Color was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_color.destroy\n respond_to do |format|\n format.html { redirect_to admin_colors_url, notice: 'Color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_color.destroy\n respond_to do |format|\n format.html { redirect_to item_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_color.destroy\n respond_to do |format|\n format.html { redirect_to my_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @variants_color.destroy\n respond_to do |format|\n format.html { redirect_to variants_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @paint_colour.destroy\n respond_to do |format|\n format.html { redirect_to admin_paint_colours_url, notice: 'Paint colour was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color = Color.find(params[:id])\n @color.destroy\n\n respond_to do |format|\n format.html { redirect_to colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @green = Green.find(params[:id])\n @green.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffold_greens_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @primary_color.destroy\n respond_to do |format|\n format.html { redirect_to primary_colors_url, notice: 'Primary color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internal_color.destroy\n respond_to do |format|\n format.html { redirect_to internal_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @interior_colour.destroy\n respond_to do |format|\n format.html { redirect_to admin_interior_colours_url, notice: 'Interior colour was successfully deleted.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @five_color.destroy\n respond_to do |format|\n format.html { redirect_to five_colors_url, notice: 'Five color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @body_color.destroy\n respond_to do |format|\n format.html { redirect_to body_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sample_color.destroy\n respond_to do |format|\n format.html { redirect_to sample_colors_url, notice: 'Sample color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @disc_color = DiscColor.find(params[:id])\n @disc_color.destroy\n\n respond_to do |format|\n format.html { redirect_to disc_colors_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @skin_color.destroy\n respond_to do |format|\n format.html { redirect_to skin_colors_url, notice: 'El Color de Piel ha sido eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @color_hue = ColorHue.find(params[:id])\n @color_hue.destroy\n\n respond_to do |format|\n format.html { redirect_to color_hues_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @secondary_color.destroy\n respond_to do |format|\n format.html { redirect_to secondary_colors_url, notice: 'Secondary color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_products_color.destroy\n respond_to do |format|\n format.html { redirect_to admin_products_path, notice: 'Products color was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
before_action :new, :check_if_student GET /books GET /books.json
|
def index
check_if_student
@books = Book.all
end
|
[
"def create\n @student = Student.find(params[:student_id])\n @student_book = @student.student_books.new(student_book_params)\n authorize! :create, @student_book\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to student_student_books_path(@student), notice: 'Student book was successfully created.' }\n format.json { render :show, status: :created, location: @student_book }\n else\n format.html { render :new }\n format.json { render json: @student_book.errors, status: :unprocessable_entity }\n end\n end\n end",
"def student\n unless logged_user.student? then\n render_403 and return\n end\n\n if request.get? then\n @student = logged_user.student\n elsif request.put? then\n student = Student.find(logged_user.student.id)\n student.specialty_id = params[:specialty]\n student.course = params[:course]\n if student.save then\n if params[:reg] then\n redirect_to :root\n else\n redirect_to :settings_student, alert: t('settings.save_suc')\n end\n else\n redirect_to :settings_student, notice: t('settings.save_fail')\n end\n end\n end",
"def require_student\n redirect_to root_path unless @auth_user && @auth_user.type == 'Student'\n end",
"def require_student \n unless current_user.student?\n redirect_back(fallback_location: manage_requests_path)\n end\n end",
"def allow_if_student(extra_suggestion = nil)\n return if @current.type == 'Student'\n message = [\"You must be Student to access this resource. #{extra_suggestion if extra_suggestion}\"]\n render json: format_errors({ base: message }), status: :forbidden\n false\n end",
"def add_student\n # PUNDIT_REVIEW_AUTHORIZE\n # PUNDIT_CHOOSE_AUTHORIZE\n # no authorization needed ...\n # authorize Portal::Clazz\n # authorize @clazz\n # authorize Portal::Clazz, :new_or_create?\n # authorize @clazz, :update_edit_or_destroy?\n @student = nil\n @portal_clazz = Portal::Clazz.find(params[:id])\n valid_data = false\n begin\n student_id = params[:student_id].to_i\n valid_data = true && student_id != 0\n rescue\n valid_data = false\n end\n\n if params[:student_id] && (!params[:student_id].empty?) && valid_data\n @student = Portal::Student.find(params[:student_id])\n end\n if @student\n @student.add_clazz(@portal_clazz)\n @portal_clazz.reload\n render :update do |page|\n page << \"if ($('students_listing')){\"\n page.replace_html 'students_listing', :partial => 'portal/students/table_for_clazz', :locals => {:portal_clazz => @portal_clazz}\n page << \"}\"\n #page << \"if ($('add_students_listing')){\"\n #page.replace_html 'add_students_listing', :partial => 'portal/students/current_student_list_for_clazz', :locals => {:portal_clazz => @portal_clazz}\n #page << \"}\"\n page << \"if ($('oClassStudentCount')){\"\n page.replace_html 'oClassStudentCount', @portal_clazz.students.length.to_s\n page << \"}\"\n page.replace 'student_add_dropdown', student_add_dropdown(@portal_clazz)\n end\n else\n render :update do |page|\n # previous message was \"that was a total failure\"\n # this case should not happen, but if it does, display something\n # more friendly such as:\n page << \"alert('Please select a user from the list before clicking add button.')\"\n end\n end\n end",
"def former_student\n @batch = Batch.shod(params[:graduate][:batch_id])\n @batch.graduate(params[:students], params[:graduate][:status_description])\n former_student2\n authorize! :create, @batch\n end",
"def before_GET(req)\n end",
"def validate_student\n\t\t@student = current_user\n\tend",
"def create\n @student = Student.new(params[:student])\n\n respond_to do |format|\n if @student.save\n format.html { redirect_to [:admin, @student], :notice => 'Student was successfully created.' }\n format.json { render :json => @student, :status => :created, :location => @student }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @student.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def mycourses_student\n sid = params[:id]\n if sid.to_i != current_user.id\n render :json => {\"error\" => \"Voit hakea vain omat kurssisi.\"}, status: 401\n else\n render :json => CourseService.student_courses(current_user.id), status: 200\n end\n end",
"def create\n @manage_student = Manage::Student.new(manage_student_params)\n\n respond_to do |format|\n if @manage_student.save\n format.html { redirect_to @manage_student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @manage_student }\n else\n format.html { render :new }\n format.json { render json: @manage_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def valid_book\n if params[:book_id] && !Book.exists?(params[:book_id])\n redirect_to user_path(current_user)\n elsif params[:book_id]\n elsif !params[:book_id] && !Book.exists?(params[:id])\n redirect_to user_path(current_user)\n end\n end",
"def get_student\n @student = Student.find(params[:student_id])\n end",
"def create\n @student = Student.new(student_params)\n if @student.save\n redirect_to(root_path)\n else\n render('new')\n end\n end",
"def get_student\n @student = Student.find(params[:student_id])\nend",
"def create\n @exam_student = ExamStudent.new\n if params[:user_id]\n @exam_student.user_id = params[:user_id]\n end\n if params[:exam_id]\n @exam_student.exam_id = params[:exam_id]\n end\n if params[:status]\n @exam_student.status = params[:status]\n end\n\n respond_to do |format|\n if @exam_student.save\n format.html { redirect_to exams_url, notice: 'Prijavili ste ispit.' }\n format.json { render :show, status: :created, location: @exam_student }\n else\n format.html { render :new }\n format.json { render json: @exam_student.errors, status: :unprocessable_entity }\n end\n end\n end",
"def check_student_registration\n if user_signed_in?\n if current_user.student.nil? && !current_user.is_admin? && !current_user.is_professor?\n redirect_to new_student_path\n end\n end\n end",
"def check_non_author\n book = Book.find(params[:id])\n if book.user_id != current_user.id\n redirect_to books_path, alert: \"You are not main author of this book. Access denied\"\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the next HttpUrl that is neither invalid nor already fetched. If there are no more URLs, it returns +nil+.
|
def get_next_url
while true
unless url = @node_manager.dequeue_url
# there are currently no further URLs in the queue
return nil
end
unless http_url = HttpUrl.parse(url)
@node_manager.log_error :invalid_url, url.inspect
next
end
if @node_manager.has_file?(http_url.to_filename)
@node_manager.log :skip_url__already_fetched, url.inspect
next
end
return http_url
end # while
end
|
[
"def get_next_url\n while true\n unless url = dequeue_url()\n # there are currently no further URLs in the queue\n return nil\n end\n\n unless http_url = HttpUrl.parse(url)\n log_error :invalid_url, url.inspect \n next\n end\n\n if has_file?(http_url.to_filename) \n log :skip_url__already_fetched, url.inspect\n next\n end\n\n return http_url\n end # while\n end",
"def next_url\n while url = @queue.shift\n return url if valid_url?(url)\n end\n end",
"def get_next_url_from_queue\n next_url = @queued_urls.first \n return nil if next_url[1][:crawl_depth] > @opts[:max_crawl_depth]\n next_url\n end",
"def next\n return if empty_queue?\n data = CrawlResult.new crawl next_url\n data.result\n end",
"def next_url\n next_page ? url(next_page) : nil\n end",
"def next_link(headers)\n key = 'link' # todo: can be 'Link' as well\n return nil unless headers.member? key\n link_tuple = LinkHeader.parse(headers[key]).links.select { |l| l.attr_pairs[0][1] == 'next' }\n link_tuple.size.zero? ? nil : link_tuple[0].href\n end",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n #p 'next_link: ' + next_link['href']\n next_url = BASE_URL + next_link['href']\n p 'next_url: ' + next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n puts next_link\n next_url = BASE_URL + next_link['href']\n puts next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def scrape_and_look_for_next_link(url)\n page = Nokogiri::HTML(open(url))\n scrape_table(page)\n next_link = page.at_css('a.next')\n if next_link \n p next_link\n next_url = BASE_URL + next_link['href']\n p next_url\n scrape_and_look_for_next_link(next_url)\n end\nend",
"def get_next_page(response)\n return nil unless response.headers[:link]\n\n matches = response.headers[:link].match('<([^>]+)>; rel=\"next\"')\n return matches[1] if matches\n end",
"def resolve_url url_array\n url_array.each do |url_str|\n url = URI.parse(url_str)\n req = Net::HTTP.new(url.host, url.port)\n\n begin\n Timeout.timeout(5) do\n res = req.request_head(url.path)\n\n if res.code == \"200\"\n return url_str\n end\n end\n rescue Timeout::Error\n puts \"URL #{url_str} did not respond in 5 seconds.\"\n next\n end\n end\n return \"\"\nend",
"def fetch(url)\n # puts \"fetching #{url}\"\n 3.times do |i|\n begin\n res = HTTParty.get(url)\n case res.code\n when 200\n return res.body\n when 404\n return nil\n end\n\n rescue Exception => ex\n raise ex if i == 2\n # fall thru to retry\n end\n\n sleep 0.5 if i < 2\n end\n\n # puts \"failed\"\n nil # failed\n end",
"def crawl\n while NG_URL.where(:a_hrefs_unprocessed => { :$not => { :$size => 0}}).count > 0 do\n next_unprocessed_url\n end\n end",
"def check_html(url, ref)\n file = get_file(url)\n html = file ? Fs.read(file) : get_http(url)\n\n if html.nil?\n add_invalid_url(url, ref)\n return\n else\n add_valid_url(url, ref)\n end\n\n return if url[0] != \"/\"\n\n html.scan(/href=\"([^\"]+)\"/) do |m|\n next_url = m[0]\n next_url = next_url.sub(/^#{@base_url}/, \"/\")\n next_url = next_url.sub(/#.*/, \"\")\n\n next if next_url =~ /\\.(css|js|json)$/\n next if next_url =~ /\\.p\\d+\\.html$/ #pagination\n next if next_url =~ /\\/2\\d{7}\\.html$/ #calendar\n\n if next_url[0] != \"/\" && next_url !~ /^https?:/\n next_url = File.expand_path next_url, File.dirname(url)\n end\n next if @results[next_url]\n\n @urls[next_url] = url\n end\n end",
"def next\n @links.key?(:next) ? Page.new(@links[:next]) : nil\n end",
"def next\n perform_request(next_page_uri) if next?\n end",
"def find_next_url(page)\r\n raise 'Define me!'\r\n end",
"def next\n return if @current >= @requests.size\n\n @current += 1\n @count -= 1\n end",
"def next_site referrer = \"\"\n if valid_site? referrer\n idx = sites.index(URI(referrer))\n nxt = (idx + 1) % sites.size\n return sites[nxt]\n end\n\n return sites.sample\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Find the group with the most actions and return an int h where: h = (max_actions + pad) factor the pad represents the top two header lines in the rendered post it the factor represents the line height of the action list
|
def compute_height(pad = 2, factor = 13)
(max_actions + pad) * factor
end
|
[
"def divide_into_equal_groups(controller_actions, num_groups)\n total_lines = controller_actions.values.sum\n lines_per_group = total_lines / num_groups\n\n action_pile = controller_actions.dup\n\n grouping = num_groups.times.each_with_object({}) do |group_num, hash|\n line_count_in_group = 0\n\n while line_count_in_group <= lines_per_group\n action, line_count = action_pile.shift\n break if line_count.nil?\n\n hash[group_num] ||= {}\n hash[group_num][action] = line_count\n \n line_count_in_group += line_count\n end\n end\n\n grouping.merge! remaining: action_pile # include whatever remains\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.inject(0){|memo, a| [memo, a.to_s.length].max}\n end",
"def max_action_length\n @max_action_length ||= actions.reduce(0) { |m, a| [m, a.to_s.length].max }\n end",
"def number_of_actions\n @actions.size\n end",
"def highest_match_count\n match_count = Hash.new(0)\n\n @hand.each { |dice| match_count[dice] += 1 }\n\n match_count.values.max\n end",
"def max_hops; end",
"def max(action)\n limits(action)[:max]\n end",
"def find_kth_largest(summary)\n [summary.length, @k].min - 1\n end",
"def largest_family\n @ordered_groups = groups.keys.sort_by { |k| groups[k].count }.reverse\n @ordered_groups.first\n end",
"def length_match_clauses\n @match_length ||= @actions.group_by { |a| a.keys.first }['length']\n end",
"def find_max_header_count\n @max_header_count = (@summaries.map{|s| s.headers.try(:size) || 0} + [1]).max\n end",
"def most_flown_aircraft\n flights\n .group(:aircraft)\n .count\n .max_by{|k,v| v}\n end",
"def max_possible_acts(sym)\n act_lmt = nil\n case sym\n when :move; act_lmt = move_action_lmt;\n when :skill; act_lmt = skill_action_lmt;\n when :atk; act_lmt = atk_action_lmt;\n when :item; act_lmt = item_action_lmt;\n end\n [act_lmt, all_action_lmt].max\n end",
"def get_span_size(num_entries, max_entries)\n if max_entries == 2\n return 6\n elsif max_entries == 4\n return (num_entries < 4) ? 4 : 3\n end\n end",
"def get_max_interactions\n max_interaction = 0\n @ld_scores.values.each do |snp_combo_array|\n if snp_combo_array.length > max_interaction\n max_interaction = snp_combo_array.length\n end\n end\n return max_interaction\n end",
"def max_index\n blocks.max(:index) || 0\n end",
"def get_max_haplotype_size\n max_haplotype = 0\n @blocks.values.each do |block|\n if block.haplotypes.length > max_haplotype\n max_haplotype = block.haplotypes.length\n end\n end\n return max_haplotype\n end",
"def group_depth; end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
method to find edge from 2 vertices
|
def findEdge(vertex1, vertex2)
visualedges = @visualGraph.visual_edges
visualedges.each do |edge|
if edge.v1.id == vertex1 && edge.v2.id == vertex2
# edge from vertex1 to vertex2
return edge
elsif edge.v2.id == vertex1 && edge.v1.id == vertex2
# edge from vertex2 to vertex1
return edge
end
end
return nil
end
|
[
"def get_edge vertex_a, vertex_b\n @edges.select{ |e| (e.vertices.include? vertex_a) && (e.vertices.include? vertex_b) }.first\n end",
"def edge a, b\n # works for both digraph and undirected graph\n @edges[a].each{|e| return e if e.connects? a, b}\n end",
"def edge a, b\n @edges[a] and @edges[a][b]\n end",
"def has_edge?(vertex1, vertex2)\n\tend",
"def find_edge(node_1, node_2)\n @edges[node_1][node_2] if @edges[node_1]\n end",
"def find_edge(one, two)\n edges.find do |e|\n (e.one == one && e.two == two) || (e.two == one && e.one == two)\n end\n end",
"def common_face(edge2)\n end",
"def edge_for(left, right)\n edges.detect { |edge| edge.left.equal?(left) && edge.right.equal?(right) }\n end",
"def edge_with(head, tail)\n edges.find { |edge| edge.head == head && edge.tail == tail }\n end",
"def edge?(v1,v2)\n e = @edges[v1]\n return false if e.nil?\n return e.include?(v2)\n end",
"def edge?( from, to )\n @vertices[from].include? to \n end",
"def other_vertex(vertex)\n return nil unless vertex_1 == vertex || vertex_2 == vertex\n return vertex_1 if vertex == vertex_2\n vertex_2\n end",
"def get_edge(x, y)\n return nil unless edge?(x, y)\n w = @g.get_edge(index(x), index(y))\n Edge.new(x, y, w) if w\n end",
"def bothE(*key)\n find_edges(key, :both)\n end",
"def contract edge\n vertex_1 = edge[0]\n vertex_2 = edge[1]\n #puts \"contracting edge \" + vertex_1.id.to_s + \", \" + vertex_2.id.to_s\n remove_vertex vertex_2\n\n vertex_2.adjacent_vertices.each{ |adjacent_vertex|\n vertex = find(adjacent_vertex)\n vertex_2_index = vertex.adjacent_vertices.index(vertex_2.id)\n vertex.adjacent_vertices[vertex_2_index] = vertex_1.id\n }\n vertex_1.adjacent_vertices.concat(vertex_2.adjacent_vertices)\n vertex_1.adjacent_vertices.delete_if {|adjacent_vertex| adjacent_vertex == vertex_1.id }\n end",
"def edge?(x, y)\n connected?(x, y)\n end",
"def edge_ids_between node1_id, node2_id\n\t\t\t# Find the connections that start with node1.\n\t\t\tbeginnings = CONNECTION_PATH.with_values(\"from-id\" => node1_id).value(\"to-id\").apply(@xml)\n\t\t\tbeginnings = CxlHelper.normalize beginnings\n\n\t\t\t# Find the connections that end with node2.\n\t\t\tendings = CONNECTION_PATH.with_values(\"to-id\" => node2_id).value(\"from-id\").apply(@xml)\n\t\t\tendings = CxlHelper.normalize endings\n\n\t\t\t# Their intersections are the ids of the nodes that we want.\n\t\t\treturn beginnings & endings\n\t\tend",
"def other_vertex(direction, edge)\n case direction\n when :in; edge.source\n else\n edge.target\n end\n end",
"def edges\n\t (@vertices + [@vertices.first]).each_cons(2) {|v1,v2| yield v1, v2}\n\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Stretch the children layouts to fill the gaps, remove redundant spaces inside the parent layout
|
def stretch_children_layouts(parent_template, parent_width, parent_height, lines)
total_height = 0
lines.each_with_index do |line, line_index|
desired_height =
if line_index == lines.length - 1
parent_height - total_height
else
line.map { |_child_template, _child_width, child_height, _x, _y| child_height }.max
end
total_width = 0
line.map!.with_index do |(child_template, child_width, child_height, x, y), index|
child_height = desired_height if parent_template.fill_height
child_width = parent_width - total_width if parent_template.fill_width && index == line.length - 1
total_width += child_width
[child_template, child_width, child_height, x, y]
end
total_height += desired_height
end
end
|
[
"def layout\n # This assumes that the container overlaps all the children.\n\n # Move all children if we have moved.\n @children.each.with_index do |child, index|\n child.x = padding_left + x\n child.y = padding_top + y\n end\n\n # Make us as wrap around the largest child.\n rect.width = (@children.map {|c| c.width }.max || 0) + padding_left + padding_right\n rect.height = (@children.map {|c| c.height }.max || 0) + padding_top + padding_bottom\n\n super\n end",
"def pack_children\n child_x, child_y = 0, 0\n \n children.each do |child|\n if horizontal?\n child.x = child_x\n child.height = height if fill?\n child_x += child.outer_width + spacing\n elsif vertical?\n child.y = child_y if vertical?\n child.width = width if fill?\n child_y += child.outer_height + spacing\n end\n end\n end",
"def layout_children\n @children.each { |c| c.layout }\n end",
"def repack\n @widths = Array.new(@rows.empty? ? 0 : @rows[0].size, 0)\n @heights = Array.new(@rows.size, 0)\n\n filled_columns = []\n filled_rows = []\n\n # Calculate the maximum widths of each column and the maximum height of each row.\n @rows.each_with_index do |row, row_num|\n row.each_with_index do |element, column_num|\n fills = (element.align_h == :fill)\n @widths[column_num] = [fills ? element.min_width : element.outer_width, @widths[column_num]].max\n filled_columns.push fills\n\n fills = (element.align_v == :fill)\n @heights[row_num] = [fills ? element.min_width : element.outer_height, @heights[row_num]].max\n filled_rows.push fills\n end\n end\n\n # Expand the size of each filled column to make the minimum size required.\n unless @widths.empty?\n num_filled_columns = filled_columns.select {|value| value }.count\n total_width = @widths.inject(0, :+) + (padding_left + padding_right) + ((@num_columns - 1) * spacing_h)\n extra_width = min_width - total_width\n if extra_width > 0\n if num_filled_columns > 0\n @widths[filled_columns.index true] += extra_width\n else\n @widths[-1] += extra_width\n end\n end\n end\n\n # Expand the size of each filled row to make the minimum size required.\n unless @heights.empty?\n num_filled_rows = filled_rows.select {|value| value }.count\n total_height = @heights.inject(0, :+) + (padding_left + padding_right) + ((@num_rows - 1) * spacing_v)\n extra_height = min_height - total_height\n if extra_height > 0\n if num_filled_rows > 0\n @heights[filled_rows.index true] += extra_height\n else\n @heights[-1] += extra_height\n end\n end\n end\n\n # Actually place all the elements into the grid positions, modified by valign and align.\n current_y = y + padding_top\n @rows.each_with_index do |row, row_num|\n current_x = x + padding_left\n\n row.each_with_index do |element, column_num|\n element.x = current_x + element.border_thickness\n\n case element.align_h # Take horizontal alignment into consideration.\n when :fill\n if element.width < @widths[column_num]\n element.width = @widths[column_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.x += (@widths[column_num] - element.width) / 2\n when :right\n element.x += @widths[column_num] - element.width\n end\n\n current_x += @widths[column_num]\n current_x += spacing_h unless column_num == @num_columns - 1\n\n element.y = current_y + element.border_thickness\n\n case element.align_v # Take horizontal alignment into consideration.\n when :fill\n if element.height < @heights[row_num]\n element.height = @heights[row_num]\n element.send :repack if element.is_a? Grid\n end\n when :center\n element.y += (@heights[row_num] - element.height) / 2\n when :bottom\n element.y += @heights[row_num] - element.height\n else\n end\n end\n\n self.width = current_x - x + padding_left if row_num == 0\n\n current_y += @heights[row_num] unless row.empty?\n current_y += spacing_h unless row_num == num_rows - 1\n end\n\n self.height = current_y - y + padding_top\n\n nil\n end",
"def widths_reset\n @width = GroupLayout::DEFAULT_SIZE\n @max = GroupLayout::DEFAULT_SIZE\n end",
"def layout_minibuilder_field_wide(mb)\n mb.rect.w = @mainRect.w - (@spacing * 2)\n mb.rect.x = @mainRect.x + @spacing\n mb.rect.y = @fieldY\n mb.refresh\n @fieldY = mb.rect.bottom + @spacing\n self << mb\n @wakeup_widgets << mb if @wakeup_widgets\n end",
"def heights_reset\n @height = GroupLayout::DEFAULT_SIZE\n end",
"def fit_it_in\n width, height = available_space\n return fit_as_empty_first_layout(height) if no_space_in_first_layout?(width)\n\n layout = generate_layout(width, @dsl.text)\n if fits_in_one_layout?(layout, height)\n fit_as_one_layout(layout)\n else\n fit_as_two_layouts(layout, height, width)\n end\n end",
"def createMainLayout()\n\t\t@header = createHeaderLayout()\n\t\t@content = createContentLayout()\n\n\t\t@main = Gtk::Box.new(:vertical, 2)\n\t\t@main.pack_start(@header)\n\t\t@main.pack_start(@content, :expand => true, :fill => true)\n\n\t\tself.children.each do |child|\n\t\t\tself.remove(child)\n\t\tend\n\n\t\tself.add(@main)\n\t\treturn self\n\tend",
"def layoutFillVertical(child=nil, padding=0, insertBefore=nil, &block)\n PlatformGUI.specific\n end",
"def stretch!(&block)\n each do |stretchable|\n if stretchable.respond_to?(:stretch!)\n stretchable.stretch!(&block)\n end\n end\n \n return self\n end",
"def test_layout()\n w = Qt5::QWidget.new\n #w.show()\n \n b = Qt5::QPushButton.new(\"Quit...\", w);\n b2 = Qt5::QPushButton.new(\"Quit2222...\", w);\n vlo = Qt5::QVBoxLayout.new();\n w2 = Qt5::QLCDNumber.new(w);\n w3 = Qt5::QLCDNumber.new(w);\n\n w2.display('6000');\n w3.display('200');\n \n vlo.addWidget(w2);\n vlo.addWidget(w3);\n\n #w.setLayout(vlo)\n\n glo = Qt5::QGridLayout.new();\n glo.addWidget(b, 0, 0) \n glo.addLayout(vlo, 1, 0); ## 没有执行???\n glo.addWidget(b2, 1, 1)\n\n\n #glo.columnCount(); \n c = glo.rowCount(); # 这里如果>1,则成功了。\n #exit;\n \n #w.layout(); # ok\n w.setLayout(glo);\n #w.layout(); # ok\n #w.hide();\n\n\n w.show();\n #glo.activate();\n #w.resize(200, 100)\n #glo.count() \n #glo.dumpObjectInfo();\n #w.dumpObjectTree();\n #w.acceptDrops();\n #h = w.height();\n # p = glo.parent();\n #w.setObjectName(\"j123456\")\n n = w.objectName();\n #puts n\n #puts n.length()\nend",
"def fix_layout\n @fix_layout\n end",
"def resizes_if_necessary\n if(@kv_height > @interieur_height || @kv_width > @interieur_width)\n @kv_height = (@kv_height / 2).ceil \n @kv_width = (@kv_width / 2).ceil \n resizes_if_necessary\n end\n end",
"def splitView(sender, resizeSubviewsWithOldSize:oldSize)\n if sender == @masterSplitView\n right = @masterSplitView.subviews.last\n rightFrame = right.frame\n rightFrame.size.width += @masterSplitView.frame.size.width - oldSize.width\n right.frame = rightFrame\n @masterSplitView.adjustSubviews\n else\n @contentSplitView.adjustSubviews\n end\n end",
"def perform_layout\n @needs_layout = false\n @subviews.each(&:perform_layout)\n end",
"def layout_child_positions()\n # Calculate total width + gap\n total = children.inject(0) {|memo, child| memo+(child.pixel_width||0)}\n total += gap * (children.length-1)\n \n # Position children\n pos = 0\n \n children.each do |child|\n # X Position\n child.x = case align\n when 'right' then\n pixel_width - total - padding_right + pos;\n when 'center' then\n\t\t\t\t (((pixel_width-padding_left-padding_right).to_f/2) - (total.to_f/2) + pos + padding_left).round;\n else\n\t\t\t\t padding_left + pos;\n end\n\n # Y Position\n child.y = case valign\n when 'bottom' then\n pixel_height - padding_bottom - child.pixel_height;\n when 'middle' then\n\t\t\t\t (((pixel_height-padding_top-padding_bottom).to_f/2) - (child.pixel_height.to_f/2) + padding_top).round;\n else\n\t\t\t\t padding_top\n end\n\n \t\t\t# Increment current position by child width and gap\n \t\t\tpos += child.pixel_width + gap;\n end\n end",
"def expand_layouts\n if @sub_layout\n layout = @sub_layout['content']\n\n # If a master_layout is found we need to process the sub_layout\n # into the master_layout using mustache.\n if @master_layout && @master_layout['content']\n payload = self.payload\n payload['content'] = layout\n layout = @templater.render(@master_layout['content'], payload)\n end\n else\n # Minimum layout if no layout defined.\n layout = '{{{content}}}' \n end\n \n layout\n end",
"def ensure_children_for_division(division, floats)\n widths = division.split('-').map(&:to_i)\n return if widths.length < floats.length\n widths.zip(floats, children).each do |width, float, child|\n if child\n child.update_attributes!(:width => width, :float => float)\n else\n child = self.class.create!(:width => width, :float => float)\n child.move_to_child_of self\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /sections or /sections.json
|
def create
@section = Section.new(section_params)
if @section.save
render json: SectionSerializer.new(@section)
else
render json: @section.errors, status: :unprocessable_entity
end
end
|
[
"def create\n @section = Section.new(section_params)\n\n if @section.save\n render :show, status: :created, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end",
"def create\n @section = Section.new(section_params) \n if @section.save\n render json: @section, status: :created\n else\n render json: {errors: @section.errors}, status: :unprocessable_entity\n end \n end",
"def create_sections; end",
"def sections\n respond_with @page.sections\n end",
"def create\n @section = Section.new(params[:section])\n @sections = Section.all\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Sekce byla úspěšně vytvořena.'\n format.html { redirect_to(admin_sections_url) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def sell_shop_section_create (section_name, params={})\r\n url = api_url \"/sell/shop/sections\"\r\n req = request_params(params)\r\n load = MultiJson.dump name: section_name\r\n\r\n feed_or_retry do\r\n RestClient.post url, load, req\r\n end \r\n end",
"def create\n @form_section = FormSection.new(form_section_params)\n @form_section.save\n respond_with( [ :admin, @form_section] )\n end",
"def create\n @section = current_account.sections.build(section_params)\n @section.parent = current_account.sections.find_by(id: params[:parent_id]) || current_account.sections.root\n @section.save\n\n respond_with @section, location: admin_api_cms_sections_path(@section)\n end",
"def create\n @post_section = PostSection.new(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to @post_section, notice: 'Post section was successfully created.' }\n format.json { render :show, status: :created, location: @post_section }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @api_v2_dashboard_section = Api::V2::Dashboard::Section.new(api_v2_dashboard_section_params)\n\n respond_to do |format|\n if @api_v2_dashboard_section.save\n format.html { redirect_to @api_v2_dashboard_section, notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: @api_v2_dashboard_section }\n else\n format.html { render :new }\n format.json { render json: @api_v2_dashboard_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @post = find_post\n @post_section = @post.sections.build(post_section_params)\n\n respond_to do |format|\n if @post_section.save\n format.html { redirect_to admin_post_section_url(@post, @post_section), notice: 'Section was successfully created.' }\n format.json { render :show, status: :created, location: admin_post_section_url(@post, @post_section) }\n else\n format.html { render :new }\n format.json { render json: @post_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sections = Section.find(:all)\n @section = Section.new(params[:section])\n\n respond_to do |format|\n if @section.save\n flash[:notice] = 'Section was successfully created.'\n format.html { redirect_to(@section) }\n format.xml { render :xml => @section, :status => :created, :location => @section }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @section.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @section = Section.find(params[:section_id])\n @subsection = @section.subsections.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @subsection }\n end\n end",
"def create\n debugger\n @sub_section = SubSection.new(params[:sub_section])\n\n respond_to do |format|\n if @sub_section.save\n format.html { redirect_to @sub_section, notice: 'Sub section was successfully created.' }\n format.json { render json: @sub_section, status: :created, location: @sub_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sub_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n user=User.find_by_id(params[:user_section][:user])\n user.sections << Section.find_by_id(params[:user_section][:section])\n \n respond_to do |format|\n if user.save\n format.html { redirect_to user_sections_path, notice: t('user_sections.successfully_created') }\n# format.json { render json: @user_section, status: :created, location: @user_section }\n else\n format.html { render action: \"new\" }\n# format.json { render json: @user_section.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n @service_section = ServiceSection.new(service_section_params)\n\n respond_to do |format|\n if @service_section.save\n format.html { redirect_to @service_section, notice: \"Service section was successfully created.\" }\n format.json { render :show, status: :created, location: @service_section }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @service_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page_section = PageSection.new(page_section_params)\n\n respond_to do |format|\n if @page_section.save\n format.html { redirect_to @page_section,\n notice: t('shared.msgs.success_created',\n obj: t('activerecord.models.page_section', count: 1)) }\n format.json { render :show, status: :created, location: @page_section }\n else\n format.html { render :new }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @page_section = Admin::PageSection.new(params[:admin_page_section])\n\n respond_to do |format|\n if @page_section.save\n format.html { redirect_to @page_section, notice: 'Page section was successfully created.' }\n format.json { render json: @page_section, status: :created, location: @page_section }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_section.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @sections = params[:path].nil? ? Section.all : Section.where(path: params[:path])\n\n respond_to do |format|\n format.html { render html: @sections }\n format.json { render json: @sections }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /commodities GET /commodities.json
|
def index
@commodities = Commodity.all
if params[:search].present?
@commodities = @commodities.query(params[:search].to_s)
end
@commodities = @commodities.page(params[:page])
respond_to do |format|
format.html
format.js {}
format.json {
render json: {:commodities => @commodities}
}
end
end
|
[
"def index\n @commodities = PlanetaryCommodity.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def index\n @commodities = Commodity.all\n end",
"def index\n @categories = Category.all\n @commodities = current_user.commodities.order(\"created_at desc\")\n @selled = @commodities.where(:num => 0).page(params[:page]).per(15)\n @selling = @commodities.where(\"num > ?\", 0).page(params[:page]).per(15)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commodities }\n end\n end",
"def index\n @commodoties = Commodoty.all\n end",
"def show\n @commodity = Commodity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commodity }\n end\n end",
"def commodities\n @commodities.values\n end",
"def get_commodity(commodity_name)\n @commodities[commodity_name]\n end",
"def show\n @planetary_commodity = PlanetaryCommodity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planetary_commodity }\n end\n end",
"def index\n# @commodity_items = CommodityItem.all\n @commodity_items = current_company.commodity_items\n end",
"def index\n @commodity_types = CommodityType.all\n end",
"def new\n @commodity = Commodity.new\n @ingredients = Ingredient.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end",
"def new\n @commodity = Commodity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @commodity }\n end\n end",
"def get_expense_companies\n res = {\n :total => nil,\n :success => true,\n :data => []\n }\n entities = OrderEntity.find_all_by_order_id(params[:id], :include => [:company])\n entities.each do |e|\n res[:data].push([e.id, e.company.name])\n end\n\n render :json => res.to_json, :layout => false\n\n end",
"def index\n @opportunities = current_company.opportunities\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @opportunities }\n end\n end",
"def index\n @accommodations = current_user.accommodations.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accommodations }\n end\n end",
"def cities\n self.class.get(\"/v1/cities\")\n end",
"def index\n @sales_productivities = SalesProductivity.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sales_productivities }\n end\n end",
"def index\n @opportunities = Opportunity.all\n\n render json: @opportunities\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Convert compressed range proof using inner product.
|
def to_compress
a = lx.dup
b = rx.dup
ts = transcript.dup
w = ts.challenge_scalar("w")
q = GENERATOR_BJ * w
a_sum = a.dup
b_sum = b.dup
g_sum = vec_g.dup
h_sum = vec_h2.dup
terms = []
until a_sum.length == 1
a_lo = []
b_lo = []
g_lo = []
h_lo = []
a_hi = []
b_hi = []
g_hi = []
h_hi = []
half = a_sum.length / 2
a_sum.each.with_index do |_, i|
if i < half
a_lo << a_sum[i]
b_lo << b_sum[i]
g_lo << g_sum[i]
h_lo << h_sum[i]
else
a_hi << a_sum[i]
b_hi << b_sum[i]
g_hi << g_sum[i]
h_hi << h_sum[i]
end
end
alo_bhi = a_lo.zip(b_hi).map { |x, y| FIELD.mod(x * y) }.sum
ahi_blo = a_hi.zip(b_lo).map { |x, y| FIELD.mod(x * y) }.sum
l_k =
g_hi.zip(a_lo).map { |x, y| x * y }.sum(INFINITY_J) +
h_lo.zip(b_hi).map { |x, y| x * y }.sum(INFINITY_J) + q * alo_bhi
r_k =
g_lo.zip(a_hi).map { |x, y| x * y }.sum(INFINITY_J) +
h_hi.zip(b_lo).map { |x, y| x * y }.sum(INFINITY_J) + q * ahi_blo
ts.points << l_k
ts.points << r_k
uk = ts.challenge_scalar("uk")
uk_inv = FIELD.inverse(uk)
terms << { L: l_k, R: r_k }
a_sum = []
b_sum = []
g_sum = []
h_sum = []
a_lo.each.with_index do |_, i|
a_sum << (a_lo[i] * uk + a_hi[i] * uk_inv)
b_sum << (b_lo[i] * uk_inv + b_hi[i] * uk)
g_sum << (g_lo[i] * uk_inv + g_hi[i] * uk)
h_sum << (h_lo[i] * uk + h_hi[i] * uk_inv)
end
end
a0 = a_sum.first
b0 = b_sum.first
Compressed.new(v, p_a, p_s, p_t1, p_t2, tx, tx_bf, e, a0, b0, terms)
end
|
[
"def transform_bin\n @productions.each do |p|\n next unless p.length > 2\n\n next_sym = nil\n count = p.rhs.length - 2\n p.rhs[1..].reverse.each do |x|\n if next_sym.nil?\n next_sym = x\n else\n name = \"#{x}_#{next_sym}\"\n name = name.to_sym if x.is_a?(Symbol) && next_sym.is_a?(Symbol)\n name = unique_name(\"#{name}_\".to_sym) if symbol?(name)\n add_production(name, x, next_sym, generated: true)\n next_sym = name\n count -= 1\n end\n end\n\n p.rhs[1] = next_sym\n p.rhs = p.rhs[0..1]\n end\n end",
"def quantize_bit_reprisentation(samples, bits, max, min)\r\n max = samples.max if max.nil? \r\n min = samples.min if min.nil?\r\n levels = bits ** 2\r\n mapped = map_to_unit_centered(samples, max, min)\r\n process(mapped, ->(n){ (n * levels / 2.0).round})\r\n end",
"def convergents_from_contfrac contfrac\n convs =[]\n contfrac.each_with_index do |e,i|\n convs << contfrac_to_frac(contfrac[0..i])\nend\nconvs\nend",
"def scale(range)\n u = uninterpolate\n i = interpolate(range[0], range[1])\n\n lambda do |x|\n x = ([0.0, x, (wrong + right).to_f].sort[1]).to_f\n i.call(u.call(x))\n end\n end",
"def quantize\r\n\t\tVec.new(@x.floor.to_f, @y.floor.to_f)\r\n\tend",
"def to(num); calc(num, @tgt, @src); end",
"def interpolbi pontos\n pontos = pontos.sort\n lambda do |*x|\n lagrange pontos.map {|x1, pts|\n [x1, lagrange(pts).call(x[1])]\n }.call(x[0])\n end\nend",
"def numeric_transformation(value); end",
"def invert list\n first = list[0]\n self.quantize(list.map{|p| first + (first - p)})\n end",
"def folding_ranges; end",
"def to_outer(point)\n transform * point\n end",
"def compose_prod_from_costs\n vect = Matrix.zeros(basis.length + 1, 1)\n basis.each_with_index do |cell, vect_row|\n vect[vect_row, 0] = data.c[cell.to_a]\n end\n vect\n end",
"def map(value, v_min, v_max, d_min, d_max)\n v_value = value.to_f # so it returns float\n\n v_range = v_max - v_min\n d_range = d_max - d_min\n (v_value - v_min) * d_range / v_range + d_min\n end",
"def map_value(val, from_range, to_range)\n orig_range = [1, (from_range[1] - from_range[0]).abs].max\n new_range = [1, (to_range[1] - to_range[0]).abs].max\n\n ((val.to_f - from_range[0]) / orig_range) * new_range + to_range[0]\n end",
"def transpose_list list, interval\n self.quantize(list.map{|p| p + interval})\n end",
"def convert_range2d(range, _class)\n # Split the range into 2 cell refs\n cell1, cell2 = range.split(':')\n\n # A range such as A:D is equivalent to A1:D65536, so add rows as required\n cell1 += '1' unless cell1 =~ /\\d/\n cell2 += '65536' unless cell2 =~ /\\d/\n\n # Convert the cell references\n row1, col1 = cell_to_packed_rowcol(cell1)\n row2, col2 = cell_to_packed_rowcol(cell2)\n\n # The ptg value depends on the class of the ptg.\n if (_class == 0)\n ptgarea = [@ptg['ptgArea']].pack(\"C\")\n elsif (_class == 1)\n ptgarea = [@ptg['ptgAreaV']].pack(\"C\")\n elsif (_class == 2)\n ptgarea = [@ptg['ptgAreaA']].pack(\"C\")\n else\n exit \"Unknown function class in formula\\n\"\n end\n\n ptgarea + row1 + row2 + col1 + col2\n end",
"def InverseZ(a, b) \r\n (a.downto b).lazy\r\nend",
"def best_compressible_range(fields, start)\n cr = compressible_ranges(fields, start)\n\n if cr[0]\n if cr[1]\n if cr[0].count == cr[1].count\n compress = cr[0].first < cr[1].first ? cr[1] : cr[0]\n else\n compress = cr[0]\n end\n else\n compress = cr[0]\n end\n else\n compress = nil\n end\n end",
"def to_range_value(float_value,range)\n range.begin + float_value * (range.end - range.begin)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /shipping_options/1 GET /shipping_options/1.json
|
def show
@shipping_option = ShippingOption.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @shipping_option }
end
end
|
[
"def shipping_options\n Hash.new\n end",
"def invoice_get_all_shipping_options\n response = xmlrpc('Invoice.getAllShippingOptions')\n end",
"def new\n @shipping_option = ShippingOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def show\n @shipping_method = @shop.shipping_methods.find params[:id]\n\n respond_to do |format|\n format.html\n format.json { render json: @shipping_method }\n end\n end",
"def index\n @shipping_methods = @shop.shipping_methods\n\n respond_to do |format|\n format.html\n format.json { render json: @shipping_methods }\n end\n end",
"def shipping_option_id\n @payment['shipping_option_id']\n end",
"def getShippingOptions(parameters)\n parameters['hash'] = OpenSSL::HMAC.hexdigest('md5', @key, parameters.values.join('.'))\n postData = parameters.map{|k,v| \"#{CGI.escape(k)}=#{CGI.escape(v)}}\"}.join('&')\n headers = {'User-Agent' => 'Mozilla/5.0', 'Content-Type' => 'application/x-www-form-urlencoded', 'Content-Length' => postData.length.to_s}\n uri = URI.parse(@baseuri + @webstore + '/v1/shipping.json')\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.set_form_data(parameters) \n response = http.request(request)\n puts response.body\n end",
"def show\n @shipping_option = ShippingOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shipping_option }\n end\n end",
"def index\n @ebay_shipping_service_options = Ebay::ShippingServiceOption.all\n end",
"def shipping\n @data[:shipping]\n end",
"def show\n @shipping_category = @shop.shipping_categories.find params[:id]\n\n respond_to do |format|\n format.html\n format.json { render json: @shipping_category }\n end\n end",
"def get_shipping_type\n shipping_region = ShippingRegion.find_by_shipping_region_id(shipping_region_id)\n json_response(shipping_region)\n end",
"def show\n @shipping_label = ShippingLabel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_label }\n end\n end",
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :created, location: @shipping_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @shipping_address = ShippingAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"def show\n @shipping_order = ShippingOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @shipping_order }\n end\n end",
"def shipping\n adjustments.find { |a| a.type == \"shipping-method\" }\n end",
"def show\n @shipping_destination = ShippingDestination.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_destination }\n end\n end",
"def show\n @shipping_override = ShippingOverride.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shipping_override }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /shipping_options/new GET /shipping_options/new.json
|
def new
@shipping_option = ShippingOption.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @shipping_option }
end
end
|
[
"def new\n @shipping_method = @shop.shipping_methods.build\n\n respond_to do |format|\n format.html \n format.json { render json: @shipping_method }\n end\n end",
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :created, location: @shipping_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shipping = Shipping.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping }\n end\n end",
"def new\n @shipping_option = ShippingOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shipping_option }\n end\n end",
"def new\n @shipping_address = ShippingAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"def new\n @shipping_order = ShippingOrder.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_order }\n end\n end",
"def new\n @shipping_override = ShippingOverride.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_override }\n end\n end",
"def new\n @shipping_category = @shop.shipping_categories.build\n\n respond_to do |format|\n format.html \n format.json { render json: @shipping_category }\n end\n end",
"def new\n @shipping_plan = ShippingPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_plan }\n end\n end",
"def create\n @shipping_method = ShippingMethod.new(shipping_method_params)\n\n respond_to do |format|\n if @shipping_method.save\n format.html { redirect_to admin_shipping_methods_url, notice: 'Shipping method was successfully created.' }\n format.json { render :show, status: :created, location: @shipping_method }\n else\n format.html { render :new }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @shipping_label = ShippingLabel.new\n @shipping_label.from_address = Address.new\n @shipping_label.to_address = Address.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_label }\n end\n end",
"def new\n @subscriber = Subscriber.find(session[:subscriber_id])\n @shipping_address = @subscriber.shipping_addresses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n flash[:notice] = 'ShippingOption was successfully created.'\n format.html { redirect_to :controller => 'shipping_options' }\n format.xml { render :xml => @shipping_option, :status => :created, :location => @shipping_option }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_option.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @shipping_line = ShippingLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @shipping_line }\n end\n end",
"def create\n @shipping_method = ShippingMethod.new(shipping_method_params)\n respond_to do |format|\n if @shipping_method.save\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_method }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @channel_shipping_service = ChannelShippingService.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @channel_shipping_service }\n end\n end",
"def new\n @customer = Customer.find(params[:customer_id])\n @shipping_address = ShippingAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_address }\n end\n end",
"def new\n @shipping_box = ShippingBox.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_box }\n end\n end",
"def new\n @shipping_rate = ShippingRate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_rate }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /shipping_options POST /shipping_options.json
|
def create
@shipping_option = ShippingOption.new(params[:shipping_option])
respond_to do |format|
if @shipping_option.save
format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }
format.json { render json: @shipping_option, status: :created, location: @shipping_option }
else
format.html { render action: "new" }
format.json { render json: @shipping_option.errors, status: :unprocessable_entity }
end
end
end
|
[
"def shipping_options\n Hash.new\n end",
"def create\n @ebay_shipping_service_option = Ebay::ShippingServiceOption.new(ebay_shipping_service_option_params)\n\n respond_to do |format|\n if @ebay_shipping_service_option.save\n format.html { redirect_to @ebay_shipping_service_option, notice: 'Shipping service option was successfully created.' }\n format.json { render :show, status: :created, location: @ebay_shipping_service_option }\n else\n format.html { render :new }\n format.json { render json: @ebay_shipping_service_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n flash[:notice] = 'ShippingOption was successfully created.'\n format.html { redirect_to :controller => 'shipping_options' }\n format.xml { render :xml => @shipping_option, :status => :created, :location => @shipping_option }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_option.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_method = ShippingMethod.new(shipping_method_params)\n\n respond_to do |format|\n if @shipping_method.save\n format.html { redirect_to admin_shipping_methods_url, notice: 'Shipping method was successfully created.' }\n format.json { render :show, status: :created, location: @shipping_method }\n else\n format.html { render :new }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def getShippingOptions(parameters)\n parameters['hash'] = OpenSSL::HMAC.hexdigest('md5', @key, parameters.values.join('.'))\n postData = parameters.map{|k,v| \"#{CGI.escape(k)}=#{CGI.escape(v)}}\"}.join('&')\n headers = {'User-Agent' => 'Mozilla/5.0', 'Content-Type' => 'application/x-www-form-urlencoded', 'Content-Length' => postData.length.to_s}\n uri = URI.parse(@baseuri + @webstore + '/v1/shipping.json')\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Post.new(uri.request_uri, headers)\n request.set_form_data(parameters) \n response = http.request(request)\n puts response.body\n end",
"def new\n @shipping_option = ShippingOption.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shipping_option }\n end\n end",
"def create\n @shipping_method = ShippingMethod.new(shipping_method_params)\n respond_to do |format|\n if @shipping_method.save\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_method }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_shipping\n\t\tShipping.create(\n\t\t\tuser_id: params[:user_id],\n\t\t\tcampaign_id: params[:campaign_id],\n\t\t\treward_id: params[:reward_id],\n\t\t\tamount: params[:amount],\n\t\t\tcountry: params[:country]\n\t\t)\n\tend",
"def invoice_get_all_shipping_options\n response = xmlrpc('Invoice.getAllShippingOptions')\n end",
"def create\n @status_shipping = StatusShipping.new(status_shipping_params)\n\n respond_to do |format|\n if @status_shipping.save\n format.html { redirect_to @status_shipping, notice: 'Status shipping was successfully created.' }\n format.json { render :show, status: :created, location: @status_shipping }\n else\n format.html { render :new }\n format.json { render json: @status_shipping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_shipping_item_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: StoreShippingApi.create_shipping_item ...\"\n end\n # resource path\n local_var_path = \"/store/shipping\"\n\n # query parameters\n query_params = {}\n query_params[:'cascade'] = opts[:'cascade'] if !opts[:'cascade'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'shipping_item'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ShippingItem')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: StoreShippingApi#create_shipping_item\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def shipping_option_id\n @payment['shipping_option_id']\n end",
"def create\n @shipping_type = ShippingType.new(shipping_type_params)\n\n respond_to do |format|\n if @shipping_type.save\n format.html { redirect_to @shipping_type, notice: 'Shipping type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @shipping_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @shipping_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def gateway_options\n options = { :email => order.email,\n :customer => order.email,\n :ip => order.last_ip_address,\n # Need to pass in a unique identifier here to make some\n # payment gateways happy.\n #\n # For more information, please see Spree::Payment#set_unique_identifier\n :order_id => gateway_order_id }\n\n if shipment\n Rails.logger.debug 'GatewayShipment'\n Rails.logger.debug shipment.inspect\n Rails.logger.debug shipment.ship_total.to_f.inspect\n Rails.logger.debug shipment.tax_total.to_f.inspect\n Rails.logger.debug shipment.item_total.to_f.inspect\n Rails.logger.debug shipment.promo_total.to_f.inspect\n options.merge!({ :shipping => shipment.cost * 100,\n # :tax => shipment.tax_total * 100, # needs to be line item adjustments\n :subtotal => shipment.item_cost * 100,\n # :discount => shipment.promo_total * 100, # needs to be line item adjustments\n :currency => currency })\n else\n Rails.logger.debug 'GatewayMarket'\n # todo have this run after all shipment payments and just collect balances due?\n options.merge!({ :shipping => order.ship_total * 100,\n :tax => order.tax_total * 100,\n :subtotal => order.item_total * 100,\n :discount => order.promo_total * 100,\n :currency => currency })\n end\n\n options.merge!({ :billing_address => order.bill_address.try(:active_merchant_hash),\n :shipping_address => order.ship_address.try(:active_merchant_hash) })\n Rails.logger.debug 'GatewayResults'\n Rails.logger.debug options.inspect\n Rails.logger.debug options[:shipping].to_f.inspect\n Rails.logger.debug options[:tax].to_f.inspect\n Rails.logger.debug options[:subtotal].to_f.inspect\n Rails.logger.debug options[:discount].to_f.inspect\n\n options\n end",
"def minimal_gateway_options\n {:email => order.user.email, \n :customer => order.user.email, \n :ip => order.ip_address, \n :order_id => order.number,\n :shipping => order.ship_amount * 100,\n :tax => order.tax_amount * 100, \n :subtotal => order.item_total * 100} \n end",
"def new\n @shipping_method = @shop.shipping_methods.build\n\n respond_to do |format|\n format.html \n format.json { render json: @shipping_method }\n end\n end",
"def fill_shipping_method_information\n @browser.radio(:id, @checkout_data['shipping_method']['method']).set\n @browser.div(:id, \"checkout-step-shipping_method\").button(:text, @checkout_data['shipping_method']['text']).click\n end",
"def gateway_options\n options = { :email => order.email,\n :customer => order.email,\n :ip => order.last_ip_address,\n # Need to pass in a unique identifier here to make some\n # payment gateways happy.\n #\n # For more information, please see Spree::Payment#set_unique_identifier\n :order_id => gateway_order_id }\n\n if drop_ship_order\n options.merge!({ :shipping => drop_ship_order.ship_total * 100,\n :tax => drop_ship_order.tax_total * 100, # TODO needs to be line item adjustments\n :subtotal => drop_ship_order.item_total * 100,\n :discount => drop_ship_order.promo_total * 100, # TODO needs to be line item adjustments\n :currency => currency })\n else\n # todo have this run after all shipment payments and just collect balance due?\n options.merge!({ :shipping => order.ship_total * 100,\n :tax => order.tax_total * 100,\n :subtotal => order.item_total * 100,\n :discount => order.promo_total * 100,\n :currency => currency })\n end\n\n options.merge!({ :billing_address => order.bill_address.try(:active_merchant_hash),\n :shipping_address => order.ship_address.try(:active_merchant_hash) })\n\n options\n end",
"def set_shipping_method\n ship_id = params[:ship_type_id]\n # Convert to integers for comparison purposes!\n ship_type = session[:order_shipping_types].find { |type| type.id.to_i == ship_id.to_i }\n ship_price = ship_type.calculated_price\n @order.order_shipping_type_id = ship_id\n @order.shipping_cost = ship_price\n @order.save\n \n if Preference.find_by_name('store_show_confirmation').is_true?\n action_after_shipping = 'confirm_order'\n else\n action_after_shipping = 'finish_order'\n end\n redirect_to :action => action_after_shipping\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /shipping_options/1 PUT /shipping_options/1.json
|
def update
@shipping_option = ShippingOption.find(params[:id])
respond_to do |format|
if @shipping_option.update_attributes(params[:shipping_option])
format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @shipping_option.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @shipping_option = ShippingOption.find(params[:id])\n\n respond_to do |format|\n if @shipping_option.update_attributes(params[:shipping_option])\n flash[:notice] = 'ShippingOption was successfully updated.'\n format.html { redirect_to :controller => 'shipping_options' }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_option.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n format.html { redirect_to @shipping_option, notice: 'Shipping option was successfully created.' }\n format.json { render json: @shipping_option, status: :created, location: @shipping_option }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shipping_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ebay_shipping_service_option.update(ebay_shipping_service_option_params)\n format.html { redirect_to @ebay_shipping_service_option, notice: 'Shipping service option was successfully updated.' }\n format.json { render :show, status: :ok, location: @ebay_shipping_service_option }\n else\n format.html { render :edit }\n format.json { render json: @ebay_shipping_service_option.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipping_method.update(shipping_method_params)\n format.html { redirect_to admin_shipping_methods_url, notice: 'Shipping method was successfully updated.' }\n format.json { render :show, status: :ok, location: @shipping_method }\n else\n format.html { render :edit }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipping_method.update(shipping_method_params)\n format.html { redirect_to [:admin, @shipping_method], notice: 'Shipping method was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shipping_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @shipping_type.update(shipping_type_params)\n format.html { redirect_to @shipping_type, notice: 'Shipping type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @shipping_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_ShippingService(value)\n set_input(\"ShippingService\", value)\n end",
"def set_ShippingServiceCost(value)\n set_input(\"ShippingServiceCost\", value)\n end",
"def update\n @shipping_service.shipping_methods[-1].destroy if @shipping_service.shipping_methods.last.name == '' || @shipping_service.shipping_methods.last.price == nil\n if @shipping_service.update(shipping_service_params)\n redirect_to dashboard_shipping_service_path(@shipping_service), notice: 'Shipping service was successfully updated.'\n else\n render :edit\n end\n end",
"def update\n @shipping_method = ShippingMethod.find(params[:id])\n\n respond_to do |format|\n if @shipping_method.update_attributes(params[:shipping_method])\n format.html { redirect_to([:admin, @shipping_method], :notice => 'Shipping method was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_method.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_label = ShippingLabel.find(params[:id])\n\n respond_to do |format|\n if @shipping_label.update_attributes(params[:shipping_label])\n format.html { redirect_to @shipping_label, notice: 'Shipping label was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_label.errors, status: :unprocessable_entity }\n end\n end\n end",
"def set_shipping_method\n ship_id = params[:ship_type_id]\n # Convert to integers for comparison purposes!\n ship_type = session[:order_shipping_types].find { |type| type.id.to_i == ship_id.to_i }\n ship_price = ship_type.calculated_price\n @order.order_shipping_type_id = ship_id\n @order.shipping_cost = ship_price\n @order.save\n \n if Preference.find_by_name('store_show_confirmation').is_true?\n action_after_shipping = 'confirm_order'\n else\n action_after_shipping = 'finish_order'\n end\n redirect_to :action => action_after_shipping\n end",
"def create\n @shipping_option = ShippingOption.new(params[:shipping_option])\n\n respond_to do |format|\n if @shipping_option.save\n flash[:notice] = 'ShippingOption was successfully created.'\n format.html { redirect_to :controller => 'shipping_options' }\n format.xml { render :xml => @shipping_option, :status => :created, :location => @shipping_option }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @shipping_option.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_box = ShippingBox.find(params[:id])\n\n respond_to do |format|\n if @shipping_box.update_attributes(params[:shipping_box])\n format.html { redirect_to admin_shipping_boxes_url, notice: 'Modelo de caixa atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_box.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_address = ShippingAddress.find(params[:id])\n\n respond_to do |format|\n if @shipping_address.update_attributes(params[:shipping_address])\n format.html { redirect_to @shipping_address, notice: 'Shipping address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shipping_address.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_order = ShippingOrder.find(params[:id])\n\n respond_to do |format|\n if @shipping_order.update_attributes(params[:shipping_order])\n format.html { redirect_to @shipping_order, :notice => 'Shipping order was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @shipping_order.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def shipping_options\n Hash.new\n end",
"def update\n respond_to do |format|\n if @shippingorder.update(shippingorder_params)\n format.html { redirect_to @shippingorder, notice: 'Shippingorder was successfully updated.' }\n format.json { render :show, status: :ok, location: @shippingorder }\n else\n format.html { render :edit }\n format.json { render json: @shippingorder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @shipping_type = ShippingType.find(params[:id])\n\n respond_to do |format|\n if @shipping_type.update_attributes(params[:shipping_type])\n format.html { redirect_to(@shipping_type, :notice => 'Shipping type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @shipping_type.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /shipping_options/1 DELETE /shipping_options/1.json
|
def destroy
@shipping_option = ShippingOption.find(params[:id])
@shipping_option.destroy
respond_to do |format|
format.html { redirect_to shipping_options_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @shipping_option = ShippingOption.find(params[:id])\n @shipping_option.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => 'shipping_options' }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ebay_shipping_service_option.destroy\n respond_to do |format|\n format.html { redirect_to ebay_shipping_service_options_url, notice: 'Shipping service option was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_method.destroy\n respond_to do |format|\n format.html { redirect_to admin_shipping_methods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_type.destroy\n respond_to do |format|\n format.html { redirect_to shipping_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_method = @shop.shipping_methods.find(params[:id])\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_shipping_methods_path(@shop) }\n format.json { render json: @shipping_method }\n end\n end",
"def destroy\n @shipping_method = ShippingMethod.find(params[:id])\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_methods_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_detail.destroy\n respond_to do |format|\n format.html { redirect_to shipping_details_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_method = ShippingMethod.find(params[:id])\n @shipping_method.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_methods_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shipping_label = ShippingLabel.find(params[:id])\n @shipping_label.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_labels_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_area.destroy\n respond_to do |format|\n format.html { redirect_to shipping_areas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_plan = ShippingPlan.find(params[:id])\n @shipping_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_plans_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_cost = ShippingCost.find(params[:id])\n @shipping_cost.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_shipping_costs_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shipping_type = ShippingType.find(params[:id])\n @shipping_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(shipping_types_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @shipping_category.destroy\n respond_to do |format|\n format.html { redirect_to admin_shipping_categories_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_order = ShippingOrder.find(params[:id])\n @shipping_order.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_orders_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @status_shipping.destroy\n respond_to do |format|\n format.html { redirect_to status_shippings_url, notice: 'Status shipping was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @shipping_override = ShippingOverride.find(params[:id])\n @shipping_override.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_overrides_url }\n format.json { head :no_content }\n end\n end",
"def destroy_shipping_method\n shipping_method = ShippingMethod.find(params[:method_id])\n service_id = shipping_method.shipping_service_id\n shipping_method.destroy\n redirect_to edit_dashboard_shipping_service_path(service_id)\n end",
"def destroy\n @shipping_line = ShippingLine.find(params[:id])\n @shipping_line.destroy\n\n respond_to do |format|\n format.html { redirect_to shipping_lines_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
order the rectangles as per assumptions
|
def order_rectangles(rec1, rec2)
r1 = Rectangle.new(rec1)
r2 = Rectangle.new(rec2)
r1 = order_coord_of_rectangles(r1)
r2 = order_coord_of_rectangles(r2)
if r2.A.X < r1.A.X
temp = r1
r1 = r2
r2 = temp
end
ret = [r1, r2]
return ret
end
|
[
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[1] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,80,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,50,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n \n # Rects Adjustments\n \n # ucEncounters\n rects[0][1].x += rects[0][0].width\n rects[0][2].x = rects[0][1].x + rects[0][1].width\n rects[0][2].width = rect.width - rects[0][0].width - rects[0][1].width\n \n # ucDefeated\n rects[1][0].y += spacing\n rects[1][1].x += rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][2].x = rects[1][1].x + rects[1][1].width\n rects[1][2].y = rects[1][0].y\n rects[1][2].width = rect.width - rects[1][0].width - rects[1][1].width\n \n # ucEscaped\n rects[2][0].y += spacing*2\n rects[2][1].x += rects[2][0].width\n rects[2][1].y = rects[2][0].y\n rects[2][2].x = rects[2][1].x + rects[2][1].width\n rects[2][2].y = rects[2][0].y\n rects[2][2].width = rect.width - rects[2][0].width - rects[2][1].width\n \n # ucExp\n rects[3][0].y += spacing*3\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].x = rects[3][1].x + rects[3][1].width\n rects[3][2].y = rects[3][0].y\n rects[3][2].width = rect.width - rects[3][0].width - rects[3][1].width\n \n # ucGold\n rects[4][0].y += spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].x = rects[4][1].x + rects[4][1].width\n rects[4][2].y = rects[4][0].y\n rects[4][2].width = rect.width - rects[4][0].width - rects[4][1].width\n \n return rects\n end",
"def sort_rectangle_coordinates(c)\n if c[0] > c[2]\n t = c[2]\n c[2] = c[0]\n c[0] = t\n end\n if c[1] > c[3]\n t = c[3]\n c[3] = c[1]\n c[1] = t\n end\n c\n end",
"def determine_rects\n end",
"def determine_rects(rect, spacing)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,40,rect.height)\n rects[1] = [Rect.new(rect.x,rect.y,35,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[2] = [Rect.new(rect.x,rect.y,35,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[3] = [Rect.new(rect.x,rect.y,35,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = [Rect.new(rect.x,rect.y,35,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[5] = [Rect.new(rect.x,rect.y,35,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = [Rect.new(rect.x,rect.y,35,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[7] = Rect.new(rect.x,rect.y,rect.width,24)\n \n adjust_y = (rect.height / (3*24)).floor\n value_width = ((rect.width - rects[0].width - (35*2) - spacing) / 2).floor\n \n # Rects Adjustments\n \n # ucCharGraphic\n # Nothing to do\n \n # ucAtkStat\n rects[1][0].x += rects[0].width\n rects[1][0].y += adjust_y\n rects[1][1].x = rects[1][0].x + rects[1][0].width\n rects[1][1].y = rects[1][0].y\n rects[1][1].width = value_width\n\n # ucDefStat\n rects[2][0].x += rects[0].width + rects[1][0].width + value_width + spacing\n rects[2][0].y += adjust_y\n rects[2][1].x = rects[2][0].x + rects[2][0].width\n rects[2][1].y = rects[2][0].y\n rects[2][1].width = value_width\n \n # ucSpiStat \n rects[3][0].x += rects[0].width\n rects[3][0].y += adjust_y + spacing\n rects[3][1].x = rects[3][0].x + rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][1].width = value_width\n \n # ucAgiStat\n rects[4][0].x += rects[0].width + rects[3][0].width + value_width + spacing\n rects[4][0].y += adjust_y + spacing\n rects[4][1].x = rects[4][0].x + rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][1].width = value_width\n \n # ucEvaStat \n rects[5][0].x += rects[0].width\n rects[5][0].y += adjust_y + (spacing*2)\n rects[5][1].x = rects[5][0].x + rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][1].width = value_width\n \n # ucHitStat\n rects[6][0].x += rects[0].width + rects[5][0].width + value_width + spacing\n rects[6][0].y += adjust_y + (spacing*2)\n rects[6][1].x = rects[6][0].x + rects[6][0].width\n rects[6][1].y = rects[6][0].y\n rects[6][1].width = value_width\n \n # cMsg\n rects[7].x += rects[0].width\n rects[7].y += ((rect.height-rects[7].height)/2).floor\n \n return rects\n end",
"def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,96,96)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[2] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[3] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[4] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[5] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[6] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucCharFace\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*2\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[2][0].y += spacing\n rects[2][0].width -= rects[2][1].width\n rects[2][1].x += (rects[2][0].width / 2).floor + rects[2][1].width\n rects[2][1].y = rects[2][0].y\n \n # ucHpStat \n rects[3][0].y += rect.height - spacing*4\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n rects[3][2].y = rects[3][0].y + spacing\n rects[3][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[4].y = rects[3][0].y+gauge_y\n rects[4].height = rects[3][0].height-gauge_y\n\n # ucMpStat\n rects[5][0].y += rect.height - spacing*2\n rects[5][1].x += rects[5][0].width\n rects[5][1].y = rects[5][0].y\n rects[5][2].y = rects[5][0].y + spacing\n rects[5][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[6].y = rects[5][0].y+gauge_y\n rects[6].height = rects[5][0].height-gauge_y\n \n return rects\n end",
"def determine_rects(rect, spacing, right_pad)\n rects = []\n \n # Rects Initialization\n rects[0] = Rect.new(rect.x,rect.y,100,24)\n rects[1] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[2] = Rect.new(rect.x,rect.y,rect.width,24)\n rects[3] = [Rect.new(rect.x,rect.y,rect.width,18),\n Rect.new(rect.x,rect.y,18,18)]\n rects[4] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[5] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[6] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[7] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n rects[8] = [Rect.new(rect.x,rect.y,24,24),\n Rect.new(rect.x,rect.y,25,24),\n Rect.new(rect.x,rect.y,rect.width,24)]\n rects[9] = Rect.new(rect.x,rect.y,rect.width,rect.height)\n \n gauge_value_width = rect.width - right_pad\n gauge_y = 16\n \n # Rects Adjustments\n \n # ucActStates\n rects[0].x += ((rect.width - rects[0].width) / 2).floor\n rects[0].y += spacing*3\n \n # cCharImage\n rects[1].height -= spacing*3\n \n # cCharName\n # Nothing to do\n \n # ucCharLvl\n rects[3][0].y += spacing\n rects[3][0].width -= rects[3][1].width\n rects[3][1].x += rects[3][0].width\n rects[3][1].y = rects[3][0].y\n \n # ucHpStat \n rects[4][0].y += rect.height - spacing*4\n rects[4][1].x += rects[4][0].width\n rects[4][1].y = rects[4][0].y\n rects[4][2].y = rects[4][0].y + spacing\n rects[4][2].width = gauge_value_width\n \n # cHpStatGauge\n rects[5].y = rects[4][0].y+gauge_y\n rects[5].height = rects[4][0].height-gauge_y\n \n # ucMpStat\n rects[6][0].y += rect.height - spacing*2\n rects[6][1].x += rects[6][0].width\n rects[6][1].y = rects[6][0].y\n rects[6][2].y = rects[6][0].y + spacing\n rects[6][2].width = gauge_value_width\n \n # cMpStatGauge\n rects[7].y = rects[6][0].y+gauge_y\n rects[7].height = rects[6][0].height-gauge_y\n \n # ucExpStat\n rects[8][0].y += spacing\n rects[8][1].x += rects[8][0].width\n rects[8][1].y = rects[8][0].y\n rects[8][2].y = rects[8][0].y + spacing\n rects[8][2].width = gauge_value_width\n \n # cExpGauge\n rects[9].y = rects[8][0].y+gauge_y\n rects[9].height = rects[8][0].height-gauge_y\n \n return rects\n end",
"def get_rectangles(cells)\n rectangles = []\n for e in cells\n next if in_rectangle(e, rectangles)\n\n if e.figure == [:corner, :north_west]\n rectangle = get_rectangle(e)\n rectangles.push(rectangle) if rectangle != nil\n end \n end\n rectangles\n end",
"def rectangles_finder(arr)\n rectangle_spots = {} # will keep track of where rectangles occupy\n rectangles = [] # will keep track of the rectangle corners for output\n\n arr.each_with_index do |row, i|\n row.each_with_index do |el, j|\n if el == 1 && !rectangle_spots.include?([i, j])\n # Found a new rectangle corner\n ul = [i, j]\n br = bottom_right(arr, ul)\n\n # Add the rectangle corners to the output\n rectangles << [ul, br]\n\n # Add the new coordinates to the hash\n rectangle_spots = update_hash(rectangle_spots, [ul, br])\n end\n end\n end\n\n # Return the rectangles\n rectangles\nend",
"def smallest_rect_for_points(points)\n # Create an initial rect which covers only one point\n initial_point = points.first\n rect = Rect.new(\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left),\n Point.new(initial_point.top, initial_point.left)\n )\n \n # Expand it so it fills every point\n points.each do |point|\n # Check left\n if point.left < rect.top_left.left\n rect.top_left.left = point.left\n rect.bottom_left.left = point.left\n end\n\n # Check right\n if point.left > rect.top_right.left\n rect.top_right.left = point.left\n rect.bottom_right.left = point.left\n end\n\n # Check top\n if point.top < rect.top_left.top\n rect.top_left.top = point.top\n rect.top_right.top = point.top\n end\n\n # Check bottom\n if point.top > rect.bottom_left.top\n rect.bottom_left.top = point.top\n rect.bottom_right.top = point.top\n end\n end\n\n rect\nend",
"def text_in_rect(xmin,xmax,ymin,ymax,page=1)\n text_map = content(page)\n box = []\n text_map.keys.sort.reverse.each do |y|\n if y >= ymin && y<= ymax\n row = []\n text_map[y].keys.sort.each do |x|\n if x >= xmin && x<= xmax\n row << text_map[y][x]\n end\n end\n box << row unless row.empty?\n end\n end\n box\n end",
"def overlapping_rectangles(arr)\n coords = arr.to_s.scan(/\\d\\,\\-?\\d/).map { |set| set.split(',').map(&:to_i) }\n rect1, rect2 = coords[0..3].sort, coords[4..-1].sort\n len1 = (rect1[2].first - rect1[0].first).abs\n width1 = (rect1[1].last - rect1[0].last).abs\n area1 = len1 * width1\n len2 = (rect2[2].first - rect2[0].first).abs\n width2 = (rect2[1].last - rect2[0].last).abs\n area2 = len2 * width2\n [area1, area2]\nend",
"def split_into_lines(rect) \n\t\tbottom_right = Point.new(rect.location.x + rect.width, rect.location.y)\n\t\ttop_right = Point.new(rect.location.x + rect.width, rect.location.y + rect.height)\n\t\ttop_left = Point.new(rect.location.x, rect.location.y + rect.height)\n\n\t\treturn [[rect.location, top_left],\n\t\t\t\t[rect.location, bottom_right],\n\t\t\t\t[top_left, top_right],\n\t\t\t\t[bottom_right, top_right]]\n\tend",
"def get_bounding_rectangle\n leftmost_x = @panel.get_width\n rightmost_x = 0\n top_y = @panel.get_height\n bottom_y = 0\n\n @entities.each do |e|\n e_x = e.get_x\n e_y = e.get_y\n\n if e_x < leftmost_x\n leftmost_x = e_x\n end\n\n if e_x + ENTITY_WIDTH > rightmost_x\n rightmost_x = e_x + ENTITY_WIDTH\n end\n\n if e_y < top_y\n top_y = e_y\n end\n\n if e_y + ENTITY_HEIGHT > bottom_y\n bottom_y = e_y + ENTITY_HEIGHT\n end\n\n #if leftmost_x - 17 > 0\n # leftmost_x = leftmost_x -17\n #else\n # leftmost_x = 0\n #end\n\n #if rightmost_x + 17 < @panel.get_width\n # rightmost_x = rightmost_x +17\n #else\n # rightmost_x = @panel.get_width\n #end\n\n #if top_y - 17 > 0\n # top_y = top_y -17\n #else\n # top_y = 0\n #end\n\n #if bottom_y + 17 < @panel.get_height\n # bottom_y = bottom_y + 17\n #else\n # bottom_y = @panel.get_height\n #end\n\n end\n return Rectangle.new leftmost_x, top_y, rightmost_x - leftmost_x, bottom_y - top_y\n end",
"def test_obb_vs_obb(rect_a, rect_b)\n @coll_depth = Numeric::POSITIVE_INFINITY\n 2.times do |i|\n axis_a = rect_a.axes[i]\n depth_a = test_intervals(rect_a.projection(axis_a), rect_b.projection(axis_a))\n return false if depth_a == 0\n\n axis_b = rect_b.axes[i]\n depth_b = test_intervals(rect_a.projection(axis_b), rect_b.projection(axis_b))\n return false if depth_b == 0\n\n abs_a = depth_a.abs\n abs_b = depth_b.abs\n\n if abs_a < @coll_depth.abs or abs_b < @coll_depth.abs\n altb = abs_a < abs_b\n @coll_normal = altb ? axis_a : axis_b\n @coll_depth = altb ? depth_a : depth_b\n end\n end\n\n @cpa = rect_a\n @cpb = rect_b\n true\n end",
"def graph_sorted\n pieces.sort do |piece, other_piece|\n if piece.y == other_piece.y\n piece.x <=> other_piece.x\n else\n other_piece.y <=> piece.y\n end\n end\n end",
"def golden_split(direction, greater=:first)\n raise \"Golden_Section#golden_split: unknown direction #{direction}\" unless [:width, :height].member?(direction)\n raise \"Golden_Section.golden_split: Unknown greater section #{greater}\" unless [:first, :last].member?(greater)\nif greater==:first\nexp=1\nelse\nexp=2\nend\nrect1=self.golden_section(direction,exp)\nif greater==:first\nexp=1\nelse\nexp=-1\nend\nif direction==:width\nrect2=rect1.beside.width(rect1.width.golden_section(exp))\nelse\nrect2=rect1.below.height(rect1.height.golden_section(exp))\nend\n[rect1,rect2]\nend",
"def render_rectangles(surface)\n while options = @rectangle_queue.shift do\n surface.pen = get_pen(options[:color], options[:border_width]) #Used for border.\n if options[:filled]\n surface.brush = get_brush(options[:color])\n else\n surface.brush = Wx::TRANSPARENT_BRUSH\n end\n surface.draw_rectangle(\n options[:x], options[:y],\n options[:width], options[:height]\n )\n end\n end",
"def draw_boundries\n res = {}\n vertices[:vertices].each_with_index do | vertex, i |\n vertex.each do | k, v |\n if i === 0\n res[:x], res[:y], res[:z] = [v[:x], v[:x]], [v[:y], v[:y]], [v[:z], v[:z]] \n else\n res[:x] = [v[:x] < res[:x][0] ? v[:x] : res[:x][0], v[:x] > res[:x][1] ? v[:x] : res[:x][1]]\n res[:y] = [v[:y] < res[:y][0] ? v[:y] : res[:y][0], v[:y] > res[:y][1] ? v[:y] : res[:y][1]]\n res[:z] = [v[:z] < res[:z][0] ? v[:z] : res[:z][0], v[:z] > res[:z][1] ? v[:z] : res[:z][1]]\n end\n end\n end\n @boundries = res\n end",
"def calc_half_rects(rect)\n r = Convert.Rect(rect)\n r1 = r.dup\n r1.width /= 2\n r2 = r.dup\n r2.width -= r1.width\n r2.x += r1.width\n return r, r1, r2\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
get a script session id
|
def get_session_id
@agent.get( @root_url + '/dwr/engine.js') do |page|
@session_id = extract_session_id(page.body)
end
end
|
[
"def sessionid\n command[:sessionid]\n end",
"def session_id\n session[:uid] rescue nil\n end",
"def get_id\n @sessionid\n end",
"def get_session_pid\n cmd_exec(\"echo $PPID\").to_s\n end",
"def id\n @id ||= scgi.session_id\n end",
"def get_SessionID()\n \t return @outputs[\"SessionID\"]\n \tend",
"def session_id; end",
"def get_session_id\n check_lisitng_id\n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def get_session_id\n check_lisitng_id\n \n calendar_frame = get_vrbo_calendar_page.iframes.first.src\n page = @agent.get calendar_frame\n link = page.links[3].href\n uri = Addressable::URI.parse(link)\n uri.query_values['sessionId']\n end",
"def session_id\n { id: auth.fetch('result'){{}}.fetch('id') }\n end",
"def session_id\n @driver.session_id\n end",
"def getSessionID()\n\t uri=\"http://#{@host}/login_sid.lua\"\n\t xml = open(uri)\n\t data = XmlSimple.xml_in(xml)\n\t sessionID = data[\"SID\"][0]\n\t if sessionID.eql?(\"0000000000000000\")\n\t challenge = data[\"Challenge\"][0]\n\t response = getResponse(challenge,@password)\n\t uri = \"http://#{@host}/login_sid.lua?username=#{@user}&response=#{response}\"\n\t xml = open(uri)\n\t data = XmlSimple.xml_in(xml)\n\t sessionID = data[\"SID\"][0]\n\t @sessionID = sessionID\n\t return sessionID\n\t else\n \t \traise FritzBoxError.new(\"FritzBoxLogin\"), \"login failed\"\n\t return sessionID\n\t end\n\tend",
"def session_id\n @driver.session_id\n end",
"def session_id\n return @session_id\n end",
"def session_id\n session.transport.algorithms.session_id\n end",
"def current_session_id(env)\n env[ENV_SESSION_OPTIONS_KEY][:id]\n end",
"def session_id\n @driver.session_id\n end",
"def cracker_session_id\n @session_id ||= ::Rex::Text.rand_text_alphanumeric(8)\n end",
"def extract_session_id(request); end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
find the ID of the top headlines element, which is in a script element that looks like this: DM.has("r0c1p15", "headlines");
|
def get_headline_div_id(page)
script = page.parser.css('script').select { |script| script.text =~ /DM\.has\(\".*\"\,\ \"headlines\"\)/ }
/DM\.has\(\"(.*)\"\,\ \"headlines\"\)/.match(script[0].to_s)[1]
end
|
[
"def read_head_id\n File.read(head_path).strip if File.exists?(head_path)\n end",
"def status_dom_id\n 'topHeaderSmallNavi'\n end",
"def test_heading_top()\n gen1 = XhtmlReportGenerator::Generator.new\n gen1.create_layout(\"\")\n el = gen1.heading_top() {\"test\"}\n assert(el != nil, \"heading_top element should not be nil\")\n end",
"def head_node\n return nil unless valid?\n\n head_node = @nodes.select { |n| n.is_shadow? }.compact\n \n # TODO: is the last guard necessary?\n head_node.empty? ? nil : head_node[0]\n end",
"def head\n if is_root?\n nil\n else\n treebank.find_token(head_id)\n end\n end",
"def headline_from_semantic_headlines\n headers = headings.select do |heading_hash|\n header_looks_like_headline?(heading_hash[:text])\n end\n\n header = headers.sort_by {|h| h[:text].length }.reverse.first\n header && header[:text]\n end",
"def html_filter_heading_anchors\n h_nodes = @html.search('//*[self::h1 or self::h2 or self::h3 or self::h4 or self::h5 and not(@id)]')\n h_nodes.each do |heading|\n heading.set_attribute('id', heading.inner_text.gsub(/\\W+/, '-'))\n end\n end",
"def headlines\n @news_api.get_top_headlines(sources: \"TechCrunch\")\nend",
"def headline\n image_iptc[\"Headline\"]\n end",
"def newsApiHeadlines\n\n newsApi = News.new(\"a28f25dce0fd4cdeb9513908b17f4d4c\")\n headlines = newsApi.get_top_headlines(country: 'ie')\n\n end",
"def fetch_paper_titile\n title = @html.xpath(\"//*[@id=\\\"abs\\\"]/div[2]/h1/text()\").text.strip!\n end",
"def head?\n\t\t@ida.isHead(flags)\n\tend",
"def head\n @attributes[:head] || self.category.head rescue nil\n end",
"def head\n\t\t@head ||= (patches.empty? ? base_id : patches.sort.last.to_id)\n\tend",
"def skill_main_headlines(language_id:)\n client_request('GetAllSkillMainHeadlines', args: { languageId: language_id })\n end",
"def skill_headlines_by_main_headline(language_id:, skill_main_headline_id:)\n args = { languageId: language_id, skillMainHeadlineId: skill_main_headline_id }\n client_request('GetSkillHeadlinesBySkillMainHeadlineId', args: args)\n end",
"def head\n @head ||= at('/html').add_child(Elements::Basic.new('head', self))\n end",
"def find_head_noun_dfs\n @tree.each do |l|\n #if ['NP=H', 'NNS=H', 'NNPS=H', 'NNP=H', 'NN=H'].include?(l.content)\n if l.nominal? and l.head?\n return l.find_head_noun\n end\n end\n return nil\n end",
"def title_word(html)\n @title_word ||=\n html.css('.di-title.cdo-section-title-hw .headword').first.text\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
extract article id from the uri
|
def get_article_id(urn)
/\/(.*)\/article\-(.*)\/.*/.match(urn)[2].to_i
end
|
[
"def id_from_uri(uri)\n id = URI.parse(uri)\n # /notes/abc\n if id.path[0,1] == \"/\"\n id.path.split(\"/\")[2]\n else\n id.to_s\n end\n end",
"def find_id(uri)\n Addressable::URI.parse(uri).basename\n end",
"def mapzen_id(uri)\n uri.split(\"/\")&.last&.split(\".\")&.first || \"unknown\" \n end",
"def id_from_url(url)\n url.split(\"/\")[-1]\n end",
"def uri_to_id(uri)\n Valkyrie::ID.new(CGI.unescape(uri.to_s.gsub(/^.*\\//, '')))\n end",
"def extract_pid(uri)\n URI(uri).path.split('/').last\n end",
"def lc_identifier(uri)\n uri.match(%r{http://id\\.loc\\.gov/authorities/[a-z]*/([a-z0-9]*)})&.captures&.first\n end",
"def uri_to_id(uri)\n translate_uri_to_id.call(uri)\n end",
"def id_from_link(node)\n node.attribute('href').value.split('/').last.to_i\n end",
"def uri_to_id(uri)\n Utility::check_types({ uri=>String }) if $DEBUG\n @status = -1\n return -1 if !@url\n turl = @url + \"/uri_to_id\"\n reqheads = [ \"Content-Type: application/x-www-form-urlencoded\" ]\n reqheads.push(\"Authorization: Basic \" + Utility::base_encode(@auth)) if @auth\n reqbody = \"uri=\" + URI::encode(uri)\n resbody = StringIO::new\n rv = Utility::shuttle_url(turl, @pxhost, @pxport, @timeout, reqheads, reqbody, nil, resbody)\n @status = rv\n return nil if rv != 200\n resbody.string.chomp\n end",
"def get_slide_id( slide_url )\n idx = slide_url.index( \"=id.\" )\n return nil unless idx\n slide_url.slice( idx + 4..-1 )\n end",
"def uri_id\n @uri_id ||= begin\n if @uri\n @uri.split(':')[2]\n elsif @gid || @id\n Radix::Base.new(BASE62_CHARS).convert(id, Radix::BASE::HEX).rjust(22, '0')\n end\n end\n end",
"def id(string)\n return if string.blank?\n\n URI(string)\n .path\n .split(\"/\")\n .last\n .to_i\n end",
"def extract_id(object)\n case object\n when ::Integer\n object\n when ::String\n object.split(\"/\").last.to_i\n when ::URI\n object.path.split(\"/\").last.to_i\n when Twitter::Identity\n object.id\n end\n end",
"def post_item_id(doc)\n href = doc.search('.subtext > a:nth-child(3)').map { |link| link['href'] }\n href[0].match(/\\d+/)\n end",
"def extract_work_id( url )\n /^.*\\/(\\d+-\\d+-.*)$/.match( url )[ 1 ]\nend",
"def ead_id\n URI.parse(self.collection_uri).path.split(\"/\").last unless self.collection_uri.nil?\n end",
"def normalize_id\n return id if expects_uri?\n loc? ? id.delete(' ') : id\n end",
"def extract_id(image_id)\n regex = /500px\\.com\\/photo\\/(\\d+)\\//\n matches = regex.match(image_id)\n return nil if !matches\n match = matches[1]\n return nil if match.empty?\n match\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
extract a meta tag value from the page
|
def get_metatag(page, tag)
page.parser.css("meta[name='#{tag}']").first['content']
end
|
[
"def content_for_meta_tag(attribute_selector, html)\n html.xpath(\"//head/meta[@#{attribute_selector}]/@content\").first.try(:content)\n end",
"def extract_meta\n meta = {}\n @page.xpath('//head/meta').each do |field|\n key = field.keys.find { |f| f != 'content' }.first\n meta[field[key]] = field['content'] || \"\"\n end\n\n meta\n end",
"def get_meta(matcher)\n val = get_meta_name(matcher)\n val = get_meta_property(matcher) if val.blank?\n val = get_meta_itemprop(matcher) if val.blank?\n val\n end",
"def meta\n tags = driver.all(:css, 'meta[name]')\n tags.inject(Hash.new) do |vals, tag|\n vals[tag.attribute(:name)] = tag.attribute(:content) if tag.attribute(:name)\n vals\n end\n end",
"def meta_tag(key)\n value = @item[key] || @config[:site][key]\n '<meta name=\"%s\" content=\"%s\">' % [h(key), h(value)] if value\nend",
"def page_meta\n res = ''\n res << tag(:meta, :name => 'description', :content => @_desc) if @_desc\n res << tag(:meta, :name => 'keywords', :content => @_keys) if @_desc\n return res\n end",
"def get_meta(property, prptfile)\n meta_doc = get_file_doc(prptfile, \"meta.xml\")\n property_elem = meta_doc.elements['office:document-meta'].elements['office:meta'].elements[property]\n\n if not property_elem.nil?\n return property_elem.text\n else\n return \"\"\n end\nend",
"def meta_tag(key)\n value = @item[key] || @site.config[:meta_data][key]\n '<meta name=\"%s\" content=\"%s\">' % [h(key), h(value)] if value\nend",
"def wp_ver_meta(url)\n \t\tsite=url_2_site(url)\n k=Wmap::UrlChecker.new\n if k.response_code(site) == 200\n doc=open_page(site)\n \t\t\t#puts doc.inspect\n meta=doc.css('meta')\n \t\t\t#puts meta.inspect\n \t\t\tmeta.each do |tag|\n \t if tag['content'].to_s =~ /wordpress/i\n \t\t\t\t\t#puts tag.to_s\n \t\t\t\t\tk=nil\n \t return tag['content'].to_s.scan(/[\\d+\\.]+\\d+/).first\n \t end\n \t\t\tend\n end\n k=nil\n return nil\n \trescue => ee\n \t\tputs \"Exception on method #{__method__} for url #{url}: #{ee}\" if @verbose\n \t\treturn nil\n end",
"def meta\n @meta ||= decoded_body[:meta]\n end",
"def get_meta_attribute(attribute_name)\n meta = @test_case.search('meta')\n meta.present? ? meta[0][attribute_name] : ''\n end",
"def scrape_meta_data\n unless @data.meta\n @data.meta!.name!\n @data.meta!.property!\n parsed_document.xpath(\"//meta\").each do |element|\n get_meta_name_or_property(element)\n end\n end\n end",
"def parse_tag_metadata_vars(meta)\n begin\n return tag unless meta\n new_tag = tag\n # Direct value metaname var\n # pattern: %V=key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # directly inserts the value or nothing if nil\n direct_value = new_tag.scan(/%V=[\\w ]*-%/)\n direct_value.map! do |dv|\n {\n :var => dv,\n :key_name => dv.gsub(/%V=|-%/, \"\"),\n :value => meta[dv.gsub(/%V=|-%/, \"\")]\n }\n end\n direct_value.each do\n |dv|\n dv[:value] ||= \"\"\n new_tag = new_tag.gsub(dv[:var].to_s,dv[:value].to_s)\n end\n\n\n # Selected value metaname var\n # pattern: %R=selection_pattern:key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # Where 'selection_pattern' is a Regex string for selecting a portion of the value from the key name in the metadata hash\n # directly inserts the value or nothing if nil\n selected_value = new_tag.scan(/%R=.+:[\\w]+-%/)\n selected_value.map! do |dv|\n {\n :var => dv,\n :var_string => dv.gsub(/%R=|-%/, \"\"),\n :key_name => dv.gsub(/%R=|-%/, \"\").split(\":\")[1],\n :pattern => Regexp.new(dv.gsub(/%R=|-%/, \"\").split(\":\").first)\n }\n end\n\n selected_value.each do\n |sv|\n if sv[:pattern] && sv[:key_name]\n sv[:value] = sv[:pattern].match(meta[sv[:key_name]]).to_s\n end\n sv[:value] ||= \"\"\n new_tag = new_tag.gsub(sv[:var].to_s,sv[:value].to_s)\n end\n rescue => e\n logger.error \"ERROR: #{p e}\"\n tag\n end\n new_tag\n end",
"def parse_tag_metadata_vars(meta)\n begin\n return tag unless meta\n new_tag = tag\n # Direct value metaname var\n # pattern: %V=key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # directly inserts the value or nothing if nil\n direct_value = new_tag.scan(/%V=[\\w ]*-%/)\n direct_value.map! do |dv|\n {\n :var => dv,\n :key_name => dv.gsub(/%V=|-%/, \"\"),\n :value => meta[dv.gsub(/%V=|-%/, \"\")]\n }\n end\n direct_value.each do\n |dv|\n dv[:value] ||= \"\"\n new_tag = new_tag.gsub(dv[:var].to_s,dv[:value].to_s)\n end\n\n\n # Selected value metaname var\n # pattern: %R=selection_pattern:key_name-%\n # Where 'key_name' is the key name from the metadata hash\n # Where 'selection_pattern' is a Regex string for selecting a portion of the value from the key name in the metadata hash\n # directly inserts the value or nothing if nil\n selected_value = new_tag.scan(/%R=.+:[\\w]+-%/)\n selected_value.map! do |dv|\n {\n :var => dv,\n :var_string => dv.gsub(/%R=|-%/, \"\"),\n :key_name => dv.gsub(/%R=|-%/, \"\").split(\":\")[1],\n :pattern => Regexp.new(dv.gsub(/%R=|-%/, \"\").split(\":\").first)\n }\n end\n\n selected_value.each do\n |sv|\n if sv[:pattern] && sv[:key_name]\n sv[:value] = sv[:pattern].match(meta[sv[:key_name]]).to_s\n end\n sv[:value] ||= \"\"\n new_tag = new_tag.gsub(sv[:var].to_s,sv[:value].to_s)\n end\n rescue => e\n logger.error \"ERROR: #{e}\"\n tag\n end\n new_tag\n end",
"def meta_info\n payload[\"meta_info\"]\n end",
"def page_meta\n @page_meta ||= @page.try(:meta_block).try(:merge, default_meta) || default_meta\n end",
"def unpack_meta(response)\n response.body['meta'] if response.body.has_key?('meta')\n end",
"def og(key)\n html.at_css(\"meta[property='og:#{key}']\")&.[]('content')\n end",
"def collect_metadates\n meta = []\n meta = @page.css('meta') if @page\n meta\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /ad_domains/1 PATCH/PUT /ad_domains/1.json
|
def update
authorize! :update, @ad_domain
respond_to do |format|
if @ad_domain.update(ad_domain_params)
format.html { redirect_to @ad_domain, notice: 'Active Directory domain was successfully updated.' }
format.json { render :show, status: :ok, location: @ad_domain }
else
format.html { render :edit }
format.json { render json: @ad_domain.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @domain = Domain.find(params[:id])\n\n if @domain.update(domain_params)\n head :no_content\n else\n render json: @domain.errors, status: :unprocessable_entity\n end\n end",
"def update\n update_and_respond(@domain, domain_params)\n end",
"def update\n @dns_domain = DnsDomain.find(params[:id])\n\n respond_to do |format|\n if @dns_domain.update_attributes(params[:dns_domain])\n format.html { redirect_to @dns_domain, notice: 'Dns domain was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @dns_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @domain.update(domain_params)\n format.html { redirect_to @domain, notice: 'Domain was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @short_domain = ShortDomain.find(params[:id])\n\n respond_to do |format|\n if @short_domain.update_attributes(params[:short_domain])\n format.html { redirect_to @short_domain, notice: 'Short domain was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @short_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if params[:domain_map][:domain].blank?\n @req_error = \"req_error\"\n end\n @domain_map = DomainMap.find(params[:id])\n params[:domain_map][:verified] = false\n if params[:domain_map][:map_type] == \"organisation\" \n params[:domain_map][:organisation_id] = current_organisation.id\n params[:domain_map][:program_id] = nil\n elsif\n params[:domain_map][:organisation_id] = nil\n end\n respond_to do |format|\n if @domain_map.update_attributes(params[:domain_map])\n format.html { redirect_to domain_maps_url, notice: 'Domain map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @domain_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @domain = Domain.find(params[:id])\n respond_to do |format|\n if @domain.update(domain_params)\n format.html { redirect_to users_domain_path(@domain), notice: 'Domain was successfully updated.' }\n format.json { render :show, status: :ok, location: @domain }\n else\n format.html { render :edit }\n format.json { render json: @domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @crm_domain.update(crm_domain_params)\n format.html { redirect_to edit_crm_domain_path(@crm_domain), notice: 'Информация по домену обновлена.' }\n format.json { render :show, status: :ok, location: @crm_domain }\n else\n format.html { render :edit }\n format.json { render json: @crm_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n dns_entry_response = RestClient.put('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n respond_to do |format|\n if @dns_entry.update(dns_entry_params)\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully updated.\" }\n format.json { render :show, status: :ok, location: @dns_entry }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @domain = RiGse::Domain.find(params[:id])\n\n respond_to do |format|\n if @domain.update_attributes(params[:domain])\n flash[:notice] = 'RiGse::Domain.was successfully updated.'\n format.html { redirect_to(@domain) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @domain = Domain.find(params[:id])\n\n respond_to do |format|\n if @domain.update_attributes(params[:domain])\n format.html { redirect_to(@domain, :notice => 'Domain was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ensembl_subdomain.update(ensembl_subdomain_params)\n format.html { redirect_to @ensembl_subdomain, notice: 'Ensembl subdomain was successfully updated.' }\n format.json { render :show, status: :ok, location: @ensembl_subdomain }\n else\n format.html { render :edit }\n format.json { render json: @ensembl_subdomain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(domain, options = {})\n fail(ParameterError, 'No domain given to add on Mailgun', caller) unless domain\n @client.put(\"domains/#{domain}\", options).to_h\n end",
"def update_domain(license_id, options={})\n update_params = { :action => \"updatedomain\",\n :license => license_id }.merge(options)\n response = request(:get, '', {:query => update_params})\n response_data_or_error response\n end",
"def update\n @email_domain = Email::Domain.find(params[:id])\n\n respond_to do |format|\n if @email_domain.update_attributes(params[:email_domain])\n format.html { redirect_to(@email_domain, :notice => 'Domain was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_domain.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @reserved_domain.update(reserved_domain_params)\n format.html { redirect_to @reserved_domain, notice: 'Reserved domain was successfully updated.' }\n format.json { render :show, status: :ok, location: @reserved_domain }\n else\n format.html { render :edit }\n format.json { render json: @reserved_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def domain_update(domain, fields)\n unless ([ :admin, :tech, :billing, :nservers ] - fields.keys).empty?\n raise ArgumentError, \"Required fields not found\"\n end\n query :domain_modify, {\n domain: domain,\n admin_c: fields[:admin],\n tech_c: fields[:tech],\n billing_c: fields[:billing],\n ns_list: fields[:nservers].join(':')\n }\n end",
"def update\n respond_to do |format|\n if @project_domain.update(project_domain_params)\n format.html { redirect_to @project_domain, notice: 'Project domain was successfully updated.' }\n format.json { render :show, status: :ok, location: @project_domain }\n else\n format.html { render :edit }\n format.json { render json: @project_domain.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @domain_list = DomainList.find(params[:id])\n \n respond_to do |format|\n if @domain_list.update_attributes(params[:domain_list])\n format.html { redirect_to @domain_list, notice: 'Domain list was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @domain_list.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
If key is absent, save the result of calling the block. If key is present, block is never called. Ex: rt_store.set(url) do fetcher.get url will only be called if url isn't in rt_store end
|
def set key, force=nil, &block
return if (!force) && cache.include?(key)
cache_val, store_val = block.call()
return unless cache_val
cache.set_nr key, cache_val # update cache
store << store_val # save value
self.misses += 1 # track the cache miss
store_val
end
|
[
"def fetch(key, options = {})\n @store.fetch(key) { @store[key] = yield }\n end",
"def do_cached( key, &block )\n \n # have a look in the cache\n value = fetch( key )\n\n # Cache HIT?\n return value unless value.nil?\n\n # Cache MISS : execute the block\n value = block.call( key )\n\n # Store value in the cache\n return store( key, value )\n end",
"def fetch(key, &_block)\n # Avoid ||= because we need to memoize falsey values.\n return cache[key] if cache.key?(key)\n\n cache[key] = yield\n end",
"def fetch_or_default(key, &block)\n @hash[key] = @hash.fetch(key, &block)\n end",
"def once (key, store: \"/var/cache/blower.json\", quiet: false)\n return yield unless key\n log.info \"once: #{key}\", quiet: quiet do\n hash_map(hosts) do |host|\n done = begin\n JSON.parse(host.read(store, quiet: true))\n rescue => e\n {}\n end\n unless done[key]\n on [host] do\n yield\n end\n done[key] = true\n host.write(done.to_json, store, quiet: true)\n end\n end\n end\n end",
"def cache(key, options = {}, &block)\n return yield(self) if options[:disable] || !Config['production']\n\n # Warning: don't change this. This must be thread safe!\n if options[:update]\n if options[:defer] && ((value = @store[key]) || @store.key?(key)) # Check key? because value could be nil\n Worker.defer { update(key, options, &block) }\n return value\n end\n else\n return value if (value = @store[key]) || @store.key?(key) # Check key? because value could be nil\n end\n update(key, options, &block)\n end",
"def cache key, value=nil, &block\n return self[key] if self.has_key?(key)\n @lock.write_sync{ @data[key] = block_given? ? yield() : value }\n end",
"def fetch(key, &block)\n read(key) || yield.tap { |value| write(key, value) }\n end",
"def call cache, cache_key\n if cache\n cache.fetch(cache_key) do\n cache[cache_key] = yield\n end\n else\n yield\n end\n end",
"def cache_get(key)\n synchronize do\n data = @cache[key]\n if !data.nil? && !data.value.empty?\n # kick off a refresh, maybe\n lookup_in_background(key) if (auto_refresh? && stale?(data))\n \n data.value\n elsif block_given?\n logger.info { \"nothing in cache for #{key} (#{data.inspect})\" }\n data = cache_put(key, yield(key.endpoint_class, key.type, key.version))\n data.value\n else\n logger.warn { \"nothing in cache for #{key} (#{data.inspect}) and no block given\" }\n nil\n end\n end\n end",
"def execute!(storage, block_parameters)\n @last_execution = Time.now\n storage.set(key, block.call(*block_parameters))\n end",
"def store_or_delete(key,value_or_nil)\n if value_or_nil\n store(key,value_or_nil)\n else\n delete(key)\n end\n end",
"def use(key, options = {}, &block)\n rv = nil\n\n # Get options\n options = setup_options(options, key)\n\n # Check if the storage has the value (if we don't have to skip the cache)\n rv = choose_backend(options).read(options[:hash]) if options[:force] == false && options[:ttl] > 0\n rv = compute_value(options, &block) if rv.nil? && block # Try to compute the value from the block\n\n # Return value\n options[:as_entry] ? rv : rv.value.dup\n end",
"def fetch_if(key_or_proc, key, &block)\n if get(key)\n key_or_proc = key_or_proc.call if key_or_proc.is_a?(Proc)\n value = fetch(key_or_proc, &block)\n else\n value = block.call\n key_or_proc = key_or_proc.call if key_or_proc.is_a?(Proc)\n set(key_or_proc, Marshal.dump(value))\n end\n value\n end",
"def fetch_and_store(key, default = nil)\n result = self[key]\n if result.nil? && !has_key?(key)\n self[key] = default.duplicable? ? default.dup : default\n else\n result\n end\n end",
"def execute(storage, block_parameters)\n if expired? then execute!(storage, block_parameters) else storage.get(key) end\n end",
"def remove_and_do(hash, key, &block)\n if hash.key? key\n block.call(hash.fetch(key))\n hash.delete(key)\n end\nend",
"def fetch(key, alternative=nil)\r\n yield key\r\n end",
"def cached_client(type, key)\n return yield unless cache_enabled?(type)\n\n @cache[type][key] ||= yield\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
================== sending invoices =============================
|
def send_invoices
change_date
@options = session[:invoice_options] || {}
[
:s_username, :s_first_name, :s_last_name, :s_number, :s_period_start, :s_period_end,
:s_issue_date, :s_sent_email, :s_sent_manually, :s_paid, :s_invoice_type
].each do |key|
@options[key] = params[key].try(:to_s).try(:strip) || @options[key].to_s
end
@invoices = Invoice.for_send(corrected_user_id, @options)
MorLog.my_debug("*************Invoice sending, found : #{@invoices.size.to_i}", 1)
@number = 0
not_sent = 0
params[:email_or_not] = 1
session[:invoice_options] = @options
email_from = Confline.get_value('Email_from', correct_owner_id)
if @invoices.size.to_i > 0
@invoices.each { |invoice|
user = invoice.user
attach = []
params[:id] = invoice.id
prepaid = invoice.invoice_type.to_s == 'prepaid' ? 'Prepaid_' : ''
@invoice = user.send_invoice_types.to_i
if @invoice.to_i != 0
if (user.email).length > 0
@invoice -= if @invoice >= 512
xlsx = {
file: export_invoice_to_xlsx,
content_type: 'application/octet-stream',
filename: "#{_('invoice_xlsx')}.xlsx"
}
attach << xlsx
512
else
0
end
if !(user.postpaid == 0 && invoice.invoicedetails.first.try(:name).to_s == "Manual Payment")
if (@invoice % 2) == 1
@invoice = Confline.get_value("#{prepaid}Invoice_default",
correct_owner_id).to_i
end
@invoice -= if @invoice >= 256
calls_cvs = {}
calls_cvs[:file] = get_prepaid_user_calls_csv(user, invoice)
calls_cvs[:content_type] = 'text/csv'
calls_cvs[:filename] = "#{_('Calls')}.csv"
attach << calls_cvs
256
else
0
end
@invoice -= if @invoice >= 128
csv = {}
csv[:file] = generate_invoice_by_cid_csv
csv[:content_type] = 'text/csv'
csv[:filename] = "#{_('Invoice_by_CallerID_csv')}.csv"
attach << csv
128
else
0
end
@invoice -= if @invoice >= 64
csv = {}
csv[:file] = generates_invoice_destinations_csv
unless csv[:file]
redirect_to :root unless performed?
return false
end
csv[:content_type] = 'text/csv'
csv[:filename] = "#{_('Invoice_destinations_csv')}.csv"
attach << csv
64
else
0
end
@invoice -= if @invoice >= 32
pdf = {}
pdf[:file] = generate_invoice_by_cid_pdf
pdf[:content_type] = 'application/pdf'
pdf[:filename] = "#{_('Invoice_by_CallerID_pdf')}.pdf"
attach << pdf
32
else
0
end
@invoice -= if @invoice >= 16
csv = {
file: generate_invoice_detailed_csv,
content_type: 'text/csv',
filename: "#{_('Invoice_detailed_csv')}.csv"
}
attach << csv
16
else
0
end
@invoice -= if @invoice >= 8
pdf = {
file: generate_invoice_detailed_pdf,
content_type: 'application/pdf',
filename: "#{_('Invoice_detailed_pdf')}.pdf"
}
attach << pdf
8
else
0
end
end
@invoice -= if @invoice >= 4
csv = {
file: generate_invoice_csv,
content_type: 'text/csv',
filename: "#{_('Invoice_csv')}.csv"
}
attach << csv
4
else
0
end
if @invoice >= 2
pdf = {
file: generate_invoice_pdf,
content_type: 'application/pdf',
filename: "#{_('Invoice_pdf')}.pdf"
}
attach << pdf
end
variables = email_variables(user)
email= Email.where(["name = 'invoices' AND owner_id = ?", user.owner_id]).first
MorLog.my_debug("Try send invoice to : #{user.address.email}, Invoice : #{invoice.id}, User : #{user.id}, Email : #{email.id}", 1)
# @num = EmailsController.send_email_with_attachment(email, email_from,
# user, attach, variables)
variables = Email.email_variables(user)
email.body = nice_email_sent(email, variables)
@num = EmailsController.send_invoices(email, user.email.to_s,
email_from, attach,
invoice.number.to_s)
MorLog.my_debug ("Invoice email was send to : #{user.address.email} ? : #{@num}")
if @num == 'true'
@number += 1
invoice.sent_email = 1
invoice.save
Action.create_email_sending_action(user, 'email_sent', email)
else
not_sent += 1
Action.create_email_sending_action(user, 'error', email,
{er_type: 1, err_message: @num})
end
else
not_sent += 1
email= Email.where(["name = 'invoices' AND owner_id = ?", user.owner_id]).first
Action.create_email_sending_action(user, 'error', email, {er_type: 1})
end
end
}
end
flash[:notice] = _('ERROR') + ': ' + @num[1].to_s if @num && @num[0] == 0
if @number.to_i > 0
flash[:status] = _('Invoices_sent') + ': ' + @number.to_s
else
flash[:notice] = _('Invoices_not_sent') + ': ' + not_sent.to_s if not_sent.to_i > 0
end
flash[:notice] = _('No_invoices_found_in_selected_period') if @invoices.size.to_i == 0
redirect_to(action: :invoices) unless performed?
return false
end
|
[
"def send_invoice(params = {})\n commit(Ebay::Requests::SendInvoice, params)\n end",
"def send_freshbooks_invoice!\n raise SignalCloud::ClientInvoiceNotCreatedError.new unless self.has_invoice?\n \n response = FreshBooks.account.invoice.sendByEmail( invoice_id: self.freshbooks_invoice_id )\n raise SignalCloud::FreshBooksError.new( 'Could not send invoice: %s (%i)' % [ response['error'], response['code'] ], response['code'] ) unless response.success?\n\n self.freshbooks_invoice_id = response['invoice_id']\n self.sent_at = DateTime.now\n self.save!\n end",
"def create_and_send_invoice\n self.invoice = ParticipationRequest::Invoice.create(participation_request: self,\n payed_at: Time.now)\n save\n\n # ParticipationRequestMailer.delay(queue: 'mailers').send_invoice_to_user(self)\n end",
"def settle\n self.send_freshbooks_invoice!\n end",
"def send_invoice\n if payment_at_changed? && payment_at.present?\n payable.try(:payment_completed!, self)\n if payable_type == 'UserGroup'\n UserMailer.payment_completed(user, self).deliver\n end\n end\n end",
"def seller_invoices\n logger.info(\"Will send email of SELLER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_seller_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def buyer_invoices\n logger.info(\"Will send email of BUYER JDE and ZLot csvs\")\n email = current_employee.present? ? current_employee.email : \"salesreports@outbid.com\"\n logger.info(\"Will send email to \\\"#{email}\\\"\")\n Vehicle.queue_buyer_invoice_email(email)\n \n respond_to do |format|\n format.json { render json: { message: \"success\" } }\n format.html { redirect_to vehicles_url(:state_as_string => \"wtg_for_settlement_confirmation\") }\n end\n end",
"def make_the_payment\n session[:purchasable] = nil\n if @order and @order.invoices.last\n \t@invoice = @order.generate_invoice_extra_entry(@current_user, params[:invoicing_info])\n else\n @invoice = @order.generate_invoice(@current_user, params[:invoicing_info]) \n end \t\n \tif params[:invoicing_info][:payment_medium] == \"cash\" or params[:invoicing_info][:payment_medium] == \"cheque\"\n \t \t@invoice.accept_cash_or_cheque_payment(params[:invoicing_info][:payment_medium]) \n elsif params[:invoicing_info][:payment_medium] == \"paypal\"\n @invoice.validating(\"paypal\")\n else\n @invoice.validating\n end \t\n @current_object.invoice = @invoice\n @current_object.save\n \tinvoice = Invoice.find(:last,:conditions=>[\"client_id = ? and purchasable_id = ?\",@current_user.id,@order.id])\n \tif @order.instance_of? CompetitionsUser\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.competition.title,invoice.final_amount.to_i,@order.competition.timing.note)\n elsif @order.instance_of? ExhibitionsUser\n create_pdf(invoice.id,invoice.number,invoice.sent_at.strftime(\"%d %b %Y\"),invoice.client.profile.full_address_for_invoice,invoice.client.profile.full_name_for_invoice,@order.exhibition.title,invoice.final_amount.to_i,@order.exhibition.timing.note)\n end\n #QueuedMail.add('UserMailer', 'send_invoice',[@invoice,@current_user], 0, send_now=true)\t\n \t \t \t\t QueuedMail.create(:mailer => 'UserMailer', :mailer_method => 'send_invoice',:args => [@current_user.profile.email_address,\"invoice#{invoice.id}\",\"An Invoice Is Send To Your Email For Your Payment\"],:priority => 0,:tomail=>@current_user.profile.email_address,:frommail=>\"test@pragtech.co.in\")\n\t\t\t \t email= UserMailer.create_send_invoice(invoice,@current_user)\n\t UserMailer.deliver(email)\n\t \n if @invoice.purchasable_type == \"Order\"\n\t session[:cart]=nil\n\t end\n end",
"def invoice(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"/invoices\"\n data = {\n\n }\n\n response = Response.new(request.post(path, data, options))\n return_values = Array.new\n \n body = response.body\n body = body[\"invoice\"]\n invoice = Invoice(self._client)\n return_values.push(invoice.fill_with_data(body))\n\n \n return_values[0]\n end",
"def send_invoice(file, invoice, current_company, current_user, subject, text, to_email, cc)\n @company = current_company\n @invoice = invoice\n @user = current_user\n @subject = subject\n @text = text\n attachments[\"#{invoice.invoice_number}.pdf\"] = file\n from_email = current_user.email\n mail(:to => to_email, :cc => cc, :from =>\"\\\"#{current_user.first_name} #{current_user.last_name}\\\"<support@profitbooks.net>\" ,:reply_to => current_user.email, :subject=> subject)\n end",
"def invoice\n\t\t@post = Post.find(params[:id])\n\t\t@request= Request.find_by(post_id:@post.id)\n\t\t@payment = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"success\")\n\t\t@payment1 = Payment.find_by(\"user_id = ? AND post_id = ? AND status = ?\",@post.user_id,@post.id,\"refund\")\n\t\trespond_to do |format|\n\t\t\tformat.html\n format.pdf do\n render pdf: \"invoice\",\n template: \"posts/_form.html.erb\",\n layout: \"pdf.html\",\n disposition: 'attachment'\n end\n end\n\tend",
"def invoices\n MorLog.my_debug(\"INVOICES\")\n\n opts = {}\n [\"true\", \"false\"].include?(params[:file].to_s) ? opts[:file] = params[:file] : opts[:file] = \"true\"\n\n username = params[:u]\n from = params[:from]\n till = params[:till]\n\n username = \"\" if not username\n from = 0 if not from\n till = 0 if not till\n\n from_t = Time.at(from.to_i)\n till_t = Time.at(till.to_i)\n\n from_nice = nice_date(from_t, 0)\n till_nice = nice_date(till_t, 0)\n\n user = User.where(:username => username).first\n\n if user\n User.current = user\n cond = \"\"\n case user.usertype.to_s\n when \"admin\"\n cond = \" AND users.owner_id = #{user.id}\"\n when \"accountant\"\n cond = \" AND users.owner_id = #{user.owner_id}\"\n when \"reseller\"\n cond = \" AND (users.owner_id = #{user.id} OR users.id = #{user.id})\"\n when \"user\"\n cond = \" AND invoices.user_id = #{user.id}\"\n end\n invoices = Invoice.select(\"invoices.*\").joins(\"JOIN users on (users.id = invoices.user_id)\").where([\"period_start >= ? AND period_end <= ? AND users.generate_invoice != 0 #{cond}\", from_nice, till_nice])\n\n if !invoices.blank? or invoices.size != 0\n doc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent => 2)\n doc.Invoices(\"from\" => from_nice, \"till\" => till_nice) {\n for inv in invoices\n iuser = inv.user\n doc.Invoice(\"user_id\" => inv.user_id, \"agreementnumber\" => iuser.agreement_number, \"clientid\" => iuser.clientid, \"number\" => inv.number) {\n for invdet in inv.invoicedetails\n doc.Product {\n doc.Name(invdet.name)\n doc.Quantity(invdet.quantity)\n doc.Price(nice_number(invdet.price))\n doc.Date_added((inv.payment ? nice_date(inv.payment.date_added, 0) : ''))\n doc.Issue_date(nice_date(inv.issue_date, 0))\n }\n end\n }\n end\n }\n else\n doc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent => 2)\n doc.Error(\"no invoices found\")\n end\n else\n doc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent => 2)\n doc.Error(\"user not found\")\n end\n\n #return out_string\n if opts[:file] == \"true\"\n if confline(\"XML_API_Extension\").to_i == 0\n send_data(out_string, :type => \"text/xml\", :filename => \"mor_api_response.xml\")\n else\n send_data(out_string, :type => \"text/html\", :filename => \"mor_api_response.html\")\n end\n else\n render :text => out_string\n end\n end",
"def fulfillment_new_invoice(invoice) \n @invoice = invoice\n sc = invoice.site.store_config\n mail(:to => sc.fulfillment_email, :subject => 'New Order')\n end",
"def send_invoice(order_id)\n response, status = BeyondApi::Request.post(@session, \"/orders/#{order_id}/send-invoice\")\n\n handle_response(response, status)\n end",
"def create\n plan = Plan.where(id:params[:plan_id].to_i).select(:price,:fees).first\n price = (plan.price.to_f / BittrexInt.btc_usd).to_f.round(6) if params[:currency_id].to_i == 12\n price = (plan.price.to_f / (BittrexInt.btc_usd * BittrexInt.ltc_btc)).to_f.round(6) if params[:currency_id].to_i == 13\n fees = (plan.fees.to_f / BittrexInt.btc_usd).to_f.round(6) if params[:currency_id].to_i == 12\n fees = (plan.fees.to_f / (BittrexInt.btc_usd * BittrexInt.ltc_btc)).to_f.round(6) if params[:currency_id].to_i == 13\n wallet = Blockio.generate_wallet(@current_user.username.to_s + '_' + SecureRandom.uuid, params[:currency_id].to_i)\n @invoice = Invoice.new(invoice_params)\n \n if @current_user.has_attribute?(:ancestry)\n @invoice.user_id = @current_user.id\n client = @invoice.user\n else\n @invoice.temp_user_id = @current_user.id\n client = @invoice.temp_user\n end\n \n @invoice.invoice_status_id = 11\n @invoice.wallet = wallet\n @invoice.price = price.round(6)\n @invoice.fees = fees.round(6)\n\n if @invoice.save\n invoice = Invoice.find_by(uuid: @invoice.uuid)\n EmailNotification.send_invoice(client,@invoice) if invoice\n render json: filter(invoice), status: :ok\n else\n render json: @invoice.errors, status: :unprocessable_entity\n end\n end",
"def paid_invoice_confirmation(invoice)\n begin\n @invoice = invoice\n @patient = @invoice.admission.patient\n\n # Generate the PDF Invoice\n generate_pdf_invoice('invoices/_paid_invoice_template.html.erb', 'paid_invoice')\n\n # Debug using Mailgun::Client.new(Rails.application.secrets.mailgun_api_key, \"bin.mailgun.net\", \"b913673b\", ssl = false)\n mg_client = Mailgun::Client.new(Rails.application.secrets.mailgun_api_key)\n\n result = mg_client.send_message(Rails.application.secrets.mailgun_domain, paid_invoice_message).to_h!\n result_message = result['message']\n\n puts(result_message)\n rescue StandardError => e\n Rails.logger.error { \"#{e.message} #{e.backtrace.join(\"\\n\")}\" }\n Rollbar.report_exception(e)\n puts 'Exception: mail gun paid'\n end\n end",
"def do_email\n @invoice = Factura.find(params[:id])\n @email = params[:email]\n \n Notifier.invoice(@email, @invoice).deliver\n \n flash[:notice] = \"The invoice has been sent successfully.\"\n redirect_to \"/facturas/#{@invoice.id}\"\n end",
"def bulk\n ids = params[\"#{model.name.underscore}_ids\"]\n if ids.is_a?(Array) && ids.length > 0\n invoices = Invoice.where(id: params[\"#{model.name.underscore}_ids\"])\n case params['bulk_action']\n when 'delete'\n invoices.destroy_all\n flash[:info] = \"Successfully deleted #{ids.length} invoices.\"\n when 'send_email'\n begin\n invoices.each {|inv| inv.send_email}\n flash[:info] = \"Successfully sent #{ids.length} emails.\"\n rescue Exception => e\n flash[:alert] = e.message\n end\n when 'set_paid'\n total = invoices.inject(0) do |n, inv|\n inv.set_paid! ? n + 1 : n\n end\n flash[:info] = \"Successfully set as paid #{total} invoices.\"\n when 'pdf'\n html = ''\n invoices.each do |inv|\n @invoice = inv\n html += render_to_string \\\n :inline => inv.get_print_template.template,\n :locals => {:invoice => @invoice,\n :settings => Settings}\n html += '<div class=\"page-break\" style=\"page-break-after:always;\"></div>'\n end\n send_data(@invoice.pdf(html),\n :filename => \"invoices.pdf\",\n :disposition => 'attachment'\n )\n return\n when 'duplicate'\n invoices.each do |inv|\n inv.duplicate\n end\n flash[:info] = \"Successfully copy #{invoices.length} invoices.\"\n else\n flash[:info] = \"Unknown action.\"\n end\n end\n redirect_to action: :index\n end",
"def paid_invoices(issued_from, issued_to)\n records \"invoice\", \"/invoices/paid/#{issued_from}/#{issued_to}\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Based on what params user selected or if they were not passed based on params saved in session return user_id, that should be filtered for financial statements. if user passed clear as param return nil Params +session_options+ hash including :user_id, might be nil Return +user_id+ integer or nil
|
def financial_statements_user_id(session_options)
not_params_clear = !params[:clear]
params_user_id, session_user_id = [params[:s_user_id], session_options.try(:[], :s_user_id)]
if current_user.usertype == 'user'
user_id = current_user_id
elsif params_user_id && not_params_clear
user_id = params_user_id || 'all'
user_id = -1 if params[:s_user].present? && params_user_id.to_i == -2
elsif session_options && session_user_id && not_params_clear
user_id = session_user_id
else
user_id = nil
end
user_id
end
|
[
"def financial_statements_user_id(session_options)\n if current_user.usertype == 'user'\n user_id = current_user.id\n elsif params[:user_id] and not params[:clear]\n user_id = params[:user_id]\n elsif session_options and session_options[:user_id] and not params[:clear]\n user_id = session_options[:user_id]\n else\n user_id = nil\n end\n end",
"def extract_user_id(params)\n User.find_by_id(params[:user_id]) || User.find_by_email(params[:email]) || nil\n end",
"def session_params\n session[:user_id]\n end",
"def current_user_id #use this method to return the appropriate User id\n session[:user_id]\n #if one is signed_in - you get nothing back\n end",
"def user_id\n case @params.event\n when 'conversation_started', 'subscribed'\n @params.user.id\n when 'unsubscribed', 'delivered', 'seen', 'failed'\n @params.user_id\n when 'message'\n @params.sender.id\n else\n @params.dig(:user, :id)\n end\n end",
"def user_id\n if (id = (@opts[:user_id] || @opts['user_id'])) && id.respond_to?(:to_s)\n if (id = id.to_s).size > 0 && id != '0'\n return id\n end\n end\n end",
"def filter_by_user!(opt)\n if model_class == User\n filter_by_model!(opt, id_key: :id)\n else\n filter_by_model!(opt, model: User)\n end\n end",
"def user_id\n instance_variable_get(:@prepared_arguments).dig(:user_id)\n end",
"def find_user\n if session[:otp_user_id]\n User.find(session[:otp_user_id])\n elsif user_params[:email]\n User.find_for_authentication(email: user_params[:email]).tap do |user|\n session[:otp_user_id] = user&.id\n end\n end\n end",
"def identified_user\n return nil if params[:session].blank?\n return nil if params[:session][:identifier].blank?\n\n if params[:session][:identifier].include?('@')\n return User.find_by_email(params[:session][:identifier])\n else\n return User.find_by_username(params[:session][:identifier])\n end\n\n nil\n end",
"def session_user_set(user)\n session[:user_id] = user ? user.id : nil\n user\n end",
"def get_user_id!(params)\n get_value_for_key(params, \"user_id\")\n end",
"def find_user(user_id)\n if user_id.nil?\n User[current_user.id]\n else\n User[user_id]\n end\n end",
"def get_user_id!(params)\n get_value_for_key!(params, \"user_id\")\n end",
"def correct_owner_id\n return 0 if accountant? or admin?\n return session[:user_id] if reseller?\n return session[:owner_id]\n end",
"def session_user(req)\n id = req.session['dealer_id']\n dealer_dao.get(id)\n end",
"def permitted_users_id\n\treturn_user_ids = Array.new\n\tif !self.venue_id.nil?\n\t return_user_ids = ActiveInVenue.where(venue_id: self.venue_id).where.not(user_id: self.user_id).map(&:user_id)\n end\n\tif self.allow_nearby\n\t\treturn_user_ids = return_user_ids | User.where.not(id: self.user_id).near([self.latitude, self.longitude], 25, units: :km).map(&:id)\n\tend\n\tblack_list = BlockUser.blocked_user_ids(self.user_id)\n \tcontent_black_list = ShoutReportHistory.where(reportable_id: self.id).where(reportable_type: 'Shout').map(&:reporter_id)\n \treturn_user_ids = return_user_ids - black_list - content_black_list\n\n \t# only user pusher for online users\n \tonline_users_ids = User.where(id: return_user_ids).where(pusher_private_online: true).map(&:id)\n \treturn online_users_ids\n end",
"def filter_cdr_user(cdr)\n to_id = cdr.callee_aor\n user = Utils.contact_user(to_id)\n filter_user = false\n @filtered_identities.each { |f_user| \n if !user.nil? && user.include?(f_user) \n filter_user = true \n end\n }\n return filter_user\n end",
"def correct_owner_id\n return 0 if accountant? or admin?\n return session[:user_id] if reseller? || partner?\n return session[:owner_id]\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=begin Based on what params user selected or if they were not passed based params saved in session return status, that should be filtered for financial statements. Params +session_options+ hash including :status, might be nil Returns +status+ string, one of valid_status_values, by default 'all' =end
|
def financial_statements_status(session_options)
not_params_clear = !params[:clear]
params_status, session_options_status = [params[:status], session_options.try(:[], [:status])]
if (@valid_status_values.include? params_status) && not_params_clear
params_status
elsif session_options && (@valid_status_values.include? session_options_status) && not_params_clear
session_options_status
else
'all'
end
end
|
[
"def financial_statements_status(session_options)\n if @valid_status_values.include? params[:status] and not params[:clear]\n status = params[:status]\n elsif session_options and @valid_status_values.include? session_options[:status] and not params[:clear]\n status = session_options[:status]\n else\n status = 'all'\n end\n end",
"def status_filter_options\n helpers.options_for_select([[\"Any\", \"ANY\"]], params.dig(:query, :status)) +\n helpers.grouped_options_for_select(\n { \"open/closed\" => [[\"Open\", \"\"], [\"Closed\", \"closed\"]],\n \"status\" => Admin::DigitizationQueueItem::STATUSES.\n find_all {|s| s != \"closed\" }.\n collect {|s| [s.humanize, s]}\n },\n params.dig(:query, :status) || \"\"\n )\n\n # helpers.options_for_select(\n # Admin::DigitizationQueueItem::STATUSES.\n # find_all {|s| s != \"closed\" }.\n # collect {|s| [s.humanize, s]},\n # params.dig(:query, :status)\n # )\n end",
"def session_status\n authorize! :manage, :home\n @status = params[:status].to_i\n @title = \"Sessions with Status: \" + SessionFlow.status(@status)\n case @status\n when SessionFlow::PRIMARY\n @sessions = InsuranceSession.primary\n when SessionFlow::SECONDARY\n @sessions = InsuranceSession.secondary\n when SessionFlow::TERTIARY\n @sessions = InsuranceSession.tertiary\n when SessionFlow::OTHER\n @sessions = InsuranceSession.other\n when SessionFlow::BALANCE\n @sessions = InsuranceSession.balancebill\n else\n @sessions = nil\n end\n\n respond_to do |format|\n format.html {render :layout => \"application\" }\n end\n end",
"def filterstatus\n\n @status=RestClient.get $api_service+\"/claims/status_filter?id=#{params[:format]}&type=#{params[:type]}\"\n @status=JSON.parse @status\n end",
"def refresh_cashflows_search_condition_help(par)\n # new condition hash\n condition = {}\n # refresh condition\n unless par.nil?\n # get previous condition from session\n condition = session[:cashflows_search_form] unless session[:cashflows_search_form].nil?\n # is_in\n condition[\"is_in\"] = par[:is_in] unless par[:is_in].nil?\n # is_domestic\n condition[\"is_domestic\"] = par[:is_domestic] unless par[:is_domestic].nil?\n # year start\n condition[\"year_s\"] = par[:year_s] unless par[:year_s].nil?\n # month start\n condition[\"month_s\"] = par[:month_s] unless par[:month_s].nil?\n # year end\n condition[\"year_e\"] = par[:year_e] unless par[:year_e].nil?\n # month end\n condition[\"month_e\"] = par[:month_e] unless par[:month_e].nil?\n # refresh session\n session[:cashflows_search_form] = condition\n end\n return condition\n end",
"def search_options\n session[:credit_note_list_opt] ? options = session[:credit_note_list_opt] : options = {}\n valid_options = [:nice_user, :first_name, :last_name, :issue_date_from, :issue_date_till]\n if can_view_finances?\n valid_options += [:status, :amount_min, :amount_max, :paid_date_from, :paid_date_till]\n end\n valid_options.each { |key|\n if params[:clear].to_i == 1 or meaningless? params[key]\n options.delete(key)\n elsif params[key]\n options[key] = params[key]\n end\n }\n return options\n end",
"def filter\n res = RResponse.new\n \n # if no filter params exists, then we're in presentation mode of an existing query (and possibly paging). in this case\n # the set of order ids must exist in session[:order_filter]\n if (params[\"filter\"].nil?)\n raise RException.new(\"order/query call with neither a filter nor a resultset in session\") if session[:order_filter].nil? \n res.data[:rs] = Order.filter(session[:order_filter], params[\"limit\"], params[\"start\"]) \n res.data[:total] = session[:order_filter].length \n res.success = true \n \n # filter params were found -- this means we're building a new query\n else\n # build a criteria hash.\n c = {}\n params[\"filter\"].each_pair do |k,v|\n if (v == 'on')\n filter = {} \n params[k].each_pair do |name, value|\n filter[name.to_sym] = value\n end \n filter[:location] = params[\"location\"] if (k == 'airport') \n filter[:role] = params[\"role\"] if (k == 'company') \n c[k.to_sym] = filter \n end\n end \n LOG.info('filter: ' + c.to_yaml)\n res.data[:total] = 0 \n if (rs = Order.prepare_filter(c))\n session[:order_filter] = rs \n res.data[:total] = rs.length\n res.msg = \"Found #{rs.length} orders\" \n else \n res.msg = \"No orders found with that criteria\"\n end \n res.success = true\n end \n \n respond(res)\n \n end",
"def get_status_collection(options)\n case options\n when :all\n {get_status(1) => 1, get_status(2) => 2, get_status(3) => 3, get_status(0) => 0}\n when :pending\n {get_status(2) => 2, get_status(0) => 0}\n when :accepted\n {get_status(3) => 3, get_status(0) => 0}\n end\n\n end",
"def filter_by_status(subscriptions)\n return subscriptions if params[:status].blank?\n\n subscriptions.filter_by_status(params[:status])\n end",
"def filter_by_status\n ids = TaskFilter.filter_status_ids(session)\n status_values = []\n hidden = \"(tasks.hidden = 0 OR tasks.hidden IS NULL)\"\n\n if ids.include?(0)\n status_values << \"tasks.status = 0\"\n# status_values << \"tasks.status = 1\"\n ids.delete(0)\n end\n if ids.include?(2)\n status_values << \"tasks.status > 1\"\n ids.delete(2)\n end\n if ids.include?(-2)\n hidden = \"tasks.hidden = 1\"\n ids.delete(-2)\n end\n if ids.include?(-1) # all statuses\n status_values.clear\n ids.delete(-1)\n end\n\n # the other values can be used untouched \n status_values += ids.map { |id| \"tasks.status = #{ id }\" }\n status_values = status_values.join(\" OR \")\n status_values = \"(#{ status_values }) AND \" if !status_values.blank?\n return \"#{ status_values } (#{ hidden }) AND \"\n end",
"def reset_filters\n # Shared\n session[:search] = nil\n session[:letter] = nil\n session[:sort] = nil\n session[:direction] = nil\n session[:ifilter] = nil\n session[:active_tab] = nil\n session[:From] = nil\n session[:To] = nil\n session[:Type] = nil\n session[:No] = nil\n session[:NoCR] = nil\n session[:Project] = nil\n session[:Order] = nil\n session[:Account] = nil\n session[:Products] = nil\n session[:Suppliers] = nil\n session[:Status] = nil\n session[:WrkrCompany] = nil\n session[:WrkrOffice] = nil\n session[:Petitioner] = nil\n session[:Balance] = nil\n session[:Client] = nil\n session[:User] = nil\n session[:Period] = nil\n # Ag2Admin\n # ...\n # Ag2Directory\n session[:ContactType] = nil\n # Ag2Finance\n # ...\n # Ag2Gest\n session[:ReadingRoute] = nil\n session[:Meter] = nil\n session[:Caliber] = nil\n session[:RequestType] = nil\n session[:RequestStatus] = nil\n session[:ClientInfo] = nil\n session[:Subscriber] = nil\n session[:SubscriberB] = nil\n session[:Operation] = nil\n session[:Biller] = nil\n session[:BillerB] = nil\n session[:ServicePoint] = nil\n session[:ServicePointB] = nil\n session[:SubscriberCode] = nil\n session[:ClientCode] = nil\n session[:SubscriberFiscal] = nil\n session[:ClientFiscal] = nil\n session[:StreetName] = nil\n session[:StreetNameB] = nil\n session[:entity] = nil\n session[:Request] = nil\n session[:BankAccount] = nil\n session[:BankOrder] = nil\n session[:Use] = nil\n session[:TariffType] = nil\n session[:Phase] = nil\n session[:PeriodB] = nil\n session[:ProjectB] = nil\n session[:ClientB] = nil\n session[:ifilter_show] = nil\n session[:ifilter_show_tariff] = nil\n session[:ifilter_index_tariff] = nil\n session[:ifilter_show_account] = nil\n session[:page_entries_show] = nil\n session[:incidences] = nil\n session[:BillNo] = nil\n # Ag2HelpDesk\n session[:Id] = nil\n session[:OfficeT] = nil\n session[:Category] = nil\n session[:Priority] = nil\n session[:Technician] = nil\n session[:Domain] = nil\n # Ag2Human\n session[:Worker] = nil\n session[:Code] = nil\n # Ag2Products\n session[:Family] = nil\n session[:Store] = nil\n session[:Measure] = nil\n session[:Manufacturer] = nil\n session[:Tax] = nil\n session[:Stores] = nil\n session[:Companies] = nil\n # Ag2Purchase\n session[:Supplier] = nil\n session[:Invoice] = nil\n # Ag2Tech\n session[:Group] = nil\n session[:Area] = nil\n session[:Labor] = nil\n\n render json: { result: session[:letter] }\n end",
"def query_status(params, path_url = 'payment_requests', class_type = 'STK')\n super\n end",
"def set_filter\n # First, ensure the requested filter is legit\n if Listing.statuses.keys.any?{ |s| s == params[:show_filter]}\n # it's a good, known filter...set it on the session object\n session[:listings_filter] = params[:show_filter]\n elsif params[:show_filter] == 'all'\n # special case of 'all' -- clear out the session object's listing_filter\n session[:listings_filter] = nil\n else\n # parameter is a bad filter value\n raise ArgumentError, \"Bad filter requested.\"\n end\n\n # now that the session object's listing_filter has been set, \n # retrieve the targeted listings in @listings\n set_filtered_listings\n \n # this will run set_filter.js.erb\n respond_to do |format|\n format.js\n end\n end",
"def filter\n # if we aren't an admin or housing admin we shouldn't be here\n record_not_found and return if !admin? and !housing_admin?\n\n # clear filters if requested\n if params[:clear] == 'true'\n session[:status] = nil\n session[:building_id] = nil\n\n flash[:notice] = 'All filters have been cleared.'\n else\n # update session values from passed in params\n session[:status] = params[:status] unless params[:status].blank?\n session[:building_id] = params[:building_id] unless params[:building_id].blank?\n\n # remove filters if none is passed\n session[:status] = nil if params[:status] == 'none'\n session[:building_id] = nil if params[:building_id] == 'none'\n\n flash[:notice] = 'Filters updated successfully.'\n end\n\n respond_to do |format|\n format.html {\n redirect_to(housing_rooms_url)\n }\n end\n end",
"def find_options_for_open_rewarded(options={})\n {:conditions => [\"kases.status IN (?) AND kases.price_cents > 0 AND kases.template != ?\", [\"open\"], true],\n :order => \"kases.updated_at DESC\"}.merge_finder_options(options)\n end",
"def check_filter_options() #:nodoc:\r\n table_name = @tables.first[1]\r\n model = @tables.first[0]\r\n session[table_name] ||= {}\r\n# process page\r\n session[table_name][:page] = params[:page] if params[:page]\r\n# new filter is applied\r\n if params[:filter]\r\n set_session_filter(table_name)\r\n session[table_name][:page] = 1\r\n end\r\n# if data model has field dc_site_id ensure that only documents which belong to the site are selected.\r\n site_id = dc_get_site._id if dc_get_site\r\n# dont't filter site if no dc_site_id field or user is ADMIN\r\n site_id = nil if !model.method_defined?('dc_site_id') or dc_user_can(DcPermission::CAN_ADMIN)\r\n# \r\n if @records = DcFilter.get_filter(session[table_name][:filter])\r\n @records = @records.and(dc_site_id: site_id) if site_id\r\n else\r\n @records = if site_id\r\n model.where(dc_site_id: site_id)\r\n else\r\n model\r\n end\r\n end\r\n=begin \r\n# TODO Use only fields requested. Higly experimental but necessary in some scenarios\r\n if (columns = @form['result_set']['columns'])\r\n cols = []\r\n columns.each { |k,v| cols << v['name'] }\r\n p '*',cols,'*'\r\n @records = @records.only(cols)\r\n end\r\n=end \r\n# pagination if required\r\n per_page = (@form['result_set']['per_page'] || 30).to_i\r\n if per_page > 0\r\n @records = @records.page(session[table_name][:page]).per(per_page)\r\n end\r\nend",
"def filter_housing\n # if we aren't an admin or housing admin we shouldn't be here\n record_not_found and return if !admin? and !housing_admin?\n\n # clear filters if requested\n if params[:clear] == 'true'\n session[:registration_type] = nil\n session[:status] = nil\n session[:district_id] = nil\n session[:region_id] = nil\n session[:building_id] = nil\n session[:group_leader] = nil\n session[:gender] = nil\n \n flash[:notice] = 'All filters have been cleared.'\n else\n # update session values from passed in params\n session[:registration_type] = params[:registration_type] unless params[:registration_type].blank?\n session[:status] = params[:status] unless params[:status].blank?\n session[:district_id] = params[:district_id] unless params[:district_id].blank?\n session[:region_id] = params[:region_id] unless params[:region_id].blank?\n session[:building_id] = params[:building_id] unless params[:building_id].blank?\n session[:group_leader] = params[:group_leader] unless params[:group_leader].blank?\n session[:gender] = params[:gender] unless params[:gender].blank?\n\n # remove filters if none is passed\n session[:registration_type] = nil if params[:registration_type] == 'none'\n session[:status] = nil if params[:status] == 'none'\n session[:district_id] = nil if params[:district_id] == 'none'\n session[:region_id] = nil if params[:region_id] == 'none'\n session[:building_id] = nil if params[:building_id] == 'none'\n session[:group_leader] = nil if params[:group_leader] == 'none'\n session[:gender] = nil if params[:gender] == 'none'\n \n flash[:notice] = 'Filters updated successfully.'\n end\n\n respond_to do |format|\n format.html {\n redirect_to(housing_participant_registrations_url)\n }\n end\n end",
"def filter_by_status(bookings)\n return bookings if params[:status].blank?\n\n bookings.filter_by_status(params[:status])\n end",
"def scope_by_status(status)\n case status\n when 'new', 'shipped', 'paid'\n with_scope(:find => { :conditions => {:status => status}}) do\n yield\n end\n else\n yield\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=begin convert prices in statements from default system currency to currency that is set in session Params +statement+ iterable of financial stement data(they rices should be in system currency) Returns +statement+ same object that was passed only it's prices recalculated in user selected currency =end
|
def convert_to_user_currency(statements)
exchange_rate = Currency.count_exchange_rate(session[:default_currency], session[:show_currency])
statements.each { |statement|
statement.price = statement.price.to_d * exchange_rate
statement.price_with_vat = statement.price_with_vat.to_d * exchange_rate
}
statements
end
|
[
"def convert_to_user_currency(statements)\n exchange_rate = Currency.count_exchange_rate(session[:default_currency], session[:show_currency])\n statements.each { |statement|\n statement.price = statement.price.to_d * exchange_rate\n statement.price_with_vat = statement.price_with_vat.to_d * exchange_rate\n }\n return statements\n end",
"def converted_currency\n quotation.converted_currency\n end",
"def convert_to(currency_to_convert)\n obj_copy = self.dup #copio el objeto\n return obj_copy if self.conversion[currency_to_convert].nil? || currency_to_convert == self.currency\n obj_copy.amount = (obj_copy.amount * obj_copy.conversion[currency_to_convert]).round(2)\n obj_copy.currency = currency_to_convert\n return obj_copy\n end",
"def convert_to(target_currency)\n make_call(currencies(target_currency))\n end",
"def collection_currency\n card_prices = []\n current_user.cards.each do |card|\n price = remove_dot(card.usd_price)\n card_prices << Money.new(price) * card.quantity \n end\n # call `format`\n card_prices.inject(:+) \n end",
"def get_price_for_other_currency(price,current_currency, updated_currency)\n get_currency_multiplier\n if current_currency == \"USD\"\n @currency_multiplier[updated_currency] * price\n elsif updated_currency == \"USD\"\n (price/@currency_multiplier[current_currency])\n else\n (price/@currency_multiplier[current_currency]) * @currency_multiplier[updated_currency]\n end\n end",
"def quote(params)\n\n result = {\n search_id: search_id = params[:search_id],\n pay_amount: pay_amount = Monetize.parse(params[:pay_amount]).amount,\n pay_currency: pay_currency = params[:pay_currency],\n get_amount: get_amount = Monetize.parse(params[:get_amount]).amount,\n get_currency: get_currency = params[:get_currency],\n trans: trans = params[:trans],\n calculated: calculated = params[:calculated],\n rates: {},\n bad_rates: {},\n quote: nil,\n quote_currency: nil,\n edited_quote: nil,\n edited_quote_rounded: nil,\n bad_amount: nil,\n gain: 0,\n gain_amount: gain_amount = 0,\n gain_currency: gain_currency = nil,\n real_rates: has_real_rates?,\n rounded: false,\n pay_rounded: params[:pay_amount].to_money(pay_currency).format,\n get_rounded: params[:get_amount].to_money(get_currency).format,\n base_rate: nil,\n errors: []\n }\n\n if currency.nil?\n result[:errors] << 'No local currency defined for that exchange'\n return result\n end\n if pay_currency == get_currency\n result[:errors] << 'Please select two different currencies'\n return result\n end\n if !self.country\n result[:errors] << 'Exchange has no country'\n return result\n else\n country = self.country\n end\n\n if calculated == 'buy_amount'\n\n rates = result[:rates] = rate(get_currency, pay_currency, trans, pay_currency, search_id)\n\n if rates[:error]\n result[:errors] << rates[:error]\n return result\n end\n\n if rates[trans.to_sym] == 0\n result[:errors] << trans + \" rate needed but empty - cannot quote\"\n return result\n end\n\n # quote: net of charges. get_amount: including charges.\n result[:quote] = pay_amount * rates[trans.to_sym]\n result[:edited_quote] = result[:edited_quote_rounded] = result[:quote].to_money(get_currency).format\n result[:quote_currency] = get_currency\n\n get_amount = result[:quote]\n result[:get_amount] = result[:get_rounded] = get_amount.to_money(get_currency).format\n\n bad_rates = result[:bad_rates] = Exchange.bad_rate(country,get_currency, pay_currency, trans, pay_currency, search_id)\n bank_fee = bad_rates[:bank_fee] || 0\n bad_amount_before_fees = (pay_amount * (bad_rates[trans.to_sym] || 0))\n bad_amount = bad_amount_before_fees * (100 - bank_fee) / 100.0\n\n result[:bad_amount] = bad_amount.to_money(get_currency).format\n result[:gain] = bad_amount != 0 ? result[:quote] - bad_amount : result[:quote] # the latter is to enable just grade sorting when bad rate isn't there\n result[:gain_amount] = result[:gain].to_money(get_currency).format\n result[:gain_type] = result[:gain] < 0 ? 'your gain' : 'your gain'\n result[:gain_short] = result[:gain] < 0 ? 'gain' : 'gain'\n result[:gain_currency] = get_currency\n\n result[:pay_amount] = pay_amount.to_money(pay_currency).format\n\n if get_currency != currency and (get_subtract = get_amount.modulo(1)) > 0\n result[:rounded] = true\n pay_subtract = get_subtract / rates[trans.to_sym]\n result[:pay_rounded] = (pay_amount - pay_subtract).to_money(pay_currency).format\n result[:get_rounded] = (get_amount - get_subtract).to_money(get_currency).format\n result[:edited_quote_rounded] = result[:get_rounded]\n end\n\n result[:base_rate] = Exchange.edit_base_rate(rates, trans)\n\n else\n\n rates = result[:rates] = rate(pay_currency, get_currency, trans, pay_currency, search_id)\n if rates[:error]\n result[:errors] << rates[:error]\n return result\n end\n if rates[trans.to_sym] == 0\n result[:errors] << trans + \" rate needed but empty - cannot quote\"\n return result\n end\n\n # quote: net of charges. pay_amount: including charges.\n result[:quote] = get_amount * rates[trans.to_sym]\n result[:edited_quote] = result[:edited_quote_rounded] = result[:quote].to_money(pay_currency).format\n result[:quote_currency] = pay_currency\n\n pay_amount = result[:quote]\n result[:pay_amount] = result[:pay_rounded] = pay_amount.to_money(pay_currency).format\n\n bad_rates = result[:bad_rates] = Exchange.bad_rate(country, pay_currency, get_currency, trans, pay_currency, search_id)\n bank_fee = bad_rates[:bank_fee] || 0\n bad_amount_before_fees = (get_amount * (bad_rates[trans.to_sym] || 0))\n bad_amount = bad_amount_before_fees * (100 + bank_fee) / 100.0\n result[:bad_amount] = bad_amount.to_money(pay_currency).format\n result[:gain] = bad_amount != 0 ? bad_amount - result[:quote] : result[:quote] * -1 # the latter is to enable just grade sorting when bad rate isn't there\n result[:gain_amount] = result[:gain].to_money(pay_currency).format\n\n result[:gain_currency] = pay_currency\n result[:gain_type] = result[:gain] < 0 ? 'you save' : 'you save'\n result[:gain_short] = result[:gain] < 0 ? 'save' : 'save'\n result[:get_amount] = get_amount.to_money(get_currency).format\n\n if get_currency == currency and pay_currency != currency and (pay_subtract = pay_amount.modulo(1)) > 0\n result[:rounded] = true\n get_subtract = pay_subtract / rates[trans.to_sym]\n result[:get_rounded] = (get_amount - get_subtract).to_money(get_currency).format\n result[:pay_rounded] = (pay_amount - pay_subtract).to_money(pay_currency).format\n result[:edited_quote_rounded] = result[:pay_rounded]\n end\n\n result[:base_rate] = Exchange.edit_base_rate(rates, trans)\n\n end\n\n return result\n\n end",
"def update_prices\n get_currency_multiplier\n # Return if currency is not available\n return if @currency_multiplier.nil?\n # Get all the variant except gift card one.\n variants = Spree::Variant.joins(:product).where(\"spree_products.is_gift_card =? and spree_variants.sku not like ?\", false, \"SWT%\")\n variants.each do |variant|\n @usd_price = variant.prices.where(currency: \"USD\").take.amount\n @currency_multiplier.keys.each do |key|\n updated_price = variant.prices.where(currency: key).take\n # Round off the amount to next 5 and substract .1 from it\n amount = get_price(key)\n updated_price.amount = amount\n updated_price.save!\n end\n end\n end",
"def run_on_prices(currencies = nil, &block)\n if currencies.present? && currencies.any?\n prices_with_currencies = prices.select { |p| currencies.include?(p.currency) }\n prices_with_currencies.each { |p| block.call p }\n else\n prices.each { |p| block.call p }\n end\n end",
"def convert_currency(session_token, amount, from_currency, to_currency)\n global.request :bf, :convertCurrency do \n soap.body = { 'bf:request' => { :header => api_request_header(session_token), :amount => amount, :fromCurrency => from_currency, :toCurrency => to_currency } }\n end\n end",
"def bank\n unless @bank\n @bank = Money::Bank::VariableExchange.new\n base_cents = price_currency == 'JPY' ? (price_cents.to_f * 100) : price_cents.to_f\n unless alt1_price_currency.blank?\n alt1_cents = alt1_price_currency == 'JPY' ? (alt1_price_cents.to_f * 100) : alt1_price_cents.to_f\n @bank.add_rate(price_currency, alt1_price_currency, alt1_cents / base_cents)\n @bank.add_rate(alt1_price_currency, price_currency, base_cents / alt1_cents)\n end\n unless alt2_price_currency.blank?\n alt2_cents = alt2_price_currency == 'JPY' ? (alt2_price_cents.to_f * 100) : alt2_price_cents.to_f\n @bank.add_rate(price_currency, alt2_price_currency, alt2_cents / base_cents)\n @bank.add_rate(alt2_price_currency, price_currency, base_cents / alt2_cents)\n end\n if !alt1_price_currency.blank? && !alt2_price_currency.blank?\n @bank.add_rate(alt1_price_currency, alt2_price_currency, alt2_cents / alt1_cents)\n @bank.add_rate(alt2_price_currency, alt1_price_currency, alt1_cents / alt2_cents)\n end\n end\n @bank\n end",
"def set_default_currency_amounts\n if self.project.present?\n if self.exchange_rate.present? && self.exchange_rate == 1.0\n \n # Set invoice items\n self.invoice_items.each do |invoice_item|\n invoice_item.default_currency_amount_cents = invoice_item.amount_cents\n end\n \n # Set invoice\n self.default_currency_total_amount_cents_exc_vat = self.total_amount_cents_exc_vat\n self.default_currency_total_amount_cents_inc_vat = self.total_amount_cents_inc_vat\n else\n account_default_currency = self.project.account.account_setting.default_currency\n reverse_exchange_rate = Currency.get_exchange_for(self.currency, account_default_currency)\n Money.add_rate(self.currency, account_default_currency, reverse_exchange_rate)\n \n # Set invoice items\n self.invoice_items.each do |invoice_item|\n invoice_item.default_currency_amount_cents = Money.new(invoice_item.amount_cents, self.currency).exchange_to(account_default_currency).cents\n end\n \n # Set invoice default amounts from the invoice items so amoutns match.\n self.default_currency_total_amount_cents_exc_vat = self.invoice_items.collect(&:default_currency_amount_cents_incl_quantity).sum\n self.default_currency_total_amount_cents_inc_vat = self.invoice_items.collect{|invoice_item| invoice_item.vat? ? ((self.vat_rate / 100) * invoice_item.default_currency_amount_cents_incl_quantity) + invoice_item.default_currency_amount_cents_incl_quantity : invoice_item.default_currency_amount_cents_incl_quantity}.sum\n end\n end\n end",
"def get_Currency()\n \t return @outputs[\"Currency\"]\n \tend",
"def run_on_prices(currencies = nil, &block)\n if currencies.present? && currencies.any?\n prices_with_currencies = prices.select { |price| currencies.include?(price.currency) }\n prices_with_currencies.each { |price| block.call(price) }\n else\n prices.each { |price| block.call(price) }\n end\n touch\n end",
"def currency_conversions\n initial_rate.conversion_rates.each_key do |x|\n puts other_currency_to_usd(x)\n end\n end",
"def base_currency_to_to_currency(date, to_currency)\n @rates[date][to_currency]\n end",
"def get_rate (currency, target_currency, rate)\n if currency == target_currency\n rate\n elsif @rate_table[[currency, target_currency]] != nil\n @rate_table[[currency, target_currency]] * rate\n else\n @rate_table.each do |k, v|\n if k[0] == currency\n rate = get_rate(k[1], target_currency, rate * v)\n return rate if rate\n end\n end\n nil\n end\nend",
"def currency_rates\n if session[:currency].nil?\n session[:currency] = {}\n res = JSON.parse(HTTParty.get(\"https://api.exchangeratesapi.io/latest?base=GBP\").to_json)\n\n\n session[:currency][:g2u] = res[\"rates\"][\"USD\"].round(2)\n session[:currency][:g2e] = res[\"rates\"][\"EUR\"].round(2)\n session[:currency][:g2c] = res[\"rates\"][\"CNY\"].round(2)\n session[:currency][:g2j] = res[\"rates\"][\"JPY\"].round(2)\n session[:currency][:g2r] = res[\"rates\"][\"RUB\"].round(2)\n session[:currency][:g2h] = res[\"rates\"][\"HKD\"].round(2)\n\n @g2u = res[\"rates\"][\"USD\"].round(2)\n @g2e = res[\"rates\"][\"EUR\"].round(2)\n @g2c = res[\"rates\"][\"CNY\"].round(2)\n @g2j = res[\"rates\"][\"JPY\"].round(2)\n @g2r = res[\"rates\"][\"RUB\"].round(2)\n @g2h = res[\"rates\"][\"HKD\"].round(2)\n\n else\n puts session[:currency]\n @g2u = session[:currency][\"g2u\"]\n @g2e = session[:currency][\"g2e\"]\n @g2c = session[:currency][\"g2c\"]\n @g2j = session[:currency][\"g2j\"]\n @g2r = session[:currency][\"g2r\"]\n @g2h = session[:currency][\"g2h\"]\n end\n\n end",
"def old_format coin, currency\n coin['currency'] = currency\n ['marketCap', 'price', 'volume24'].each do |key|\n coin[key] = coin[key][currency]\n end\n\n coin\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=begin financial data returned by invoice, credit notes or payments may lack some information, this method's purpose is to retrieve information from part of financial statement(let's say financial stetement is devided in three parts: credit note, invoice and payments) about paid/unpaid financial data. if there is no such data return default, default meaning that there is no paid/unpaid part, so it's count and price is 0. TODO should rename valiable names, cause they dont make much sense. maybe event method name should be renamed Note that price and price including taxes will be converted from default system currency to user selected Params +statement+ part of financial statement +status+ whatever valid status might have the statement Returns +paid/unpaid_statement+ if there is such statement that satisfies condition(status) returns it, else returns default statement. =end
|
def get_financial_statement(statements, status)
statements.each { |statement|
if statement.status == status
return statement
end
}
#Return default financial data if required stetement was not found
Struct.new('We', :count, :price, :price_with_vat, :status)
return Struct::We.new(0, 0, 0, status)
end
|
[
"def financial_statements_get\n @doc.page {\n if @current_user and not (@current_user.is_accountant? and (not @current_user.accountant_allow_read('can_see_finances') or not @current_user.allow_read('payments_manage') or not @current_user.accountant_allow_read('invoices_manage')))\n if @values[:date_from] and @values[:date_till]\n date_from = Time.at(@values[:date_from].to_i).to_date.to_s(:db)\n date_till = Time.at(@values[:date_till].to_i).to_date.to_s(:db)\n end\n date_from = Date.today.to_s(:db) if !date_from\n date_till = Time.now.tomorrow.to_s(:db) if !date_till\n if ['paid', 'unpaid', 'all'].include? @values[:status]\n status = @values[:status]\n else\n status = 'all'\n end\n if @current_user.usertype == 'user'\n user_id = @current_user.id\n ordinary_user = @current_user.is_user?\n elsif @values[:user_id] and @values[:user_id].to_i > 0\n user_id = @values[:user_id].to_i\n end\n if @current_user.is_admin? or @current_user.is_accountant?\n owner_id = 0\n else\n owner_id = @current_user.id\n end\n\n if !@current_user.is_user?\n coi = @current_user.usertype == 'accountant' ? 0 : @current_user.id\n user = User.where(:id => @values[:user_id], :owner_id => coi).first if @values[:user_id]\n else\n user = @current_user\n end\n\n if user or !@values[:user_id]\n\n financial_statements = {}\n financial_statements[\"invoices\"] = Invoice.financial_statements(owner_id, user_id, status, date_from, date_till, ordinary_user)\n financial_statements[\"credit_notes\"] = CreditNote.financial_statements(owner_id, user_id, status, date_from, date_till, ordinary_user)\n default_currency_name = Currency.get_default.name\n financial_statements[\"payments\"] = Payment.financial_statements(owner_id, user_id, status, date_from, date_till, ordinary_user, default_currency_name)\n\n @doc.financial_statement(\"currency\" => default_currency_name) {\n financial_statements.to_a.each { |type, statements|\n statements.to_a.each { |data|\n @doc.statement(\"type\" => type) {\n @doc.status(data.status)\n @doc.count(data.count)\n if type == 'payments' or type == 'credit_notes'\n @doc.price(nice_number(data.price))\n @doc.price_with_vat(nice_number(data.price_with_vat))\n else\n @doc.price(nice_number(data.price * count_exchange_rate(@current_user.currency.name, default_currency_name)))\n @doc.price_with_vat(nice_number(data.price_with_vat * count_exchange_rate(@current_user.currency.name, default_currency_name)))\n end\n }\n }\n }\n }\n else\n @doc.error(_('Dont_be_so_smart'))\n end\n else\n @doc.error(\"Bad login\")\n end\n }\n send_xml_data(@out_string, params[:test].to_i)\n end",
"def get_amount_paid\n if paid? then price\n else amount_paid\n end\n end",
"def prepare_get_value_sales_evaluations(header,year,month, account, type)\n first_saldo = {}\n first_saldo = \n TrialBalance.find(:first,:conditions => [\"MONTH(transaction_date) = #{month} AND YEAR(transaction_date) = #{year} and account_id = ?\",account.id]\n ) \n result = 0\n aje = []\n result = first_saldo.nil? ? 0 : first_saldo.last_saldo #get_first_saldo(account,year,month)\n aje = get_summary_aje(account, year,month)\n if account.account_type == \"debet\"\n result = result - aje[1] + aje[0]\n else\n result = result - aje[0] + aje[1]\n end \n aje = []\n result\n end",
"def financial_statements\n doc = Builder::XmlMarkup.new(:target => out_string = \"\", :indent => 2)\n doc.instruct! :xml, :version => \"1.0\", :encoding => \"UTF-8\"\n doc.page {\n if @current_user and not (@current_user.is_accountant? and (not @current_user.accountant_allow_read('can_see_finances') or not @current_user.allow_read('payments_manage') or not @current_user.accountant_allow_read('invoices_manage')))\n if @values[:date_from] and @values[:date_till]\n date_from = Time.at(@values[:date_from].to_i).to_date.to_s(:db)\n date_till = Time.at(@values[:date_till].to_i).to_date.to_s(:db)\n end\n date_from = Date.today.to_s(:db) if !date_from\n date_till = Time.now.tomorrow.to_s(:db) if !date_till\n if ['paid', 'unpaid', 'all'].include? @values[:status]\n status = @values[:status]\n else\n status = 'all'\n end\n if @current_user.usertype == 'user'\n user_id = @current_user.id\n ordinary_user = @current_user.is_user?\n elsif @values[:user_id] and @values[:user_id].to_i > 0\n user_id = @values[:user_id].to_i\n end\n if @current_user.is_admin? or @current_user.is_accountant?\n owner_id = 0\n else\n owner_id = @current_user.id\n end\n\n if !@current_user.is_user?\n coi = @current_user.usertype == 'accountant' ? 0 : @current_user.id\n user = User.where(:id => @values[:user_id], :owner_id => coi).first if @values[:user_id]\n else\n user = @current_user\n end\n\n if user or !@values[:user_id]\n\n financial_statements = {}\n financial_statements[\"invoices\"] = Invoice.financial_statements(owner_id, user_id, status, date_from, date_till, ordinary_user)\n financial_statements[\"credit_notes\"] = CreditNote.financial_statements(owner_id, user_id, status, date_from, date_till, ordinary_user)\n default_currency_name = Currency.get_default.name\n financial_statements[\"payments\"] = Payment.financial_statements(owner_id, user_id, status, date_from, date_till, ordinary_user, default_currency_name)\n\n doc.financial_statement(\"currency\" => default_currency_name) {\n financial_statements.each { |type, statements|\n statements.each { |data|\n doc.statement(\"type\" => type) {\n doc.status(data.status)\n doc.count(data.count)\n if type == 'payments' or type == 'credit_notes'\n doc.price(nice_number(data.price))\n doc.price_with_vat(nice_number(data.price_with_vat))\n else\n doc.price(nice_number(data.price * count_exchange_rate(@current_user.currency.name, default_currency_name)))\n doc.price_with_vat(nice_number(data.price_with_vat * count_exchange_rate(@current_user.currency.name, default_currency_name)))\n end\n }\n }\n }\n }\n else\n doc.error(_('Dont_be_so_smart'))\n end\n else\n doc.error(\"Bad login\")\n end\n }\n send_xml_data(out_string, params[:test].to_i)\n end",
"def servicetax\n if (self.orderid).present?\n servicetax = 0\n if self.product_master.sel_s_tax.blank? || self.product_master.sel_s_tax == 1\n\n servicetaxid = 10040\n servicetaxrate = Orderpaymentmode.find(servicetaxid).charges\n\n maharastracodextraid = 10020\n maharastracodextrarate = Orderpaymentmode.find(maharastracodextraid).charges\n\n maharastracodextracharge = self.total * maharastracodextrarate\n\n cashondeliveryid = 10001\n cashondeliveryrate = Orderpaymentmode.find(cashondeliveryid).charges\n cashondeliverycharge = self.total * cashondeliveryrate\n\n\n\n #add all charges\n servicetax = ((maharastracodextracharge || 0) + (cashondeliverycharge || 0)) * (servicetaxrate || 0)\n\n #check if address is selected\n if self.order_master.customer_address_id.present?\n #check if state is maharastra\n if self.order_master.customer_address.state.upcase == 'MAHARASHTRA'\n\n servicetax = ((maharastracodextracharge || 0) + (cashondeliverycharge || 0)) * (servicetaxrate || 0)\n else\n servicetax = (cashondeliverycharge || 0) * (servicetaxrate || 0)\n\n\n end\n end\n\n #check if paid using credit card is selected\n if self.order_master.orderpaymentmode_id.present?\n if self.order_master.orderpaymentmode_id == 10000\n return 0\n end\n end\n\n end\n\n end\n\n return servicetax.round(2)\nend",
"def retail_best_shipped_paid_percent product_variant_id, media_id\n base_return = ReturnRate.where( product_variant_id: product_variant_id)\n product_variant = ProductVariant.find(product_variant_id)\n media = Medium.find(media_id).name\n #all_values = []\n # media_id: media_id,\n return_rate = ReturnRate.new\n \n return_rate.rate_0 = 50.0\n return_rate.note_0 = \"#{product_variant.extproductcode} default value\"\n return_rate.rate = 50.0\n return_rate.note = \"#{product_variant.extproductcode} default value\"\n return_rate.rate_1 = 0.0\n return_rate.note_1 = \"Nothing for #{product_variant.extproductcode}, for 60 - 30 days for media #{media_id}\"\n return_rate.rate_2 = 0.0\n return_rate.note_2 = \"Nothing for #{product_variant.extproductcode}, for 60 - 60 days for media #{media_id}\"\n \n #all_values << default\n if base_return.where(offset: 30, no_of_days: 60).present?\n first_check = base_return.where(offset: 30, no_of_days: 60).first\n first_no = (first_check.cancelled.to_f / first_check.shipped.to_f) * 100\n # all_values[1].key =\n # all_values[1].values = \"\"\n # all_values << first_no\n # return_rate_2 = ReturnRate.new\n return_rate.rate_1 = first_no.round(2)\n return_rate.note_1 = \"#{product_variant.extproductcode} for 30 - 60 days (#{first_check.cancelled}/ #{first_check.shipped}) #{first_no.round(2)} for media #{media}\"\n end\n \n if base_return.where(offset: 60, no_of_days: 60).present?\n second_check = base_return.where(offset: 60, no_of_days: 60).first\n if second_check.transfer_total > 0 && second_check.transfer_paid > 0\n second_no = (second_check.cancelled.to_f / second_check.shipped.to_f) * 100\n #all_values << second_no\n \n # return_rate_3 = ReturnRate.new\n if second_no.present?\n return_rate.rate_2 = second_no\n return_rate.note_2 = \"#{product_variant.extproductcode} for 60 - 60 days (#{second_check.cancelled}/ #{second_check.shipped}) #{second_no.round(2)} for media #{media}\"\n end\n end\n end\n \n return return_rate\n end",
"def bank_account_tax_due( account_type, account_amount )\nif account_type == \"normal\"\n return account_amount * 0.10\nelse\n return 0\nend\nend",
"def getPrice\n\n item = self.formula.item.price_basis\n price = 0.0\n case (item.price_basis.to_i)\n when 0#[:awp]\n price = item.awp_unit_price\n when 1 #[:act]\n price = item.act_unit_price\n when 2 #[:basis_340b]\n price = item.govt_340b_unit_price\n when 3 #[:wac]\n price = item.wac_unit_price\n when 4 #[:contract]\n price = item.contract_unit_price\n when 5 #[:nadac]\n price = item.nadac_unit_price\n when 6 #[:custom]\n price = item.custom_unit_price\n when 7 #[:user]\n price = item.mac_unit_price\n else\n price = 0.0\n end\n price\n end",
"def particular_and_discount_details\n include_particular_associations = @financefee.tax_enabled ? [:pay_all_discounts] : [:collection_tax_slabs]\n @fee_particulars = @date.finance_fee_particulars.all(:conditions => \"batch_id=#{@financefee.batch_id}\",\n :include => include_particular_associations).select do |par|\n (par.receiver_type=='Student' and\n par.receiver_id==@student.id) ? par.receiver=@student : par.receiver; (par.receiver.present?) and\n (par.receiver==@student or par.receiver==@financefee.student_category or\n par.receiver==@financefee.batch)\n end\n @categorized_particulars=@fee_particulars.group_by(&:receiver_type)\n if @financefee.tax_enabled?\n @tax_collections = @financefee.tax_collections.all(:include => :tax_slab)\n # (:select => \"distinct tax_collections.*,\n # ctxs.tax_slab_id as tax_slab_id, ffp.name as particular_name\",\n # :include => :tax_slab,\n # :joins => \"INNER JOIN collectible_tax_slabs ctxs\n # ON ctxs.collectible_entity_type = tax_collections.taxable_entity_type AND\n # ctxs.collectible_entity_id = tax_collections.taxable_entity_id AND\n # ctxs.collection_id = #{@financefee.fee_collection_id} AND\n # ctxs.collection_type = 'FinanceFeeCollection'\n # INNER JOIN tax_slabs\n # ON tax_slabs.id = ctxs.tax_slab_id\n # INNER JOIN finance_fee_particulars ffp\n # ON ffp.id=tax_collections.taxable_entity_id\")\n\n @total_tax = @tax_collections.map do |x|\n FedenaPrecision.set_and_modify_precision(x.tax_amount).to_f\n end.sum.to_f\n\n # @tax_slabs = @tax_collections.map {|tax_col| tax_col.tax_slab }.uniq\n\n # @tax_slabs = TaxSlab.all(:conditions => {:id => @tax_collections.keys })\n @tax_slabs = @tax_collections.group_by { |x| x.tax_slab }\n\n @tax_config = Configuration.get_multiple_configs_as_hash(['FinanceTaxIdentificationLabel',\n 'FinanceTaxIdentificationNumber']) if @tax_slabs.present?\n end\n @discounts=@date.fee_discounts.all(:conditions => \"batch_id=#{@financefee.batch_id}\").\n select do |par|\n (par.receiver.present?) and\n ((par.receiver==@financefee.student or\n par.receiver==@financefee.student_category or\n par.receiver==@financefee.batch) and\n (par.master_receiver_type!='FinanceFeeParticular' or\n (par.master_receiver_type=='FinanceFeeParticular' and\n (par.master_receiver.receiver.present? and\n @fee_particulars.collect(&:id).include? par.master_receiver_id) and\n (par.master_receiver.receiver==@financefee.student or\n par.master_receiver.receiver==@financefee.student_category or\n par.master_receiver.receiver==@financefee.batch))))\n end\n @categorized_discounts=@discounts.group_by(&:master_receiver_type)\n @total_discount = 0\n @total_payable=@fee_particulars.map { |s| s.amount }.sum.to_f\n @total_discount =@discounts.map do |d|\n d.master_receiver_type=='FinanceFeeParticular' ?\n (d.master_receiver.amount * d.discount.to_f/(d.is_amount? ? d.master_receiver.amount : 100)) :\n @total_payable * d.discount.to_f/(d.is_amount? ? @total_payable : 100)\n end.sum.to_f unless @discounts.nil?\n end",
"def get_invoice_detail(detailed)\n if self.contact_id\n primary_contact = self.contact\n elsif self.matter_id\n primary_contact = self.matter.contact\n end\n role_id = Role.find_by_name('lawyer').id if consolidated_by.eql?(\"User\")\n p_tax,s_tax,n_total = self.calculate_tax\n invoice_details = self.tne_invoice_details.map do |id|\n activity = consolidated_by =='User' ? id.lawyer_name : (consolidated_by =='Activity' ? id.activity : id.tne_entry_date.to_s)\n if detailed\n case consolidated_by\n when 'User'\n time_entries,expense_entries = consolidated_by_user(self, id.entry_type, id.lawyer_name)\n if id.entry_type == 'Time'\n for te in time_entries\n actual_duration = company.duration_setting.setting_value == \"1/100th\" ? one_hundredth_timediffernce(te.actual_duration) : one_tenth_timediffernce(te.actual_duration)\n activity+= \"\\n\\t\\t #{te.time_entry_date} #{te.acty_type.alvalue} #{commas(actual_duration)} hrs @ $#{commas(te.actual_activity_rate)}/hr - #{te.description}\"\n end\n else\n for ee in expense_entries\n activity+= \"\\n\\t\\t #{ee.expense_entry_date} #{ee.expense.alvalue}- $#{commas(ee.final_expense_amount)}- #{ee.description}\"\n end\n end\n when 'Activity'\n time_entries, expense_entries = consolidated_by_activity(self, id.entry_type, id.activity)\n if id.entry_type == 'Time'\n for te in time_entries\n\t\t\t actual_duration = company.duration_setting.setting_value == \"1/100th\" ? one_hundredth_timediffernce(te.actual_duration) : one_tenth_timediffernce(te.actual_duration)\n activity+= \"\\n\\t\\t #{te.time_entry_date} #{te.performer.full_name} #{commas(te.actual_duration)} hours @ $#{commas(te.actual_activity_rate)}/hr - #{te.description}\"\n end\n else\n for ee in expense_entries\n activity+= \"\\n\\t\\t #{ee.expense_entry_date} #{ee.performer.full_name}- $#{commas(ee.final_expense_amount)} - #{ee.description}\"\n end\n end\n when 'Date'\n time_entries, expense_entries = consolidated_by_date(self, id.entry_type, id.tne_entry_date)\n if id.entry_type == 'Time'\n for te in time_entries\n\t\t\t actual_duration = company.duration_setting.setting_value == \"1/100th\" ? one_hundredth_timediffernce(te.actual_duration) : one_tenth_timediffernce(te.actual_duration)\n activity+= \"\\n\\t\\t #{te.acty_type.alvalue} #{te.performer.full_name} #{commas(te.actual_duration)} hours @ $#{commas(te.actual_activity_rate)}/hr - #{te.description}\"\n end\n else\n for ee in expense_entries\n activity+= \"\\n\\t\\t #{ee.expense.alvalue} #{ee.performer.full_name}- $#{commas(ee.final_expense_amount)} - #{ee.description}\"\n end\n end\n end\n end\n actual_duration = company.duration_setting.setting_value == \"1/100th\" ? one_hundredth_timediffernce(id.duration) : one_tenth_timediffernce(id.duration)\n if id.entry_type\n [\n activity,\n commas(id.rate),\n actual_duration.blank? ? '' : actual_duration,\n commas(id.amount)\n ]\n end\n end\n return [primary_contact,p_tax,s_tax,n_total,invoice_details]\n end",
"def get_invoice_details\n if self.bill_type == 'debit'\n\n # Set up paypal client\n @api = PayPal::SDK::Invoice::API.new(\n :mode => \"sandbox\",\n :app_id => ENV['APP_ID'],\n :username => ENV['USERNAME'],\n :password => ENV['PASSWORD'],\n :signature => ENV['SIGNATURE'])\n\n # Build request object\n @get_invoice_details = @api.build_get_invoice_details({\n :invoiceID => self.paypal_id })\n\n # Make API call & get response\n @get_invoice_details_response = @api.get_invoice_details(@get_invoice_details)\n\n # Access Response\n if @get_invoice_details_response.success?\n if @get_invoice_details_response.paymentDetails.paypalPayment.amount == self.amount * (-1)\n self.update_attribute(:satisfied?, true)\n self.save\n # p @get_invoice_details_response\n # @get_invoice_details_response.invoice\n # @get_invoice_details_response.invoiceDetails\n # @get_invoice_details_response.refundDetails\n # @get_invoice_details_response.invoiceURL\n end\n else # no api response\n @get_invoice_details_response.error\n end\n end\n end",
"def rrp_exc_sales_tax\n price_get(1).try(:price_amount)\n end",
"def get_pending_fee_details_for_student\n fees = get_pending_fees(@student)\n if @amount_type == \"each-fee\"\n payment_details = get_fee_detail_hash(fees,@student,@amount_type)\n payment_details = payment_details.sort_by{|x| x[\"due_date\"]} \n elsif @amount_type == \"all-fee\"\n payment_details = get_fee_detail_hash(fees,@student,@amount_type)\n end\n return payment_details\n end",
"def capital_expenditure_for_month(month_val=nil,year=nil)\n calc_for_financial_data_display\n find_dashboard_portfolio_display\n month= @financial_month\n year = Date.today.prev_month.year if year.nil?\n year = find_selected_year(year)\n cur_month = @end_date ? @end_date : params[:start_date]\n #~ month=1\n pci = @note.try(:class).eql?(Portfolio) ? PropertyCapitalImprovement.find(:first,:conditions => [\"year=? and portfolio_id = ? and month < ?\",year,@note.id,Date.today.month],:select=>'month',:order => \"month desc\") : PropertyCapitalImprovement.find(:first,:conditions => [\"year=? and real_estate_property_id=? and month < ?\",year,@note.id,Date.today.month],:select=>'month',:order => \"month desc\")\n\n if params[:tl_month].blank? && params[:period] != '5' && params[:tl_period] != '5'\n month = pci.month if !pci.nil?\n end\n query = get_query_for_capital_improvement_executive(month,year)\n asset_details = PropertyCapitalImprovement.find_by_sql(query)\n if !asset_details.empty?\n @capital_improvement = {}\n @capital_percent = {}\n tot_a = 0\n tot_b = 0\n for asset in asset_details\n if !asset.Cate.nil? and [\"total tenant improvements\",\"total leasing commissions\",\"total building improvements\",\"total lease costs\", \"total net lease costs\",\"total loan costs\"].include?(asset.Cate.downcase.strip)\n @capital_improvement[asset.Cate.downcase.strip] = asset.act.to_f\n #~ tot_a = tot_a + asset.act.to_f if !asset.act.nil?\n #~ tot_b = tot_b + asset.bud.to_f if !asset.bud.nil?\n elsif !asset.Cate.nil? and asset.Cate.downcase.strip==\"total capital expenditures\"\n tot_a=asset.act.to_f if !asset.act.nil?\n tot_b=asset.bud.to_f if !asset.bud.nil?\n end\n end\n for asset in asset_details\n if !asset.Cate.nil? and [\"total tenant improvements\",\"total leasing commissions\",\"total building improvements\",\"total lease costs\", \"total net lease costs\",\"total loan costs\"].include?(asset.Cate.downcase.strip)\n @capital_percent[asset.Cate.downcase.strip] =((@capital_improvement[asset.Cate.downcase.strip]*100)/tot_a)\n end\n end\n diff = tot_b - tot_a\n diff_per = tot_b != 0.0 ? (diff * 100)/tot_b : 0\n if diff_per == 0\n diff_per = 0\n elsif diff_per.nan?\n diff_per = 0\n end\n @captial_diff={:diff => diff.abs,:tot_budget => tot_b,:diff_percent => diff_per,:style => (tot_b >= tot_a ) ? \"greenrow\" : \"redrow\",:tot_actual => tot_a,:diff_word => (tot_b > tot_a ) ? \"below\" : \"above\",:tot_budget => tot_b}\n end\n end",
"def sales_by_invoice\n end",
"def debt_service\n property.net_operating_income / debt_payment\n end",
"def state_fulfillment_fee\n adjustments.eligible.where(:label => 'Additional State Fulfillment Fee').first.amount rescue 0.0\n end",
"def compound_return(periods,present_value,future_value)\n pv = present_value.to_d\n fv = future_value.to_d\n n = periods.to_d\n rate = ((fv / pv)**(1/n))-1\n end",
"def price_check(contract_id, liquidity_param, quant, choice)\n #pull in relevant contract row\n contract_row = Contract.where({ :id => contract_id }).at(0)\n \n #for classical contracts do the following:\n #need to update to account for yes vs no\n if contract_row.category == \"Classical\"\n if choice == \"yes\"\n #set contract contribution sum from before purchase to 0 to start\n contract_contribution_sum_pre = 0\n\n #calculate contract contribution sum total from before purchase\n contract_row.market.contracts.each do |contract_calc|\n contract_contibution = Math.exp((contract_calc.quantity_a.to_f / liquidity_param))\n contract_contribution_sum_pre = contract_contribution_sum_pre + contract_contibution\n end\n #calculate cost function for # of original outstanding shares\n cost_function_pre = liquidity_param * Math.log(contract_contribution_sum_pre)\n\n #set contract contribution sum from after purchase to 0\n contract_contribution_sum_post = 0\n #calculate contract contribution sum from after purchase for all contract except for the relevant contract\n contract_row.market.contracts.where.not({ :id => contract_id }).each do |contract_calc|\n contract_contibution = Math.exp((contract_calc.quantity_a.to_f / liquidity_param))\n contract_contribution_sum_post = contract_contribution_sum_post + contract_contibution\n end\n\n #add quantity user wants to purchase to the quantity for contract that user wants to purchase\n contract_contribution_sum_post = contract_contribution_sum_post + Math.exp(((contract_row.quantity_a.to_f + quant.to_f) / liquidity_param))\n\n #calculate cost function for desired # of new outstanding shares\n\n cost_function_post = liquidity_param * Math.log(contract_contribution_sum_post)\n\n #calculate pricefor purchase by subtracting the cost function post by the cost function pre\n price = (cost_function_post - cost_function_pre).ceil(2)\n\n return price\n \n #set price equal to 1-price of yes if choice is no\n #needs to be fixed so that cannot make infinite money\n elsif choice == \"no\"\n total_price = 0\n contract_row.market.contracts.where.not({ :id => contract_row.id }).each do |calculate_price|\n total_price = total_price + price_check(calculate_price.id, liquidity_param, quant, \"yes\")\n end\n\n price = total_price.ceil(2)\n\n return price\n\n end\n \n\n\n #for Independent contracts do the following:\n elsif contract_row.category == \"Independent\"\n #calculate contract contribution sum total from before purchase\n cost_function_pre = liquidity_param * Math.log((Math.exp((contract_row.quantity_a.to_f / liquidity_param)) + Math.exp((contract_row.quantity_b.to_f / liquidity_param))))\n \n if choice == \"yes\"\n cost_function_post = liquidity_param * Math.log((Math.exp(((contract_row.quantity_a.to_f + quant.to_f)/ liquidity_param)) + Math.exp((contract_row.quantity_b.to_f / liquidity_param))))\n elsif choice == \"no\"\n cost_function_post = liquidity_param * Math.log((Math.exp(((contract_row.quantity_a.to_f)/ liquidity_param)) + Math.exp(((contract_row.quantity_b.to_f + quant.to_f) / liquidity_param))))\n end\n price = (cost_function_post - cost_function_pre).ceil(2)\n return price\n end\n\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=begin Only one who may not have permissions to view financial statements is accountant. If he does not have 'can see finances', 'invoices manage' and 'manage payments' permissions to read he cannot view financial statements. In any other case everyone can view treyr user's invoices, credit notes and payments. =end
|
def can_view_financial_statements?
if accountant? and (not current_user.accountant_allow_read('can_see_finances') or not current_user.accountant_allow_read('payments_manage') or not current_user.acoutnant_alllow_read('invoices_manage'))
return false
else
return true
end
end
|
[
"def can_view_financial_statements?\n if current_user.is_accountant? and (not current_user.accountant_allow_read('can_see_finances') or not current_user.accountant_allow_read('payments_manage') or not current_user.acoutnant_alllow_read('invoices_manage'))\n return false\n else\n return true\n end\n end",
"def can_view_finances?\n current_user and ((current_user.is_admin? or current_user.is_reseller? or (current_user.is_accountant? and current_user.accountant_allow_read('see_financial_data') and current_user.accountant_allow_read('invoices_manage'))))\n end",
"def can_see_finances?\n accountant_allow_read('see_financial_data')\n end",
"def authorize_fraud\n unless (@fraud.investigator == current_user.id || current_user.role_title == \"company_admin\")\n flash[:alert] = \"Access restricted\"\n redirect_to frauds_path\n end\n end",
"def restrict_edit_by_account\n redirect_to challenges_path, :alert => 'You do not have access to this page.' unless @challenge.account == current_user.accountid || current_user.sys_admin?\n end",
"def ensure_is_authorized_to_view\n @is_member_of_company = (@relation == :company_admin_own_site || @relation == :company_employee || @relation == :rentog_admin_own_site)\n\n # ALLOWED\n return if @relation == :rentog_admin ||\n @relation == :rentog_admin_own_site ||\n @relation == :domain_supervisor ||\n @relation == :company_admin_own_site\n\n\n # NOT ALLOWED\n # with error message\n flash[:error] = t(\"listing_events.you_have_to_be_company_member\")\n redirect_to root\n return false\n end",
"def can_view_credit_notes?\n if current_user.is_admin? or current_user.is_reseller? or (current_user.is_accountant? and current_user.accountant_allow_read('invoices_manage'))\n true\n else\n dont_be_so_smart\n redirect_to :controller => \"callc\", :action => \"main\" and return false\n end\n end",
"def check_to_exclude_accounts\n errors.add(:base, 'This is a special account and it is not possible to continue. Please contact to administrator.') if observed.is_a?(User) && [User.support_id, User.main_admin_id].include?(observed.id)\n end",
"def special_access_for_cfo_or_treasurer?(state)\n (current_user.cfo? && state == 'approval') ||\n (current_user.treasurer? && ['execution', 'executed'].include?(state)) ||\n (cfo_as_treasurer? && ['approval', 'execution', 'executed'].include?(state))\n end",
"def myincome?\n unless current_user.admin? || (Income.find_by(user_id: current_user.id).id == @income.id)\n redirect_to root_path \n end \nend",
"def authorize_auditees_skip_company_admin\n\t if(!@audit.auditees.map(&:id).include?(current_user.id) && current_user.role_title != \"company_admin\")\n\t flash[:alert] = \"Access restricted\"\n\t \t\tredirect_to audits_path\n\t \tend\n\tend",
"def accountant_allow_edit(permission)\n return accountant_right(permission) == 2\n end",
"def can_edit_financial_data?\n if can_edit_finances?\n true\n else\n dont_be_so_smart\n redirect_to :controller => \"callc\", :action => \"main\" and return false\n end\n end",
"def restriction_in_words\n if access_level == 'creator'\n \"You are the only one who can see this note.\"\n elsif access_level == 'unit'\n \"Only #{user.units.collect(&:name).join(\" and \") rescue 'your program unit'} staff can see this note.\"\n else\n \"Any EXPO user can see this note.\"\n end\n end",
"def deny\n self.granted = -1\n restaurant = Restaurant.find(self.restaurant_id)\n restaurant.mark_collaborative\n end",
"def show_accounting_for_loan\n @accounting_book = @loan.accounting_book\n @accounting_entries = @accounting_book.accounting_entries\n\n authorize Loan\n end",
"def authorize_auditor\n\t \tunless (@audit.auditor == current_user.id || current_user.role_title == \"company_admin\")\n flash[:alert] = \"Access restricted\"\n\t \t\tredirect_to audits_path\n\t \tend\n end",
"def restriction_in_words\n if access_level == 'creator'\n \"You are the only one who can see this note.\"\n # elsif access_level == 'unit'\n # \"Only #{user.units.collect(&:name).join(\" and \") rescue 'your program unit'} staff can see this note.\"\n else\n \"Any DreamSIS user can see this note.\"\n end\n end",
"def check_if_user_access_transactions\n if current_user && current_user.admin?\n @transactions = Transaction.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Argument: integer, num Side effects: None Return: String. Alterating 1's and 0's. A total of num 1's and 0's Edge cases: i/p: 0 Algorithm: str = '' Do the folllowing num times to index = 1, 2, 3, ..., num if index is odd str << '1' otherwise str << '0' Return str
|
def stringy(num)
str = ''
1.upto(num) do |index|
if index.odd?
str << '1'
else
str << '0'
end
end
str
end
|
[
"def stringy(num)\n res = ''\n (1..num).each { |current| current.odd? ? res << '1' : res << '0' }\n res\nend",
"def stringy(int)\n string = []\n count = int\n\n count.times do\n if \n string.size.odd? \n string.push(0)\n else \n string.push(1)\n end\n end\n string.join\nend",
"def stringy(num, start='1')\n (1..num).map { |idx| idx.odd? ? start : (start == '1' ? '0' : '1') }.join\nend",
"def stringy(input)\n string = ''\n for i in 0..input-1\n if i.even?\n string[i] = '1'\n else\n string[i] = '0'\n end\n end\n string\nend",
"def stringy(num)\n string = ''\n num.times { string[-1] == '1' ? string << '0' : string << '1' }\n string\nend",
"def stringy(integer)\n ones_and_zeroes = []\n\n integer.times do |index|\n number = index.even? ? 1 : 0\n ones_and_zeroes << number\n end\n\n ones_and_zeroes.join\nend",
"def stringy(number, first_number = 1)\n text = \"\"\n (1..number).each do |num|\n if first_number == 1\n num.odd? ? text += 1.to_s : text += 0.to_s\n else\n num.odd? ? text += 0.to_s : text += 1.to_s\n end\n end\n text\nend",
"def stringy2(int, *zero)\n str = ''\n if zero == [0] then str += '0' else str += '1' end\n int.times do |n|\n if n > 0\n array = str.chars\n if array[n - 1] == '0' then str += '1' else str += '0' end\n end\n end\n p str\nend",
"def string(input_integer)\n output_array = []\n\n input_integer.times do |index|\n index.even? ? output_array << '1' : output_array << '0'\n end\n\n output_array.join\nend",
"def stringy(i)\n array = []\n i.times { array.last == 1 ? array << 0 : array << 1 }\n array.join\nend",
"def stringy(num, start)\n result = ''\n num.times do |_|\n result << start\n start = start == '1' ? '0' : '1'\n end\n result\nend",
"def stringy(integer, zero_or_one='1')\n str = ''\n integer.times do |ctr|\n ctr += 1 if zero_or_one == '0'\n ctr % 2 == 0 ? str << '1' : str << '0'\n end\n str\nend",
"def stringy(input, opt=1)\n string = \"\"\n if opt == 0\n input.times do |i|\n i.odd? ? string << \"1\" : string << \"0\"\n end\n else\n input.times do |i|\n i.odd? ? string << \"0\" : string << \"1\"\n end\n end\nputs string\n\nend",
"def stringy2(number, start_with=1)\n start_with == 0 ? shift = 1 : shift = 0\n string = \"\"\n number.times do |index|\n string << ((index+shift).even? ? \"1\" : \"0\")\n end\n string\nend",
"def stringy(int)\n stringy = \"\"\n odd = false\n int.times do\n if odd == true\n stringy << \"0\"\n odd = false\n else \n stringy << \"1\"\n odd = true\n end\n end\n return stringy\nend",
"def stringy(int)\n\ncounter = int\narr = []\n\n while counter > 0\n if !arr.empty? && counter % 2 ==0\n arr << 0\n elsif counter % 2 !=0 && arr.last != 1 || arr.empty?\n arr << 1\n else\n next\n end\n counter -= 1\n end\n arr.join()\nend",
"def stringy(integer)\n string = ''\n count = 1\n \n while count <= integer\n # count.odd? ? string += '1' : string += '0'\n string += count.odd? ? '1' : '0'\n count += 1\n end\n \n string\nend",
"def stringy(number, start_with = 1)\n if start_with != 1 && start_with != 0\n puts 'Invalid value for start. Only 1 and 0 allowed'\n return\n end\n\n number_string = start_with.to_s\n iterations = number - 1\n\n iterations.times do |previous_number|\n number_string[previous_number] == '1' ? number_string << '0' : number_string << '1'\n end\n\n number_string\nend",
"def stringy(num)\n string = '10' * (num/2)\n num.even? ? string : string + '1'\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
returns htmls of kiwix answer searches
|
def kiwixAnswerSearch(aA, aB, aC, aD)
htmls = []
begin
address1 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aA) + '.html'
rescue
puts "address1 not encoded"
end
begin
address2 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aB) + '.html'
rescue
puts "address1 not encoded"
end
begin
address3 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aC) + '.html'
rescue
puts "address1 not encoded"
end
begin
address4 ='http://127.0.0.1:8000/wikipedia_en_all_nopic_01_2012/A/' + URI::encode(aD) + '.html'
rescue
puts "address1 not encoded"
end
begin
htmls << HTTParty.get(address1)
rescue
puts "address1 not gotten"
end
begin
htmls << HTTParty.get(address2)
rescue
puts "address2 not gotten"
end
begin
htmls << HTTParty.get(address3)
rescue
puts "address3 not gotten"
end
begin
htmls << HTTParty.get(address4)
rescue
puts "address4 not gotten"
end
end
|
[
"def answer_html\n return '' if answer.nil? || answer.strip.empty?\n \n doc = Document.new(answer)\n question_form_answers = doc.root\n \n html = ''\n question_form_answers.each_element { |answer| html += as_answer(answer) }\n return html\n end",
"def search\n @uurl = params[:uurl]\n searchexpr = params[:searchexpr]\n @hpexpr = 'hpricot_object.search(' + '\"' + searchexpr + '\"' + ').to_html'\n hpricot_object = get_my_hp_elem(@uurl)\n @myhtml = hpricot_object.search(searchexpr).to_html\n render(:layout => \"nada\", :action => \"demoout\")\n end",
"def as_answer(answer)\n html = '<div class=\"quest\">'\n \n # The name of the group\n html += \"<h3>Question: #{answer.elements['QuestionIdentifier'].text}</h3>\"\n \n # The results\n html += '<div class=\"res\">'\n \n # - Selections\n sel = []\n answer.each_element('SelectionIdentifier') { |el| sel << el.text }\n html += \"<div class=\\\"selection\\\">#{sel.join(', ')}</div>\" if sel.size > 0\n \n # - Free text\n answer.each_element('FreeText') { |el| html += \"<div class=\\\"freetext\\\">#{el.text}</div>\" }\n \n # - Other text\n answer.each_element('OtherSelectionText') { |el| html += \"<div class=\\\"other\\\">#{el.text}</div>\" }\n\n html += '</div>'\n \n return html + '</div>'\n end",
"def getsearchresults\n query=params['q'].gsub(' ','+')\n query=query.gsub('/','%2F')\n if params[:site]=='metacritic'\n doc=Nokogiri::HTML(open(\"http://metacritic.com/search/game/#{query}/results\"))\n doc.encoding='utf-8'\n @results=doc.css(\"li.result\").inner_html\n elsif params[:site]=='gamerankings'\n doc=Nokogiri::HTML(open(\"http://www.gamerankings.com/browse.html?search=#{query}&numrev=3\"))\n @results=doc.at_css(\"div#main_col > div.pod\").inner_html\n end\n respond_to do |format|\n format.js {render :layout => false}\n end\n end",
"def search_help(q)\n url = @search_help_endpoint + URI.encode_www_form( { q: q } )\n response = nil\n begin\n timed_out = Timeout::timeout(@timeout) do\n puts \"uBio: #{url}\" if @debug\n response = Net::HTTP.get_response(URI.parse(uri))\n end\n rescue Timeout::Error, Errno::ECONNRESET\n raise Timeout::Error, \"uBio didn't respond within #{timeout} seconds.\"\n end\n Nokogiri::HTML(response.body)\n end",
"def question_html\n Qualification.question_html_ext(testXML)\n end",
"def japanese\n puts \"Let's explore Japanese whiskies\"\n #call method to list whiskies for this particular type\n whisky_list('c/35/japanese-whisky?filter=true&rfdata=~size.76#productlist-filter')\n end",
"def search_kickass(search_term)\n white_space = '%20'\n baseurl = KickassParser::Parser::BASEURL\n kickass_url = baseurl + '/usearch/'\n url = kickass_url + search_term.gsub(' ', white_space)\n\n begin\n page = Agent.get_web_page(url)\n KickassParser.new(page).main_divs\n rescue\n []\n end\n end",
"def ask_search(squery, verbose=true)\n if verbose\n $config['HTTP']['PROGRESS'] = true\n end\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Searching via Ask....\".white if verbose\n ask=[]\n goodlinks=[]\n usablelinks=[]\n # Build our array of page requests links\n (0 .. 30).each { |x| ask << \"http://www.ask.com/web?q=#{squery}&page=#{x}\" }\n # Curl's Multi::Mode for faster requests\n mresponses = @http.multi_get(ask)\n ask.each do |url|\n page = Nokogiri::HTML(mresponses[url].body_str)\n possibles = page.css(\"a\")\n possibles.select do |link|\n begin\n\t url = URI.parse(link['href'])\n\t if url.scheme == 'http' || url.scheme =='https'\n\t usablelinks << link['href']\n\t end\n\trescue URI::InvalidURIError => err \n\t # If bad link cause error cause its not a link dont freak out, just move on....\n\tend\n end\n end\n usablelinks = usablelinks.uniq\n usablelinks.each do |url|\n goodlinks << url unless url =~ @bad_regex\n end\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Unique Links: #{goodlinks.length}\".white if verbose\n f=File.open(\"#{@@out}ask.search\", 'w+')\n goodlinks.each { |x| f.puts x }\n f.close\n if verbose\n $config['HTTP']['PROGRESS'] = false\n end\n return goodlinks\n end",
"def japanese\n puts \"Let's explore the whiskies of Japan\"\n #call method to list whiskies for this particular type\n list_whiskies('c/35/japanese-whisky?filter=true&rfdata=~size.76#productlist-filter')\n end",
"def search\n @answers = Answer.search(@q, :per_page => 10, :page => params[:page] || 1, :index => 'answers', :match_mode => :boolean)\n\n render :partial => 'search_list' and return if request.xhr?\n end",
"def search_wikipedia\n respond_to do |format|\n format.html do\n @wikipedia_search_text = params[:artist_name]\n meta = MetaGeneration.new(Setting.get_settings)\n @wikipedia_search = meta.search_text(@wikipedia_search_text, 10)\n render 'search_wikipedia.html', layout: false\n end\n end\n end",
"def scrape_wiki_list_for_honorifics(url)\n noko = noko_for(url)\n honorifics = []\n thai_id=\".E0.B8.81.E0.B8.B2.E0.B8.A3.E0.B9.81.E0.B8.95.E0.B9.88.E0.B8.87.E0.B8.95.E0.B8.B1.E0.B9.89.E0.B8.87.E0.B8.A3.E0.B8.AD.E0.B8.9A.E0.B9.81.E0.B8.A3.E0.B8.81\"\n noko.xpath(\"//h3[span[@id=\\\"#{thai_id}\\\"]]/following-sibling::table[1]//ol/li[a]\").each do |li|\n honorifics << li.xpath('./text()[not(preceding-sibling::a)]').text().tidy\n # we're ignoring name because we get them from the Senate's own site,\n # but in case you want it: name = li.css('a[1]')a.text :-)\n end\n return honorifics.uniq!.sort_by!{|x| x.length}.reverse\nend",
"def whisky_list(url)\n @whiskies = WhiskyPicker::WhiskyScraper.scrape_index(BASEPATH + url) #array\n #display list of whiskies\n @whiskies.each_with_index do |whisky, index|\n puts \"#{index+1}. #{whisky.name}\"\n end\n end",
"def get_search_html(url)\n # fetch html for base page\n doc = open(url).read()\n\n # fetch next result pages\n row = 101\n nextdoc = doc\n while nextdoc.include?('see next results')\n nextdoc = open(url + '&p_start_row=' + row.to_s()).read()\n doc += nextdoc\n row += 100\n end\n return doc\nend",
"def scrape_index path, **opts\n\t\t\t# This is a magic string that targets the index format /r/teslore uses to\n\t\t\t# enumerate their Compendium, in the wiki page and weekly patch posts.\n\t\t\tquery = opts[:css] || \"td:first-child a\"\n\t\t\t# Reddit will respond with an HTML dump, if we are querying a wiki page,\n\t\t\t# or a wrapped HTML dump, if we are querying a post.\n\t\t\tfetch = @client.get(path).body\n\t\t\t# Set fetch to be an array of hashes which have the desired text as a\n\t\t\t# direct child.\n\t\t\tif fetch[:kind] == \"wikipage\"\n\t\t\t\tfetch = [fetch[:data]]\n\t\t\telsif fetch[:kind] == \"Listing\"\n\t\t\t\tfetch = fetch[:data][:children].map { |c| c[:data] }\n\t\t\tend\n\t\t\t# reddit will put the text data in :content_html if we queried a wikipage,\n\t\t\t# or :selftext_html if we queried a post. The two keys are mutually\n\t\t\t# exclusive, so this simply looks for both and remaps fetch items to point\n\t\t\t# to the actual data.\n\t\t\t[:content_html, :selftext_html].each do |k|\n\t\t\t\tfetch.map! do |item|\n\t\t\t\t\tif item.respond_to?(:has_key?) && item.has_key?(k)\n\t\t\t\t\t\titem[k]\n\t\t\t\t\telse\n\t\t\t\t\t\titem\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\t\t# Ruby doesn't like having comments between each successive map block.\n\t\t\t# This sequence performs the following transformations on each entry in\n\t\t\t# the fetched list.\n\t\t\t# 1. Unescape the HTML text.\n\t\t\t# 2. Process the HTML text into data structures.\n\t\t\t# 3. Run CSS queries on the data structures to find the links sought.\n\t\t\t# 4. Unwrap the link elements to get the URI at which they point.\n\t\t\t# 5. In the event that multiple pages were queried to get data, the array\n\t\t\t# that each of those queries returns is flattened so that this method only\n\t\t\t# returns one single array of link URIs.\n\t\t\tfetch.map do |item|\n\t\t\t\t@html_filter.decode(item)\n\t\t\tend\n\t\t\t.map do |item|\n\t\t\t\tNokogiri::HTML(item)\n\t\t\tend\n\t\t\t.map do |item|\n\t\t\t\titem.css(query).map do |item|\n\t\t\t\t\titem.attributes[\"href\"].value\n\t\t\t\tend\n\t\t\tend\n\t\t\t.flatten\n\t\tend",
"def results\n results_html.map do |result_html|\n KindleUnlimitedEbookResult.new(result_html)\n end\n end",
"def render_multiple_choice(q,index)\n # q.text => string of question text exactly as it appears in RuQL file\n # q.answers => iterable of Answer instances\n # answer.correct? => boolean\n # answer.answer_text => text of answer\n # answer.has_explanation? => does this answer (right or wrong) have its own hint/explan?\n # answer.explanation => answer-specific hint/explanation\n # q.raw? => if :raw => true was specified in RuQL, ie question may contain html markup\n # q.tags => iterable of any tags associated w/question\n # q.group => if non-nil, question's group (intended for \"question pool\" functionality,\n # which not all formatters might support)\n #\n # Do something to add quetsion to @output, or write to a file/STDOUT, or whatever\n end",
"def whisky_list(whisky_url)\n #scrape and create whisky hashes for all selected whiskies using urls\n @whiskies = WhiskyPicker::Whiskyscraper.scrape_index_page(BASE_PATH + whisky_url)\n #display list of whiskies\n @whiskies.each_with_index do |whisky, index|\n puts \"#{index+1}. #{whisky.name}\"\n end\n # menu\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
returns list of uris from a google search
|
def googleSearch(q, n = 5)
search = Google::Search::Web.new do |search|
search.query = q
search.size = :small
end
begin
uris = search.first(n).map(&:uri)
rescue
"uri fault"
end
return uris
end
|
[
"def get_urls(search_results)\n # A Google search_result looks like:\n # <a href=\"/url?q=https://www.scienceexchange.com/\">Science Exchange<b>...</b></a>\n # To get the actual page URL, use the 'href' and get the query param 'q' term.\n urls = []\n search_results.each do |result|\n url = result['href']\n query = URI.parse(url).query\n result_url = CGI.parse(query)['q'].first\n result_url = url if result_url.nil?\n urls << result_url\n end\n return urls\n end",
"def get_urls( search_url )\n urls = []\n result_json = parse_json( search_url )\n result_json['items'].each do |item|\n urls << item['url']\n end\n\n return urls\nend",
"def external_search_urls\n {\n Google_Maps: \"https://maps.google.com/maps?q=\",\n Google_Search: \"https://www.google.com/search?q=\",\n Wikipedia: \"https://en.wikipedia.org/w/index.php?search=\"\n }.freeze\n end",
"def scan(kw, count)\n lookups = count / 10\n\n if kw.nil? or kw.empty? then\n kw = \"cats\"\n end\n\n @search = \"http://google.com/search?q=#{kw}\"\n\n a = WWW::Mechanize.new\n\n self.urllist = []\n \n lookups.times do |i|\n page = a.get(@search)\n\n hpage = Hpricot(page.body)\n\n @search = hpage.search(\"a[@class='pn']\").first.attributes[\"href\"]\n\n hpage.search(\"//li[@class='g']/h3/a\").each do |link|\n self.urllist << link.attributes[\"href\"]\n end\n\n end\n\n end",
"def google_search_url(presentation)\n url = \"https://www.google.com/search?&q=%22#{ google_safe(presentation.name) }%22\"\n url += \"+%22#{ google_safe(presentation.speakers.first.name) }%22\" if presentation.speakers.present?\n return url\n end",
"def google_search(squery, verbose=true)\n goodlinks=[]\n usablelinks=[]\n puts \"[\".light_blue + \"*\".white + \"]\".light_blue + \" Searching via Google....\".white if verbose\n agent = Mechanize.new\n begin\n agent.user_agent = $config['HTTP']['HTTP_USER_AGENT']\n if $config['HTTP']['PROXY']\n if $config['HTTP']['PROXY_AUTH']\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i, user=$config['HTTP']['PROXY_USER'], pass=$config['HTTP']['PROXY_PASS'])\n else\n agent.set_proxy($config['HTTP']['PROXY_IP'], $config['HTTP']['PROXY_PORT'].to_i)\n end\n end\n\n page = agent.get('http://www.google.com/') # Google main search page\n search_form = page.form(page.forms.first.name) # Grab the first & only form on page\n search_form.q = squery.gsub(' ', '%20') # Set our Search Query or Dork value\n # Submit form and create new Page object\n page = agent.submit(search_form, search_form.buttons.first)\n\n page.links.each do |link|\n # Filter out a bunch of noise & junk links with regex\n usablelinks << link.href unless link.href.nil? or link.href =~ @bad_regex\n end\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Getting Google Results!\\n\\t=>#{e}\\n\") if verbose\n end\n\n # Next we loop through additional pages to get more results\n count=1\n z=['|','\\\\','/','*','-']\n (1..14).each do |x|\n begin\n page = agent.page.link_with(:text => \"Next\").click # We need find the \"NEXT\" link & click it!\n page.links.each do |link|\n print \"\\r [\".light_blue + \"#{z[rand(z.size)]}\".white + \"] Scraping\".light_blue + \"...\".white\n usablelinks << link.href unless link.href.nil? or link.href =~ @bad_regex\n end\n count += 1\n sleep(1)\n rescue OpenSSL::SSL::SSLError,Errno::ETIMEDOUT,Net::HTTP::Persistent::Error,NoMethodError,Zlib::DataError,Mechanize::ResponseCodeError => e\n print_error(\"Problem Getting Google Results!\\n\\t=>#{e}\\n\") if verbose\n end\n end\n print \"\\r [\".light_blue + \"*\".white + \"]\".light_blue + \" Results are in...\\n\".white\n goodlinks = usablelinks.uniq\n puts \" [\".light_green + \"+\".white + \"] \".light_green + \"Unique Links: #{goodlinks.length}\".white if verbose\n f=File.open(\"#{@@out}google.search\", 'w+')\n goodlinks.each { |x| f.puts x }\n f.close\n return goodlinks\n end",
"def search_google\n raw_results = SearchGoogle.new.search(strip_truncate_q)\n NormalizeGoogle.new.to_result(raw_results, strip_truncate_q)\n end",
"def search_google(targetdom)\n print_status(\"Searching Google for email addresses from #{targetdom}\")\n response = \"\"\n emails = []\n header = { 'User-Agent' => \"Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)\"}\n clnt = Net::HTTP::Proxy(@proxysrv,@proxyport,@proxyuser,@proxypass).new(\"www.google.com\")\n searches = [\"100\", \"200\",\"300\", \"400\", \"500\"]\n searches.each { |num|\n resp = clnt.get2(\"/search?hl=en&lr=&ie=UTF-8&q=%40\"+targetdom+\"&start=#{num}&sa=N&filter=0&num=100\",header)\n response << resp.body\n }\n print_status(\"Extracting emails from Google search results...\")\n response.gsub!(/<.?em?[>]*>/, \"\")\n response.scan(/[A-Z0-9._%+-]+@#{targetdom}/i) do |t|\n emails << t\n end\n return emails.uniq\n end",
"def get_listing_URLs_from_search_html(search_html)\r\n raise NotImplementedError\r\n end",
"def google(query)\n url = \"http://www.google.com/search?q=#{CGI.escape(query)}\"\n res = Nokogiri::HTML(open(url)).at(\"h3.r\")\n\n title = res.text\n link = res.at('a')[:href]\n desc = res.at(\"./following::div\").children.first.text \nrescue \n \"No results found\"\nelse\n CGI.unescape_html \"#{title} - #{desc} (#{link})\"\nend",
"def google_results(query,amount)\n\n\ts = Scrapah::Scraper.new :type => :headless\n\ts.start\n\n\ttasks = []\n\ttasks << 'https://www.google.com/search?q='+URI.encode(query)\n\tdiscovery = Proc.new {|d| d.css('td.b a').first['href']}\n\t\n\tresults = []\n\n\twhile(results.size < amount && !tasks.empty?)\n\t\tputs s.get tasks.shift\n\n\t\tputs tasks\n\t\tputs 'sdf'\n\n\t\ttasks << s.process(discovery)\n\t\tputs tasks\n\t\tputs 'blah'\n\t\ttasks.map!{|t| t='https://www.google.com'+t if t.start_with?('/')}\n\t\ttasks = tasks.uniq.flatten\n\tend\n\n\n\n\ts.stop\n\nend",
"def search_results\n GoogleSearchResults.instance\n end",
"def google\n\t\tsites=Wmap::GoogleSearchScraper.new.workers.keys\n\tend",
"def build_google_search_url\n\t'https://www.google.com/search?q='+ARGV.to_a.join('+')\nend",
"def product_url_search(query)\n products = []\n title = \"\"\n\n agent = Mechanize.new\n agent.open_timeout = 6\n agent.read_timeout = 6\n agent.user_agent_alias = 'Mac Safari'\n agent.get(URI.encode(query))\n\n if agent.page.is_a? Mechanize::Page\n base_uri = URI.parse(URI.encode(query))\n \n images = []\n\n #begin\n # og_image = agent.page.parser.at('meta[property=\"og:image\"]')\n # images << og_image['content'] if og_image\n #rescue\n # LoggedException.add(__FILE__,__method__,ex)\n #end\n \n images += agent.page.images.map do |img| \n begin\n img.src.match(/^http/) ? \n img.src : \n URI.decode(base_uri.merge(URI.encode(img.src)).to_s).\n gsub(\"¥\",\"\\\\\")\n rescue\n img.src ? img.src : ''\n end\n end\n\n title = agent.page.title\n else\n images = [query]\n end\n\n products = images.map do |image|\n product_search_hash(image,image,query,\"\",\"\")\n end\n rescue => ex\n LoggedException.add(__FILE__,__method__,ex)\n ensure\n return [title,products]\n end",
"def uris\n arr = []\n self.each_uri {|u| arr << u}\n arr\n end",
"def index\n @google_searches = GoogleSearch.all\n end",
"def process_urlquery\n\turls = Array.new\n\txdoc = Nokogiri::HTML(open('http://urlquery.net'))\n\txdoc.xpath('//table//a').each do |item|\n\t\tif item.to_s =~ /title\\=\\\"(.*)\\\" href=/\n\t\t\turl = $1\n\t\t\turls.push(url)\n\t\telse\n\t\t\tprint \"No match.\".red\n\t\t\tputs item.to_s.light_red\n\t\tend\n\tend\n\treturn urls\nend",
"def search\n agent = Mechanize.new do |a|\n a.user_agent_alias = \"Linux Firefox\"\n end\n\n gform = agent.get(\"http://google.com/images\").form(\"f\")\n gform.q = @word\n return agent.submit(gform, gform.buttons.first)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
iterably counts number of hits of each answer in a list of uris
|
def hitCount(uris, aA, aB, aC, aD)
hitCountStart = Time.now
aAll = []
aAll << aA << aB << aC << aD
countA = 0
countB = 0
countC = 0
countD = 0
aA = aA.downcase
aB = aB.downcase
aC = aC.downcase
aD = aD.downcase
aTotal = []
bTotal = []
cTotal = []
dTotal = []
plaintexts=[]
n = uris.size
n.times {|i|
if Time.now - hitCountStart < 8
begin
begin
doc = Nokogiri::HTML(open(uris[i]))
doc.css('script, link').each { |node| node.remove }
plaintexts << doc.css('body').text.downcase.split("\n"). collect { |line| line.strip }.join("\n")
rescue
puts "Nokogiri could not read"
end
#rescue
# "Nokogiri fault"
plaintexts[i].each_line { |bar|
begin
countA += bar.scan(/\b#{aA}\b/i).size
rescue
end
begin
countB += bar.scan(/\b#{aB}\b/i).size
rescue
end
begin
countC += bar.scan(/\b#{aC}\b/i).size
rescue
end
begin
countD += bar.scan(/\b#{aD}\b/i).size
rescue
end
}
puts "A = " + countA.to_s + " B = " + countB.to_s + " C = " + countC.to_s + " D = " + countD.to_s
end
end
}
end
|
[
"def answers_with_count\n count=Hash.new(0)\n self.list_answers.each {|a| count[a]+=1 }\n count\n end",
"def popular_links\n result = {}\n urls[0...5].each do |url|\n result[url] = url.num_clicks\n end\n result\n end",
"def count_replies(html)\n reply_count = { :rep => Hash.new(0), :img => Hash.new(0) }\n replies = html.scan(@opts.replies_pattern)\n replies.each do |r|\n reply_count[:rep][r[0]] += 1\n reply_count[:img][r[0]] += 1 if r[1]\n end\n reply_count\n end",
"def count\n hits.count\n end",
"def response_count\n sum = 0\n responses.each do |r|\n sum += 1\n sum += r.response_count\n end\n return sum\n end",
"def results_n_plus_one\n answer_choices.each_with_object(Hash.new(0)) do |choice, h|\n # n queries here for responses\n h[choice.text] = choice.responses.count\n end\n end",
"def compute_counts_from(html)\n text = clean_html(html)\n # snarf the count of total hits and hits on this page\n if text.match(/hits \\d+ through \\d+.\\s*out of (\\d+)/mi) {|m|\n @count = m[1].to_i\n @pages = (@count.to_f / 50.0).ceil.to_i\n }\n else # no forward citations\n @count = 0\n @pages = 0\n end\n \n PatentAgent.dlog \"Forward Citation\", \"for #{@parent} => Count: #{@count}: Pages: #{@pages}\"\n [@count, @pages]\n end",
"def collect_counts(hn_doc_name, hn_doc_text)\n COLLECTION_SETS.each_pair do |collection_set_name, set|\n HN_DATA[collection_set_name] = {} unless HN_DATA.has_key?(collection_set_name) # should inject instead of setting up beforehand\n HN_DATA[collection_set_name][hn_doc_name] = {} unless HN_DATA[collection_set_name].has_key?(hn_doc_name)\n set.each do |term|\n # have to extract with a non-alpha character on each side to match\n # terms like \"c\" and \"java\" vs \"javascript\"\n count = hn_doc_text.scan(/[^a-z]#{Regexp.escape(term)}[^a-z]/im).size\n HN_DATA[collection_set_name][hn_doc_name][term] = count\n end\n end\nend",
"def count_of_url_in_seo(input)\n\t \tNonAdwordUrl.where(url: input).count\n\t end",
"def num_hits; @hits.size; end",
"def urlhist(path)\n\t\tu = Hash.new(0)\n\t\tcnt = 0\n\t\tf=File.open(path)\n\t\tf.readlines.each do |line|\n\t\t\tpart = line.split(' ')\n\t\t\turl = part[6]\n\t\t\tu[url] = u[url] + 1\n\t\t\tcnt +=1\t\n\t\tend\n\t\tu.sort.each do |k, v|\n\t\t\tprint \"The frequency of #{k} | \"\n\t\t\twhile v > 0\n\t\t\t\tprint \"#\"\n\t\t\t\tv-=1\n\t\t\tend\n\t\tputs \"\\n\"\n\t\tend\n\t\t\n\tend",
"def get_uri_counts\n\n # Open database\n db = SQLite3::Database.open(\"test.db\")\n\n # Find all unique dates in database\n dates = find_dates(db)\n\n # Store results in hash\n results = {}\n \n # Iterate through each date to find count\n dates.each do |date|\n\n # Prepre a nested hash\n results[\"#{date}\"] = {}\n\n # Header for terminal\n puts \"On #{date}...\"\n\n # All uri's\n uris = %w[messages people textdata].map {|i| \"/api/v1/#{i}\"}\n\n # Find the count of each uri\n uris.each do |uri|\n db.execute(\"SELECT COUNT(*) FROM Access WHERE uri = \\\"#{uri}\\\" AND time LIKE \\\"#{date} __:__:__\\\"\") do |result|\n results[\"#{date}\"][\"#{uri}\"] = result[0]\n puts \"Total entries with uri = #{uri}: #{result}\"\n end\n end\n puts \"\\n\"\n end\n\n results\nend",
"def artist_count\n\t\t@music_collection.each do |track|\n\t\t\tentry = /(.*) \\-/.match(track)\n\t\t\tnext unless entry\n\t\t\t@artists << entry[1]\n\t\tend\n\t\t@artists.each do |artist| \n\t\t\t@counts[artist] += 1 \n\t\t\tend\n\t\t@counts\n\tend",
"def counts(n) \n count = Hash.new(0)\n a_hash = self.answers_hash\n answers = a_hash.values\n answers.each{ |ans| count[ans] += 1}\n count[n]\n end",
"def count\n search_results.values.collect(&:size).sum\n end",
"def count_links(html)\n\t\ta_counter = 0\n\t\tNokogiri::HTML(html).search(\"a\").each do |e|\n\t\t\tnext unless e.attribute(\"href\")\n\t\t\tif e.attribute(\"href\").content.include?(@website.base_url) || e.attribute(\"href\").content.start_with?(\"/\")\n\t\t\t\ta_counter+=1 \n\t\t\tend\n\t\tend\n\t\ta_counter\n\tend",
"def num_matches\n count = 0\n other_answers.each do |a|\n count += 1 if base_answer.food_groups == a.food_groups\n end\n count\n end",
"def hashtag_counts(hashtags, args={}, opts={})\n return [] unless (hashtags && hashtags.length > 0)\n # NOTE: currently not used. offering same api as topic_counts\n args ||= {}\n hashtags = [hashtags].flatten\n # init a mapping from request argument to a normalized version\n # {\"abc\": \"#Abc\"}\n hashtags_args_map = {}\n # map normalized version to original argument\n hashtags.each_with_index do |htag, idx|\n ntag = normalize_hashtag(htag)\n hashtags_args_map[ntag] = htag\n hashtags[idx] = ntag\n end\n\n # initialize return structure\n # key: hashtag (as requested by caller i.e. \"#abc\")\n # value: {\"name\": \"#ABC\", \"count\": 123}\n # {\"#abc\" => {\"name\": \"#ABC\", \"count\": 123}}\n counts_arr = []\n\n # TODO API enforces times \"line up evenly on 300 second intervals\"\n # valid: 13:00:00, 13:05:00, 13:10:00, ...\n # do anything to the args?\n start_ts = args[:mentions_since] && args[:mentions_since].to_i\n end_ts = args[:mentions_until] && args[:mentions_until].to_i\n\n # NOTE: lib currently encodes array values into comma separated strings\n # however, this api endpoint needs arg \"hashtags[]\" in url query string\n # including here as part of the path with time args being included in params arg\n # (added to query string by library)\n params = {\n \"since\" => start_ts.to_s,\n \"until\" => end_ts.to_s\n }\n\n # url encode each argument as part of query string params\n hashtags_query_str = hashtags.map do |arg|\n \"hashtags[]=#{CGI::escape(arg)}\"\n end.join('&')\n\n # make request for hashtag counts\n # block is called with response object that would have been returned by `get_object` call\n get_object(\"hashtag_counts?#{hashtags_query_str}\", params, opts) do |hashtags_res|\n # iterate response Array\n # [{\"count\"=>\"2147\", \"hashtag\"=>{\"id\"=>\"351255261652168\", \"name\"=>\"#MLB\"}}, ...]\n hashtags_res.each do |hashtag_doc|\n # get hashtag label as returned by API\n htag_name = (hashtag_doc['hashtag'] && hashtag_doc['hashtag']['name']).to_s\n # normalize returned hashtag and map it back to requested hashtag\n htag = hashtags_args_map[normalize_hashtag(htag_name)]\n # add to return structure\n counts_arr << {\n \"query\" => htag,\n \"name\" => htag_name,\n \"count\" => hashtag_doc['count'].to_i,\n \"breakdown_by\" => []\n }\n # entity_id = (hashtag_doc['hashtag'] && hashtag_doc['hashtag']['id']).to_s\n # if entity_id.length > 0\n # doc[\"id\"] = Base64.encode64(\"topic_#{entity_id}\").chomp\n # end\n end\n end\n\n counts_arr\n end",
"def results\n results_count = Hash.new(0)\n\n joins_sql = <<-SQL\n LEFT OUTER JOIN\n responses\n ON\n responses.answer_choice_id = answer_choices.id\n SQL\n\n responses = self.answer_choices\n .select(\"answer_choices.*, COUNT(responses.id) AS answer_count\")\n .joins(joins_sql)\n .group(\"answer_choices.id\")\n\n responses.each do |response|\n results_count[response.text] = response.answer_count\n end\n results_count\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
verifica se ha um medico na equipe
|
def is_medico_membro(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_medico = false
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'medico'
val_is_medico = true
end
end
val_is_medico
end
|
[
"def is_medico_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n count_medicos = 0\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n count_medicos += 1\n elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and\n Pessoa.find(membros[i]).rank.downcase != 'jounin'\n return false\n end\n end\n\n ((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico'))\n end",
"def mile_scandinavian? = unit == 'mile-scandinavian'",
"def earth_mass? = unit == 'earth-mass'",
"def es_medidor_de_energia_reactiva\n \tmedidor_id = MedidorEstadoMedidor.where(estado_medidor_id: self.id).take.medidor_id\n medidor = Medidor.find(medidor_id)\n return medidor.tipo_medidor.codigo == 2\n end",
"def centiliter? = unit == 'centiliter'",
"def is_molar_quantity?\n denominator_quantities == [:amount_of_substance]\n end",
"def megahertz? = unit == 'megahertz'",
"def megawatt? = unit == 'megawatt'",
"def solar_mass? = unit == 'solar-mass'",
"def mile? = unit == 'mile'",
"def is_specific_quantity?\n denominator_quantities == [:mass]\n end",
"def megabit? = unit == 'megabit'",
"def cubic_mile? = unit == 'cubic-mile'",
"def square_mile? = unit == 'square-mile'",
"def centimeter? = unit == 'centimeter'",
"def nautical_mile? = unit == 'nautical-mile'",
"def multi?\n return number_of(\"MSH\")>1\n end",
"def kilojoule? = unit == 'kilojoule'",
"def decimeter? = unit == 'decimeter'"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
verifica se a equipe e uma equipe com 3 medicos e um Chunnin ou Jounin
|
def is_medico_equipe(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
count_medicos = 0
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'medico'
count_medicos += 1
elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and
Pessoa.find(membros[i]).rank.downcase != 'jounin'
return false
end
end
((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico'))
end
|
[
"def multi?\n return number_of(\"MSH\")>1\n end",
"def es_mayor c\n\t\t# Para comparar enteros primero hay que convertir los valores de las cartas que tienen letras p.e. \"j\" o \"as\"\n\t\ta_valor_i= 0\n\t\tcase (@carta.split \"+\")[0]\n\t\twhen Constantes::J\n\t\t\ta_valor_i = 11\n\t\twhen Constantes::Q\n\t\t\ta_valor_i = 12\n\t\twhen Constantes::K\n\t\t\ta_valor_i = 13\n\t\twhen Constantes::AS\n\t\t\ta_valor_i = 14\n\t\telse\n\t\t\ta_valor_i = (@carta.split \"+\")[0].to_i\n\t\tend\n\t\tb_valor_i=0\n\t\tcase (c.carta.split \"+\")[0]\n\t\twhen Constantes::J\n\t\t\tb_valor_i = 11\n\t\twhen Constantes::Q\n\t\t\tb_valor_i = 12\n\t\twhen Constantes::K\n\t\t\tb_valor_i = 13\n\t\twhen Constantes::AS\n\t\t\tb_valor_i = 14\n\t\telse\n\t\t\tb_valor_i = (c.carta.split \"+\")[0].to_i\n\t\tend\n\t\ta_valor_i > b_valor_i\n\tend",
"def three_of_a_kind?\n case wilds\n when 2, 3, 4, 5\n true\n when 1\n natural_pair?\n when 0\n sh[0].face == sh[2].face ||\n sh[1].face == sh[3].face ||\n sh[2].face == sh[4].face\n end\n end",
"def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_anbu = true\n\n for i in 0..3\n val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))\n end\n end",
"def carta_tem_ponto?(carta)\n ['A', '7', 'K', 'J', 'Q'].include? carta.numero\n end",
"def three_set?\n collected_dice = @dice_cup.group_by { |i| i }\n\n collected_dice.each_value do |v|\n if v.length >= 3\n return true\n end\n end\n\n false # No sets of three... :-(\n end",
"def multiracial?\n ethnicities.size > 1\n end",
"def cubic_yard? = unit == 'cubic-yard'",
"def cubic_centimeter? = unit == 'cubic-centimeter'",
"def is_medico_membro(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_medico = false\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n val_is_medico = true\n end\n end\n\n val_is_medico\n end",
"def multiple?\n\t\treturn ((multiplicity == :zero_or_more) ||(multiplicity == :one_or_more))\n\tend",
"def trio?\n @valores.to_h.select{|k, v| (3..3).cover?(v)}.size == 1\n end",
"def noun_articles_correct? set\n ((set & NOUNS).count >= 1) || ((set & ARTICLES).count >= 2)\n end",
"def megabit? = unit == 'megabit'",
"def found_multiple?\n @flags.size > 1\n end",
"def ounce? = unit == 'ounce'",
"def has_three_bonus_parts\n # placeholder\n # will fill in if issue of accidentally not associating bonus parts\n # becomes actually problematic\n end",
"def kilowatt? = unit == 'kilowatt'",
"def aSommetVoisin()\n if(@grille != nil)\n #puts \"dimension de la grille : \" + @grille.longueur.to_s + \":\" + @grille.largeur.to_s\n #puts \"test du voisin gauche, y = \" + y.to_s\n boolSommetGauche = y-1 >= 0 ? @grille.getCase(x, y-1).contenu.is_a?(Sommet) : false\n #puts \"test du voisin droit, y = \" + y.to_s\n boolSommetDroit = y+1 < @grille.largeur ? @grille.getCase(x, y+1).contenu.is_a?(Sommet) : false\n #puts \"test du voisin haut, x = \" + x.to_s\n boolSommetHaut = x-1 >= 0 ? @grille.getCase(x-1, y).contenu.is_a?(Sommet) : false\n #puts \"test du voisin bas, x = \" + x.to_s\n boolSommetBas = x+1 < @grille.longueur ? @grille.getCase(x+1, y).contenu.is_a?(Sommet) : false\n return boolSommetGauche || boolSommetDroit || boolSommetHaut || boolSommetBas\n else\n return false\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Verifica se a equipe e formada por anbus
|
def is_anbu_equipe(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_anbu = true
for i in 0..3
val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))
end
end
|
[
"def puedoTomarInsumos?\n super && @cantidadPAActual == cantidadPAMax\n end",
"def valida_viajes_completos(cliente)\n if cliente.reservacions.find_all_by_estadotipo_id(3).count==0 \n return false\n end\n end",
"def bus_code?\n (code[1] == '1')\n end",
"def baclava_input?\n @baclava_in\n end",
"def barco_hundido?\n @tamanio == @disparos_recibidos\n end",
"def verificar_proxima_maquina\n\t\tif @proxima_maquina.estado == 0\n\t\t\t#puts \"--- Intentando enviar \" + @almacen.to_s\n\t\t\trecibido = @proxima_maquina.recibir_insumo(@almacen)\n\t\t\t#puts \"--- Envie \" + recibido.to_s\n\t\t\tif recibido == @almacen\n\t\t\t\t@estado = 0\n\t\t\tend\n\t\t\t@almacen = @almacen - recibido\n\t\tend\n\tend",
"def inscrite?\n self.paiementsTotal == 0 and !self.enRegle?\n end",
"def hay_empate?\n !@jugador_uno.gana?(@jugador_dos) && !@jugador_dos.gana?(@jugador_uno)\n end",
"def palabraReservada?(palabra)\n return $palabrasReservadas.include? palabra\nend",
"def debo_ir_a_carcel\n if (super)\n return !pagar_fianza\n else\n return true \n # Lo hemos hecho así, porque pensamos que si tiene carta y llama a \n # pagar fianza y tiene el saldo suficiente, se restaría dinero\n # del saldo aún teniendo la carta libertad\n end\n end",
"def verificacion_menu\n\n if(@alimentos.map{|x| x.valor_energetico}.reduce(:+).between?(@persona.gasto_energetico_total_-0.1*@persona.gasto_energetico_total_,@persona.gasto_energetico_total_+0.1*@persona.gasto_energetico_total_))\n return true\n else\n return false\n end\n\n end",
"def check_to(v)\n return true unless v\n return true if v.size == 0\n\n if parser.regexp[:OPAQUE] !~ v || /\\A#{MAILBOX_PATTERN}*\\z/o !~ v\n raise InvalidComponentError,\n \"bad component(expected opaque component): #{v}\"\n end\n\n return true\n end",
"def is_valid_bus?(bus)\n valid = false\n get_supported_buses if buses.nil?\n unless bus.blank?\n self.buses.each do |b|\n valid = true if b[\"bus_name\"] == bus\n end\n end\n valid\n end",
"def cross_check_mac_address_with_ouis\n oui = self.mac_address.to_s.upcase.gsub(/[^A-F0-9]/,'')[0,6]\n if Oui.where(:value => oui).first == nil or Oui.where(:value => oui).first.manufacturer != self.phone_model.manufacturer\n errors.add( :mac_address, \"The given mac address doesn't match to the OUIs of the manufacturer #{self.phone_model.manufacturer.name}.\" )\n end\n end",
"def verificarDisparo\n\n\t\t\tif @disparo == @barco1\n\t\t\t\t\tcambioTablero(\"X\")\n\t\t\t\t\t@golpeado.push(@barco1)\n\t\t\t\t\tputs \"Destruirte un barco\\n\"\n\t\t\t\t\t @barco2\n\t\t\t\t\tcambioTablero(\"X\")\n\t\t\t\t\t@golpeado.push(@barco2)\n\t\t\t\t\tputs \"Destruirte un barco\\n\"\n\n\t\t\t\t\telse\n\t\t\t\t\t@disparo =! @barco1 && @barco2\n\t\t\t\t\tcambioTablero(\"*\")\n\t\t\t\t\tputs \"Fallaste\\n\"\n\t\t\t\tend\n\t\t\t\n\t\tend",
"def is_business?\r\n code_type == 'BUS' rescue false\r\n end",
"def bus_flag(name)\n if /\\w+\\[\\d+:\\d+\\]/ =~ name # AAA[msb:lsb] => Type = \"Bus\" , signal_name = AAA, MSB = msb, LSB = lsb\n return true\n else\n return false\n end\n end",
"def registrar_en_bitacora\n return false\n end",
"def carta_tem_ponto?(carta)\n ['A', '7', 'K', 'J', 'Q'].include? carta.numero\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
verifica se o raikage e um membro da equipe
|
def is_raikage_membro(equipe)
membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]
val_is_raikage = false
for i in 0..3
if Pessoa.find(membros[i]).rank.downcase == 'raikage'
val_is_raikage = true
end
end
val_is_raikage
end
|
[
"def is_medico_membro(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_medico = false\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n val_is_medico = true\n end\n end\n\n val_is_medico\n end",
"def is_anbu_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n val_is_anbu = true\n\n for i in 0..3\n val_is_anbu = (val_is_anbu and (Pessoa.find(membros[i]).rank.downcase == 'anbu'))\n end\n end",
"def ha_scassinatore?\n members.select { |member| member.scassinatore? }.any?\n end",
"def is_medico_equipe(equipe)\n membros = [equipe.mb_1_id, equipe.mb_2_id, equipe.mb_3_id, equipe.mb_S_id]\n count_medicos = 0\n\n for i in 0..3\n if Pessoa.find(membros[i]).rank.downcase == 'medico'\n count_medicos += 1\n elsif Pessoa.find(membros[i]).rank.downcase != 'chuunin' and\n Pessoa.find(membros[i]).rank.downcase != 'jounin'\n return false\n end\n end\n\n ((count_medicos == 3) and (Pessoa.find(membros[3]).rank.downcase == 'medico'))\n end",
"def what_is_occupation\n @occupation\n end",
"def sachPnr_exists\r\n if self.SachPnr.nil? then\r\n return true\r\n end\r\n\r\n ozbperson = OZBPerson.where(\"Mnr = ?\", self.SachPnr)\r\n if ozbperson.empty? then\r\n errorString = String.new(\"Es konnte keinen zugehörigen Sachbearbeiter zu der angegebenen Mnr (#{self.SachPnr}) gefunden werden.\")\r\n errors.add :mnr, errorString\r\n return false\r\n end\r\n return true\r\n end",
"def idr\n \n if @genero = \"hombre\" && @alimentoTotal.prot >= 54.0 && @alimentoTotal.valorEnergetico >= 3000\n return true\n elsif @genero = \"mujer\" && @alimentoTotal.prot >= 41.0 && @alimentoTotal.valorEnergetico >= 2300\n return true\n else return false\n \n end\n end",
"def palabraReservada?(palabra)\n return $palabrasReservadas.include? palabra\nend",
"def rent_magazine_item?(magazine_item)\n \tif magazine_item.rental\n \treturn magazine_item.rental.user == self \n else\n \treturn false\n end\n end",
"def bc_resident?\n address_record.get_province_code == \"BC\"\n end",
"def multiple_rental_locations\n\n @product_family = ::Yito::Model::Booking::ProductFamily.get(SystemConfiguration::Variable.get_value('booking.item_family'))\n @multiple_rental_locations = SystemConfiguration::Variable.get_value('booking.multiple_rental_locations', 'false').to_bool\n result = (@product_family and @product_family.multiple_locations and @multiple_rental_locations)\n return result\n \n end",
"def primary_restaurant?\n primary_employment.present? && primary_employment.restaurant.present?\n end",
"def primary_applicant\n tax_household_members.detect do |tax_household_member|\n tax_household_member.is_subscriber == true\n end\n end",
"def multiracial?\n ethnicities.size > 1\n end",
"def debo_ir_a_carcel\n if (super)\n return !pagar_fianza\n else\n return true \n # Lo hemos hecho así, porque pensamos que si tiene carta y llama a \n # pagar fianza y tiene el saldo suficiente, se restaría dinero\n # del saldo aún teniendo la carta libertad\n end\n end",
"def magazine_item_on_rent?\n\t magazine_items.each do |i|\n\t return true if i.is_rent\n\t end\n\t return false \n\tend",
"def puedoTomarInsumos?\n super && @cantidadPAActual == cantidadPAMax\n end",
"def business_owner?\n self.role == 'bizowner'\n end",
"def name_info\n return true if self.member # Isn't this simpler than next line?\n return true if Member.find_by_id(self.member_id) || (! self.other_travelers.blank?)\n errors[:member] << \"Must use existing member or enter name in 'Other travelers'\"\n return false\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /outsides GET /outsides.json
|
def index
@outsides = Outside.all
end
|
[
"def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end",
"def show\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @outside_request }\n end\n end",
"def api_venues_openings\n\n\t\tvenues_index = params['venue_index'].to_i\n\t\tvenues_limit = params['num_venues'].to_i\n\n\t\topenings_from_date = params['from_date']\n\t\topenings_to_date = params['to_date']\n\n\t\torigin = location_service.get_lat_long(params['postal'])\n\n\t\tschedule_tree = Venue::getOpeningsByProxyAndDate(\n\t\t\tvenues_index, \n\t\t\tvenues_limit,\n\t\t\torigin,\n\t\t\topenings_from_date, \n\t\t\topenings_to_date\n\t\t)\n\n\t\trender :json => schedule_tree\n\n\tend",
"def create\n @outside = Outside.new(outside_params)\n\n respond_to do |format|\n if @outside.save\n format.html { redirect_to @outside, notice: 'Outside was successfully created.' }\n format.json { render :show, status: :created, location: @outside }\n else\n format.html { render :new }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\r\n @bodysides = Bodyside.all\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @bodysides }\r\n end\r\n end",
"def index\n render json: @places\n end",
"def index\n @holes = Hole.all\n respond_with @holes\n end",
"def offDayUser\n page = params[:page] || 1 \n per = params[:per] || 5 \n render json: @current_user.off_days.page(page).per(per)\n end",
"def index\n @endorsements = Endorsement.all\n\n render json: @endorsements\n end",
"def index\n @ozones = Ozone.all\n render json: @ozones\n end",
"def index\n\t lat, lon = params[:lat], params[:lon]\n\t if lat and lon\n @photos = Photo.nearby(lat.to_f, lon.to_f)\n render :json => @photos._as_json\n\t else\n if !@event.nil?\n @photos = @event.photos.paginate(:page => params[:page], :per_page => 15)\n render :json => {\n :photos => @photos.as_json(\n {:methods => [:owner],\n :include => {:comments => {:methods => [:owner]},\n :likes => {:methods => [:owner]}}}),\n :page => params[:page],\n :per_page => 15,\n :total_photos => @photos.count }\n end\n\t end\n\tend",
"def index\n @outings = Outing.all\n end",
"def index\n render json: Roomservice.where(stay_id: params[:stay_id])\n end",
"def index\n @openings = Opening.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @openings }\n end\n end",
"def index\n begin\n conditions = [\"course_id = ?\",@course.id]\n @holes = Hole.find(:all, :order => 'number', :conditions => conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @holes }\n end\n rescue\n render :layout => 'error', :template => 'errors/error'\n end\n end",
"def index\n @area_of_interests = AreaOfInterest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @area_of_interests }\n end\n end",
"def index\n authorize! :read, Outlet\n outlets = current_user.outlets(params)\n render json: outlets\n end",
"def destroy\n @outside.destroy\n respond_to do |format|\n format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def index\n @insides = Inside.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /outsides POST /outsides.json
|
def create
@outside = Outside.new(outside_params)
respond_to do |format|
if @outside.save
format.html { redirect_to @outside, notice: 'Outside was successfully created.' }
format.json { render :show, status: :created, location: @outside }
else
format.html { render :new }
format.json { render json: @outside.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @outside_request = OutsideRequest.new(params[:outside_request])\n\n respond_to do |format|\n if @outside_request.save\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully created.' }\n format.json { render json: @outside_request, status: :created, location: @outside_request }\n else\n format.html { render action: \\\"new\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @outsides = Outside.all\n end",
"def index\n @outside_requests = OutsideRequest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @outside_requests }\n end\n end",
"def destroy\n @outside.destroy\n respond_to do |format|\n format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def update\n respond_to do |format|\n if @outside.update(outside_params)\n format.html { redirect_to @outside, notice: 'Outside was successfully updated.' }\n format.json { render :show, status: :ok, location: @outside }\n else\n format.html { render :edit }\n format.json { render json: @outside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @outside_request = OutsideRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @outside_request }\n end\n end",
"def create\n @innerpost = Innerpost.new(innerpost_params)\n\n respond_to do |format|\n if @innerpost.save\n format.html { redirect_to @innerpost, notice: 'Innerpost was successfully created.' }\n format.json { render :show, status: :created, location: @innerpost }\n else\n format.html { render :new }\n format.json { render json: @innerpost.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @outdoor = Outdoor.new(params[:outdoor])\n\n respond_to do |format|\n if @outdoor.save\n format.html { redirect_to @outdoor, notice: 'Outdoor was successfully created.' }\n format.json { render json: @outdoor, status: :created, location: @outdoor }\n else\n format.html { render action: \"new\" }\n format.json { render json: @outdoor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n # post to API\n url = 'https://petapi-1.herokuapp.com/addPet'\n response = RestClient.post( url, { name: params[:name], type: params[:type], breed: params[:breed], location: params[:location], latitude: params[:latitude], longitude: params[:longitude] })\n\n # if we get an ok response, redirect to main list page\n if response.code <= 200\n # redirect to main page\n redirect_to '/'\n end\n end",
"def create\n @events_outfit = EventsOutfit.new(params[:events_outfit])\n\n respond_to do |format|\n if @events_outfit.save\n format.html { redirect_to @events_outfit, :notice => 'Events outfit was successfully created.' }\n format.json { render :json => @events_outfit, :status => :created, :location => @events_outfit }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @events_outfit.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids','acctids','itemids'])\n\t\t\n\t\t# ok, this join stuff is bogus - it encodes properly, but the other side only sees the last element and loses the array type - it's just string\n\t\t# this way, i 'split' it at the other side to recover my array\n\t\t# it should work without the join/split crap, but it doesn't\n\t\trequest.set_form_data({:custids => ( params['custids'] || []).join(','), :acctids => ( params['acctids'] || []).join(','), :itemids => ( params['itemids'] || []).join(','), :amount => params['amount'], :type => params['type']})\n\t\t\n\t\tputs request.body\n\t\t\n\t\tresponse = http.request(request)\n\t\tputs response.body\n\n respond_to do |format|\n format.html { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n format.json { render :text => response.code == :ok ? \"\" : response.body, status: response.code }\n end\n end",
"def create\n @off_day = OffDay.new(off_day_params)\n\n respond_to do |format|\n if @off_day.save\n format.html { redirect_to @off_day, notice: 'Off day was successfully created.' }\n format.json { render :show, status: :created, location: @off_day }\n else\n format.html { render :new }\n format.json { render json: @off_day.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @day_off = DayOff.new(day_off_params)\n\n respond_to do |format|\n if @day_off.save\n format.html { redirect_to @day_off, notice: 'Day off was successfully created.' }\n format.json { render :show, status: :created, location: @day_off }\n else\n format.html { render :new }\n format.json { render json: @day_off.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_venues_openings\n\n\t\tvenues_index = params['venue_index'].to_i\n\t\tvenues_limit = params['num_venues'].to_i\n\n\t\topenings_from_date = params['from_date']\n\t\topenings_to_date = params['to_date']\n\n\t\torigin = location_service.get_lat_long(params['postal'])\n\n\t\tschedule_tree = Venue::getOpeningsByProxyAndDate(\n\t\t\tvenues_index, \n\t\t\tvenues_limit,\n\t\t\torigin,\n\t\t\topenings_from_date, \n\t\t\topenings_to_date\n\t\t)\n\n\t\trender :json => schedule_tree\n\n\tend",
"def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend",
"def postEntityOpening_times( entity_id, monday, tuesday, wednesday, thursday, friday, saturday, sunday, closed, closed_public_holidays)\n params = Hash.new\n params['entity_id'] = entity_id\n params['monday'] = monday\n params['tuesday'] = tuesday\n params['wednesday'] = wednesday\n params['thursday'] = thursday\n params['friday'] = friday\n params['saturday'] = saturday\n params['sunday'] = sunday\n params['closed'] = closed\n params['closed_public_holidays'] = closed_public_holidays\n return doCurl(\"post\",\"/entity/opening_times\",params)\n end",
"def create\n @outdoor = Outdoor.new(outdoor_params)\n flash[:notice] = 'Outdoor foi criado com sucesso.' if @outdoor.save\n respond_with @outdoor, :location => admin_outdoors_path\n end",
"def create\n @outdoor = Outdoor.new(params[:outdoor])\n\n respond_to do |format|\n if @outdoor.save\n format.html { redirect_to(@outdoor, :notice => 'Outdoor was successfully created.') }\n format.xml { render :xml => @outdoor, :status => :created, :location => @outdoor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @outdoor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def areas\n @area = Area.new(geo_json: params.to_json)\n if @area.save\n json_response([id: @area.id], :created, :geo_json_recieved)\n else\n json_response(nil, :error, :db_error)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /outsides/1 PATCH/PUT /outsides/1.json
|
def update
respond_to do |format|
if @outside.update(outside_params)
format.html { redirect_to @outside, notice: 'Outside was successfully updated.' }
format.json { render :show, status: :ok, location: @outside }
else
format.html { render :edit }
format.json { render json: @outside.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @outside_request = OutsideRequest.find(params[:id])\n\n respond_to do |format|\n if @outside_request.update_attributes(params[:outside_request])\n format.html { redirect_to @outside_request, notice: 'Outside request was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \\\"edit\\\" }\n format.json { render json: @outside_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def patch *args\n make_request :patch, *args\n end",
"def update\n request = RestClient.put File.join(API_SERVER,\"rest-api/departments\"), { \n 'id' => params['id'], \n 'name' => params['department']['name'], \n 'description' => params['department']['description'] }.to_json, :content_type => :json, :accept => :json\n\n redirect_to :action => :index\n end",
"def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend",
"def put(*a) route 'PUT', *a end",
"def update\n @hole = Hole.find(params[:id])\n @hole.update_attributes(hole_params)\n respond_with @hole\n end",
"def update\n respond_to do |format|\n if @set_aside.update(set_aside_params)\n format.html { redirect_to @set_aside, notice: 'Set aside was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @set_aside.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put *args\n make_request :put, *args\n end",
"def update\r\n @bodyside = Bodyside.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @bodyside.update_attributes(bodyside_params)\r\n format.html { redirect_to @bodyside, notice: 'Bodyside was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @bodyside.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def update\n @especy = Especie.find(params[:id])\n\n respond_to do |format|\n if @especy.update_attributes(params[:especy])\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @especy.update(especy_params)\n format.html { redirect_to @especy, notice: 'Especie was successfully updated.' }\n format.json { render :show, status: :ok, location: @especy }\n else\n format.html { render :edit }\n format.json { render json: @especy.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @eveent.update(eveent_params)\n format.html { redirect_to @eveent, notice: 'Eveent was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @eveent.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @offert.update(offert_params)\n format.html { redirect_to @offert, notice: 'Offert was successfully updated.' }\n format.json { render :show, status: :ok, location: @offert }\n else\n format.html { render :edit }\n format.json { render json: @offert.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n put(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def update\n @hole = Hole.find(params[:id])\n\n respond_to do |format|\n if @hole.update_attributes(params[:hole])\n format.html { redirect_to @hole, notice: 'Hole was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @hole.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @emergencyrequest = Emergencyrequest.find(params[:id])\n\n respond_to do |format|\n if @emergencyrequest.update_attributes(params[:emergencyrequest])\n format.html { redirect_to @emergencyrequest, notice: 'Emergencyrequest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @emergencyrequest.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nope.update(nope_params)\n format.html { redirect_to @nope, notice: 'Nope was successfully updated.' }\n format.json { render :show, status: :ok, location: @nope }\n else\n format.html { render :edit }\n format.json { render json: @nope.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /outsides/1 DELETE /outsides/1.json
|
def destroy
@outside.destroy
respond_to do |format|
format.html { redirect_to outsides_url, notice: 'Outside was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @outside_request = OutsideRequest.find(params[:id])\n @outside_request.destroy\n\n respond_to do |format|\n format.html { redirect_to outside_requests_url }\n format.json { head :no_content }\n end\n end",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destroy\n @json.destroy\n\n head :no_content\n end",
"def delete\n self.class.headers 'Authorization' => \"OAuth #{ENV['sfdc_token']}\"\n self.class.headers 'Content-Type' => \"application/json\"\n response = self.class.delete(SObject.root_url+\"/sobjects/#{@object_name}/#{@Id}\")\n raise response.parsed_response[0]['message'] if response.code.to_i > 299\n nil\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete endpoint\n do_request :delete, endpoint\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 @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version_box(args = {}) \n delete(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend",
"def destroy\n @off.destroy\n respond_to do |format|\n format.html { redirect_to offs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @offert = Offert.find(params[:id])\n @offert.destroy\n\n respond_to do |format|\n format.html { redirect_to offerts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @eveent.destroy\n respond_to do |format|\n format.html { redirect_to eveents_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @episodio.destroy\n respond_to do |format|\n format.html { redirect_to episodios_url, notice: 'Episodio was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exoplanet = Exoplanet.find(params[:id])\n @exoplanet.destroy\n\n respond_to do |format|\n format.html { redirect_to exoplanets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @oid.destroy\n respond_to do |format|\n format.html { redirect_to oids_url }\n format.json { head :no_content }\n end\n end",
"def delete_endpoint\n end",
"def destroy\n @sidequest.destroy\n respond_to do |format|\n format.html { redirect_to sidequests_url, notice: 'Sidequest was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @indesert.destroy\n respond_to do |format|\n format.html { redirect_to indeserts_url, notice: 'Indesert was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
create a uri with prefix and hash of the address
|
def uri
uri_prefix + Digest::MD5.hexdigest(self.address)
end
|
[
"def build_url(prefix='x', suffix='')\n id = SecureRandom.uuid\n \"/#{prefix}/#{id}/#{suffix}\"\n end",
"def construct_url(uri)\n \"#{uri.scheme}://#{uri.host}#{uri.path}\"\n end",
"def build_url(prefix='x', suffix='')\n id = SecureRandom.uuid\n \"/#{prefix}/#{id}/#{suffix}\"\nend",
"def make_absolute_uri(hash={})\n @urigen.make_absolute_uri(hash)\n end",
"def build_uri(path)\n uri = base_uri\n uri.path = path\n uri.to_s\n end",
"def create_uri(str_uri)\n sip_factory.create_uri('sip:' + str_uri)\n end",
"def build_uri(uri)\n if (uri.start_with?(@storeuri))\n return uri\n end\n if uri.start_with?(\"/\")\n return @storeuri + uri\n else\n return @storeuri + \"/\" + uri\n end\n end",
"def build_uri\n # Validate the scheme.\n scheme = build_scheme.upcase\n raise UnresolvableResourceError, 'scheme must be http or https' if scheme!='HTTP' && scheme!='HTTPS'\n \n # Build and normalize the URI.\n URI.const_get(scheme).\n build2(host: build_host, port: build_port(scheme), userinfo: build_userinfo, path: build_path, query: build_query).\n normalize\n end",
"def create_request_url uri\n uri_noslash = uri.gsub %r{^/}, \"\"\n \"#{@endpoint}/#{uri_noslash}\"\n end",
"def create_uri url\n uri = URI.parse url\n uri.user = @login\n uri.password = @password\n uri\n end",
"def uri\n URI::Generic.build(host: addr, port: port)\n end",
"def full_uri\n \"#{host_uri}#{uri}\"\n end",
"def full_uri\n protocol + \"://\" + host + uri\n end",
"def join_uri(scheme, userinfo, host, port, registry, path, opaque, query, fragment)\n URI::Generic.new(scheme, userinfo, host, port, registry, path, opaque, query, fragment).to_s\n end",
"def uri\n \"#{uri_scheme}#{id}\"\n end",
"def to_uri\n build_uri\n end",
"def build_uri\n uri = URI(\"#{Phantomblaster::API_URL}#{path}\")\n query = build_query(uri, args)\n uri.query = query\n uri\n end",
"def build_uri(base_uri = nil, **params)\n if base_uri\n base_uri = base_uri.sub(%r{/$}, '')\n base_uri + '/' + asset.identifier\n else\n IIIF::URI.new(service_url, **params).to_uri.to_s\n end\n end",
"def hash_uri(uri)\n data = String.new\n data << uri\n offset = data.length < 10 ? data.length : 10\n data.insert(offset, @salt)\n hash = Digest::MD5.digest(data)\n hash = Base64.strict_encode64(hash[2..7])\n hash.gsub('=', '.').gsub('+', '-').gsub('/', '_')\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns prefixes split on the namespace pattern.
|
def prefixes
prefix.split(NAMESPACE_PATTERN)
end
|
[
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end",
"def split_names\n @adapter.find_strings_by_prefix(namespace_key('.split.'))\n .map { |split| split.gsub(namespace_key('.split.'), '') }\n end",
"def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end",
"def unprefixed_namespace_component_names\n if self.name.nil? || self.name == ''\n []\n else\n self.name.split('::')\n end\n end",
"def split_prefix(var, prefix)\n\n if prefix.nil?\n m = VAR_PREFIX_REGEX.match(var.to_s)\n prefix = m[1]\n var = m[2]\n end\n\n [ var, prefix ]\n end",
"def exploded_namespace_declarations(ns)\n Hash[ns.map do |prefix, uri|\n if prefix==\"\"\n [\"xmlns\", uri]\n else\n [[prefix, \"xmlns\"], uri]\n end\n end]\n end",
"def get_prefixes\n find_all{|entry| entry.type==Morpheme::PREFIX}\n end",
"def namespace_component_names\n if self.name.nil? || self.name == ''\n []\n else\n unprefixed_names = unprefixed_namespace_component_names\n \n names = []\n\n while current_name = unprefixed_names.pop\n current_full_name = (unprefixed_names + [current_name]).join('::')\n names.unshift(current_full_name)\n end\n \n names\n end\n end",
"def prefixes\n self.class.prefixes\n end",
"def namespaces\n @namespaces ||= self.class.name.split('::').slice(0...-1).map(&:underscore).map(&:to_sym)\n end",
"def namespaces\n names = self.class.name.split(\"::\")\n names.pop\n \n names.map(&:underscore).map(&:to_sym)\n end",
"def get_prefixed_words(prefix)\n # FILL ME IN\n return Lexicon.new.trie.find_words_starting_with(prefix)\n end",
"def namespace_names\n @namespaces.map(&:name)\n end",
"def prefix_regex( prefix, key_separator )\n /\\A(?<prefix>#{prefix}[#{key_separator}]*)(?<rest>.*)\\Z/i\n end",
"def ngrams_prefixed_by(prefix)\n ngram_set = NgramSet.new\n\n return ngram_set unless @prefixes.has_key?(prefix)\n\n ngram_set += @prefixes[prefix].grams.map do |gram|\n prefix + gram\n end\n\n return ngram_set\n end",
"def map_to_namespace(names)\n if !namespace\n return names\n end\n\n ary = Array(names)\n ary.map! do |n|\n _,name = split_name(n)\n \"#{namespace}#{DELIMATOR}#{name}\"\n end\n if names.is_a? Array\n ary \n else\n ary.first\n end\n end",
"def namespaces ns = \"root\", cn = \"__Namespace\"\n result = []\n each_instance( ns, cn ) do |inst|\n name = \"#{ns}/#{inst.Name}\"\n result << name\n result.concat namespaces name, cn\n end\n result.uniq\n end",
"def get_namespace(node, prefix); end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns namespaces split on the namespace pattern.
|
def namespaces
namespace.split(NAMESPACE_PATTERN)
end
|
[
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def namespaces\n @namespaces ||= self.class.name.split('::').slice(0...-1).map(&:underscore).map(&:to_sym)\n end",
"def split_names\n @adapter.find_strings_by_prefix(namespace_key('.split.'))\n .map { |split| split.gsub(namespace_key('.split.'), '') }\n end",
"def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end",
"def namespaces\n names = self.class.name.split(\"::\")\n names.pop\n \n names.map(&:underscore).map(&:to_sym)\n end",
"def namespaces ns = \"root\", cn = \"__Namespace\"\n result = []\n each_instance( ns, cn ) do |inst|\n name = \"#{ns}/#{inst.Name}\"\n result << name\n result.concat namespaces name, cn\n end\n result.uniq\n end",
"def get_namespace sexp\n current = sexp\n type = current.first\n namespace = []\n subs = []\n while type == :colon2\n namespace.unshift current.rest.rest.first.to_s\n current = current.rest.first\n subs << current\n type = current.first\n end\n namespace.unshift current.rest.first.to_s\n return namespace[0...namespace.length-1], subs # return all except for the last element\n end",
"def possible_namespaces\n namespaces = []\n key = @key.to_s\n while (index = key.rindex('_'))\n key = key[0, index]\n namespaces << key.to_sym\n end\n namespaces\n end",
"def unprefixed_namespace_component_names\n if self.name.nil? || self.name == ''\n []\n else\n self.name.split('::')\n end\n end",
"def ruby_namespace namespaces\n namespaces = namespaces.split \".\" if namespaces.is_a? String\n namespaces.reject(&:empty?).map(&:upcase_first).join \"::\"\n end",
"def exploded_namespace_declarations(ns)\n Hash[ns.map do |prefix, uri|\n if prefix==\"\"\n [\"xmlns\", uri]\n else\n [[prefix, \"xmlns\"], uri]\n end\n end]\n end",
"def namespace_names\n @namespaces.map(&:name)\n end",
"def map_to_namespace(names)\n if !namespace\n return names\n end\n\n ary = Array(names)\n ary.map! do |n|\n _,name = split_name(n)\n \"#{namespace}#{DELIMATOR}#{name}\"\n end\n if names.is_a? Array\n ary \n else\n ary.first\n end\n end",
"def split_name(name)\n classified_name = name.to_s.classify\n name_parts = classified_name.split(\"::\")\n namespace_name = name_parts[0...-1].join(\"::\")\n return [nil, classified_name] if namespace_name.empty?\n\n [namespace_name, name_parts.last]\n end",
"def namespaces\n ivar_cache(\"object_namespaces\") do\n nss = []\n full_name = self.class.name.to_s\n nss = full_name.split(\"::\")\n nss.pop\n nss\n end\n end",
"def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend",
"def namespace(separator = Typelib::NAMESPACE_SEPARATOR, remove_leading = false)\n\t\tns = do_namespace\n\t\tif remove_leading\n\t\t ns = ns[1..-1]\n\t\tend\n\t\tif separator && separator != Typelib::NAMESPACE_SEPARATOR\n\t\t ns.gsub!(Typelib::NAMESPACE_SEPARATOR, separator)\n\t\tend\n\t\tns\n\t end",
"def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end",
"def split_name(name)\n Namespace.split_name name\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns targets split on the namespace pattern.
|
def targets
target.split(NAMESPACE_PATTERN)
end
|
[
"def namespaces\n namespace.split(NAMESPACE_PATTERN)\n end",
"def prefixes\n prefix.split(NAMESPACE_PATTERN)\n end",
"def inferred_targets\n target_group = group\n targets = []\n while targets.empty? && target_group.respond_to?(:sibling_targets)\n targets += target_group.sibling_targets\n target_group = target_group.parent\n end\n targets\n end",
"def targets\n return @targets unless @targets.nil?\n\n expanded_urls = []\n @split_targets.each do |target|\n expanded_urls = (expanded_urls | expand_targets(target))\n end\n @targets = expanded_urls.map do |url|\n config = @conn_options.merge(config_for_target(url))\n TargetHost.new(config.delete(:url), config)\n end\n end",
"def namespaces\n @namespaces ||= self.class.name.split('::').slice(0...-1).map(&:underscore).map(&:to_sym)\n end",
"def targets()\n targets = []\n \n each_element() do |element|\n if targets = element.targets then\n break\n end\n end\n \n return targets\n end",
"def namespaces\n names = self.class.name.split(\"::\")\n names.pop\n \n names.map(&:underscore).map(&:to_sym)\n end",
"def split_names\n @adapter.find_strings_by_prefix(namespace_key('.split.'))\n .map { |split| split.gsub(namespace_key('.split.'), '') }\n end",
"def targets()\n if @target then\n return [self]\n else\n return []\n end\n end",
"def split_prefix\n [$1, $2, $3] if @prefix =~ PREFIX_PAT\n end",
"def targets\n\t\t@targets ||= begin\n\t\t\tconfig_list('target(Enumerator)?$').map do |li|\n\t\t\t\tif li[0].downcase == 'target'\n\t\t\t\t\tli[1]\n\t\t\t\telsif li[0].downcase == 'targetenumerator'\n\t\t\t\t\trv = run_command(\"Enumerating targets using '#{li[1]}'\", li[1]).split(/\\s+/)\n\t\t\t\t\tif $?.exitstatus != 0\n\t\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\t\"Target enumeration failed. Aborting.\"\n\t\t\t\t\tend\n\t\t\t\t\trv\n\t\t\t\telse\n\t\t\t\t\traise RuntimeError,\n\t\t\t\t\t\t\t\"Unknown target expansion option: #{li[0]}\"\n\t\t\t\tend\n\t\t\tend.flatten\n\t\tend\n\tend",
"def resolve_name(target)\n if (group = @group_lookup[target])\n group.all_targets\n else\n # Try to wildcard match targets in inventory\n # Ignore case because hostnames are generally case-insensitive\n regexp = Regexp.new(\"^#{Regexp.escape(target).gsub('\\*', '.*?')}$\", Regexp::IGNORECASE)\n\n targets = @groups.all_targets.select { |targ| targ =~ regexp }\n targets += @groups.target_aliases.select { |target_alias, _target| target_alias =~ regexp }.values\n\n if targets.empty?\n raise(WildcardError, target) if target.include?('*')\n [target]\n else\n targets\n end\n end\n end",
"def namespaces\n map(&:namespace).map(&:prefix).map(&:to_s).map(&:downcase).uniq\n end",
"def get_targets args\n tlist = args[ :targets ]\n raise \"Missing target list\" if !tlist\n raise \"Empty target list\" if tlist.empty?\n t_type = args[ :target_type ]\n raise \"Missing target_type\" if !t_type\n raise \"Bad target type: #{t_type}\" if ![:obj, :lib, :exe].include? t_type\n opt = args[ :options ]\n raise \"Missing options\" if !opt\n raise \"Empty options\" if opt.empty?\n result = []\n tlist.each{ |name|\n name.strip!\n raise \"Target name empty\" if name.empty?\n\n # add version and extension if necessary (user may supply the full name\n # such as libFoo.3.2.1.so_dbg or just the prefix 'libFoo')\n #\n ext = File.extname name\n raise \"Please omit extension in name (it will be computed): #{name}\" if !ext.empty?\n name = add_ext name, t_type\n\n target = find_target name\n raise \"Target #{name} not found\" if !target\n raise \"Target #{name} not unique\" if target.size > 1\n result << target.first\n }\n return result\n end",
"def namespaces\n Dir[\"#{NAMESPACE_DIR}/*\"]\n .find_all { |dir| FileTest.directory?(dir) }\n .map { |dir| File.basename(dir) }\nend",
"def all_targets\n @groups.inject(local_targets) do |acc, g|\n acc.merge(g.all_targets)\n end\n end",
"def extract()\n\t\tns = @doc.root.namespace\n\t\ttargets = REXML::XPath.match(@doc, \"//ns:g[@inkscape:label='export']/ns:rect\", {'ns' => ns})\n\t\treturn targets\n\tend",
"def get_targets\n {\n method: \"Target.getTargets\"\n }\n end",
"def namespaces_to_paths(namespaces)\n paths = []\n namespaces.each do |namespace|\n pieces = namespace.split(\":\")\n path = pieces.join(\"/\")\n paths << \"#{path}/#{pieces.last}\"\n paths << path\n end\n paths.uniq!\n paths\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Note that we always have a cascaded event join for the model that the event actually belongs to, even if it's not cascadable. I know this is bad terminology, but it seems better to do this way so that we can get all events for an object directly from the cascaded events join table.
|
def maybe_cascade
CascadedEventJoin.find_or_create_by(cascaded_eventable: self.eventable, event_id: self.id)
if self.cascadable and self.eventable.respond_to?(:cascade_event)
self.eventable.cascade_event(self)
end
end
|
[
"def related_events\n find_related_frbr_objects( :is_related_to, :which_events?) \n end",
"def model_events\n @model_events ||= Hash.new do |cache, id|\n event = source_result_event(id)\n\n model_event = Calculations::V3::Models::Event.new(\n calculated: calculated?(event),\n date: event.date.to_date,\n discipline: Calculations::V3::Models::Discipline.new(event.discipline),\n # TODO: end_date triggers SQL\n end_date: event.end_date.to_date,\n id: event.id,\n multiplier: multiplier(event.id),\n sanctioned_by: associations_by_name[event.sanctioned_by]\n )\n\n event.races.each do |race|\n model_event.add_category(model_categories[race.category_id])\n end\n\n if event.parent_id\n model_events[event.parent_id].add_child model_event\n end\n\n cache[id] = model_event\n end\n end",
"def event_model(model); self.model.event_model(model) end",
"def get_all_events\n @events = Event.all\n end",
"def events\n object.event_associations_between(period)\n end",
"def get_all_events\n return Event.find(:all, :conditions => { :session_id => self.id }, :order => \"date ASC\")\n end",
"def associated_informed_consent_event\n Event.joins(:contact_links).\n where(:participant_id => participant_id,\n :event_type_code => Event.informed_consent_code).\n where(\"contact_links.contact_id in (?)\", contacts.map(&:id)).\n readonly(false).first\n end",
"def event_relation_graph_for(model)\n event_relation_graphs.fetch(model)\n end",
"def event_entry\n\t\tlist_results = Result.where({\"competitor_id\" => self.id})\n\t\tif list_results.empty?\n\t\t\treturn nil\n\t\telse\n\t\t\tevent_id_arr =[]\n\t\t\tlist_results.each do |result|\n\t\t\t\tevent_id_arr << result.event_id\n\t\t\tend\n\t\tend\n\n\t\tif event_id_arr.empty?\n\t\t\treturn nil\n\t\telse\n\t\t\treturn Event.where(\"id\" => event_id_arr)\n\t\tend\n\tend",
"def event\n @event ||= event_type.singularize.camelize.constantize.find_by_id(event_id)\n end",
"def get_events\n Record.with(collection: \"#{self.class.name.demodulize.downcase}_timeline\") do |m|\n m.by(proprietor: { \"#{self.class.name.demodulize.downcase}_id\".to_sym => id })\n end\n end",
"def index\n @event_related_links = EventRelatedLink.all\n end",
"def find_event\n Event.joins(:purchase).where(purchase: {buyer_id: current_user.id}).ids\n end",
"def get_kassi_events\n query = \"\n SELECT DISTINCT kassi_events.id, kassi_events.realizer_id, kassi_events.receiver_id, \n kassi_events.eventable_id, kassi_events.eventable_type, kassi_events.created_at \n FROM kassi_events, conversations, kassi_events_people\n WHERE kassi_events.id = kassi_events_people.kassi_event_id\n AND kassi_events_people.person_id = '#{id}'\n AND kassi_events.pending = 0\n AND (kassi_events.eventable_type <> 'Reservation'\n OR (kassi_events.eventable_id = conversations.id\n AND conversations.return_time < '#{DateTime.now.utc}'))\n ORDER BY id DESC\n \"\n KassiEvent.find_by_sql(query)\n end",
"def events\n Class.new(Sequel::Model(events_table))\n end",
"def joined_event?\n current_event = Event.find(params[:id])\n current_user && current_event.users.find_by(id: current_user.id)\n end",
"def read_event\n self.class.select(\"READ_EVENT(#{self.id})\").all\n end",
"def contacts\n Contact.joins(:contact_links).\n joins(\"left outer join events on events.id = contact_links.event_id\").\n where(\"events.participant_id = ?\", self.id)\n end",
"def events_awarded\n find_related_frbr_objects( :is_awarded_to, :which_events?) \n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Convenience for getting element blueprints
|
def element_blueprints(composite_object = nil)
adapter.element_blueprints(composite_object)
end
|
[
"def element_blueprints(composite_object = nil)\n composite_object ||= self\n\n # Traverse!\n return composite_object.elements[element_name] if composite_object.hash[:elements].is_a?(Hash)\n\n return element_blueprints(composite_object.parent) if composite_object.parent\n\n nil\n end",
"def get_blueprints\n connection.resource(:get, 'blueprints')\n end",
"def descriptor()\n delegation = lambda { |key| \"#{key || :parent}-first\" }\n path_elements = lambda do |xml, libs|\n libs.each { |lib| xml.tag! \"path-element\", \"lib/#{lib.to_s.pathmap('%f')}\" }\n end\n xml = Builder::XmlMarkup.new(:indent=>2)\n xml.instruct!\n xml.jbi :xmlns=>\"http://java.sun.com/xml/ns/jbi\", :version=>\"1.0\" do\n xml.component :type=>component.type.to_s.sub(\"_\", \"-\"),\n \"component-class-loader-delegation\"=>delegation[component.delegation],\n \"bootstrap-class-loader-delegation\"=>delegation[bootstrap.delegation] do\n xml.identification do\n xml.name component.name\n xml.description component.description\n end\n xml.tag!(\"component-class-name\", component.class_name)\n xml.tag!(\"component-class-path\") { path_elements[xml, component.libs] }\n xml.tag!(\"bootstrap-class-name\", bootstrap.class_name)\n xml.tag!(\"bootstrap-class-path\") { path_elements[xml, bootstrap.libs] }\n end\n end\n end",
"def blueprint_value\n Blueprints::RootNamespace.root.build @name => @options\n @registry.inject(Blueprints::RootNamespace.root.context.instance_variable_get(:\"@#{@iv_name}\")) do |value, (method, args, block)|\n value.send(method, *args, &block)\n end\n end",
"def blueprint_for(klass)\n if @blueprints\n key = klass\n while key != Object\n return @blueprints[key] unless @blueprints[key].nil?\n key = key.superclass\n end\n raise \"Blueprint for class #{klass} is not defined\"\n end\n raise \"Blueprint for class #{klass} is not defined\"\n end",
"def getElement\n @element\n end",
"def feed_elements\n elements.named(definition['feed_elements'])\n end",
"def get_elem_controller\n elem_type.tableize\n end",
"def description\n description = self.class.descriptions.detect { |d| d['name'] == self.name }\n if description.blank?\n log_warning \"Could not find element definition for #{self.name}. Please check your elements.yml!\"\n return {}\n else\n return description\n end\n end",
"def element_render_naming\n JSON_ELEMENT_RENDER_NAMING\n end",
"def getStyleElement\n return @element\n end",
"def all_blueprints\n project_blueprints = all_project_blueprint_infos.map { |info| info.name }\n\n gem_blueprints = specs.map do |spec|\n dot_lono = dot_meta_path(spec)\n config = YAML.load_file(dot_lono)\n config[\"blueprint_name\"]\n end\n\n all = project_blueprints + gem_blueprints\n all.uniq\n end",
"def resources\n elements.select { |e| e.resource?}\n end",
"def element\n self\n end",
"def elements\n @elements ||= Watir::Container.instance_methods unless @elements\n end",
"def elements\n model = self.model.constantize\n model.respond_to?(:generic_listing_elements) ? model.generic_listing_elements : model.all\n end",
"def elements_for_layout(layout)\n elements = []\n layout_elements = PageLayout.get(layout)[\"elements\"]\n return Element.descriptions if layout_elements == \"all\"\n Element.descriptions.each do |element|\n if layout_elements.include?(element[\"name\"])\n elements << element\n end\n end\n elements\n end",
"def element_symbol; end",
"def blueprint(name = nil, &block)\n Blueprint.new(name, self, &block)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Gets the mode from the data and calls the API. Returns the response from the API.
|
def checkModes(data)
mode = data['mode']
call_features=Array.new(1) { Hash.new }
if mode=="labels"
call_features<<{
type:"LABEL_DETECTION",
maxResults:1
}
end
return apiRequest(data['image'],call_features)
end
|
[
"def api_mode\n if config.mode and API_MODES.include? config.mode.to_sym\n config.mode.to_sym\n else\n DEFAULT_API_MODE\n end\n end",
"def get_mode\n @situation[:mode]\n end",
"def modes\n @client.get('/Journey/Meta/Modes')\n end",
"def mode=(newmode)\n raise ArgumentError, \"Unknown API mode #{newmode.inspect}\" unless MODES.include?(newmode)\n @api_mode = newmode\n end",
"def get_step_mode\n send_request(FUNCTION_GET_STEP_MODE, [], '', 1, 'C')\n end",
"def api_mode; end",
"def mode(mode_id)\n @modes[mode_id]\n end",
"def request\n \"GetFeature\"\n end",
"def show\n @modes = Mode.all\n @mode = Mode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @mode }\n end\n end",
"def current_mode\n\t\tspeed = @data.speed\n\t\tspeed = :unknown if speed == 65535\n\t\t\n\t\tduplex = case @data.duplex\n\t\t\twhen 0 then :half\n\t\t\twhen 1 then :full\n\t\t\telse :unknown\n\t\tend\n\t\t\n\t\tport = case @data.port\n\t\t\twhen 0 then 'T'\n\t\t\twhen 1 then 'AUI'\n\t\t\twhen 2 then 'MII'\n\t\t\twhen 3 then 'F'\n\t\t\twhen 4 then 'BNC'\n\t\t\twhen 255 then 'Other'\n\t\t\telse 'Unknown'\n\t\tend\n\t\t\n\t\tMode.new(speed, duplex, port)\n\tend",
"def call_API\n case @input[:type]\n when :text\n @input = @input[:value]\n call_text_API\n when :url\n @input = @input[:value]\n call_URL_API\n else\n \"Invalid input\"\n end\n end",
"def api_get(action, data)\n api_request(action, data, 'GET')\n end",
"def mode new_mode = nil\n data = mode_data()\n if new_mode\n data[:mode] = new_mode \n mode_data data\n end\n data[:mode]\n end",
"def call_api\n @client.build_url\n @client.get\n assign_data\n end",
"def fetch\n ComicVine::API.get_details_by_url(self.api_detail_url)\n end",
"def call_api\n\t\tputs \"Getting info on elected officials for zipcode: #{zip_code}\"\n\t\t@api_data_on_electeds = JSON.load RestClient.get \"https://congress.api.sunlightfoundation.com/legislators/locate?zip=#{zip_code}&apikey=952d630dfb75498ab63de7a362a85335\"\n\tend",
"def mode\n case @data_list\n when QRNumeric\n :mode_number\n when QRAlphanumeric\n :mode_alpha_numk\n else\n :mode_8bit_byte\n end\n end",
"def mode\n Constants::Modes[raw_match['game_mode']]\n end",
"def game_mode\n fetch('games.minecraft.game_mode')\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Starts the webserver that takes images and sends them to the API. html server runs on
|
def start_webserver()
server = TCPServer.new('localhost', DEFAULT_PORT)
puts "Vision server running on http://localhost:#{DEFAULT_PORT}/"
while session = server.accept
time = Time.new
puts "New connection #{time.inspect}"
if File.exist?(DEFAULT_HTML_PATH) && !File.directory?(DEFAULT_HTML_PATH)
File.open(DEFAULT_HTML_PATH, "rb") do |file|
session.print "HTTP/1.1 200 OK\r\n" +
"Content-Type: text/html\r\n" +
"Content-Length: #{file.size}\r\n" +
"Connection: close\r\n"
session.print "\r\n"
# write the contents of the file to the session
IO.copy_stream(file, session)
end
else
message = "HTML File not found\n"
# respond with a 404 error code to indicate the file does not exist
session.print "HTTP/1.1 404 Not Found\r\n" +
"Content-Type: text/plain\r\n" +
"Content-Length: #{message.size}\r\n" +
"Connection: close\r\n"
session.print "\r\n"
session.print message
end
end
end
|
[
"def serve\n @server.start\n end",
"def run\n check_for_web_build\n build_development\n listener = Listen.to(File.join(absolute_path, 'web')) do |_mod, _add, _rem|\n build_development\n end\n listener.start\n # @todo Get the public folder from a config?\n Gamefic::Sdk::Server.run! source_dir: absolute_path, public_folder: File.join(absolute_path, 'builds', 'web', 'development')\n end",
"def start\n # we trap CTRL+C in the console and kill the server\n trap(\"INT\") { BeEF::Core::Server.instance.stop }\n \n # starts the web server\n @http_server.start\n end",
"def start_server() \n unless @was_opened\n render_host_page\n @was_opened = true\n end\n @webserver = Thread.new do \n @server = TCPServer.new @port\n while session = @server.accept\n request = session.gets\n # puts request #debugging\n session.print \"HTTP/1.1 200\\r\\n\" # 1\n session.print \"Content-Type: application/json\\r\\n\" \n session.print \"Access-Control-Allow-Origin: *\\r\\n\"\n session.print \"\\r\\n\" \n @json_content_file.rewind\n output = @json_content_file.read\n session.print output\n session.close\n end\n end\n end",
"def serve\n server = WEBrick::HTTPServer.new :Port => @port || 4000, :DocumentRoot => 'site/application.html'\n trap('INT') { server.shutdown }\n server.start\n end",
"def run\n trap('INT') { http_server.shutdown }\n http_server.start\n end",
"def start\n run_server\n accept_clients\n end",
"def static_preview(options={})\n #build_dir = options[:build_dir] || settings.build_dir\n #system \"thin start -A file -c #{build_dir}\"\n Static::Server.run(options)\n end",
"def static_preview(options={})\n #build_dir = options[:build_dir] || settings.build_dir\n #system \"thin start -A file -c #{build_dir}\"\n StaticServer.run(options)\n end",
"def main()\n if ARGV.include? '--skip'\n createEmptyBuild()\n exit\n end\n setDebuggingLevel()\n pid = launchWebServer()\n if not waitForWebServer()\n puts red(\"ERROR: \") + \"Failed to start webserver\"\n closeWebServer(pid)\n exit(false)\n end\n pagesToSnapshotJson = loadPagesToSnapshotJson()\n pagesToSnapshot = JSON.parse(pagesToSnapshotJson)\n generateSnapshots(pagesToSnapshot)\n closeWebServer(pid)\nend",
"def serve options\n server = WEBrick::HTTPServer.new :Port => options[:port]\n server.mount '/', Oaf::HTTPHandler, options\n trap 'INT' do server.shutdown end\n server.start\n end",
"def run\n\t\tself.print_hosts # generate all the host_*.html files\n\t\tself.print_index # generate the index.html file\n\t\tself.print_vulns # generate all the vuln_*.html files\n\t\tself.print_vuln_overview # generate the vuln_overview.html file\n\tend",
"def startServer(params)\n @@server = HTTPServer.new(\n :Port => params[:webPort] || DEF_WEB_PORT,\n :Logger => Log4r::Logger.new(\"#{MObject.logger.fullname}::web\"),\n :RequestHandler => lambda {|req, resp|\n beforeRequestHook(req, resp)\n }\n )\n trap(\"INT\") { @@server.shutdown }\n\n path = File.dirname(params[:configDir]) + \"/favicon.ico\"\n @@server.mount(\"/favicon.ico\", HTTPServlet::FileHandler, path) {\n raise HTTPStatus::NotFound, \"#{path} not found.\"\n }\n @@server.mount_proc('/') {|req, res|\n res['Content-Type'] = \"text/xml\"\n body = [%{<?xml version='1.0'?><serviceGroups>}]\n @@registeredServices.each {|path, service|\n info = service.info\n name = service.serviceName\n body << \"<serviceGroup path='#{path}' name='#{name}'><info>#{info}</info></serviceGroup>\"\n }\n body << \"</serviceGroups>\"\n res.body = body.to_s\n }\nend",
"def execute!\n make_web_directory\n generate_universe\n generate_html\n print_success_message\n end",
"def start_all\n UiChanged::Screenshot.async_crawl_and_compare\n head :ok\n end",
"def start\n @server.start\n end",
"def start\n @pid = Process.fork do\n if (@options.rack) \n # NOTE: This does not support command-line setting of repo!\n opts = { :server => :webrick, :host => @host, :port => @port}\n PlanR::Application::LocalHttpd::WebApp.run!( repo, opts ) \n else\n # rack doesn't do the one thing we need it to: \n # pass WebApp instantiation arguments to Webrick.mount\n opts = { :BindAddress => @host, :Port => @port}\n @webrick = ::WEBrick::HTTPServer.new(opts)\n @webrick.mount \"/\", Servlet,\n [ PlanR::Application::LocalHttpd::WebApp, \n @options ]\n @webrick.start\n end\n end\n\n trap('INT') { Process.kill 'INT', @pid }\n trap('TERM') { Process.kill 'INT', @pid }\n\n self\n end",
"def start_webserver\n AYTests::WebServer.new(\n veewee_dir: Pathname.pwd.join(\"definitions\", \"autoyast\"),\n files_dir: files_dir\n ).start\n end",
"def launch_server\n unless File.directory? config.path\n STDERR.puts \"Invalid path (#{config.path})\" \n return\n end\n\n show_status\n Server.prepare\n Server.run!\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
This is called once an outputter has been created. It sets the default formatter and level, if these have been already set.
|
def created_outputter(outputter)
#
# Set the formatter and level for any newly created outputters
#
if @default_formatter
outputter.formatter = @default_formatter if outputter.formatter.is_a?(Log4r::DefaultFormatter)
end
if @default_level
outputter.level = @default_level if outputter.level == Log4r::RootLogger.instance.level
end
result.outputters << outputter
end
|
[
"def initialize\n @formatter = method(:default_formatter)\n end",
"def configure\n yield self\n\n # Ensure every appender has a formatter and a level configuration.\n #\n appenders.each do |appender|\n appender.formatter ||= @formatter if appender.respond_to? 'formatter='\n appender.levels = @levels if appender.levels.empty?\n end\n end",
"def default_formatter=(value); end",
"def default_formatter; end",
"def initialize(options={}, &block)\n # Backward compatibility\n options = {level: options} unless options.is_a?(Hash)\n options = options.dup\n level = options.delete(:level)\n filter = options.delete(:filter)\n @formatter = options.delete(:formatter)\n @formatter = self.class.extract_formatter(@formatter) if @formatter.is_a?(Symbol)\n @formatter ||= block\n # Default to #call method for formatting if defined for an appender\n @formatter ||= (respond_to?(:call) ? self : SemanticLogger::Formatters::Default.new)\n raise(ArgumentError, \"Unknown options: #{options.inspect}\") if options.size > 0\n\n # Appenders don't take a class name, so use this class name if an appender\n # is logged to directly\n super(self.class, level, filter)\n end",
"def default_formatter\n SemanticLogger::Formatters::Default.new\n end",
"def set_outputters(logger, config)\n formatter = create_formatter(config)\n logger.outputters = get_outputters(config, formatter)\n return logger\n end",
"def formatters=(formatters); end",
"def formatter\n @formatter ||= Formatters::Default.new\n end",
"def formatter\r\n @formatter ||= SimpleFormatter.new\r\n end",
"def set_output_format(args)\n # Identify method entry\n debug_print \"#{ self } : #{ __method__ }\\n\"\n\n # Need at least one file in args\n unless args.length == 1\n debug_print \"Invalid argument passed\\n\"\n return false\n end\n\n # Set config flag for CL tag set in config\n @config.cl_output_set = true\n debug_print \"Updated cl_output_set flag: #{ @config.cl_output_set }\\n\"\n\n @config.output_format = case args.pop.to_s\n when 'j', 'json'\n Watson::Formatters::JsonFormatter\n when 'unite'\n Watson::Formatters::UniteFormatter\n when 'silent'\n Watson::Formatters::SilentFormatter\n when 'nocolor'\n Watson::Formatters::NoColorFormatter\n else\n Watson::Formatters::DefaultFormatter\n end\n\n debug_print \"Updated output_format to: #{@config.output_format}\\n\"\n end",
"def format_to_new_ine\n @writer.formatter = proc do |severity, datetime, _progname, msg|\n \"\\n#{msg}\"\n end\n @logger.formatter = proc do |severity, datetime, _progname, msg|\n \"\\n#{msg}\"\n end\n end",
"def initialize(*args)\n old_initialize(*args)\n self.formatter = SimpleFormatter.new\n end",
"def set_optional_formatters\n return if @conf[\"reporter\"].nil?\n\n if @conf[\"reporter\"].key?(\"json-rspec\")\n # We cannot pass in a nil output path. Rspec only accepts a valid string or a IO object.\n if @conf[\"reporter\"][\"json-rspec\"]&.[](\"file\").nil?\n RSpec.configuration.add_formatter(Inspec::Formatters::RspecJson)\n else\n RSpec.configuration.add_formatter(Inspec::Formatters::RspecJson, @conf[\"reporter\"][\"json-rspec\"][\"file\"])\n end\n @conf[\"reporter\"].delete(\"json-rspec\")\n end\n\n formats = @conf[\"reporter\"].select { |k, _v| %w{documentation progress html}.include?(k) }\n formats.each do |k, v|\n # We cannot pass in a nil output path. Rspec only accepts a valid string or a IO object.\n if v&.[](\"file\").nil?\n RSpec.configuration.add_formatter(k.to_sym)\n else\n RSpec.configuration.add_formatter(k.to_sym, v[\"file\"])\n end\n @conf[\"reporter\"].delete(k)\n end\n end",
"def initialize\n super(STDOUT)\n @formatter = RainbowifyFormatter.new\n end",
"def initialize\n @builtin_formatter_path = File.expand_path(\"formatters\", File.dirname(__FILE__))\n @custom_formatter_path = Config.config['formatter_dir'] if Config.config['formatter_dir']\n end",
"def formatter fmt\n @formatter = fmt\n end",
"def remove_default\n @default_formatter = nil\n self\n end",
"def default_formatter\n SemanticLogger::Formatters::Json.new\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Defines a Hash where the settings shall be stored.
|
def initialize
@settings = Hash.new
end
|
[
"def initialize(*args)\n super\n storage[:settings] ||= {}\n end",
"def settings\n @settings ||= {}\n end",
"def setGlobalSettingsHash(hash)\n @@settingsMetainfo.each do |k,v|\n set(k, hash[k.to_s]) if hash.has_key?(k.to_s)\n end\n end",
"def hash\n { hash: @hash, hashType: @hash_type }\n end",
"def to_h\n # This may seem counter-intuitive but we need to call super first as the settings\n # may not have been loaded yet, which means @unmanaged_settings will be empty.\n # We call super first to force any file loading and then merge the unmanaged settings\n settings_hash = super\n @unmanaged_settings = {} if @unmanaged_settings.nil?\n @unmanaged_settings.merge(settings_hash)\n end",
"def settings\n @settings.inject({}){|f,h| f.merge!(h); f}\n end",
"def config=(hash)\n @@config = hash\n end",
"def c=(hash)\n @@config = hash\n end",
"def configure_settings(hash)\n raise TypeError unless hash.is_a?(Hash)\n check_for_active_task\n\n definition = @task.Definition\n\n allow_demand_start = hash[:allow_demand_start]\n allow_hard_terminate = hash[:allow_hard_terminate]\n compatibility = hash[:compatibility]\n delete_expired_task_after = hash[:delete_expired_task_after]\n disallow_start_if_on_batteries = hash[:disallow_start_if_on_batteries]\n enabled = hash[:enabled]\n execution_time_limit = \"PT#{hash[:execution_time_limit] || hash[:max_run_time] || 0}M\"\n hidden = hash[:hidden]\n idle_duration = \"PT#{hash[:idle_duration]||0}M\"\n stop_on_idle_end = hash[:stop_on_idle_end]\n wait_timeout = \"PT#{hash[:wait_timeout]||0}M\"\n restart_on_idle = hash[:restart_on_idle]\n network_settings = hash[:network_settings]\n priority = hash[:priority]\n restart_count = hash[:restart_count]\n restart_interval = hash[:restart_interval]\n run_only_if_idle = hash[:run_only_if_idle]\n run_only_if_network_available = hash[:run_only_if_network_available]\n start_when_available = hash[:start_when_available]\n stop_if_going_on_batteries = hash[:stop_if_going_on_batteries]\n wake_to_run = hash[:wake_to_run]\n xml_text = hash[:xml_text] || hash[:xml]\n\n definition.Settings.AllowDemandStart = allow_demand_start if allow_demand_start\n definition.Settings.AllowHardTerminate = allow_hard_terminate if allow_hard_terminate\n definition.Settings.Compatibility = compatibility if compatibility\n definition.Settings.DeleteExpiredTaskAfter = delete_expired_task_after if delete_expired_task_after\n definition.Settings.DisallowStartIfOnBatteries = disallow_start_if_on_batteries if disallow_start_if_on_batteries\n definition.Settings.Enabled = enabled if enabled\n definition.Settings.ExecutionTimeLimit = execution_time_limit if execution_time_limit\n definition.Settings.Hidden = hidden if hidden\n definition.Settings.IdleSettings.IdleDuration = idle_duration if idle_duration\n definition.Settings.IdleSettings.StopOnIdleEnd = stop_on_idle_end if stop_on_idle_end\n definition.Settings.IdleSettings.WaitTimeout = wait_timeout if wait_timeout\n definition.Settings.IdleSettings.RestartOnIdle = restart_on_idle if restart_on_idle\n definition.Settings.NetworkSettings = network_settings if network_settings\n definition.Settings.Priority = priority if priority\n definition.Settings.RestartCount = restart_count if restart_count\n definition.Settings.RestartInterval = restart_interval if restart_interval\n definition.Settings.RunOnlyIfIdle = run_only_if_idle if run_only_if_idle\n definition.Settings.RunOnlyIfNetworkAvailable = run_only_if_network_available if run_only_if_network_available\n definition.Settings.StartWhenAvailable = start_when_available if start_when_available\n definition.Settings.StopIfGoingOnBatteries = stop_if_going_on_batteries if stop_if_going_on_batteries\n definition.Settings.WakeToRun = wake_to_run if wake_to_run\n definition.Settings.XmlText = xml_text if xml_text\n\n update_task_definition(definition)\n\n hash\n end",
"def to_hash()\n Hash[\n self.class.settings.map do |key|\n begin\n [key, self[key]]\n rescue ArgumentError\n nil\n end\n end.compact()\n ]\n end",
"def type_to_form_ready_hash_site\n {\n username: resource[:username],\n password: resource[:password],\n configStoreConnection: JSON.generate(type_to_form_ready_hash_configstore),\n settings: JSON.generate(type_to_form_ready_hash_logsettings),\n runAsync: false,\n }\n end",
"def get_settings\n settings = {}\n settings['sharing_scope'] = self.sharing_scope\n settings['access_type'] = self.access_type\n settings['use_custom_sharing'] = self.use_custom_sharing\n settings['use_whitelist'] = self.use_whitelist\n settings['use_blacklist'] = self.use_blacklist\n return settings\n end",
"def to_hash\n unless @indifferent_access\n indifferent_access!\n end\n @settings\n end",
"def config(hash)\n merge!(self.class.new(hash))\n end",
"def set_hash(name)\n hash_name = name.to_s.downcase.tr('-', '').to_sym\n\n unless ALLOWED_HASH.include?(hash_name)\n fail NotApplicableError.new(\"hash: '#{hash_name}' is not a valid option, available options: #{ALLOWED_HASH.to_a.join(', ')}\")\n end\n\n @hasher = HASH_CLASSES[hash_name]\n end",
"def to_hash\n configuration\n end",
"def to_hash\n self.config.to_hash\n end",
"def rubocop_config_store=(_); end",
"def to_hash\n @config.dup\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /massive_loads/1 GET /massive_loads/1.json
|
def show
@massive_load = MassiveLoad.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @massive_load }
end
end
|
[
"def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end",
"def index\n @loads = Load.all\n end",
"def index\n @cpu_loads = CpuLoad.all\n end",
"def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @load }\n end\n end",
"def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end",
"def index\n @loadbalancers = getmydata(\"Loadbalancer\")\n pagination\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @loadbalancers }\n end\n end",
"def show\n @import_batch = ImportBatch.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @import_batch }\n end\n end",
"def index\n if params[:shipper]\n @loads = current_user.loads.where(shipper_id: params[:shipper])\n elsif params[:carrier]\n @loads = current_user.loads.where(carrier_id: params[:carrier])\n else\n @loads = current_user.loads.all\n end\n\n json_response(@loads)\n end",
"def create\n @massive_load = MassiveLoad.new(params[:massive_load])\n\n respond_to do |format|\n if @massive_load.save\n read_excel\n format.html { redirect_to @massive_load, notice: t(:successfully_created) }\n format.json { render json: @massive_load, status: :created, location: @massive_load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @massive_load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end",
"def create\n @massive_load = MassiveLoad.new(params[:massive_load])\n\n respond_to do |format|\n if @massive_load.save\n @has_error = false\n read_excel\n if @has_error\n flash[:error] = t(\"massive_load.format_error\")\n MassiveLoad.destroy(@massive_load)\n redirect_to new_massive_load_path and return\n end\n format.html { redirect_to @massive_load, notice: t(:successfully_created) }\n format.json { render json: @massive_load, status: :created, location: @massive_load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @massive_load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @product_loads = ProductLoad.active.order(:vending_machine_id).all\n end",
"def show\n @loadcall = Loadcall.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loadcall }\n end\n end",
"def index\n @mallet_runs = MalletRun.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mallet_runs }\n end\n end",
"def index\n @local_cpu_summaries = LocalCpuSummary.orderByParms('id desc',params).paginate(:page=>params[:page], :per_page => config.itemsPerPageHTML)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @local_cpu_summaries }\n end\n end",
"def show\n @timechunk = Timechunk.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @timechunk }\n end\n end",
"def index\n @loadings = Loading.all\n end",
"def show\n render json: @load_type\n end",
"def show\n @load_file = LoadFile.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @load_file }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /massive_loads/new GET /massive_loads/new.json
|
def new
@massive_load = MassiveLoad.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @massive_load }
end
end
|
[
"def new\n @load_test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @load_test }\n end\n end",
"def new\n @loadcall = Loadcall.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loadcall }\n end\n end",
"def new\n @load_database = LoadDatabase.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @load_database }\n end\n end",
"def new\n @dump = Dump.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dump }\n end\n end",
"def new\n @fload = Fload.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @fload }\n end\n end",
"def new\n @import_batch = ImportBatch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_batch }\n end\n end",
"def new\n @launch = Launch.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @launch }\n end\n end",
"def new\n @test = LoadTest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test }\n end\n end",
"def new\n @livestock_import = LivestockImport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @livestock_import }\n end\n end",
"def new\n @import = Import.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import }\n end\n end",
"def new\n @progress = @task.progresses.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @progress }\n end\n end",
"def new\n @import_job = ImportJob.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @import_job }\n end\n end",
"def new\n @importer = Importer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importer }\n end\n end",
"def new\n @collect = Collect.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collect }\n end\n end",
"def new\n @pool = Pool.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pool }\n end\n end",
"def new\n @importer = Importer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @importer}\n end\n end",
"def new\n @load_balancer = LoadBalancer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @load_balancer }\n end\n end",
"def create\n @load = loads.new(load_params)\n\n respond_to do |format|\n if @load.save\n format.html { redirect_to @load, notice: 'Load was successfully created.' }\n format.json { render :show, status: :created, location: @load }\n else\n format.html { render :new }\n format.json { render json: @load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @import_request = ImportRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @import_request }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /massive_loads POST /massive_loads.json
|
def create
@massive_load = MassiveLoad.new(params[:massive_load])
respond_to do |format|
if @massive_load.save
read_excel
format.html { redirect_to @massive_load, notice: t(:successfully_created) }
format.json { render json: @massive_load, status: :created, location: @massive_load }
else
format.html { render action: "new" }
format.json { render json: @massive_load.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @massive_load = MassiveLoad.new(params[:massive_load])\n\n respond_to do |format|\n if @massive_load.save\n @has_error = false\n read_excel\n if @has_error\n flash[:error] = t(\"massive_load.format_error\")\n MassiveLoad.destroy(@massive_load)\n redirect_to new_massive_load_path and return\n end\n format.html { redirect_to @massive_load, notice: t(:successfully_created) }\n format.json { render json: @massive_load, status: :created, location: @massive_load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @massive_load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @massive_load = MassiveLoad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @massive_load }\n end\n end",
"def create\n @load = loads.new(load_params)\n\n respond_to do |format|\n if @load.save\n format.html { redirect_to @load, notice: 'Load was successfully created.' }\n format.json { render :show, status: :created, location: @load }\n else\n format.html { render :new }\n format.json { render json: @load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bulk_create\n __debug_route\n __debug_request\n @list = bulk_create_manifest_items\n render_json bulk_update_response\n rescue => error\n post_response(error)\n end",
"def bulk_create\n __log_activity\n __debug_route\n __debug_request\n @list = wf_bulk(start_state: :creating, event: :submit, variant: :create)\n wf_check_partial_failure\n post_response(:ok, @list, xhr: false)\n rescue UploadWorkflow::SubmitError, Record::SubmitError => error\n post_response(:conflict, error, xhr: false)\n rescue => error\n post_response(error, xhr: false)\n end",
"def show\n @massive_load = MassiveLoad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @massive_load }\n end\n end",
"def create\n respond_to do |format|\n if @load.save\n format.html { redirect_to @load, notice: 'Load was successfully created.' }\n format.json { render json: @load, status: :created, location: @load }\n else\n format.html { render action: \"new\" }\n format.json { render json: @load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end",
"def create\n @load = Load.new(load_params)\n @client=Client.all\n @branch_office=BranchOffice.all\n @worker=Worker.all\n @vehicle=Vehicle.all\n respond_to do |format|\n if @load.save\n format.html { redirect_to @load, notice: 'La carga se guardó correctamente.' }\n format.json { render :show, status: :created, location: @load }\n else\n format.html { render :new }\n format.json { render json: @load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def upload\n data = params[:json_data]\n\t\trecalls = JSON.parse(data)\n\t\trecalls.each do |recall|\n\t\t\t@recall = Recall.find_by_id(recall['id'])\n\t\t\tif @recall.nil?\n\t\t\t\t@recall = Recall.create(:id => recall['id'], :product_id => recall['product_id'], :reason => recall['reason'], :level_id => recall['level_id'], :region_id => recall['region_id'], :contact_id => recall['contact_id'], :date => recall['date'])\n\t\t\tend\n\t\tend\n\t\t\n respond_to do |format|\n format.html { redirect_to :controller => 'recalls', :action => 'index' }\n end\n \n end",
"def create\n @cpu_load = CpuLoad.new(cpu_load_params)\n\n respond_to do |format|\n if @cpu_load.save\n format.html { redirect_to @cpu_load, notice: 'Cpu load was successfully created.' }\n format.json { render :show, status: :created, location: @cpu_load }\n else\n format.html { render :new }\n format.json { render json: @cpu_load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def chunks\n content={:chunks=>local_store.chunks.keys}\n respond 200, content\n end",
"def bulk_new\n @bulk_new = BulkNew.new\n\n respond_to do |format|\n format.html # bulk_new.html.erb\n format.json { render json: @bulk_new }\n end\n end",
"def create\n @page_load = PageLoad.new(page_load_params)\n\n respond_to do |format|\n if @page_load.save\n format.html { redirect_to @page_load, notice: 'Page load was successfully created.' }\n format.json { render :show, status: :created, location: @page_load }\n else\n format.html { render :new }\n format.json { render json: @page_load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def bulk_new\n __debug_route\n bulk_new_manifest_items\n rescue => error\n failure_status(error)\n end",
"def load_upload_records\n @uploaded = []\n# ['upload_01.json', 'upload_02.json'].each do |file|\n ['upload_03.json'].each do |file|\n File.open(file, 'r').each do |line|\n next if line.strip() == ''\n @uploaded.push(JSON.parse(line))\n end\n end\n end",
"def create\n @product_load = ProductLoad.new(product_load_params)\n\n respond_to do |format|\n if @product_load.save\n format.html { redirect_to @product_load, notice: 'Product load was successfully created.' }\n format.json { render :show, status: :created, location: @product_load }\n else\n format.html { render :new }\n format.json { render json: @product_load.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @workload = Workload.new(workload_params)\n\n respond_to do |format|\n if @workload.save\n format.html { redirect_to @workload, notice: 'Workload was successfully created.' }\n format.json { render :show, status: :created, location: @workload }\n else\n format.html { render :new }\n format.json { render json: @workload.errors, status: :unprocessable_entity }\n end\n end\n end",
"def run_bulk; end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /massive_loads/1 DELETE /massive_loads/1.json
|
def destroy
@massive_load = MassiveLoad.find(params[:id])
@massive_load.destroy
respond_to do |format|
format.html { redirect_to massive_loads_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @load.destroy\n respond_to do |format|\n format.html { redirect_to loads_url, notice: 'Load was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @json.destroy\n\n head :no_content\n end",
"def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end",
"def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @load = Load.find(params[:id])\n @load.destroy\n\n respond_to do |format|\n format.html { redirect_to(loads_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @load_file = LoadFile.find(params[:id])\n @load_file.destroy\n\n respond_to do |format|\n format.html { redirect_to load_files_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cpu_load.destroy\n respond_to do |format|\n format.html { redirect_to cpu_loads_url, notice: 'Cpu load was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @load_test = LoadTest.find(params[:id])\n @load_test.destroy\n\n respond_to do |format|\n format.html { redirect_to load_tests_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @single_action.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @demand.destroy\n respond_to do |format|\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 @mast.destroy\n respond_to do |format|\n format.html { redirect_to masts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @timechunk = Timechunk.find(params[:id])\n @timechunk.destroy\n\n respond_to do |format|\n format.html { redirect_to timechunks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fload = Fload.find(params[:id])\n @fload.destroy\n\n respond_to do |format|\n format.html { redirect_to floads_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @loadcall = Loadcall.find(params[:id])\n @loadcall.destroy\n\n respond_to do |format|\n format.html { redirect_to loadcalls_url }\n format.json { head :no_content }\n end\n end",
"def bulk_load_delete(name)\n @api.bulk_load_delete(name)\n end",
"def destroy\n @roadblock.destroy\n respond_to do |format|\n format.html { redirect_to \"/roadblocks-dash\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stall.destroy\n respond_to do |format|\n format.html { redirect_to stalls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @load_balancer = LoadBalancer.find(params[:id])\n @load_balancer.destroy\n\n respond_to do |format|\n format.html { redirect_to load_balancers_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /audit_trails or /audit_trails.json
|
def index
@audit_trails = AuditTrail.all
end
|
[
"def index\n\t\taudit_trail\n\t\trender :action => 'audit_trail'\n\tend",
"def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend",
"def audit_account(id, options={}) path = \"/api/v2/accounts/#{id}/audit\"\n get(path, options, AvaTax::VERSION) end",
"def index\n @audit_logs = @user.audits\n end",
"def index\n response = ::TrailFetcher.new.get\n puts response.read_body\n @trails = Trail.all\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def index\n @audits = Audit.all\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def index\n @audit_logs = AuditLog.all\n end",
"def index\n @user_audits = UserAudit.all\n end",
"def retrieve_audit_log(audit_log_id)\n start.uri('/api/system/audit-log')\n .url_segment(audit_log_id)\n .get()\n .go()\n end",
"def list_global_audit_logs_for_date_range(args = {}) \n get(\"/auditlog.json/global\", args)\nend",
"def index\n @audits = Audit.where('auditable_id = ? AND LOWER(auditable_type) = LOWER(?)', params[:id], params[:type])\n end",
"def retrieve_audit_log(audit_log_id)\n start.uri('/api/system/audit-log')\n .url_segment(audit_log_id)\n .get()\n .go()\n end",
"def index\n @auditvs = Auditv.all.page(params[:page]).per(10)\n end",
"def list_trails()\r\n resp = @cloudtrail.describe_trails({})\r\n \r\n puts\r\n puts \"Found #{resp.trail_list.count} trail(s):\"\r\n puts\r\n \r\n resp.trail_list.each do |trail|\r\n puts \"Name: #{trail.name}\"\r\n puts \"Amazon S3 bucket name: #{trail.s3_bucket_name}\" \r\n puts\r\n end\r\n\r\n # Uncomment the following line to print all available information.\r\n # puts resp\r\n end",
"def index\n @trails = current_user.trails\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @trails.to_xml }\n end\n end",
"def list(filter=KalturaNotImplemented, pager=KalturaNotImplemented)\n\t\t\tkparams = {}\n\t\t\tclient.add_param(kparams, 'filter', filter);\n\t\t\tclient.add_param(kparams, 'pager', pager);\n\t\t\tclient.queue_service_action_call('audit_audittrail', 'list', kparams);\n\t\t\tif (client.is_multirequest)\n\t\t\t\treturn nil;\n\t\t\tend\n\t\t\treturn client.do_queue();\n\t\tend",
"def search_audit_logs(request)\n start.uri('/api/system/audit-log/search')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /audit_trails or /audit_trails.json
|
def create
@audit_trail = AuditTrail.new(audit_trail_params)
respond_to do |format|
if @audit_trail.save
format.html { redirect_to @audit_trail, notice: "Audit trail was successfully created." }
format.json { render :show, status: :created, location: @audit_trail }
else
format.html { render :new, status: :unprocessable_entity }
format.json { render json: @audit_trail.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create_audit_log(request)\n start.uri('/api/system/audit-log')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def create_audit_log(request)\n start.uri('/api/system/audit-log')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def create\n @audit = current_user.audits.build(params[:audit])\n\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @audit, notice: 'Audit was successfully created.' }\n format.json { render json: @audit, status: :created, location: @audit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @audit_trails = AuditTrail.all\n end",
"def create\n @audit_log = AuditLog.new(audit_log_params)\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to @audit_log, notice: 'Audit log was successfully created.' }\n format.json { render :show, status: :created, location: @audit_log }\n else\n format.html { render :new }\n format.json { render json: @audit_log.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @labtech_audit = LabtechAudit.new(labtech_audit_params)\n\n respond_to do |format|\n if @labtech_audit.save\n format.html { redirect_to @labtech_audit, notice: 'Labtech audit was successfully created.' }\n format.json { render :show, status: :created, location: @labtech_audit }\n else\n format.html { render :new }\n format.json { render json: @labtech_audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_audit_log\n if (@audit_log && @audit_log.auditable)\n if [\"update\",\"destroy\"].include?(action_name)\n update_and_destroy_audit\n elsif action_name == \"create\"\n create_audit\n end \n end\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def audit\n render :json=>@generic_file.audit\n end",
"def create\n @audit_log = AuditLog.new(params[:audit_log])\n\n respond_to do |format|\n if @audit_log.save\n format.html { redirect_to(@audit_log, :notice => 'Audit log was successfully created.') }\n format.xml { render :xml => @audit_log, :status => :created, :location => @audit_log }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @audit_log.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @audita = Audita.new(audita_params)\n\n respond_to do |format|\n if @audita.save\n format.html { redirect_to @audita, notice: 'Audita was successfully created.' }\n format.json { render :show, status: :created, location: @audita }\n else\n format.html { render :new }\n format.json { render json: @audita.errors, status: :unprocessable_entity }\n end\n end\n end",
"def add_triage_audit_log( args = {})\n # \n # Wed Jan 5 23:45:29 IST 2011, ramonrails\n # * pick up last status from unsaved changes, or fire query\n _last_status = (self.changed? ? status_was : last_triage_status)\n if (status != _last_status)\n options = { :status => _last_status, :is_dismissed => dismissed_from_triage?, :description => \"Status updated to [#{status}]. Auto triggered through user model.\" }\n log = TriageAuditLog.new( options.merge( args).merge( :user => self, :created_by => self.created_by, :updated_by => self.created_by))\n log.send( :create_without_callbacks)\n self.last_triage_audit_log = log # link it, since we do not have callbacks\n end\n end",
"def api_audit\n # authorize! :api_audit, Vehicle.new\n vehicle = Vehicle.find_by_id(params[:id])\n # filter params\n days = params[:days] || \"21\"\n type = params[:type] || \"\"\n # aquacadets\n gon.notes = []\n if vehicle.present?\n gon.notes = vehicle.api_audit_notes\n .note_of_sub_type(type)\n .past_x_days(days)\n .reverse\n gon.parameters = { \"days\" => days, \"type\" => type }\n # Only needed on first load\n if request.format.html?\n gon.path = \"/vehicles/#{vehicle.id}/api-audit\"\n gon.recordName = vehicle.make_model_description\n gon.uid = vehicle.lot_num\n end\n end\n\n respond_to do |format|\n format.html { render \"shared/api_audit.html.erb\" }\n format.json { render json: { notes: gon.notes.as_json, parameters: gon.parameters } }\n end\n end",
"def index\n\t\taudit_trail\n\t\trender :action => 'audit_trail'\n\tend",
"def create\n @audit = @project.audits.build(audit_params)\n\n respond_to do |format|\n if @audit.save\n format.html { redirect_to @project, notice: 'Audit was successfully created.' }\n format.json { render :show, status: :created, location: @project }\n else\n format.html { render :new }\n format.json { render json: @project.errors, status: :unprocessable_entity }\n end\n end\n end",
"def search_audit_logs(request)\n start.uri('/api/system/audit-log/search')\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .post()\n .go()\n end",
"def create\n @order_audit = OrderAudit.new(order_audit_params)\n\n respond_to do |format|\n if @order_audit.save\n format.html { redirect_to @order_audit, notice: 'Order audit was successfully created.' }\n format.json { render :show, status: :created, location: @order_audit }\n else\n format.html { render :new }\n format.json { render json: @order_audit.errors, status: :unprocessable_entity }\n end\n end\n end",
"def list_audit_logs_for_date_range_for_tenant(args = {}) \n get(\"/tenants.json/#{args[:tenantId]}/auditlog\", args)\nend",
"def create\n @ainit = Ainit.new(params[:ainit])\n\n respond_to do |format|\n if @ainit.save\n format.html { redirect_to @ainit, notice: 'Audit was successfully created.' }\n format.json { render json: @ainit, status: :created, location: @ainit }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ainit.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /moto_registration_numbers/1 GET /moto_registration_numbers/1.xml
|
def show
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @moto_registration_number }
end
end
|
[
"def show\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end",
"def index\n @phone_numbers = @kontact_information.phone_numbers.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @phone_numbers }\n end\n end",
"def index\n @registration_numbers = RegistrationNumber.all\n end",
"def retrieve_registration_report(application_id, start, _end)\n start.uri('/api/report/registration')\n .url_parameter('applicationId', application_id)\n .url_parameter('start', start)\n .url_parameter('end', _end)\n .get()\n .go()\n end",
"def retrieve_registration_report(application_id, start, _end)\n start.uri('/api/report/registration')\n .url_parameter('applicationId', application_id)\n .url_parameter('start', start)\n .url_parameter('end', _end)\n .get()\n .go()\n end",
"def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n respond_to do |format|\n if @moto_registration_number.save\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }\n format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def index\n @registered_numbers = RegisteredNumber.all\n end",
"def destroy\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n @moto_registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def index\n @patientregistrations = Patientregistration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @patientregistrations }\n end\n end",
"def index\n @registrations = Registration.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registrations }\n end\n end",
"def retrieve_registration(user_id, application_id)\n start.uri('/api/user/registration')\n .url_segment(user_id)\n .url_segment(application_id)\n .get()\n .go()\n end",
"def retrieve_registration(user_id, application_id)\n start.uri('/api/user/registration')\n .url_segment(user_id)\n .url_segment(application_id)\n .get()\n .go()\n end",
"def index\n @registration_codes = RegistrationCode.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @registration_codes }\n end\n end",
"def show\n @registration_information = RegistrationInformation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @registration_information }\n end\n end",
"def parse_simple_registrations(response)\n registrations = attributes_to_hash(response, \"//registration\", \"id\")\n end",
"def monitoring_xml(num = nil)\n return @client.call(HOST_POOL_METHODS[:monitoring]) if num.nil?\n\n @client.call(HOST_POOL_METHODS[:monitoring], num.to_i)\n end",
"def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /moto_registration_numbers/new GET /moto_registration_numbers/new.xml
|
def new
@moto_registration_number = MotoRegistrationNumber.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @moto_registration_number }
end
end
|
[
"def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n respond_to do |format|\n if @moto_registration_number.save\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }\n format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @registration = Registration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration }\n end\n end",
"def new\n @number = Number.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @number }\n end\n end",
"def new\n @registration_information = RegistrationInformation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_information }\n end\n end",
"def new\n @registration = NodeRegistration.new\n node_id = params[:node]\n \n if(mac = params[:node_mac])\n mac.gsub!(/[^A-Fa-f0-9]/,'')\n node_id = mac.to_i(16)\n logger.info \"Got node-id: #{node_id}\"\n end\n\n node = Node.find_by_id(node_id) || Node.new(id: node_id)\n \n if(node && node.node_registration.present?)\n flash[:error] = \"Fehler: Der Node #{node.mac} ist bereits registriert.\"\n redirect_to app_index_path\n return\n end\n\n @registration.node = node\n @registration.owner = current_user\n @registration.osm_loc = \"Suchbegriff\"\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @registration }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render xml: @download_registration }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_criterion }\n end\n end",
"def new\n @contact = Contact.find_by_id_and_user_id(params[:contact_id], session[:user].id)\n @telno = TelephoneNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telno }\n end\n end",
"def new\n @phone_number = PhoneNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phone_number }\n end\n end",
"def new_rest\n @page_usage = PageUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page_usage }\n end\n end",
"def new\n @phone_number = @kontact_information.phone_numbers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.mobile\n format.xml { render :xml => @phone_number }\n end\n end",
"def new\n @called_number = CalledNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @called_number }\n end\n end",
"def new\n @registration_code = RegistrationCode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_code }\n end\n end",
"def new\n @registration_renewal = RegistrationRenewal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_renewal }\n end\n end",
"def new_rest\n @v1_page_usage = V1PageUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @v1_page_usage }\n end\n end",
"def new\n @telephone = Telephone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @telephone }\n end\n end",
"def new\n @identity = Identity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @identity }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /moto_registration_numbers POST /moto_registration_numbers.xml
|
def create
@moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])
respond_to do |format|
if @moto_registration_number.save
format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }
format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }
else
format.html { render :action => "new" }
format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @registration_number = RegistrationNumber.new(registration_number_params)\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully created.' }\n format.json { render :show, status: :created, location: @registration_number }\n else\n format.html { render :new }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @registered_number = RegisteredNumber.new(registered_number_params)\n\n respond_to do |format|\n if @registered_number.save\n format.html { redirect_to @registered_number, notice: 'Registered number was successfully created.' }\n format.json { render :show, status: :created, location: @registered_number }\n else\n format.html { render :new }\n format.json { render json: @registered_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @patientregistration_data = PatientregistrationData.new(params[:patientregistration_data])\n\n respond_to do |format|\n if @patientregistration_data.save\n\t\t@n=Number.find_by_names(\"reciept\")\n\t\t@n.value=@patientregistration_data.reciept_no\n\t\t@n.update_attributes(params[:n])\n format.html { redirect_to(\"http://localhost:3000/patientregistration_datas/new\") }\n format.xml { render :xml => @patientregistration_data, :status => :created, :location => @patientregistration_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientregistration_data.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end",
"def create\n @node_registration = NodeRegistration.new(params[:node_registration])\n \n respond_to do |format|\n if @node_registration.save\n format.html { redirect_to(nodes_path, :notice => 'Node erfolgreich registiert') }\n format.xml { render :xml => @node_registration, :status => :created, :location => @node_registration }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @node_registration.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n p = params[:node_registration]\n \n @registration = NodeRegistration.new(latitude: p[:latitude],longitude: p[:longitude],\n operator_name: p[:operator_name], operator_email: p[:operator_email],\n name: p[:name], node_at: p[:node_at],notice: p[:notice],\n loc_str: p[:loc_str], osm_loc: p[:osm_loc])\n \n if permitted_to?(:set_owner, @registration)\n @registration.owner_id = p[:owner_id]\n else\n @registration.owner = current_user\n end\n @registration.creator = current_user\n @registration.updater = current_user\n\n respond_to do |format|\n if @registration.save\n format.html { redirect_to root_path, notice: 'Node erfolgreich registriert' }\n format.json { render json: @registration, status: :created, location: @registration }\n else\n format.html { render action: \"new\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @registration_numbers = RegistrationNumber.all\n end",
"def parse_simple_registrations(response)\n registrations = attributes_to_hash(response, \"//registration\", \"id\")\n end",
"def destroy\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n @moto_registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @registrationn = Registrationn.new(registrationn_params)\n\n respond_to do |format|\n if @registrationn.save\n format.html { redirect_to @registrationn, notice: 'Registrationn was successfully created.' }\n format.json { render :show, status: :created, location: @registrationn }\n else\n format.html { render :new }\n format.json { render json: @registrationn.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @registration_number = RegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @registration_number }\n end\n end",
"def update\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @moto_registration_number.update_attributes(params[:moto_registration_number])\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def register\n @processing_node = ProcessingNode.find_by_uuid(params[:id])\n\n respond_to do |format|\n if @processing_node and @processing_node.update_attributes(:ip_address => request.remote_ip)\n ((@processing_node.status == 'waiting_approval') ? @processing_node.activate_waiting_approval! : @processing_node.activate!)\n flash[:notice] = 'Processing Node was successfully updated.'\n format.html { redirect_to(@processing_node) }\n format.xml { head :ok }\n else\n flash[:notice] = 'Processing Node could not be updated.'\n format.html { redirect_to(processing_nodes_path) }\n format.xml { render :xml => @processing_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @auto_number = AutoNumber.new(auto_number_params)\n\n respond_to do |format|\n if @auto_number.save\n format.html { redirect_to @auto_number, notice: \"Created new number: #{@auto_number.file_name}\" }\n format.json { render :show, status: :created, location: @auto_number }\n else\n format.html { render :new }\n format.json { render json: @auto_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @numero_registro = NumeroRegistro.new(numero_registro_params)\n\n respond_to do |format|\n if @numero_registro.save\n format.html { redirect_to @numero_registro, notice: 'El número de registro fue creado correctamente.' }\n format.json { render :show, status: :created, location: @numero_registro }\n else\n format.html { render :new }\n format.json { render json: @numero_registro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def retrieve_registration_report(application_id, start, _end)\n start.uri('/api/report/registration')\n .url_parameter('applicationId', application_id)\n .url_parameter('start', start)\n .url_parameter('end', _end)\n .get()\n .go()\n end",
"def export_registrations(distribution_method:, time_range:, contact_fields:, account: nil, **params)\n params.merge!(\n distribution_method: distribution_method,\n time_range: time_range,\n contact_fields: contact_fields\n )\n post account, \"contact/getregistrations\", params\n end",
"def retrieve_registration_report(application_id, start, _end)\n start.uri('/api/report/registration')\n .url_parameter('applicationId', application_id)\n .url_parameter('start', start)\n .url_parameter('end', _end)\n .get()\n .go()\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /moto_registration_numbers/1 PUT /moto_registration_numbers/1.xml
|
def update
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
respond_to do |format|
if @moto_registration_number.update_attributes(params[:moto_registration_number])
format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }
end
end
end
|
[
"def update\n @registration_number = RegistrationNumber.find(params[:id])\n\n respond_to do |format|\n if @registration_number.update_attributes(params[:registration_number])\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @moto_registration_number = MotoRegistrationNumber.new(params[:moto_registration_number])\n\n respond_to do |format|\n if @moto_registration_number.save\n format.html { redirect_to(@moto_registration_number, :notice => 'Moto registration number was successfully created.') }\n format.xml { render :xml => @moto_registration_number, :status => :created, :location => @moto_registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @moto_registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @registration_number.update(registration_number_params)\n format.html { redirect_to @registration_number, notice: 'Registration number was successfully updated.' }\n format.json { render :show, status: :ok, location: @registration_number }\n else\n format.html { render :edit }\n format.json { render json: @registration_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def UpdateRegistrations(request_xml)\n request = SOAP::StreamHandler::ConnectionData.new(request_xml)\n stream = SOAP::HTTPStreamHandler.new(SOAP::Property.new)\n resp_data = stream.send('http://www.regonline.com/webservices/RegistrationUpdateService.asmx',\n request,\n \"http://www.regonline.com/webservices/2007/08/RegistrationUpdateService/UpdateRegistrations\"\n )\n resp_data.receive_string\n end",
"def update\n respond_to do |format|\n if @registered_number.update(registered_number_params)\n format.html { redirect_to @registered_number, notice: 'Registered number was successfully updated.' }\n format.json { render :show, status: :ok, location: @registered_number }\n else\n format.html { render :edit }\n format.json { render json: @registered_number.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n @moto_registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(moto_registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def update_registration(user_id, request)\n start.uri('/api/user/registration')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end",
"def update number, routes\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end",
"def update_registration(user_id, request)\n start.uri('/api/user/registration')\n .url_segment(user_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end",
"def update\n @node_registration = NodeRegistration.find(params[:id])\n\n respond_to do |format|\n if @node_registration.update_attributes(params[:node_registration])\n format.html { redirect_to(nodes_path, :notice => 'Registrierung erfolgreich angepasst') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @node_registration.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def register\n @processing_node = ProcessingNode.find_by_uuid(params[:id])\n\n respond_to do |format|\n if @processing_node and @processing_node.update_attributes(:ip_address => request.remote_ip)\n ((@processing_node.status == 'waiting_approval') ? @processing_node.activate_waiting_approval! : @processing_node.activate!)\n flash[:notice] = 'Processing Node was successfully updated.'\n format.html { redirect_to(@processing_node) }\n format.xml { head :ok }\n else\n flash[:notice] = 'Processing Node could not be updated.'\n format.html { redirect_to(processing_nodes_path) }\n format.xml { render :xml => @processing_node.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n p = params[:node_registration]\n @registration = NodeRegistration.find(params[:id])\n if permitted_to?(:set_owner, @registration)\n @registration.owner_id = p[:owner_id]\n else\n @registration.owner = current_user\n end\n @registration.updater = current_user\n\n respond_to do |format|\n if @registration.update_attributes(latitude: p[:latitude],longitude: p[:longitude],\n operator_name: p[:operator_name], operator_email: p[:operator_email],\n name: p[:name], node_at: p[:node_at],notice: p[:notice],\n loc_str: p[:loc_str], osm_loc: p[:osm_loc])\n \n format.html { redirect_to nodes_path, notice: 'Registrierung erfolgreich gespeichert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registration.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @registration_number = RegistrationNumber.new(params[:registration_number])\n\n respond_to do |format|\n if @registration_number.save\n format.html { redirect_to(@registration_number, :notice => 'Registration number was successfully created.') }\n format.xml { render :xml => @registration_number, :status => :created, :location => @registration_number }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @registration_number.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def new\n @moto_registration_number = MotoRegistrationNumber.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end",
"def create\n @patientregistration_data = PatientregistrationData.new(params[:patientregistration_data])\n\n respond_to do |format|\n if @patientregistration_data.save\n\t\t@n=Number.find_by_names(\"reciept\")\n\t\t@n.value=@patientregistration_data.reciept_no\n\t\t@n.update_attributes(params[:n])\n format.html { redirect_to(\"http://localhost:3000/patientregistration_datas/new\") }\n format.xml { render :xml => @patientregistration_data, :status => :created, :location => @patientregistration_data }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @patientregistration_data.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put_tax_and_registration_by_number(organization, number, tax_registration_form, incoming={})\n HttpClient::Preconditions.assert_class('organization', organization, String)\n HttpClient::Preconditions.assert_class('number', number, String)\n opts = HttpClient::Helper.symbolize_keys(incoming)\n query = {\n :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))\n }.delete_if { |k, v| v.nil? }\n (x = tax_registration_form; x.is_a?(::Io::Flow::V0::Models::TaxRegistrationForm) ? x : ::Io::Flow::V0::Models::TaxRegistrationForm.new(x))\n r = @client.request(\"/#{CGI.escape(organization)}/orders/#{CGI.escape(number)}/tax/registration\").with_query(query).with_json(tax_registration_form.to_json).put\n ::Io::Flow::V0::Models::TaxRegistration.new(r)\n end",
"def show\n @moto_registration_number = MotoRegistrationNumber.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @moto_registration_number }\n end\n end",
"def update_rest\n @v1_page_usage = V1PageUsage.find(params[:id])\n\n respond_to do |format|\n if @v1_page_usage.update_attributes(params[:v1_page_usage])\n flash[:notice] = 'V1PageUsage was successfully updated.'\n format.html { redirect_to(@v1_page_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @v1_page_usage.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def setRegistrationId\n if (params.has_key?(:device_uid) && params.has_key?(:regid))\n device = Device.find_by_uuid(params[:device_uid])\n device.gcm_id = params[:regid]\n device.save\n render status: 200, text: \"\"\n else\n render status: 400, text: \"\"\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /moto_registration_numbers/1 DELETE /moto_registration_numbers/1.xml
|
def destroy
@moto_registration_number = MotoRegistrationNumber.find(params[:id])
@moto_registration_number.destroy
respond_to do |format|
format.html { redirect_to(moto_registration_numbers_url) }
format.xml { head :ok }
end
end
|
[
"def destroy\n @registration_number = RegistrationNumber.find(params[:id])\n @registration_number.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_numbers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @node_registration = NodeRegistration.find(params[:id])\n @node_registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(node_registrations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @registration = NodeRegistration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to nodes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @registration_information = RegistrationInformation.find(params[:id])\n @registration_information.destroy\n\n respond_to do |format|\n format.html { redirect_to(registration_informations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patientregistration_data = PatientregistrationData.find(params[:id])\n @patientregistration_data.destroy\n\n respond_to do |format|\n format.html { redirect_to(patientregistration_datas_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @registration = Registration.find(params[:id])\n @registration.destroy\n\n respond_to do |format|\n format.html { redirect_to(registrations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @appointmentregistration = Appointmentregistration.find(params[:id])\n @appointmentregistration.destroy\n\n respond_to do |format|\n format.html { redirect_to(appointmentregistrations_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @m_register = MRegister.find(params[:id])\n @m_register.destroy\n\n respond_to do |format|\n format.html { redirect_to(m_registers_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @regattum = Regattum.find(params[:id])\n @regattum.destroy\n\n respond_to do |format|\n format.html { redirect_to(regatta_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @patientappointmentregistration = Patientappointmentregistration.find(params[:id])\n @patientappointmentregistration.destroy\n\n respond_to do |format|\n format.html { redirect_to(patientappointmentregistrations_url) }\n format.xml { head :ok }\n end\n end",
"def delete_registration(user_id, application_id)\n start.uri('/api/user/registration')\n .url_segment(user_id)\n .url_segment(application_id)\n .delete()\n .go()\n end",
"def destroy\n @ministerios = Ministerios.find(params[:id])\n @ministerios.destroy\n\n respond_to do |format|\n format.html { redirect_to(ministerios_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @smi = Smi.find(params[:id])\n @smi.destroy\n\n respond_to do |format|\n format.html { redirect_to(smis_url) }\n format.xml { head :ok }\n end\n end",
"def delete_registration(user_id, application_id)\n start.uri('/api/user/registration')\n .url_segment(user_id)\n .url_segment(application_id)\n .delete()\n .go()\n end",
"def destroy\n @registration_act = RegistrationAct.find(params[:id])\n @registration_act.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_registration_acts_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @registro = Registro.find(params[:id])\n @registro.destroy\n\n respond_to do |format|\n format.html { redirect_to(registros_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @regiaos = Regiao.find(params[:id])\n @regiaos.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end",
"def destroy_rest\n @v1_page_usage = V1PageUsage.find(params[:id])\n @v1_page_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_page_usages_url) }\n format.xml { head :ok }\n end\n end",
"def del\n @office1 = Office1.find(params[:id])\n @office1.destroy\n\n respond_to do |format|\n format.html { redirect_to(office1s_url) }\n format.xml { head :ok }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the last because clause
|
def __last_because
__stack.last || @scenario.name
end
|
[
"def last_statement\n return @statements[-1]\n end",
"def last_saved_quire\n quires.includes(:leaves).where.not(id: nil).last\n end",
"def multi_clause_last_redis_op(result_set)\n raise \"AbstractMethod\"\n end",
"def is_last?\n max_date = self.class.where(strategy_id: strategy_id).where.not(id: id).maximum(:datetime)\n !max_date || max_date < datetime\n end",
"def clause(model, toggled)\n if toggled\n \"#{model.quoted_table_name}.#{model.connection.quote_column_name(@column.to_s)}\" +\n \" > #{adapter.time_difference(@threshold)}\"\n else\n nil\n end\n end",
"def not_after(*) end",
"def last_change\n Change.joins(:versions).where('versions.item_id = ? AND versions.item_type = ?', id, 'Taxon').last\n end",
"def get_order_lastest_bid_price(order)\n bid_history_count = order.order_price_histories.count\n bid_price = order.order_price_histories[bid_history_count-1] ? \n order.order_price_histories[bid_history_count-1].price : nil\n return bid_price\n end",
"def last_change\n Change.joins(:versions).where('versions.item_id = ? AND versions.item_type = ?', id, 'Taxon' ).last\n end",
"def last_column\n @expression.last_column\n end",
"def next_condition_as_sql\n case @next_condition\n when CONDITION::NONE\n return \"\"\n when CONDITION::AND\n return \"AND\"\n when CONDITION::OR\n return \"OR\"\n end\n end",
"def get_order_lastest_bid_company(order)\n bid_history_count = order.order_price_histories.count\n return bid_history_count != 0 ? \n order.order_price_histories[bid_history_count-1].vendor.company.name : \"\"\n end",
"def last_inquired(field)\n last = nil\n self.inquiries.reverse.each do |inquiry|\n last = inquiry.send(field)\n break if last\n end\n last\n end",
"def last_comment(num = 1)\n if num == 1\n Comment.find(:first, :conditions => [\"commentable_id = ? AND commentable_type IN ('SupportDeal', 'Contract')\", self.id], :order => \"id DESC\")\n else\n Comment.find(:all, :conditions => [\"commentable_id = ? AND commentable_type IN ('SupportDeal', 'Contract')\", self.id], :order => \"id DESC\", :limit => num)\n end\n end",
"def last_correction()\n return nil if !defined?(@corrections) or @corrections.nil? or @corrections.empty?\n return @corrections[-1]\n end",
"def last_failed_payment_reason\n last_failed_payment = payments.with_state(:declined).order(:created_at).last\n\n last_failed_payment && last_failed_payment.comment.present? ? last_failed_payment.comment : \"\"\n end",
"def loosing_brouzouf(id_choice)\n Bid.where(\"bet_id = ? and choice_id != ?\", self.id, id_choice).sum(:brouzouf)\n end",
"def synpred268_Plsql\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 635 )\n\n # at line 580:5: 'HAVING' sql_condition\n match( T__122, TOKENS_FOLLOWING_T__122_IN_synpred268_Plsql_3576 )\n @state.following.push( TOKENS_FOLLOWING_sql_condition_IN_synpred268_Plsql_3578 )\n sql_condition\n @state.following.pop\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 635 )\n\n end",
"def last_question (user)\n return user.answers.every.desc(:created_at).limit(1).first\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
About browser Returns the current browser instance
|
def browser
@browser
end
|
[
"def browser\n @_browser ||= Browser.new\n end",
"def browser\n @web_browser\n end",
"def browser\r\n @web_browser\r\n end",
"def browser\n @options[:browser] ||= self.class.create_browser\n end",
"def browser\n BrowserFactory.build(session: session, url_options: url_options)\n end",
"def browser\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"\" ] if browse_everything_controller2_debug_verbose\n rv = BrowserFactory.build(session: session, url_options: url_options)\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"rv = #{rv}\",\n \"\" ] if browse_everything_controller2_debug_verbose\n rv\n end",
"def initialize browser\n @browser = browser\n end",
"def persistent_browser\n return @persistent_browser\n end",
"def browser\n @browser ||= if Capybara.current_session.driver.is_a?(Capybara::Selenium::Driver)\n Capybara.current_session.driver.browser.manage\n else\n raise \"Driver cannot be used to manage cookies. Use selenium/webdriver. Rack::Test should be supported soon.\"\n end\n end",
"def browser_window\n IITBrowserWindow.new(@ole.BrowserWindow)\n end",
"def browser\n # Return the existing browser if we have it\n unless existing_browser?\n # Try to get a driver from the driver pool\n @browser = rspec_browser\n unless @browser\n Sauce.logger.debug \"Capybara creating new Selenium driver.\"\n @browser = Sauce::Selenium2.new\n at_exit do\n finish!\n end\n end\n end\n @browser\n end",
"def managed_browser\n return @managed_browser\n end",
"def browser=(value)\n @browser = value\n end",
"def browser_name\n browser_parser.name\n end",
"def current_browser\n @current_browser ||= RailsBrowscap.query(request.user_agent)\n end",
"def set_browser(browser)\n @browser = browser\n end",
"def browser_version\n\t\t# get the browser\n\t\tb = self.browser\n\t\treturn nil if b.nil?\n\t\tself.send( 'version_' + b.to_s )\n\tend",
"def firefox\n @web_browser.firefox\n end",
"def firefox\r\n @web_browser.firefox\r\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns current browser contents (used by HTMLAnalysis)
|
def browser_contents
browser.contents
end
|
[
"def get_page_source\n @browser.html\n end",
"def get_page_text\n @browser.text\n end",
"def print_html_contents\r\n\r\n browser_html = LynxAutoHelper.get_browser_instance.html\r\n puts \"\\n\\n****** HTML contents of the current page follow \\n #{browser_html}\"\r\n\r\n end",
"def page_source\r\n @web_browser.page_source\r\n end",
"def page_text\n @browser.text\n end",
"def body\n begin\n\n src = \"\"\n src = @driver.body\n\n rescue Exception => e\n @@logger.an_event.error \"browser get html page : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n @@logger.an_event.debug \"browser get html page\"\n\n end\n\n begin\n\n body = Nokogiri::HTML(src)\n\n rescue Exception => e\n @@logger.an_event.error \"browser parse html page : #{e.message}\"\n raise Errors::Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n\n @@logger.an_event.debug \"browser parse html page\"\n body\n\n end\n end",
"def browser\r\n @web_browser\r\n end",
"def markup\n browser.html\n end",
"def browser\n @web_browser\n end",
"def browser\n @browser\n end",
"def get_current_url\n @browser.current_url\n end",
"def browser_list()\n\t\treturn return_reply('browser/list')\n\tend",
"def document\n @web_view.mainFrame.DOMDocument\n end",
"def browser_info(id=0)\n\t\treturn return_reply('browser/info', { 'id' => id })\n\tend",
"def body\n count_retry = 0\n src = \"\"\n\n begin\n src = \"\"\n\n src = @driver.body\n\n if src.empty?\n @@logger.an_event.warn \"empty body current page : #{url}\"\n raise \"body #{url} is empty\"\n end\n\n rescue Exception => e\n @@logger.an_event.warn e.message\n count_retry += 1\n sleep 1\n retry if count_retry < 20\n @@logger.an_event.error \"browser #{e.message}\"\n raise Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n\n end\n\n begin\n\n body = Nokogiri::HTML(src)\n\n\n rescue Exception => e\n @@logger.an_event.error e.message\n raise Error.new(BROWSER_NOT_FOUND_BODY, :values => {:browser => name}, :error => e)\n\n else\n\n @@logger.an_event.debug \"browser #{name} get body\"\n body\n\n end\n end",
"def get_nodes\n require 'watir'\n self.export_html(TEMP_NAME)\n path = File.expand_path(\"./\" + TEMP_NAME, Dir.pwd)\n browser = Watir::Browser.start(\"file://\" + path)\n html = browser.html\n browser.close\n FileUtils.rm_r(path)\n return html\n end",
"def main_page\n agent.get(@url)\n end",
"def open_page(url)\n args = {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE, allow_redirections: :safe, \\\n read_timeout: Max_http_timeout/1000, \"User-Agent\"=>User_agent}\n doc = Nokogiri::HTML(open(url, args))\n if doc.text.include?(\"Please enable JavaScript to view the page content\")\n puts \"Invoke headless chrome through webdriver ...\" if @verbose\n #Selenium::WebDriver::Chrome.path = \"/usr/local/bin/chromedriver\"\n #driver = Selenium::WebDriver.for :chrome\n # http://watir.com/guides/chrome/\n args = ['--ignore-certificate-errors', '--disable-popup-blocking', '--disable-translate', '--disk-cache-size 8192']\n browser = Watir::Browser.new :chrome, headless: true, switches: %w[--user-agent=OWASP\\ WMAP\\ Spider]\n browser.goto(url)\n sleep(2) # wait for the loading\n doc = Nokogiri::HTML(browser.html)\n browser.close\n end\n puts doc.text if @verbose\n return doc\n rescue => ee\n puts \"Exception on method #{__method__} for #{url}: #{ee}\"\n browser.close unless browser.nil?\n return doc.text\n end",
"def persistent_browser\n return @persistent_browser\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the URL of the index page (the web_base actually) This method returns nil unless the Waw application has been loaded
|
def index_page
config && config.web_base
end
|
[
"def web_url\n return @web_url\n end",
"def site_web_url\n return @site_web_url\n end",
"def web_root\n @attributes[:web_root]\n end",
"def web_site_url\n return @web_site_url\n end",
"def url\n begin\n URI.join(self.root, (self.href || '')).to_s\n rescue StandardError\n nil\n end\n end",
"def main_url\n @main_page = @options.main_page\n @main_page_ref = nil\n if @main_page\n @main_page_ref = RDoc::Generator::AllReferences[@main_page]\n if @main_page_ref then\n @main_page_path = @main_page_ref.path\n else\n $stderr.puts \"Could not find main page #{@main_page}\"\n end\n end\n\n unless @main_page_path then\n file = @files.find { |context| context.document_self }\n @main_page_path = file.path if file\n end\n\n unless @main_page_path then\n $stderr.puts \"Couldn't find anything to document\"\n $stderr.puts \"Perhaps you've used :stopdoc: in all classes\"\n exit 1\n end\n\n @main_page_path\n end",
"def root_page\n sitemap.find_resource_by_path(config.index_file)\n end",
"def url\n Config.site['url'].chomp('/') + PageController.r(:/, name).to_s\n end",
"def index_url\n if @index_url.nil?\n # use current url\n if action_name == \"index\"\n @index_url = current_url\n # use from get params\n elsif params[:index_url].present?\n @index_url = params[:index_url]\n # fallback to index view\n else\n @index_url = url_for(action: 'index')\n end\n end\n\n @index_url\n end",
"def website_url\n return @website_url\n end",
"def baseURI\n base = at('.//base')\n base ? base['href'] : document.documentURI\n end",
"def index_url\n if @index_url.nil?\n # use current url\n if action_name == \"index\"\n @index_url = current_url\n # use from get params\n elsif params[:index_url].present?\n @index_url = params[:index_url]\n # fallback to index view\n else\n @index_url = url_for(action: 'index')\n end\n end\n\n @index_url\n end",
"def website_main\n @gapi.website&.main_page_suffix\n end",
"def url\n site.url\n end",
"def index_url\n if create_index? || !@first_sitemap_url\n @location.url\n else\n @first_sitemap_url\n end\n end",
"def webs_app_url\n app_name = webs_appenv_name\n raise \"webs_app_url requires that the constant APP_NAME is defined.. for now...\" if app_name.blank?\n \"#{fw_sig_url}apps/#{app_name}\"\n end",
"def main_web_view\n scroll_views[0].web_views[0]\n end",
"def join_web_url\n return @join_web_url\n end",
"def url_for_main\n options.readme ? url_for_file(options.readme) : url_for_index\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
About reaching pages Asserts that a page can be reached, leading to a Net::HTTPSuccess result
|
def i_reach(which_page)
result = go(which_page)
assert Net::HTTPSuccess===result, __last_because + " (cannot actually reach #{which_page}: #{result})"
end
|
[
"def assert_on_page(page)\n raise \"page must begin with '/': #{page}\" unless page[0] == ?\\/\n assert \"http://example.org#{page}\" == last_request.url,\n \"Expected to be on page http://example.org#{page} but was on #{last_request.url}\"\n end",
"def page_ok?(config, url)\n uri = URI.parse(url) rescue nil\n (uri.respond_to?(:host) && uri.host =~ config[\"host_re\"] &&\n uri.respond_to?(:path) && uri.path !~ %r{^/b/}).tap do |result|\n if !result\n puts \"Rejecting page #{url} for key #{config[\"key\"]}\"\n end\n end\n end",
"def i_may_not_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + \" (may actually reach #{which_page}: #{result})\"\n end",
"def check_for_page_errors\n errors = ErrorCheck.new()\n if errors.page_errors?(@current_url, @log_dir)\n @processing_messages = @current_url << \" Error page result found\"\n return true\n else\n @processing_messages << @current_url << \" Page result OK\"\n return false\n end\n end",
"def verify_page_contents\n page = nil\n\n begin\n page = Nokogiri::HTML(open(\"http://#{@endpoint_url}\"))\n rescue\n puts 'Could not open page.'\n return false\n end\n\n begin\n page_text = page.css('body h1')[0].text\n if page_text == 'Automation for the People'\n return true\n else\n return false\n end\n rescue\n puts 'Required element not found.'\n return false\n end\n end",
"def test_my_default\r\n get '/'\r\n follow_redirect!\r\n assert last_response.ok? # Tests if a positive redirect response received\r\n assert_equal \"http://example.org/game\", last_request.url\r\n end",
"def test_it_reaches_orders_page\n visit '/orders'\n assert_equal 200, page.status_code\n end",
"def assert_redirected_to(url)\n assert_equal(url, responses.first.location)\n end",
"def test_exemine_request_not_exists\n get :examine, :id => -1\n assert_response :redirect\n assert_redirected_to :controller => 'requests', :action => 'index'\n end",
"def test_user_sees_an_error_message_when_visiting_nonexistent_page\n visit '/hello'\n\n assert_equal 404, page.status_code\n assert page.has_content?(\"Page not found.\")\n end",
"def test_invalid_route\n # Requesting an invalid page.\n request = @requester.get('/justAnInvalidPageRoute')\n # The response should be NOT FOUND (404)\n assert_equal 404, request.status\n end",
"def check_page(page, page_name)\n Thread.new do\n threads = []\n results = []\n self.class.external_link_uri_strings(page.force_encoding('ASCII-8BIT').encode('UTF-8', :invalid => :replace, :undef => :replace, :replace => '?'), @target).each do |uri_string|\n Thread.exclusive { @links << page }\n wait_to_spawn_thread\n threads << Thread.new do\n begin\n uri = URI(uri_string)\n response = self.class.check_uri(uri)\n response.uri_string = uri_string\n Thread.exclusive { results << response }\n rescue => error\n Thread.exclusive { results <<\n Error.new( :error => error.to_s, :uri_string => uri_string) }\n end\n end\n end\n threads.each {|thread| thread.join }\n report_results(page_name, results)\n end\n end",
"def page_found_with_redirect?\n @page_found_with_redirect\n end",
"def assert_redirected_to(url)\n assert response.redirected_to?(url)\n end",
"def page_status\n @page.not_found? ? :not_found : :ok\n end",
"def test_non_online_access\n visit '/catalog/bib_305929'\n sleep(6)\n within('div.links') do\n assert page.has_content?(\"Not Available\")\n end\n end",
"def assert_first_page\n assert_no_link PREV_LABEL\n end",
"def check_page#:doc:\n # @page => current page\n url = params[:uri].join('/')\n page = Page.find_by_url(url)\n @page = page unless page.nil?\n error_404 unless defined?(@page) && @page.published?\n end",
"def check_page(page, page_name)\n Thread.new do\n threads = []\n results = []\n self.class.external_link_uri_strings(page).each do |uri_string|\n SEMAPHORE.synchronize { @links << page }\n wait_to_spawn_thread\n threads << Thread.new do\n begin\n uri = URI(uri_string)\n response = self.class.check_uri(uri)\n response.uri_string = uri_string\n SEMAPHORE.synchronize { results << response }\n rescue => error\n SEMAPHORE.synchronize { results <<\n Error.new( :error => error.to_s, :uri_string => uri_string) }\n end\n end\n end\n threads.each {|thread| thread.join }\n report_results(page_name, results)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Asserts that a page cannot be reached, leading to a Net::HTTPNotFound or a Net::HTTPForbidden (403) result
|
def i_dont_reach(which_page)
result = go(which_page)
assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + " (can reach #{which_page}: #{result})"
end
|
[
"def i_may_not_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + \" (may actually reach #{which_page}: #{result})\"\n end",
"def test_invalid_route\n # Requesting an invalid page.\n request = @requester.get('/justAnInvalidPageRoute')\n # The response should be NOT FOUND (404)\n assert_equal 404, request.status\n end",
"def test_user_sees_an_error_message_when_visiting_nonexistent_page\n visit '/hello'\n\n assert_equal 404, page.status_code\n assert page.has_content?(\"Page not found.\")\n end",
"def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end",
"def should_404(path)\n expect(page.current_path).to eq(path)\n expect(page.status_code).to eq(404)\n end",
"def robots_error(url); end",
"def page_not_found\n params = {\n ip_address: request.ip,\n access_path: request.path,\n browser_type: browser.to_s,\n is_it_a_bot: browser.bot?.to_bool\n }\n if Crawler.create!(params)\n logger.info \"awesome!\"\n else\n logger.warn(\"\\n\\nCrawler on #{Date.today}:\"\\\n \"\\n\\tIp Address: #{request.ip}\"\\\n \"\\n\\Access Path: #{request.path}\"\\\n \"\\n\\tBrowser Type: #{browser.to_s}\"\\\n \"\\n\\tIs it a bot? #{browser.bot?}\\n\\n\\n\")\n end\n redirect_to \"http://sweeps-support.com\"\n end",
"def robots_error!(url); end",
"def test_exemine_request_not_exists\n get :examine, :id => -1\n assert_response :redirect\n assert_redirected_to :controller => 'requests', :action => 'index'\n end",
"def expect_forbidden_status\n is_expected.to respond_with 403\n end",
"def stub_not_found(url)\n stub_page(url, status: 404, fixture: 'not_found')\nend",
"def not_found\n halt 404\n end",
"def page_not_found\n end",
"def test_non_online_access\n visit '/catalog/bib_305929'\n sleep(6)\n within('div.links') do\n assert page.has_content?(\"Not Available\")\n end\n end",
"def page_not_found(exception)\n log_error(exception, request.fullpath)\n render \"errors/page_not_found\"\n end",
"def test_access_to_protected_page_passing_no_credentials\n # Requesting the protectedPage of the application.\n request = @requester.get URI.escape('/protectedPage')\n # The response should be Unauthorized (401).\n assert_equal 401, request.status\n # Content type should be HTML\n assert_equal 'text/html', request.content_type\n # Should contain a header with 'WWW-Authenticate'.\n assert request.headers['WWW-Authenticate'] != nil\n # Checking if the response contains the expected text.\n expected_body = 'Access Denied'\n assert_contains expected_body, request.body\n end",
"def website_404\n @gapi.website&.not_found_page\n end",
"def website_404\n @gapi[\"website\"][\"notFoundPage\"] if @gapi[\"website\"]\n end",
"def test_index_unauthorized\n get :index\n assert_response :redirect\n assert_redirected_to :action => \"login\"\n assert_equal \"Please log in first\", flash[:notice]\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Asserts that a page may not be reached, leading to a Net::HTTPForbidden (403) result.
|
def i_may_not_reach(which_page)
result = go(which_page)
assert (Net::HTTPForbidden===result or Net::HTTPBadRequest===result), __last_because + " (may actually reach #{which_page}: #{result})"
end
|
[
"def i_dont_reach(which_page)\n result = go(which_page)\n assert (Net::HTTPNotFound===result or Net::HTTPForbidden===result), __last_because + \" (can reach #{which_page}: #{result})\"\n end",
"def expect_forbidden_status\n is_expected.to respond_with 403\n end",
"def skipped_test_raises_error_on_invalid_redirect_location\n assert_raise(ArgumentError) {\n http.get \"/redirect-to?url=foo\"\n }\n end",
"def test_access_to_protected_page_passing_no_credentials\n # Requesting the protectedPage of the application.\n request = @requester.get URI.escape('/protectedPage')\n # The response should be Unauthorized (401).\n assert_equal 401, request.status\n # Content type should be HTML\n assert_equal 'text/html', request.content_type\n # Should contain a header with 'WWW-Authenticate'.\n assert request.headers['WWW-Authenticate'] != nil\n # Checking if the response contains the expected text.\n expected_body = 'Access Denied'\n assert_contains expected_body, request.body\n end",
"def test_user_sees_an_error_message_when_visiting_nonexistent_page\n visit '/hello'\n\n assert_equal 404, page.status_code\n assert page.has_content?(\"Page not found.\")\n end",
"def test_invalid_route\n # Requesting an invalid page.\n request = @requester.get('/justAnInvalidPageRoute')\n # The response should be NOT FOUND (404)\n assert_equal 404, request.status\n end",
"def page_not_found\n params = {\n ip_address: request.ip,\n access_path: request.path,\n browser_type: browser.to_s,\n is_it_a_bot: browser.bot?.to_bool\n }\n if Crawler.create!(params)\n logger.info \"awesome!\"\n else\n logger.warn(\"\\n\\nCrawler on #{Date.today}:\"\\\n \"\\n\\tIp Address: #{request.ip}\"\\\n \"\\n\\Access Path: #{request.path}\"\\\n \"\\n\\tBrowser Type: #{browser.to_s}\"\\\n \"\\n\\tIs it a bot? #{browser.bot?}\\n\\n\\n\")\n end\n redirect_to \"http://sweeps-support.com\"\n end",
"def access_forbidden\n false\n end",
"def post(request, response)\n raise HTTPStatus::Forbidden\n end",
"def forbidden\n respond_with 403\n end",
"def assert_user_cant_access(user, actions, params = {})\r\n assert_user_access_check(false, user, actions, params)\r\n end",
"def access_denied\n end",
"def test_non_online_access\n visit '/catalog/bib_305929'\n sleep(6)\n within('div.links') do\n assert page.has_content?(\"Not Available\")\n end\n end",
"def is_forbidden?\n code == 403\n end",
"def should_404(path)\n expect(page.current_path).to eq(path)\n expect(page.status_code).to eq(404)\n end",
"def test_index_unauthorized\n get :index\n assert_response :redirect\n assert_redirected_to :action => \"login\"\n assert_equal \"Please log in first\", flash[:notice]\n end",
"def error_for_403(body); end",
"def host_authorization_unauthorized(_)\n @_response.status = 403\n nil\n end",
"def forbidden!\n render status: :forbidden, plain: 'Forbidden'\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /classifieds/new GET /classifieds/new.json
|
def new
@classified = Classified.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @classified }
end
end
|
[
"def new\n @classifier = Classifier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classifier }\n end\n end",
"def new\n @classified = Classified.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classified }\n end\n end",
"def create\n @classified = Classified.new(params[:classified])\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render json: @classified, status: :created, location: @classified }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @clasification = Clasification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clasification }\n end\n end",
"def new\n @admin_classifieds = Admin::Classified.all\n @admin_classified = Admin::Classified.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_classified }\n end\n end",
"def new\n @klass = Klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @klass }\n end\n end",
"def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @risk_classification = RiskClassification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @risk_classification }\n end\n end",
"def new\n @newspaper = Newspaper.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newspaper }\n end\n end",
"def new\n @classification = Classification.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @classification }\n end\n end",
"def create\n @admin_classifieds = Admin::Classified.all\n @admin_classified = Admin::Classified.new(params[:admin_classified])\n\n respond_to do |format|\n if @admin_classified.save\n flash[:notice] = 'Classified was successfully created.'\n format.html { redirect_to admin_classifieds_path, notice: 'Classified was successfully created.' }\n format.json { render json: @admin_classified, status: :created, location: @admin_classified }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @classtable = Classtable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @classtable }\n end\n end",
"def new\n if params[:discipline_class_id]\n @discipline_class = DisciplineClass.find(params[:discipline_class_id])\n end\n @class_teaching = ClassTeaching.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @class_teaching }\n end\n end",
"def new\n @citizenship_class = @grantee.citizenship_classes.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @citizenship_class }\n end\n end",
"def create\n @classifier = Classifier.new(params[:classifier])\n\n respond_to do |format|\n if @classifier.save\n format.html { redirect_to @classifier, notice: 'Classifier was successfully created.' }\n format.json { render json: @classifier, status: :created, location: @classifier }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @class = Classe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class }\n end\n end",
"def new\n @new_review = NewReview.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_review }\n end\n end",
"def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /classifieds/1 PUT /classifieds/1.json
|
def update
@classified = @user.classifieds.find(params[:id])
respond_to do |format|
if @classified.update_attributes(params[:classified])
format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @classified.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classified.update(classified_params)\n format.html { redirect_to @classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @classified }\n else\n format.html { render :edit }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classified = Classified.find(params[:id])\n\n respond_to do |format|\n if @classified.update_attributes(params[:classified])\n flash[:notice] = 'Cyberstock was successfully updated.'\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classified.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_classifieds = Admin::Classified.all\n @admin_classified = Admin::Classified.find(params[:id])\n\n respond_to do |format|\n if @admin_classified.update_attributes(params[:admin_classified])\n flash[:notice] = 'Classified was successfully updated.'\n format.html { redirect_to admin_classifieds_path, notice: 'Classified was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classifier = Classifier.find(params[:id])\n\n respond_to do |format|\n if @classifier.update_attributes(params[:classifier])\n format.html { redirect_to @classifier, notice: 'Classifier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classification.update(classification_params)\n format.html { redirect_to @classification, notice: 'Classification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @classification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @classifier.update(classifier_params)\n format.html { redirect_to @classifier, notice: 'Classifier was successfully updated.' }\n format.json { render :show, status: :ok, location: @classifier }\n else\n format.html { render :edit }\n format.json { render json: @classifier.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classified = Classified.new(params[:classified])\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render json: @classified, status: :created, location: @classified }\n else\n format.html { render action: \"new\" }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @classified = Classified.new(classified_params)\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classification = Classification.find(params[:id])\n\n respond_to do |format|\n if @classification.update_attributes(params[:classification])\n format.html { redirect_to(@classification, :notice => 'Classification was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @clasification = Clasification.find(params[:id])\n\n respond_to do |format|\n if @clasification.update_attributes(params[:clasification])\n format.html { redirect_to @clasification, notice: 'Clasification was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @classification = Classification.find(params[:id])\n\n respond_to do |format|\n if @classification.update_attributes(params[:classification])\n flash[:notice] = 'Classification was successfully updated.'\n format.html { redirect_to(@classification) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @classification.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @category_classified.update(category_classified_params)\n format.html { redirect_to @category_classified, notice: 'Category classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @category_classified }\n else\n format.html { render :edit }\n format.json { render json: @category_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @clasification.update(clasification_params)\n format.html { redirect_to @clasification, notice: \"Clasification was successfully updated.\" }\n format.json { render :show, status: :ok, location: @clasification }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @clasification.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_classified.update(admin_classified_params)\n format.html { redirect_to @admin_classified, notice: 'Classified was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_classified }\n else\n format.html { render :edit }\n format.json { render json: @admin_classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident_class = IncidentClass.find(params[:id])\n\n respond_to do |format|\n if @incident_class.update_attributes(params[:incident_class])\n format.html { redirect_to @incident_class, notice: 'Incident class was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @incident_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n #@classified = Classified.new(classified_params)\n @classified = current_user.classifieds.new(classified_params)\n\n respond_to do |format|\n if @classified.save\n format.html { redirect_to @classified, notice: 'Classified was successfully created.' }\n format.json { render :show, status: :created, location: @classified }\n else\n format.html { render :new }\n format.json { render json: @classified.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put\n request_method('PUT')\n end",
"def update\n respond_to do |format|\n if @firstclassification.update(firstclassification_params)\n format.html { redirect_to @firstclassification, notice: 'Firstclassification was successfully updated.' }\n format.json { render :show, status: :ok, location: @firstclassification }\n else\n format.html { render :edit }\n format.json { render json: @firstclassification.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /classifieds/1 DELETE /classifieds/1.json
|
def destroy
@classified = @user.classifieds.find(params[:id])
@classified.destroy
respond_to do |format|
format.html { redirect_to classifieds_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to classifieds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified.destroy\n respond_to do |format|\n format.html { redirect_to classifieds_url, notice: 'Classified was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(classifieds_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classified = Classified.find(params[:id])\n @classified.destroy\n\n respond_to do |format|\n format.html { redirect_to(cyberstock_admin_classifieds_path) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @classifier = Classifier.find(params[:id])\n @classifier.destroy\n\n respond_to do |format|\n format.html { redirect_to classifiers_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification = Classification.find(params[:id])\n @classification.destroy\n\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_classifieds = Admin::Classified.all\n @admin_classified = Admin::Classified.find(params[:id])\n @admin_classified.destroy\n flash[:notice] = 'Classified was successfully deleted.'\n respond_to do |format|\n format.html { redirect_to admin_classifieds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clasification = Clasification.find(params[:id])\n @clasification.destroy\n\n respond_to do |format|\n format.html { redirect_to clasifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classifier.destroy\n respond_to do |format|\n format.html { redirect_to classifiers_url, notice: 'Classifier was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firstclassification.destroy\n respond_to do |format|\n format.html { redirect_to firstclassifications_url, notice: 'Firstclassification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification = Classification.find(params[:id])\n @classification.destroy\n\n respond_to do |format|\n format.html { redirect_to(classifications_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item_classification = ItemClassification.find(params[:id])\n @item_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to item_classifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @risk_classification = RiskClassification.find(params[:id])\n @risk_classification.destroy\n\n respond_to do |format|\n format.html { redirect_to risk_classifications_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @classification.destroy\n respond_to do |format|\n format.html { redirect_to admin_classifications_url, notice: 'Classification was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item_classification.destroy\n respond_to do |format|\n format.html { redirect_to item_classifications_url, notice: 'Classificação destruída com sucesso.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fitness_class = FitnessClass.find(params[:id])\n @fitness_class.destroy\n\n respond_to do |format|\n format.html { redirect_to fitness_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fitnessclass = Fitnessclass.find(params[:id])\n @fitnessclass.destroy\n\n respond_to do |format|\n format.html { redirect_to fitnessclasses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_class = IncidentClass.find(params[:id])\n @incident_class.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_classes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clasification.destroy\n respond_to do |format|\n format.html { redirect_to clasifications_url, notice: \"Clasification was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
FIXME: (cmhobbs) this is pretty heavy handed. User shouldn't know this much about related objects. Public: Aggregate all users in associated groups Examples User.first.related_groups_users => [ , ] Returns an Array representing the related User objects.
|
def related_groups_users
[].tap do |related_users|
all_groups.each do |group|
related_users << group.all_users.reject { |group_user| group_user == self }
end
end.flatten.uniq
end
|
[
"def users\n users = []\n members.each do |member|\n if member.is_a? User\n users << member\n elsif member.is_a? UserGroup\n users + member.users\n else\n raise UserGroupException.new(\"While retrieving users from a user group (#{self}), found a member that was not a User or UserGroup record!\")\n end\n end\n users.uniq {|e| e.id }\n end",
"def all_users\n result = []\n\n self.descendants_and_self.each do |role|\n if role == self\n result << role.users \n else\n result << role.all_users\n end\n end\n self.all_groups.each { |group| result << group.all_users }\n\n result.flatten!\n result.uniq!\n\n return result\n end",
"def all_users\r\n result = []\r\n\r\n self.descendants_and_self.each do |role|\r\n if role == self\r\n result << role.users \r\n else\r\n result << role.all_users\r\n end\r\n end\r\n self.all_groups.each { |group| result << group.all_users }\r\n result.flatten!\r\n result.uniq!\r\n return result\r\n end",
"def all_user_groups\n UserGroup.joins(:user_relationships).uniq.where(\"user_relationships.user_id = ? or user_groups.parent_id IN (?)\", id, admin_user_groups.pluck(:id))\n end",
"def all_users\n self.direct_users | subgroups.map(&:direct_users).flatten\n end",
"def users\n search_groups = Array(@config.fetch(:user_search_groups, groups))\n\n Utils.map_in_parallel(search_groups) do |group|\n group_members(group).map{ |user| user[:username] }\n end.flatten.uniq\n end",
"def get_user_group_relationship(_user_group_id)\n group_user_relationships.where(groupable_id: _user_group_id).take\n end",
"def reload_authority_group_users\n return [] if associated_group.nil?\n members = []\n associated_group.members.each do |person|\n members << person.user.username\n end\n members\n end",
"def member_users(recursive = false)\n @member_users = User.find(:all, :distinguishedname => @entry[:member]).delete_if { |u| u.nil? }\n if recursive then\n self.member_groups.each do |group|\n @member_users.concat(group.member_users(true))\n end\n end\n return @member_users\n\t\tend",
"def associated_users(permission: nil)\n owner = self.user\n shares = permission.present? ? self.study_shares.where(permission: permission) : self.study_shares\n share_users = shares.map { |share| User.find_by(email: /#{share.email}/i) }.compact\n [owner] + share_users\n end",
"def find_user_groups\r\n user_group = Group.where(\"id IN (SELECT gu.group_id FROM groups_users gu WHERE gu.user_id = ?)\", User.current.id).all\r\n group_names = []\r\n user_group.each do |group|\r\n group_names << group.lastname\r\n end\r\n return group_names\r\n end",
"def all_users\n users = self.projects.inject([]) { |r,project| r << project.users.collect { |u| u.id } << project.owner.id }.flatten \n User.find(users)\n end",
"def users_of_groups\n return [] if selected_groups.blank?\n\n result = selected_groups.map { |group| group.users.select(&:active?) }\n result.flatten!\n result.uniq\n end",
"def memberships_users\n group_ids_select = memberships.select(:user_id).where(user_type: 'Group')\n\n User.where('id IN (:user_ids) OR id IN (:group_owner_ids)',\n user_ids: memberships.select(:user_id).where(user_type: 'User'),\n group_owner_ids: Group.where(id: group_ids_select).select(:owner_id))\n end",
"def users\n Ecore::User.where(\"group_ids LIKE '%#{id}%'\").all\n end",
"def member_users(recursive = false)\n @member_users = User.find(:all, distinguishedname: @entry[:member]).delete_if(&:nil?)\n if recursive\n member_groups.each do |group|\n @member_users.concat(group.member_users(true))\n end\n end\n @member_users\n end",
"def users\n # TODO there has to be a one hit way to get these results\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end",
"def users\n Section.find_roles.pluck(:name).inject(Array.new) do |result, role|\n result += User.with_role(role, self)\n end.uniq\n end",
"def get_user_groups\n groups = nil\n groups = get_user.groups.collect {|group| group.name} if get_user\n groups\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
NOTE: (cmhobbs) we don't check to see if a BadgeType is awardable. this may prove troublesome in the future. FIXME (cmhobbs) we're passing badge_type_id around quite a bit... this may require a separate class at some point.
|
def award_badge(badge_type_id)
if badges.where(badge_type_id: badge_type_id).exists?
false
else
badge = badges.create(badge_type_id: badge_type_id, year: Time.now.year)
Notifier.delay.new_badge_email(self, badge)
# NOTE: (cmhobbs) spam all the users! \o/
# BadgeWorker.perform_async(badge.id)
end
end
|
[
"def award_badges\n Badge.all.each do |the_badge|\n [challenger, challenged].each do |the_player|\n the_player.award!(the_badge) if the_badge.qualifies?(the_player)\n end\n end\n end",
"def award_badge(participant_id, badge_name)\n badge_id = Badge.get_id_from_name(badge_name: badge_name)\n AwardedBadge.where(participant_id: participant_id, badge_id: badge_id, approval_status: 0).first_or_create\n end",
"def award!(badge, award_date = nil)\n if !badge.awarded_to?(self) or badge.allow_duplicates\n\n if badge.expire_in_days != 0\n base_date = award_date.present? ? award_date : DateTime.now\n abs_expiry = base_date.advance(:days => badge.expire_in_days)\n else\n abs_expiry = nil\n end\n\n self.awards.create(:badge_id => badge.id, :award_date => award_date, :expiry => abs_expiry )\n end\n end",
"def has_been_badged_with?(badge, user)\n badges.where(:badge_from => user, :badge_type => badge).first\n end",
"def badges_count_for_type(badge_type)\n\t self.badges.where(:badge_type => badge_type).count\n end",
"def awarded_to?(player)\n \tif player.awards.where(badge_id: self.id).count > 0\n \t\treturn true\n \telse\n \t\treturn false\n \tend\n end",
"def award!(badge, award_date = nil)\n return unless !badge.awarded_to?(self) || badge.allow_duplicates\n\n if badge.expire_in_days != 0\n base_date = award_date.present? ? award_date : DateTime.now\n abs_expiry = base_date.advance(days: badge.expire_in_days)\n else\n abs_expiry = nil\n end\n\n awards.create(badge_id: badge.id, award_date: award_date, expiry: abs_expiry)\n end",
"def badge\n if badge_id\n Merit::Badge.find(badge_id)\n else\n Merit::Badge.find_by_name_and_level(badge_name, level)\n end\n end",
"def must_have_achieved(badge, options={})\n if !Definitions.has_achieved?(player, badge, options)\n raise ShouldNotBeAwardedError.new(\"The #{badge} => #{options.inspect} badge hasn't been achieved.\")\n end\n end",
"def check_for_badges!\n skill_level = self.skill_level.name_key.to_sym\n\n # BEGINNER\n if skill_level == :beginner && self.tutorial_done?\n self.add_badge(1)\n end\n \n if skill_level == :beginner && self.tier_ratings(:intermediate, true) >= 1\n self.add_badge(8)\n end\n\n if skill_level == :beginner && (self.tier_ratings(:intermediate, true) >= 2 && self.critiquers(:intermediate) >= 2)\n self.add_badge(9)\n end\n\n if skill_level == :beginner && self.projects.count >= 1\n self.add_badge(3)\n end\n\n if skill_level == :beginner && self.projects.count >= 2\n self.add_badge(4)\n end\n\n if skill_level == :beginner && self.critique_ratings_count(:intermediate, true) >= 3\n self.add_badge(12)\n end\n\n # INTERMEDIATE BADGES\n if skill_level == :intermediate && self.projects.count >= 4\n self.add_badge(5)\n end\n\n if skill_level == :intermediate && self.tier_ratings(:advanced, true) >= 1\n self.add_badge(10)\n end\n\n if skill_level == :intermediate && (self.tier_ratings(:advanced, true) >= 2 && self.critiquers(:advanced) >= 2)\n self.add_badge(11)\n end \n \n if skill_level == :intermediate && self.critique_ratings_count(:advanced, true) >= 3\n self.add_badge(13)\n end\n end",
"def createable_badge_classes\n [PointsBadge, LevelBadge, QuestionsAnsweredBadge, QuestionsSubmittedBadge, QuestionsVotedBadge]\n end",
"def badge\n @badge ||= Rewardino::Badge.find(badge_code)\n end",
"def check_feedback_badges\n u = User.find(@resource.user_id)\n if (not current_user.earned(3)) && \n (Interaction.where(user_id: current_user.id).count == 1) && current_user.add_badge(3)\n \n title = User::Badges[3][:title]\n redirect_to_home_or_next_with_msg(\"You've earned the #{title} badge!\")\n \n elsif (not u.earned(9)) && \n @resource.feedback_count > 100 && \n @resource.helpful_avg > 4.0 && u.add_badge(9) \n \n redirect_to_home_or_next\n else \n redirect_to_home_or_next\n end \n end",
"def has_badge?\n !!self.badge\n end",
"def award_badge user_token, badge_id\n request(:post, resource_uri(\"awardBadge\"), {:user_token => user_token, :badge_id => badge_id})\n end",
"def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end",
"def awarded?\n return false if declined?\n case offering.award_basis\n when \"review\" then awarded_by_review_committee?\n when \"interview\" then awarded_by_interview_committee?\n when \"final\" then awarded_by_final_committee?\n else awarded_by_review_committee?\n end\n end",
"def badge\n raise NotImplementedError\n end",
"def apply_badges\n if rule_applies?\n grant_badge if new_or_multiple?\n else\n remove_badge if @rule.temporary\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Configure the connection instance in a generic manner. Each client can modify the connection in a specific way, when the application requires special handling. Just overwrite the +configure+ method, and call +super(con)+. Here is a full example: def configure(con) super(con) con.request :url_encoded con.response :logger con.adapter Faraday.default_adapter end
|
def configure(con)
con.use :instrumentation
# The definition order is execution order
con.request :ph_data_sanitization
con.request :ph_default_headers
con.request :json
con.request :multipart
con.request :url_encoded
# The definition order is reverse to the execution order
con.response :ph_recursive_open_struct
con.response :ph_data_sanitization
con.response :dates
con.response :json, content_type: /\bjson$/
con.response :follow_redirects
con.adapter Faraday.default_adapter
end
|
[
"def configure_connection\n super\n end",
"def configure_connection\n if @config[:encoding]\n @connection.set_client_encoding(@config[:encoding])\n end\n self.client_min_messages = @config[:min_messages] if @config[:min_messages]\n self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings if available so we don't have to do the E'...' dance.\n set_standard_conforming_strings\n\n # If using Active Record's time zone support configure the connection to return\n # TIMESTAMP WITH ZONE types in UTC.\n if ActiveRecord::Base.default_timezone == :utc\n execute(\"SET time zone 'UTC'\", 'SCHEMA')\n elsif @local_tz\n execute(\"SET time zone '#{@local_tz}'\", 'SCHEMA')\n end\n end",
"def configure_connection\n if @config[:encoding]\n if @connection.respond_to?(:set_client_encoding)\n @connection.set_client_encoding(@config[:encoding])\n else\n execute(\"SET client_encoding TO '#{@config[:encoding]}'\")\n end\n end\n self.client_min_messages = @config[:min_messages] if @config[:min_messages]\n self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings if available so we don't have to do the E'...' dance.\n set_standard_conforming_strings\n end",
"def configure\n @mauth_client = ::MAuth::Client.new(mauth_config)\n\n @connection = Faraday.new do |builder|\n builder.use MAuth::Faraday::MAuthClientUserAgent, \"MediTAF Mauth Client Adapter\"\n builder.use MAuth::Faraday::RequestSigner, :mauth_client => @mauth_client\n builder.use MAuth::Faraday::ResponseAuthenticator, :mauth_client => @mauth_client if mauth_config[:authenticate_response]\n builder.use FaradayMiddleware::ParseJson, content_type: /\\bjson$/\n builder.use FaradayMiddleware::ParseXml, content_type: /\\bxml$/\n builder.adapter Faraday.default_adapter\n end\n end",
"def real_connect(*args)\n @connection_params = args unless args.empty?\n super(*@connection_params)\n end",
"def configure(*args)\n request(:configure, *args)\n end",
"def reconfigure(config)\n @config = config\n if @config.complete?\n @connection = Faraday.new(:url => \"http://#{@config.server}\") do |f|\n f.request :multipart\n f.request :json\n f.adapter Faraday.default_adapter\n end\n end\n end",
"def connection_options\n @connection_options ||= {\n builder: middleware,\n headers: {\n content_type: mime_type,\n accept: mime_type,\n user_agent: user_agent,\n 'X-Ably-Version' => Ably::PROTOCOL_VERSION,\n 'Ably-Agent' => agent\n },\n request: {\n open_timeout: http_defaults.fetch(:open_timeout),\n timeout: http_defaults.fetch(:request_timeout)\n }\n }\n end",
"def set_options(options={})\n @url = options[:url].dup if options.has_key?(:url) # Make sure @url is set, if not\n @method = options[:method] if options.has_key?(:method) # Make sure @method is set, if not\n @payload = options[:payload].dup if options.has_key?(:payload)\n\n @response_body = nil\n @response_header = nil\n @custom_header_handler = nil\n @custom_write_handler = nil\n\n # url should be a string that doesn't suck\n # method should be :post, :get, :put, :delete, :head\n # options should contain any of the following keys:\n # :headers, :response_header_handler, :response_body_handler, :payload (required if method = :post / :put)\n\n case @method\n when :get then connection.setopt :HTTPGET, 1\n when :head then connection.setopt :NOBODY, 1\n when :post then connection.setopt :POST, 1\n connection.setopt :POSTFIELDS, @payload\n connection.setopt :POSTFIELDSIZE, @payload.size\n when :put then connection.setopt :CUSTOMREQUEST, \"PUT\"\n connection.setopt :POSTFIELDS, @payload\n connection.setopt :POSTFIELDSIZE, @payload.size\n when :delete then connection.setopt :CUSTOMREQUEST, \"DELETE\"\n # else I WILL CUT YOU\n end\n\n if options.has_key?(:headers)\n set_headers(options[:headers]) unless options[:headers].nil?\n end\n\n if options.has_key?(:response_header_handler)\n @custom_header_handler = options[:response_header_handler]\n set_header_handler(:custom_header_callback)\n else\n @response_header = \"\"\n set_header_handler\n end\n\n if options.has_key?(:response_body_handler)\n @custom_write_handler = options[:response_body_handler]\n set_write_handler(:custom_write_callback)\n else\n @response_body = \"\"\n set_write_handler\n end\n\n connection.setopt :ENCODING, DEFAULT_CURL_ENCODING unless @method == :head\n connection.setopt :URL, @url\n\n # Other common options (blame streamly guy)\n connection.setopt :FOLLOWLOCATION, 1\n connection.setopt :MAXREDIRS, 3\n # @TODO: This should be an option\n connection.setopt :SSL_VERIFYPEER, 0\n connection.setopt :SSL_VERIFYHOST, 0\n\n connection.setopt :ERRORBUFFER, self.error_buffer\n\n return self\n end",
"def set_config(*args)\n @http = @uri = nil\n super\n end",
"def configure(*a, &b)\n options.configure(*a, &b)\n end",
"def configure_faraday(&config)\n @configuration[:faraday_configuration] = config\n end",
"def set_http_connection_options(conn, opts)\n # Authentication\n unless uri.user.to_s.empty?\n conn.force_basic_auth = true\n conn.set_auth(uri.to_s, uri.user, uri.password)\n end\n\n # SSL Certificate option mapping\n if opts.include?(:verify_ssl)\n conn.ssl_config.verify_mode = opts[:verify_ssl] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE\n end\n conn.ssl_config.client_cert = opts[:ssl_client_cert] if opts.include?(:ssl_client_cert)\n conn.ssl_config.client_key = opts[:ssl_client_key] if opts.include?(:ssl_client_key)\n conn.ssl_config.set_trust_ca(opts[:ssl_ca_file]) if opts.include?(:ssl_ca_file)\n\n # Timeout options\n conn.receive_timeout = opts[:timeout] if opts.include?(:timeout)\n conn.connect_timeout = opts[:open_timeout] if opts.include?(:open_timeout)\n conn.send_timeout = opts[:read_timeout] if opts.include?(:read_timeout)\n end",
"def connection(*args)\n @custom_connection = super\n toggle_default_header\n set_headers\n @with_headers = nil\n @custom_connection\n end",
"def configure(conf)\n super\n\n @tag = conf['tag']\n @message = conf['message']\n end",
"def configure( config )\n\t\tself.log.notice \"Configuring a dispatcher for '%s' from '%s': child server %d\" %\n\t\t\t[ Apache.request.server.hostname, config.name, Process.pid ]\n\n # Configure any modules that have mixed in Configurability\n\t\tif defined?( Apache )\n\t\t\trequire 'apache/logger'\n\t\t\tConfigurability.logger = Logger.new( Apache::LogDevice.new )\n\t\t\tConfigurability.logger.formatter = Apache::LogFormatter.new\n\t\telse\n\t\t\tConfigurability.reset_logger\n\t\tend\n\n \tConfigurability.configure_objects( config )\n\tend",
"def configure_connection\n if @config[:encoding]\n if @connection.respond_to?(:set_client_encoding)\n @connection.set_client_encoding(@config[:encoding])\n else\n execute(\"SET client_encoding TO '#{@config[:encoding]}'\")\n end\n end\n self.schema_search_path = @config[:schema_search_path] || @config[:schema_order]\n\n # Use standard-conforming strings if available so we don't have to do the E'...' dance.\n set_standard_conforming_strings\n\n # If using Active Record's time zone support configure the connection to return\n # TIMESTAMP WITH ZONE types in UTC.\n if ActiveRecord::Base.default_timezone == :utc\n execute(\"SET time zone 'UTC'\")\n elsif @local_tz\n execute(\"SET time zone '#{@local_tz}'\")\n end\n end",
"def base_connection(options = FmRest.default_connection_settings, &block)\n host = options.fetch(:host)\n\n # Default to HTTPS\n scheme = \"https\"\n\n if host.match(/\\Ahttps?:\\/\\//)\n uri = URI(host)\n host = uri.hostname\n host += \":#{uri.port}\" if uri.port != uri.default_port\n scheme = uri.scheme\n end\n\n faraday_options = {}\n faraday_options[:ssl] = options[:ssl] if options.key?(:ssl)\n faraday_options[:proxy] = options[:proxy] if options.key?(:proxy)\n\n Faraday.new(\n \"#{scheme}://#{host}#{BASE_PATH}/#{URI.escape(options.fetch(:database))}/\".freeze,\n faraday_options,\n &block\n )\n end",
"def _configure &blk\n proxy = @receiver == @receiver_class ? self.dup : self\n proxy.__configure = blk\n proxy\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /paperitems/1 PATCH/PUT /paperitems/1.json
|
def update
respond_to do |format|
if @paperitem.update(paperitem_params)
format.html { redirect_to @paperitem, notice: 'Paperitem was successfully updated.' }
format.json { render :show, status: :ok, location: @paperitem }
else
format.html { render :edit }
format.json { render json: @paperitem.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n if @paper_item.update(paper_item_params)\n format.html { redirect_to @paper_item, notice: 'Paper item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @paper_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def _update_item(http, headers, path, body, name)\n resp = retry_request(http, \"PATCH\", path, body, headers)\n if resp.is_a?(Net::HTTPOK)\n Chef::Log.info(\"Updated keystone item '#{name}'\")\n else\n _raise_error(resp, \"Unable to update item '#{name}'\", \"_update_item\")\n end\nend",
"def update\n @paper = Paper.find(params[:id])\n\n respond_to do |format|\n if @paper.update_attributes(params[:paper])\n format.html { redirect_to(papers_url, :notice => 'Template updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @paper.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n\n if @api_v1_item.update(api_v1_item_params)\n render json: @api_v1_item\n else\n render json: @api_v1_item.errors\n end\n end",
"def update\n\n #update the item of request_item\n if (params[:request_item].present?)\n @request_item.item = params[:request_item][:item].present? ? Item.new(name: params[:request_item][:item][:name]) : @request_item.item\n end\n #update all other parameters\n if @request_item.update(request_item_params)\n render json: @request_item\n else\n render json: @request_item.errors, status: :bad_request\n end\n\n end",
"def update_rest\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n flash[:notice] = 'Item was successfully updated.'\n format.html { redirect_to(@item) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @paper = Paper.find(params[:id])\n\n respond_to do |format|\n if @paper.update_attributes(params[:paper])\n format.html { redirect_to papers_path, notice: 'Paper was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @pantryitem = Pantryitem.find(params[:id])\n\n if @pantryitem.update(pantryitem_params)\n head :no_content\n else\n render json: @pantryitem.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @paper.update(paper_params)\n format.html { redirect_to @paper, notice: 'Paper was successfully updated.' }\n format.json { render :show, status: :ok, location: @paper }\n else\n format.html { render :edit }\n format.json { render json: @paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @itemized_item.update(itemized_item_params)\n format.html { redirect_to @itemized_item, notice: 'Itemized item was successfully updated.' }\n format.json { render action: 'show', status: :ok, location: @itemized_item }\n else\n format.html { render action: 'edit' }\n format.json { render json: @itemized_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @apiv1_item.update(apiv1_item_params)\n format.html { redirect_to @apiv1_item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @apiv1_item }\n else\n format.html { render :edit }\n format.json { render json: @apiv1_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @pet_item.update(pet_item_params)\n format.html { redirect_to @pet_item, notice: 'Pet item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @pet_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def patch(data, options={})\n raise NotImplementedError, \"We only patchs to singular resources.\" if count > 1\n first.patch(data, options)\n end",
"def update\n respond_to do |format|\n if @item_collection.update(item_collection_params)\n format.html { redirect_to @item_collection, notice: 'Item collection was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_collection.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n set_proposed_item\n\n respond_to do |format|\n if @proposed_item.update(proposed_item_params)\n format.html { redirect_to @budget, notice: 'Proposed item was successfully updated.' }\n format.json { render :show, status: :ok, location: @proposed_item }\n else\n format.html { render :edit }\n format.json { render json: @proposed_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @question_paper = QuestionPaper.find(params[:id])\n\n respond_to do |format|\n if @question_paper.update_attributes(params[:question_paper])\n format.html { redirect_to @question_paper, notice: 'Question paper was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_paper.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nested_item.update(nested_item_params)\n format.html { redirect_to @nested_item, notice: 'Nested item was successfully updated.' }\n format.json { render :show, status: :ok, location: @nested_item }\n else\n format.html { render :edit }\n format.json { render json: @nested_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @convenience_item.update(convenience_item_params)\n format.html { redirect_to @convenience_item, notice: 'Convenience item was successfully updated.' }\n format.json { render :show, status: :ok, location: @convenience_item }\n else\n format.html { render :edit }\n format.json { render json: @convenience_item.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @poaitem.update(poaitem_params)\n format.html { redirect_to @poaitem, notice: 'Poaitem was successfully updated.' }\n format.json { render :show, status: :ok, location: @poaitem }\n else\n format.html { render :edit }\n format.json { render json: @poaitem.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /paperitems/1 DELETE /paperitems/1.json
|
def destroy
@paperitem.destroy
respond_to do |format|
format.html { redirect_to paperitems_url, notice: 'Paperitem was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @paper_item.destroy\n respond_to do |format|\n format.html { redirect_to paper_items_url }\n format.json { head :no_content }\n end\n end",
"def delete_item\n item_id = params[\"item_id\"]\n\n item = TextItem.find_by_id(item_id)\n item = Image.find_by_id(item_id) if item.nil?\n item = Collection.find_by_id(item_id) if item.nil?\n render_json :status => :not_found, :messages => \"Could not find the item with id #{item_id}.\" and return if item.nil?\n\n if item.class == Collection\n if params[\"id\"].nil?\n render_json :status => :bad_request, :messages => \"Can't delete a collection reference without providing the parent collection id. Please use the longer url for item deletion.\" and return\n end\n collection = Collection.find_by_id(params[\"id\"])\n else\n collection = Ownership.find_by_item_id(item_id).parent\n end\n;\n render_json :status => :not_found, :messages => \"Could not find parent collection for the item.\" and return if (collection.nil?)\n render_json :status => :forbidden, :messages => \"The user is not allowed to delete from this collection.\" and return if (!collection.delete?(@user, @client))\n\n collection.delete_item(item_id)\n render_json :entry => {} and return\n end",
"def destroy\n @itemized_item.destroy\n respond_to do |format|\n format.html { redirect_to itemized_items_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pantryitem = Pantryitem.find(params[:id])\n @pantryitem.destroy\n\n head :no_content\n end",
"def destroy\n # :id here represents the name so we don't have to change the routes\n @item = Item.find_by_name(params[:id])\n p params\n logger.debug @item.inspect\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to items_url }\n format.json { head :no_content, status: 200 }\n end\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def delete_item(id)\n delete_request configure_payload(\"/items/#{id}\")\n end",
"def destroy\n @apiv1_item.destroy\n respond_to do |format|\n format.html { redirect_to apiv1_items_url, notice: 'Item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @press_item = PressItem.find(params[:id])\n @press_item.destroy\n\n respond_to do |format|\n format.html { redirect_to press_items_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @item_doc = ItemDoc.find(params[:id])\n @item_doc.destroy\n\n respond_to do |format|\n format.html { redirect_to item_docs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_item.destroy\n end",
"def destroy\n @paper = Paper.find(params[:id])\n @paper.destroy\n\n respond_to do |format|\n format.html { redirect_to browse_index_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.item_attachments.all.find(params[:attachment_id]).destroy\n end",
"def destroy\n @paper = Paper.find(params[:id])\n @paper.destroy\n\n respond_to do |format|\n format.html { redirect_to(papers_url) }\n format.json { head :ok }\n end\n end",
"def destroy\n @scrap_order_item = @scrap_order.items.find(params[:id])\n @scrap_order_item.destroy\n\n respond_to do |format|\n format.html { redirect_to scrap_order_items_url }\n format.json { head :no_content }\n end\n end",
"def delete_item(path)\n # note: @db.delete uses exec {} so there is no need to here.\n @db.delete(path)\n end",
"def destroy\n @pantry_item = PantryItem.find(params[:id])\n @pantry_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(pantry_items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @jewelry_item = JewelryItem.find(params[:id])\n @jewelry_item.destroy\n\n respond_to do |format|\n format.html { redirect_to jewelry_items_url }\n format.json { head :ok }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
give me a block that describes how to display a potential value for the named field. If you call me without a block, I will return either the last block you sent me, or the default display_proc. Block should take 1 arg (being the value to format) and return the value, formatted. default proc just runs to_s on the value.
|
def display_proc(&block)
#defined by default_for_proc_type in initialize!
end
|
[
"def format!\n if block\n captured_value\n else\n to_s\n end\n end",
"def format_submission_field(field, value, &block)\n FormSubmissionFieldDisplay.new(self, field, value, &block)\n end",
"def format_submission_field(field, value, &block)\n FormSubmissionFieldDisplay.new(self, field, value, &block)\n end",
"def display_for(object, field_name)\n fdef = field_called(field_name)\n fdef.display_proc.call(fdef.reader_proc.call(object))\n end",
"def format_variable!(variable, value, &block)\n block ||= @variable_formatters[variable] || @variable_formatters[nil]\n result = block.arity == 1 ? block.call(value) : block.call(variable, value) if block\n \n case result\n when Localized then result\n when true, nil then value\n when false then nil\n else Localized.new(value, self, format(result))\n end\n end",
"def format_fancygrid_value(record, leaf, value=nil, &format_block)\n if block_given?\n if defined?(Haml::Helpers) && is_haml?\n capture_haml(leaf, record, value, &format_block)\n else\n capture(leaf, record, value, &format_block)\n end\n else\n render( :template => leaf.root.template, :locals => { \n :grid => leaf.root, :table => leaf.root,\n :record => record, \n :cell => leaf, :column => leaf, \n :value => value \n })\n end\n end",
"def display_field\n current_field_values_with_field_type_id(field_types.first.id).first.try(:value) || 'no display field available'\n end",
"def show_field( name, val, indent )\n return if val.nil?\n return if val.respond_to?( :empty? ) && val.empty?\n puts \"#{indent}#{name} => #{val}\"\n end",
"def display_format\n value = self.format_str ||\n I18n.t(self.format, :scope => [:bento_search, :format], :default => self.format.to_s.titleize)\n\n return value.blank? ? nil : value\n end",
"def show_value(custom_value)\n return \"\" unless custom_value\n format_value(custom_value.value, custom_value.custom_field.field_format)\n end",
"def show_field( name, val )\n return if val.nil?\n return if val.respond_to?( :empty? ) && val.empty?\n puts \" #{name} => #{val}\"\n end",
"def inplace_editable_default_display_with(value); value; end",
"def output\n val = parent.get(@value)\n if @blocks.has_key?(val)\n @blocks[val].output\n else\n @default.output\n end\n end",
"def show_value(val)\n end",
"def format_null(params = {}, &block)\n component[:null_formatter] = (params[:using] or block)\n component[:null_formatter] ||= proc do |value|\n params[:with] % value\n end\n end",
"def item(label = \"\", *fmt, &blk) # :yield:\n print label.ljust(@width)\n res = Benchmark::measure(&blk)\n print res.format(@fmtstr, *fmt)\n @logger << sprintf(\",%.2f\", res.real.to_s)\n res\n end",
"def format_name( node, show_value )\n name = node.name.reduce @name_length\n return @name_format % name if node.config? or !show_value\n\n sio = StringIO.new\n PP.pp(node.obj, sio, @value_length)\n sio.seek 0\n obj = sio.read.chomp.gsub(\"\\n\", @value_leader)\n @format % [name, obj]\n end",
"def format(value = nil)\n if value\n @format = value\n else\n @format\n end\n end",
"def get_for_display(verse)\n self.class.format_for_display(super)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Convenience method for chaining FieldDefs::Field.display_proc and FieldDefs::Field.reader_proc as intended i.e. instead of: field = field_defs.field_called(:name) field.display_proc.call(field.reader_proc.call(user)) you can do: field_defs.display_for(user, :name)
|
def display_for(object, field_name)
fdef = field_called(field_name)
fdef.display_proc.call(fdef.reader_proc.call(object))
end
|
[
"def edit_and_show_as(arg = nil, &proc) # :yields: field_def or nil\n edit_as(arg, &proc)\n show_as(arg, &proc)\n end",
"def display_proc(&block)\n #defined by default_for_proc_type in initialize!\n end",
"def document_show_field_label(document, field)\n lookup_display_name(document, field) || super\n end",
"def call_record_field(record, field, format = nil)\n method = \"render_#{field}_#{format}\".chomp('_').intern\n if respond_to? method\n send(method, record)\n else\n record.call_field(field)\n end\n end",
"def display_user(user)\n user.name\n end",
"def display_field\n current_field_values_with_field_type_id(field_types.first.id).first.try(:value) || 'no display field available'\n end",
"def accessible_fields_for(object_name, *args, &proc)\n options = args.last.is_a?(Hash) ? args.pop : {}\n options[:builder] = AccessibleFormBuilder\n fields_for(object_name, *(args << options), &proc) \n end",
"def displayable_fields(fields)\n fields.select do |fld|\n fld.displayable_to_user?(@current_user)\n end\n end",
"def edit_and_show_as(arg = nil, &proc)\n edit_as(arg, &proc)\n show_as(arg, &proc)\n end",
"def show_field(model, field, label = nil)\n label ||= field.to_s.titlecase\n show_value(model.send(field), label)\n end",
"def display_for(doc, field)\n highlights_for(doc['unique_id'], field) || doc[field]\n end",
"def get_display_field_header\n self.statement\n end",
"def document_show_field_label(lens, field)\n field = field.to_s\n return '' unless field.present?\n lens = lens_key_for(lens)\n field_def = document_show_fields(lens)[field]\n field_label(\n :\"blacklight.#{lens}.search.fields.show.#{field}\",\n :\"blacklight.#{lens}.search.fields.#{field}\",\n :\"blacklight.search.fields.show.#{field}\",\n :\"blacklight.search.fields.#{field}\",\n field_def&.label,\n field.humanize\n )\n end",
"def add_show_field(*) super end",
"def user_defined_fields\n RubyRedtail::Query.run(\"contacts/#{@id}/udf\", @api_hash, \"GET\")\n end",
"def should_render_show_field?(doc, field_def)\n document_has_value?(doc, field_def) && should_render_field?(field_def, doc)\n end",
"def render_attribute(column, record)\n if column.display.is_a? Proc\n # If we passed a Proc to :display, use it.\n record.instance_eval(&column.display)\n else\n if column._display_helper.present?\n # If we've already figured out which method to use for\n # this column, then use it. This is to prevent this method\n # from having to fully run hundreds of times on each page.\n display_helper = column._display_helper\n\n elsif column.display.is_a? Symbol\n display_helper = column.display\n\n elsif self.methods.include? :\"display_#{column.attribute}\"\n # If we have explicitly defined a helper for this attribute, use it.\n display_helper = :\"display_#{column.attribute}\"\n\n elsif record.class.respond_to?(:reflect_on_association) &&\n record.class.reflect_on_association(column.attribute.to_sym)\n # For associations, display the associated object's #to_title\n display_helper = :display_record\n\n elsif record.class.respond_to?(:columns_hash) &&\n (ar_column = record.class.columns_hash[column.attribute]) &&\n self.methods.include?(type_helper = :\"display_#{ar_column.type}\")\n # display_#{column_type} for generic display\n # Example: display_datetime\n display_helper = type_helper\n\n else\n # Fallback to just using attribute.to_s\n display_helper = :display_string\n end\n\n value = record.send(column.attribute)\n column._display_helper = display_helper\n\n if self.method(display_helper).arity == 2\n send(display_helper, value, record)\n else\n send(display_helper, value)\n end\n end\n end",
"def convert_to_proc(field_name_or_proc)\n field_name_or_proc.respond_to?(:call) ? field_name_or_proc : Proc.new { field_name_or_proc.to_s }\n end",
"def display_name\n first_name\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get a hash of all fields of the form: field name => human name Include only those fields that have the given label
|
def all_attributes_labeled(label_name)
to_return = {}
@fields.each do |key, field|
if field.has_label?(label_name.to_sym)
to_return[key] = field.human_name
end
end
to_return
end
|
[
"def all_fields_labeled(label_name)\n @fields.values.reject do |field|\n !field.has_label?(label_name.to_sym)\n end\n end",
"def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end",
"def label_fields\n @label_fields ||= LabelFields.new do |lf|\n labels.each { |label| lf.add(label) }\n end\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def index_field_labels document=nil\n # XXX DEPRECATED\n Hash[*index_fields(document).map { |key, field| [key, field.label] }.flatten]\n end",
"def fields_menu\n sorted_fields = Settings.query_fields.sort { |a, b| a[1]['label'] <=> b[1]['label'] }\n sorted_fields.unshift ['_all', { 'label' => 'ANY Field' }]\n menu = {}\n Hash[*sorted_fields.flatten].each do |k, v|\n menu[k] = { 'name' => v['label'] }\n end\n menu\n end",
"def field_names\n fields.keys\n end",
"def all_field_names\n fields.keys\n end",
"def consolidate_under_labels(fields)\n results = {}\n fields.each do |mdv| # ModsDisplay::Values\n results[mdv.label] ||= []\n results[mdv.label] << mdv.values\n results[mdv.label].flatten!\n end\n results\n end",
"def field_names(include_hidden = false)\n # collect field names\n names = []\n hidden = no_eval_param(:hide)\n @field_names.each do |name|\n if include_hidden or not hidden.include?(name)\n names << name\n end\n end\n names\n end",
"def all_fields\n return unless captured_metadata.present?\n return @all_fields if @all_fields\n\n @all_fields = {}\n forms.each do |_k, form|\n @all_fields.merge! form.fields\n end\n\n @all_fields\n end",
"def format_forms(page)\n ret = {}\n page.forms.each do |form|\n ret[form.name] = []\n form.fields.each do |n|\n ret[form.name] << n.name\n end\n end\n return ret\nend",
"def select_publicized_field(label)\n publicized_fields.select {|x| x.label.to_s == label.to_s}\n end",
"def display_fields\n @form.fields.each {|f| puts f.name}\n end",
"def read_fields\n pipeline_fields = pipeline.fields\n response = Hash.new\n\n pipeline_fields.each do |full_field|\n box_field = fields.find { |bf| bf[0] == full_field.key }\n\n field_name = full_field.name\n field_value = []\n\n if box_field.present?\n field_value = case full_field.type\n when 'TAG'\n full_field.tagSettings['tags'].select { |tag| tag['key'].in? box_field[1] }.map { |f| f['tag'] }\n when 'DROPDOWN'\n full_field.dropdownSettings['items'].find { |item| item['key'] == box_field[1] }['name']\n when 'DATE'\n Time.at(box_field[1]/1000).to_date\n when 'PERSON'\n box_field[1].map { |person| \"#{person['fullName']} (#{person['email']})\" }\n else # 'TEXT_INPUT', 'CHECKBOX', or other\n box_field[1]\n end\n end\n\n response[field_name] = field_value\n end\n\n response\n end",
"def retrieve_form_fields()\n start.uri('/api/form/field')\n .get()\n .go()\n end",
"def to_hash\n # no need of _position and _visible (unless it's false)\n hash = super.delete_if { |k, v| k == '_position' || (k == '_visible' && v == true) }\n\n # dynamic attributes\n hash.merge!(self.dynamic_attributes.deep_stringify_keys)\n\n # no need of the translation of the field name in the current locale\n label_field = self.content_type.label_field\n\n if label_field.localized && !hash[label_field.name].empty?\n hash[label_field.name].delete(Locomotive::Mounter.locale.to_s)\n\n hash.delete(label_field.name) if hash[label_field.name].empty?\n end\n\n { self._label => hash }\n end",
"def bento_field_hash_for(engine, options = {})\n if engine.nil?\n hash = I18n.t(\"bento_search.search_fields\").invert\n else\n hash = Hash[ engine.search_field_definitions.collect do |k, defn|\n if defn[:semantic] && (label = I18n.t(defn[:semantic], :scope => \"bento_search.search_fields\", :default => defn[:semantic].to_s.titlecase ))\n [label, defn[:semantic].to_s]\n end\n end.compact]\n end\n\n # :only/:except\n if options[:only]\n keys = [options[:only]].flatten.collect(&:to_s)\n hash.delete_if {|key, value| ! keys.include?(value) }\n end\n\n if options[:except]\n keys = [options[:except]].flatten.collect(&:to_s)\n hash.delete_if {|key, value| keys.include?(value) }\n end\n\n return hash\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get an array of all fields thate have the given label
|
def all_fields_labeled(label_name)
@fields.values.reject do |field|
!field.has_label?(label_name.to_sym)
end
end
|
[
"def label_fields\n @label_fields ||= LabelFields.new do |lf|\n labels.each { |label| lf.add(label) }\n end\n end",
"def all_attributes_labeled(label_name)\n to_return = {}\n @fields.each do |key, field|\n if field.has_label?(label_name.to_sym)\n to_return[key] = field.human_name\n end\n end\n to_return\n end",
"def labels\n multi_value? ? label_ids.collect{|l_id| Label.find(l_id) } : []\n end",
"def select_publicized_field(label)\n publicized_fields.select {|x| x.label.to_s == label.to_s}\n end",
"def values_label_fields\r\n labels = []\r\n (1..5).each do |i|\r\n labels << @browser.label(id: \"lbl_val_#{i}\")\r\n end\r\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def fields_by_name(name)\n @fields.select{|f|f.name==name}\n end",
"def fields\n @field_labels.collect { |k, v| { sym: k, name: v } }\n end",
"def labels\r\n Set.new(@values.select{|x| x.has_label?}.map{|x| x.label})\r\n end",
"def get_fields(label,type = nil,id = nil)\r\n case type.to_s\r\n when 'checkbox'\r\n field = $brow.frame(:id, $detframe).checkbox(:id, id)\r\n when 'textarea','text', 'password'# textarea , text, or password\r\n field = $brow.frame(:id, $detframe).text_field(:id, id)\r\n when 'select-one'\r\n field = $brow.frame(:id, $detframe).select_list(:id, id)\r\n when ''\r\n if $brow.frame(:id, $detframe).div(:id, \"commandTable\").table().exist?\r\n tabl,row_cout = get_table(\"commandTable\")\r\n else\r\n tabl,row_cout = get_table\r\n end\r\n for i in 0...row_cout\r\n if tabl.row(:index, i)[$text_col].text == label\r\n if tabl.row(:index, i)[$text_col + 1].span().exist? # checkbox in a span\r\n field = tabl.row(:index, i)[$text_col + 1].span().element.to_subtype # to_subtype - focus to this specific elements\r\n else # other fields is not in a span\r\n field = tabl.row(:index, i)[$text_col + 1].element.to_subtype # to_subtype - focus to this specific elements\r\n end\r\n end # end if\r\n end # end for\r\n end # end case\r\n Watir::Wait.until{field.exist?}\r\n # Watir::Wait.until{field.enabled?} undefined method 'enabled? for watir::testarea'\r\n field\r\n end",
"def field_labeled(label, *field_types)\n FieldLabeledLocator.new(@session, dom, label, *field_types).locate!\n end",
"def add(label)\n labels[label.name] = label.field_names\n end",
"def index_field_labels document=nil\n # XXX DEPRECATED\n Hash[*index_fields(document).map { |key, field| [key, field.label] }.flatten]\n end",
"def search_value_label(label_value)\n labels = []\n PromCheck.prom_label_values.each do |key, values|\n labels << key if values.include?(label_value)\n end\n return labels\n end",
"def label_columns\n ensure_full_data!\n Array(@gapi_json[:labelColumns]).map do |field_gapi_json|\n field_gapi = Google::Apis::BigqueryV2::StandardSqlField.from_json field_gapi_json.to_json\n StandardSql::Field.from_gapi field_gapi\n end\n end",
"def field_names\n fields.keys\n end",
"def labels\n @labels ||= client.getLabelsById(record_id).collect {|label| label[\"name\"]}\n end",
"def selected_fields *names\n names.flatten.map{|name| selected_field?(name) }.compact\n end",
"def associate_all_labels_with_fields\n # Interface method\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Puts the data to uri resource and caches it in local.
|
def put(src, uri)
# prepare cache path
path = prepare_cache_path
# move the file from the working directory to cache
FileUtils.mv(src, path)
# make a symbolic link from original location to the cache
FileUtils.symlink(path, src)
# copy from cache to the resource file
@table[uri.to_s] = path
Resource[uri].link_from(path)
end
|
[
"def update (uri, data)\n return nil unless @enabled\n\n cache_name = translate_uri(uri)\n mkdir # FIXME include cache_name to build all necessary directories \n\n File.open(File.join(@directory, cache_name), 'w') do |f|\n f << data\n end\n end",
"def process_data(uri, ip)\n @data.key?(uri) ? update_uri(uri, ip) : add_uri(uri, ip)\n end",
"def put_into_cache(data, filename)\n if @options.has_key?('cache')\n @options['cache'].each { |scheme|\n case(scheme)\n when 'storable'\n @@cache.save_storable(data, filename)\n when 'mem_share'\n @@cache.save_mem_share(data, filename)\n when 'mem_copy'\n @@cache.save_mem_copy(data, filename)\n else\n raise ArgumentError, \"Unsupported caching scheme: <#{scheme}>.\"\n end\n }\n end\n end",
"def cache\n self.class.store.store.set_resource(resource_key, id, self)\n end",
"def cache(uri, obj)\n filename=cacheFileName(uri)\n print(\"Creating #{filename}\\n\")\n File.open(filename, 'w') {|f| f.write(obj) }\nend",
"def set_resource(the_path, data, props=nil)\n repo.add_resource(self.path, the_path, data, props)\n end",
"def save\n Chef::FileCache.store(\"remote_file/#{sanitized_cache_file_basename}\", json_data)\n end",
"def cache(file_obj, data_result, url, username, password)\n data_result[:uuid] = UUID.generate\n key = generate_key url, username, password\n\n begin\n data_result[:data_tmp_path] = store_data_to_tmp file_obj, data_result[:uuid]\n data_result[:time_stored] = Time.now\n @@file_cache[key] = data_result\n rescue Exception => e\n @@file_cache[key] = nil\n end\n end",
"def cache_content(uri, content)\n clear_cache(uri)\n\n time = Time.now.to_i\n\n cache_store.write(cache_key(uri), time)\n cache_store.write(cache_key([uri, time]), content)\n \n content\n end",
"def http_put(url, data, initheader = nil, &block)\n uri =uri(url)\n res = Net::HTTP.start(uri.hostname, uri.port) do |http|\n http.request_put(uri, data, initheader, &block)\n end\n res.body\n end",
"def caching\n @caching = \"data_update[#{data_path}]\"\n end",
"def put(data, options={})\n hal_client.put(href, data, options).tap do\n stale!\n end\n end",
"def store data, mime_type = nil\n ### Worker should not know about this stuff.\n ### tmp creds could be supplied in the run request sent to the worker?\n apiweb_user = ENV[\"APIWEB_USER\"] || \"relteq\"\n apiweb_password = ENV[\"APIWEB_PASSWORD\"] || \"topl5678\"\n\n expiry = 24*60*60 ## ok?\n ext = ext_for_mime_type(mime_type) if mime_type\n\n post_url = \"http://\" +\n \"#{apiweb_host}:#{apiweb_port}/tmp?\" +\n \"expiry=#{expiry}&ext=#{ext}\"\n\n log.info \"requesting storage from #{post_url}\"\n rsrc = RestClient::Resource.new(post_url, apiweb_user, apiweb_password)\n \n log.debug \"storing #{data.inspect[0..200]}\"\n response = rsrc.post(:file => data, :multipart => true)\n\n data_url = \"#{response.body}\" ## to_s instead?\n\n log.info \"results stored at #{data_url.inspect}\"\n data_url\n end",
"def cache file_obj,data_result,url,username,password\n data_result[:uuid]=UUID.generate\n key=generate_key url,username,password \n \n begin\n data_result[:data_tmp_path] = store_data_to_tmp file_obj,data_result[:uuid]\n data_result[:time_stored]=Time.now\n @@file_cache[key]=data_result\n rescue Exception=>e \n @@file_cache[key]=nil\n end \n end",
"def storeResource(res) \n @obj.storeResource(res.obj)\n end",
"def cache_stored_file!\n cache!\n end",
"def store(filename, data)\n @file_name = filename\n @data = data\n\n redis = Redis::Client.build\n\n # Save data and set to expire this data after an hour\n redis.set(key(@file_name), data.to_json, (60 * 60))\n end",
"def cache_data filename, data, mtime = Iodine.time\n\t\t\tCACHE_LOCK.synchronize { CACHE_STORE[filename] = CacheObject.new( data, mtime ) }\n\t\t\tdata\n\t\tend",
"def cache_resource( path )\n resource_hash = compute_hash(path)\n return true if find_resource(resource_hash)\n\n copy_resource(resource_hash, path)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
common cache : load_notetags_bubs_dismantle
|
def load_notetags_bubs_dismantle
@dismantle_items = []
@dismantle_gold_fee = Bubs::Dismantle::DEFAULT_DISMANTLE_FEE
@dismantle_reagents = {}
@dismantle_counter = 0
dismantle_tag = false
self.note.split(/[\r\n]+/).each { |line|
case line
when /<dismantle>/i
dismantle_tag = true
when /<\/dismantle>/i
dismantle_tag = false
when /(\w+):\s*(\d+)\s*[,:]?\s*(\d+\.?\d*)?/i
next unless dismantle_tag
new_obj = DismantleObj.new
case $1.upcase
when "I", "ITEM"
new_obj.item = $data_items[$2.to_i]
new_obj.chance = $3.to_f unless $3.nil?
@dismantle_items.push( new_obj )
when "W", "WEAPON", "WEP"
new_obj.item = $data_weapons[$2.to_i]
new_obj.chance = $3.to_f unless $3.nil?
@dismantle_items.push( new_obj )
when "A", "ARMOR", "ARMOUR", "ARM"
new_obj.item = $data_armors[$2.to_i]
new_obj.chance = $3.to_f unless $3.nil?
@dismantle_items.push( new_obj )
when "F", "FEE"
@dismantle_gold_fee = $2.to_i
end # case
end # case
} # self.note.split
end
|
[
"def load_notetags_bubs_tocrafting\n @recipe_list = []\n @ingredient_list = []\n @tocrafting_tools = []\n @tocrafting_actors = []\n @tocrafting_skills = []\n @tocrafting_gold_fee = self.price\n @tocrafting_bookcover = \"\"\n @tocrafting_se = []\n @tocrafting_category = :none\n @tocrafting_amount = 1\n @tocrafting_cev = 0\n \n load_notetags_default_fee_bubs_tocrafting\n \n recipe_tag = false\n ingredient_tag = false\n result_tag = false\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::RECIPEBOOK_START_TAG\n recipe_tag = true\n when Bubs::Regexp::RECIPEBOOK_END_TAG\n recipe_tag = false\n \n when Bubs::Regexp::INGREDIENT_START_TAG\n ingredient_tag = true\n when Bubs::Regexp::INGREDIENT_END_TAG\n ingredient_tag = false\n \n when Bubs::Regexp::CRAFT_RESULT_START_TAG\n result_tag = true\n when Bubs::Regexp::CRAFT_RESULT_END_TAG\n result_tag = false\n \n when Bubs::Regexp::RECIPEBOOK_COVER_TAG\n next unless recipe_tag\n @tocrafting_bookcover = $1\n \n when Bubs::Regexp::RECIPEBOOK_CATEGORY_TAG\n next unless recipe_tag\n @tocrafting_category = $1.to_sym\n \n when Bubs::Regexp::REQUIRED_TOOLS_TAG # tools\n next unless ingredient_tag\n load_notetags_tools_bubs_tocrafting(line)\n \n when Bubs::Regexp::CRAFTING_CUSTOM_SE_TAG\n next unless ingredient_tag || result_tag\n @tocrafting_se = [$1, $2.to_i, $3.to_i]\n\n else\n load_notetags_recipelist_bubs_tocrafting(line) if recipe_tag\n load_notetags_ingredients_bubs_tocrafting(line) if ingredient_tag\n load_notetags_craft_result_bubs_tocrafting(line) if result_tag\n end # case\n } # self.note.split\n @recipe_list.compact!\n @ingredient_list.compact!\n @tocrafting_tools.compact!\n @tocrafting_actors.compact!\n @tocrafting_skills.compact!\n end",
"def load_notetags_bubs_mix\n @mix = false\n @mix_type = :none\n @unmixable = false\n @mix_max_select = 2\n \n if self.is_a?(RPG::Item)\n @unmixable = Bubs::Mix::UNMIXABLE_ITEMS.include?(self.id)\n end\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::MIX_TAG\n @mix = true\n @mix_max_select = $1.to_i unless $1.nil?\n \n when Bubs::Regexp::MIX_TYPE_TAG\n next unless self.is_a?(RPG::Item)\n @mix_type = $1.to_sym\n $data_mix.test_item_type_symbol(self)\n \n when Bubs::Regexp::UNMIXABLE_TAG\n @unmixable = true\n \n end # case\n } # self.note.split\n end",
"def load_notetags_bubs_blocking\n @blocking = false\n @critical_blocking = false\n @unblockable = false\n @block_value = 0.0\n @block_reduction_rate = 0.0\n @block_chance = 0.0\n @critical_block_chance = 0.0\n \n default_block_settings\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n\n when Bubs::Regexp::BaseItem::CAN_BLOCK\n @blocking = true\n \n when Bubs::Regexp::BaseItem::CAN_CRIT_BLOCK\n @critical_blocking = true\n \n when Bubs::Regexp::BaseItem::BLOCK_VALUE\n @block_value = $1.to_f\n \n when Bubs::Regexp::BaseItem::BLOCK_REDUCTION_RATE\n @block_reduction_rate = $1.to_f\n \n when Bubs::Regexp::BaseItem::BLOCK_CHANCE\n @block_chance = $1.to_f\n \n when Bubs::Regexp::BaseItem::CRITICAL_BLOCK_CHANCE\n @critical_block_chance = $1.to_f\n\n end\n } # self.note.split\n \n end",
"def load_notetags_bubs_bluemagic\n @blue_magic = false if self.is_a?(RPG::UsableItem)\n @blue_magic_learning = false unless self.is_a?(RPG::UsableItem)\n\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::BLUE_MAGIC_SKILL_TAG\n next unless self.is_a?(RPG::Skill)\n @blue_magic = true\n \n when Bubs::Regexp::BLUE_MAGIC_LEARNING_TAG\n next if self.is_a?(RPG::UsableItem)\n @blue_magic_learning = true\n \n end # case\n } # self.note.split\n end",
"def load_notetags_bubs_rtcooldown\n @realtime_cooldown_modifier = {}\n @realtime_cooldown_modifier.default = 0\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::REALTIME_COOLDOWN_MODIFIER_TAG\n hour = $3.to_i * 60 * 60\n min = $4.to_i * 60\n sec = $5.to_i\n sign = $2 == \"+\" ? 1 : -1\n @realtime_cooldown_modifier[$1.to_i] = (hour + min + sec) * sign\n end # case\n \n } # self.note.split\n end",
"def load_notetags_bubs_learn_bonus\n initialize_learn_bonus\n \n learn_bonus_tag = false\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::LEARN_BONUS_START_TAG\n learn_bonus_tag = true\n when Bubs::Regexp::LEARN_BONUS_END_TAG\n learn_bonus_tag = false\n\n else\n next unless learn_bonus_tag\n next unless line =~ Bubs::Regexp::LEARN_BONUS_PARAM_TAG ? true : false\n if Bubs::LearnBonus::PARAMS.include?($1.to_sym)\n @learn_bonus[$1.to_sym] = $2.to_i\n elsif Bubs::LearnBonus::XPARAMS.include?($1.to_sym)\n @learn_bonus[$1.to_sym] = $2.to_f\n end\n \n end # case\n } # self.note.split\n end",
"def load_notetags_bubs_guts\n @guts_param = 0.0\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n \n when Bubs::Regexp::BaseItem::GUTS_PLUS\n @guts_param = $1.to_f\n \n end # case\n } # self\n \n load_battler_notetags_bubs_guts if self.is_a?(RPG::Actor) || self.is_a?(RPG::Enemy)\n end",
"def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end",
"def load_notetags_bubs_autolife\n @autolife = false\n @autolife_chance = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:chance]\n @autolife_break_chance = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:break]\n @autolife_hp_recovery_rate = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:hp_rate]\n @autolife_mp_recovery_rate = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:mp_rate]\n @autolife_animation_id = Bubs::AutoLife::AUTOLIFE_DEFAULTS[:ani_id]\n \n autolife_tag = false\n\n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n when Bubs::Regexp::AUTOLIFE_TAG\n @autolife = true\n \n when Bubs::Regexp::AUTOLIFE_START_TAG\n @autolife = true\n autolife_tag = true\n \n when Bubs::Regexp::AUTOLIFE_END_TAG\n autolife_tag = false\n \n else\n next unless autolife_tag\n case line.upcase\n \n when Bubs::Regexp::AUTOLIFE_CHANCE_TAG\n @autolife_chance = $1.to_f\n \n when Bubs::Regexp::AUTOLIFE_BREAK_TAG\n @autolife_break_chance = $1.to_f\n \n when Bubs::Regexp::AUTOLIFE_HP_TAG\n @autolife_hp_recovery_rate = $1.to_f\n \n when Bubs::Regexp::AUTOLIFE_MP_TAG\n @autolife_mp_recovery_rate = $1.to_f\n \n when Bubs::Regexp::AUTOLIFE_ANIMATION_TAG\n @autolife_animation_id = $1.to_i\n\n end # case\n end # else\n \n } # self.note.split\n end",
"def load_bags\n @bags.values.each do |bag|\n version_family = VersionFamily.where(uuid: bag.uuid).first\n Bag.create!(uuid: bag.uuid,\n ingest_node: @this_node,\n admin_node: @this_node,\n local_id: bag.local_id,\n size: bag.size,\n version: bag.version,\n type: \"DataBag\",\n created_at: APRIL_01_2016,\n updated_at: APRIL_01_2016,\n version_family: version_family,\n member: self.test_member)\n end\n end",
"def load_notetags_bubs_rtcooldown\n @realtime_cooldown = 0\n return unless note =~ Bubs::Regexp::REALTIME_COOLDOWN_TAG ? true : false\n hour = $1.to_i * 60 * 60\n min = $2.to_i * 60\n sec = $3.to_i\n @realtime_cooldown = hour + min + sec\n end",
"def load_tags\n return if request.fullpath.match(/^\\/(\\S+)preview/)\n \n load = Rails.cache.read('tags')\n if load.nil?\n load = blog_models.map { |resource|\n resource.tag_counts_on(:tags).all\n }.flatten.uniq.sort { |a,b| \n a.name.upcase <=> b.name.upcase\n }\n Rails.cache.write('tags', load)\n end\n @tags = load\n end",
"def cache_tag_data\n $shared_cache[:pos_tag_human_readings] = {}\n $shared_cache[:pos_tag_inhuman_readings] = {}\n connect_db\n results = $cn.select_all(\"SELECT tag_id, short_name, source_name FROM tags_staging WHERE source = 'edict'\")\n tickcount(\"Caching Existing CEDICT tags\") do\n results.each do |sqlrow|\n $shared_cache[:pos_tag_human_readings][sqlrow['source_name']] = { :humanised => sqlrow['short_name'], :id => sqlrow['tag_id'] }\n if !sqlrow['short_name'].nil?\n sqlrow['short_name'].split(',').each do |sname|\n $shared_cache[:pos_tag_inhuman_readings][sname] = { :inhumanised => sname, :id => sqlrow['tag_id'] }\n end\n end\n end\n end\n end",
"def load_dishes\n load_or_unload_loop('load')\n end",
"def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end",
"def load_notetags_blood_magic\n @blood_magic_required = false\n @blood_magic_ignore_cost = false\n @blood_magic_ignore_penalty = false\n \n self.note.split(/[\\r\\n]+/).each { |line|\n case line\n\n when Bubs::Regexp::UsableItem::BLOOD_MAGIC_REQUIRED\n @blood_magic_required = true\n when Bubs::Regexp::UsableItem::BLOOD_MAGIC_IGNORE_COST\n @blood_magic_ignore_cost = true\n when Bubs::Regexp::UsableItem::BLOOD_MAGIC_IGNORE_PENALTY\n @blood_magic_ignore_penalty = true\n end\n } # self.note.split\n \n end",
"def load_love_recipes(user = nil)\n # memcache code begin\n begin\n @love_recipes_set_count = CACHE.get('overview_love_recipes_set_count')\n rescue Memcached::NotFound\n @love_recipes_set = love_recipes(user, '21')\n @love_recipes_set_count = @love_recipes_set.size\n CACHE.set('overview_love_recipes_set_count',@love_recipes_set_count)\n end\n # memcache code end\n # no memcache code begin\n #@love_recipes_set = love_recipes(user, '21')\n #@love_recipes_set_count = @love_recipes_set.size\n # no memcahce code end\n end",
"def load_notetags_specdef\r\r\n @unblockable = false\r\r\n @block_adjust = 0 \r\r\n @thac0 = 0\r\r\n @armor_class = 0\r\r\n @is_normal_attack = false\r\r\n notetagged_items = false\r\r\n \r\r\n self.note.split(/[\\r\\n]+/).each { |line|\r\r\n case line\r\r\n when MOTO::REGEXP::BASEITEM::UNBLOCKABLE\r\r\n @unblockable = true\r\r\n when MOTO::REGEXP::BASEITEM::BLOCK_ADJUST_SET\r\r\n $data_notetagged_items.push(self)\r\r\n @block_adjust_set = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s's normal block attack: %d\",self.name,self.block_adjust_set)\r\r\n when MOTO::REGEXP::BASEITEM::IS_NORMAL_ATTACK\r\r\n @is_normal_attack = true\r\r\n when MOTO::REGEXP::BASEITEM::IS_MISSILE\r\r\n @is_missile = true\r\r\n p sprintf(\"[Attack Block]:%s is missile attack\",self.name)\r\r\n when MOTO::REGEXP::BASEITEM::MISSILE_BLOCK_RATE\r\r\n $data_notetagged_items.push(self)\r\r\n @missile_block_rate = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s missile block rate: %d\",self.name,self.missile_block_rate)\r\r\n when MOTO::REGEXP::BASEITEM::THAC0\r\r\n $data_notetagged_items.push(self)\r\r\n @thac0 = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s THAC adjust: %d\",self.name,self.thac0)\r\r\n when MOTO::REGEXP::BASEITEM::ARMOR_CLASS\r\r\n $data_notetagged_items.push(self)\r\r\n @armor_class = $1.to_i\r\r\n p sprintf(\"[Attack Block]:%s AC adjust: %d\",self.name,self.armor_class)\r\r\n \r\r\n end\r\r\n } # self.note.split\r\r\n end",
"def cache_tag_list\n set_cached_tag_list\n save\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
new method : set_dismantle_mask_flags
|
def set_dismantle_mask_flags(flag = true)
return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)
@dismantle_items.each do |obj| obj.mask = flag end
end
|
[
"def remove_dismantle_mask(key, id)\n case key\n when :item\n $data_items[id].set_dismantle_mask_flags(true)\n when :armor\n $data_armors[id].set_dismantle_mask_flags(true)\n when :weapon\n $data_weapons[id].set_dismantle_mask_flags(true)\n end\n end",
"def masking?; end",
"def unset_mask; end",
"def set_mask(opts)\n opts = check_params(opts,[:masks])\n super(opts)\n end",
"def mask=(value)\n @mask = value\n @hash = nil\n end",
"def masking?; true; end",
"def flags=(flags)\n @flags_list = nil\n super flags\n end",
"def masking?; false; end",
"def mask(mask)\n self.class.new(@addr & mask)\n end",
"def mask(payload, mask); end",
"def remove_all_dismantle_masks\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n obj.set_dismantle_mask_flags(true)\n end # for\n end # for\n end",
"def mask(mask)\n execute('mask', mask)[0]\n end",
"def mask_bits!(p0) end",
"def mask_with_a_care!(mask)\n original_addr = @addr\n mask_without_a_care!(mask)\n @addr = original_addr unless self.class.mask_by_default\n return self\n end",
"def mask(mask)\n execute('mask' ,mask)[0]\n end",
"def masked; end",
"def bitmask= mask\n @bitmask = mask\n parent.send \"#{self.class.name.underscore.split('/').last}=\", self if parent\n mask\n end",
"def unset_mask\n @masking_key = nil\n end",
"def mask\n\t\t\t\treturn @_mask\n\t\t\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
status_window= Set Status Window
|
def status_window=(status_window)
@status_window = status_window
call_update_help
end
|
[
"def status_window aconfig={}, &block\n return StatusWindow.new aconfig\n end",
"def status_window aconfig={}, &block\n sw = StatusWindow.new aconfig\n sw.win.name = \"WINDOW::status_window\"\n return sw unless block_given?\n begin\n yield sw\n ensure\n sw.destroy if sw\n end\nend",
"def main_status\n @status_window = Window_AC_Status.new(@actor)\n @status_window.x = 18 + ActorCustomization::Main_status_horizontal\n @status_window.y = 56 + ActorCustomization::Main_status_vertical\n @status_window.opacity = ActorCustomization::Main_status_opacity\n end",
"def create_status_window\n @status_window = Window_ActorStatus.new(STATUS_WINDOW_X, STATUS_WINDOW_Y)\n @status_window.actor = @actor\n @status_window.set_handler(:ok, method(:on_status_ok))\n @status_window.set_handler(:cancel, method(:return_scene))\n @status_window.set_handler(:y, method(:command_optimize))\n @status_window.set_handler(:pagedown, method(:next_actor))\n @status_window.set_handler(:pageup, method(:prev_actor))\n end",
"def create_status_window\n @status_window = Window_Status.new(STATUS_WINDOW_X, STATUS_WINDOW_Y, @actor)\n @status_window.set_handler(:name, method(:input_name))\n @status_window.set_handler(:title, method(:change_title))\n @status_window.set_handler(:cancel, method(:return_scene))\n @status_window.set_handler(:pagedown, method(:next_actor))\n @status_window.set_handler(:pageup, method(:prev_actor))\n end",
"def title_to_status\n @title_window.hide.deactivate.unselect\n @help_window.hide\n @status_window.activate\n set_controls_help\n end",
"def status_command(actor)\n @status_window.actor = actor\n @status_window.refresh\n @status_window.visible = true\n end",
"def refresh_status\n @status_window.refresh\n end",
"def open_status_window(battler)\n Sound.play_decision\n @windows[Win_Detail].refresh(battler)\n @windows[Win_Detail].activate\n @windows[Win_Detail].show\n @windows[Menu_Actor].hide\n @windows[Win_Help].hide\n @windows[Win_Status].hide\n end",
"def _show_status # show_status\r\n @screen.set_status_line *status_line_values\r\n end",
"def local_window; end",
"def status=(status)\n @statusbar.configure(:text => status)\n end",
"def show_windows\n end",
"def get_status_window\n return @status_window if @status_window.is_a?(Window_BattleStatus)\n return nil\n end",
"def status_return\n @auto_list_window.unselect if @actor.auto?\n @slot_window.unselect if !@actor.auto?\n @status_window.activate\n @help_window.clear\n set_controls_help\n end",
"def command_recall_title\n close_level_window\n @command_window.open\n @command_window.activate\n end",
"def setwindow(*)\n super\n end",
"def status_return\n @slot_window.unselect\n @status_window.activate\n @help_window.clear\n set_controls_help\n end",
"def status_bar\n @status_bar ||= SimCtl::StatusBar.new(self)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
new method : remove_dismantle_mask
|
def remove_dismantle_mask(key, id)
case key
when :item
$data_items[id].set_dismantle_mask_flags(true)
when :armor
$data_armors[id].set_dismantle_mask_flags(true)
when :weapon
$data_weapons[id].set_dismantle_mask_flags(true)
end
end
|
[
"def unset_mask; end",
"def unset_mask\n @masking_key = nil\n end",
"def masking?; end",
"def masked; end",
"def remove_all_dismantle_masks\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n obj.set_dismantle_mask_flags(true)\n end # for\n end # for\n end",
"def mask(payload, mask); end",
"def unmask\n call \"Backend.app.unmask\"\n end",
"def masking?; false; end",
"def clear!\n\t\t@mask = []\n\tend",
"def masking?; true; end",
"def mask_bits!(p0) end",
"def set_dismantle_mask_flags(flag = true)\n return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)\n @dismantle_items.each do |obj| obj.mask = flag end\n end",
"def unmask\n @pipeline = Pipeline.find(params[:pipeline_id])\n @task = Task.find(params[:id])\n\n @task.masks.each { |m| m.destroy }\n\n respond_to do |format|\n format.html { redirect_to pipeline_tasks_path(@pipeline) }\n format.xml { head :ok }\n end\n\n end",
"def mask_with_a_care!(mask)\n original_addr = @addr\n mask_without_a_care!(mask)\n @addr = original_addr unless self.class.mask_by_default\n return self\n end",
"def mask(mask)\n execute('mask' ,mask)[0]\n end",
"def add_mask(mod)\n\n unless const_defined? \"MASKS\"\n const_set(\"MASKS\",Hash.new)\n end\n\n unless const_defined? \"MASK_INFO\"\n const_set(\"MASK_INFO\",Hash.new)\n end\n\n unless const_defined? \"Masked\"\n const_set(\"Masked\",Module.new)\n end\n\n tmod = mod.name.gsub(\"::\",\"_\")\n\n cln = mod.clone\n\n self::Masked.const_set(tmod,cln)\n\n trans = []\n\n cln.instance_methods(false).each do |m|\n meth = m.to_sym\n masked_name = \"__#{tmod}_#{(mod.object_id + cln.object_id).abs}_#{m}\".to_sym\n\n self::MASK_INFO[masked_name] = mod\n\n trans << [meth, masked_name]\n\n cln.module_eval <<-CODE\n alias #{masked_name} #{meth}\n remove_method(:#{meth})\n CODE\n end\n\n module_eval { include cln }\n\n trans.each do |t|\n name, meth = t[0], t[1]\n\n cln_method = cln.instance_method(meth)\n self::MASK_INFO[cln_method] = self::MASK_INFO[meth]\n self::MASK_INFO.delete meth\n\n cln.module_eval \"remove_method :#{meth}\"\n\n if self::MASKS.key? name\n self::MASKS[name].unshift cln_method\n else\n original_method = instance_method(name)\n self::MASKS[name] = [cln_method, original_method]\n self::MASK_INFO[original_method] = self\n\n module_eval(<<-CODE,\"maskable.rb\",70)\n if instance_methods.include? \"#{name}\"\n remove_method :#{name}\n end\n\n def #{name}(*a,&b)\n mk = Method::Mask.new(:#{name}, self, \n self.class::MASKS[:#{name}], a, b)\n if Thread.current['__running_mask']\n Thread.current['__running_mask'] << mk\n else\n Thread.current['__running_mask'] = [mk]\n end\n \n return Method.rest\n ensure\n if Thread.current['__running_mask'].size == 1\n Thread.current['__running_mask'] = []\n else\n Thread.current['__running_mask'].pop\n end\n end\n\n CODE\n end\n end\n end",
"def unmask(message, key)\n masked = []\n mask_bytes = key.unpack(\"C4\")\n i = 0\n message.each_byte do |byte|\n masked << (byte ^ mask_bytes[i % 4])\n i += 1\n end\n #p :unmasked => masked.pack(\"C*\"), :original => message\n return masked.pack(\"C*\")\n end",
"def mask_right(str, mask)\n str.gsub(/#{mask}\\z/, '')\n end",
"def mask\n\t\t\t\treturn @_mask\n\t\t\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
new method : remove_all_dismantle_masks
|
def remove_all_dismantle_masks
groups = [$data_items, $data_armors, $data_weapons]
for group in groups
for obj in group
next if obj.nil?
obj.set_dismantle_mask_flags(true)
end # for
end # for
end
|
[
"def unset_mask; end",
"def clear!\n\t\t@mask = []\n\tend",
"def unset_mask\n @masking_key = nil\n end",
"def remove_all_of controllable\n @controls.reject! { |control| control.controllable == controllable }\n end",
"def remove_dismantle_mask(key, id)\n case key\n when :item\n $data_items[id].set_dismantle_mask_flags(true)\n when :armor\n $data_armors[id].set_dismantle_mask_flags(true)\n when :weapon\n $data_weapons[id].set_dismantle_mask_flags(true)\n end\n end",
"def unmask\n @pipeline = Pipeline.find(params[:pipeline_id])\n @task = Task.find(params[:id])\n\n @task.masks.each { |m| m.destroy }\n\n respond_to do |format|\n format.html { redirect_to pipeline_tasks_path(@pipeline) }\n format.xml { head :ok }\n end\n\n end",
"def remove_all_wideip_rules\n super\n end",
"def clear_flags\n @regs.each(&:clear_flags)\n end",
"def delete_all_wideips\n super\n end",
"def remove(*permissions)\n @old_mask ||= self.mask\n permissions.each { |permission| self.mask &= ~mask_for_permission(permission) }\n end",
"def unmask\n call \"Backend.app.unmask\"\n end",
"def delete_all_port_mirrors\n super\n end",
"def reset_mask_for column_name, *fields\n fields = bitfields if fields.empty?\n max = bitfield_max(column_name)\n (0..max).sum{|i| 2 ** i} - only_mask_for(column_name, *fields)\n end",
"def clear_flags\n each(&:clear_flags)\n self\n end",
"def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end",
"def _remove_all_method\n :\"_remove_all_#{self[:name]}\"\n end",
"def masked; end",
"def delete_all_administrative_ips\n super\n end",
"def set_dismantle_mask_flags(flag = true)\n return unless self.is_a?(RPG::Item) || self.is_a?(RPG::EquipItem)\n @dismantle_items.each do |obj| obj.mask = flag end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
def new method : get_dismantle_count
|
def get_dismantle_count(key, id)
case key
when :item
$data_items[id].dismantle_counter
when :armor
$data_armors[id].dismantle_counter
when :weapon
$data_weapons[id].dismantle_counter
end # case
end
|
[
"def disperse_count\n @disperse_count\n end",
"def count\n dps.count\nend",
"def get_all_dismantle_count\n count = 0\n groups = [$data_items, $data_armors, $data_weapons]\n for group in groups\n for obj in group\n next if obj.nil?\n count += obj.dismantle_counter\n end # for\n end # for\n return count\n end",
"def offense_counts; end",
"def offense_count; end",
"def count\n @count.value\n end",
"def instantiate_counts\n self.create_count\n end",
"def count_restaurants\n end",
"def offense_count=(_); end",
"def updateCount\n @updateCount\n end",
"def food_count()\nreturn @stomach.count()\nend",
"def count\n @bonds.count\n end",
"def getredeemcount()\r\n return getvalueasint(SVTags::REDEEM_COUNT)\r\n end",
"def count\n 0\n end",
"def requested_count\n notifications.count\n end",
"def getNbRecompense\n return 0\n end",
"def count\n @params[:rettype] = 'count'\n self\n end",
"def disc_count\n return @disc_count\n end",
"def actual_count\n redis_count = self.redis_clicks.value\n db_count = self.clicks || 0\n redis_count + db_count\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
def new method : get_all_dismantle_count
|
def get_all_dismantle_count
count = 0
groups = [$data_items, $data_armors, $data_weapons]
for group in groups
for obj in group
next if obj.nil?
count += obj.dismantle_counter
end # for
end # for
return count
end
|
[
"def offense_counts; end",
"def count\n dps.count\nend",
"def get_dismantle_count(key, id)\n case key\n when :item\n $data_items[id].dismantle_counter\n when :armor\n $data_armors[id].dismantle_counter\n when :weapon\n $data_weapons[id].dismantle_counter\n end # case\n end",
"def count_restaurants\n end",
"def fetch_count\n @options[:count_only] = true\n result_processor.to_result\n end",
"def get_counts_for_all_entities\n @tracker.counts\n end",
"def count\n @params[:rettype] = 'count'\n self\n end",
"def offense_count; end",
"def disperse_count\n @disperse_count\n end",
"def count\n @bonds.count\n end",
"def food_count()\nreturn @stomach.count()\nend",
"def index\n @dislike_counts = DislikeCount.all\n end",
"def instantiate_counts\n self.create_count\n end",
"def count\n @count.value\n end",
"def how_many(klass)\n JSON.parse(@client.raw_read(resource: klass, summary: \"count\").response[:body])[\"total\"].to_i\n end",
"def total_count\n fetch.json.[](:total_count)\n end",
"def total_count\n query_results.total_count\n end",
"def get_ordercount(cate_id)\n Order.where(category_id: cate_id ).count\n \n end",
"def sellings_count\n sellings.count\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /accession_location_entries/1 GET /accession_location_entries/1.json
|
def show
@accession_location_entry = AccessionLocationEntry.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @accession_location_entry }
end
end
|
[
"def show\n @collection_location_entry = CollectionLocationEntry.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @collection_location_entry }\n end\n end",
"def get_location\n as_json(get_results('/locations.json'))\n end",
"def new\n @accession_location_entry = AccessionLocationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accession_location_entry }\n end\n end",
"def get_location\n JSON.parse(get_results('/locations.json'), {symbolize_names: true})\n end",
"def index\n @geo_entries = GeoEntry.all\n end",
"def index\n @map = Map.find(params[:map_id])\n if @map.kind == \"activity\"\n @locations = @map.locations.activity\n elsif @map.kind == \"news\"\n @locations = @map.locations.news\n else\n @locations = @map.locations\n end\n respond_to do |format|\n format.json { render :json => @locations.as_json(:include => :location_pin)}\n end\n end",
"def event_get_location_details\n @loc = Apis::HereApi.new(\"\").get_location_details(params[:locationid])\n render json: @loc\n end",
"def index\n @map_entries = MapEntry.all\n end",
"def lookup_response(request, entries); end",
"def show\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def index\n @clinic_locations = ClinicLocation.all\n\n # respond_to do |f|\n # f.json { render :index, location: @clinic_locations }\n # end\n end",
"def locations\n customer = Customer.find_by(id: params[:id], company: current_company)\n locations = customer.locations\n render json: { locations: locations }\n end",
"def index\n @entries = SourceGlossaryEntry.eager_load(:locale_glossary_entries).sort_by { |e| e.source_copy.downcase }\n\n respond_with @entries do |format|\n format.json { render json: decorate(@entries).to_json }\n end\n end",
"def index\n @lesion_locations = LesionLocation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesion_locations }\n end\n end",
"def index\n @recipe_locations = RecipeLocation.all\n end",
"def show\n @maplocation = MapLocation.find(params[:id])\n respond_to do |format|\n format.html\n format.json { render :json => @maplocation }\n end\n end",
"def fetch_location\n location_list\n puts \"TYPE THE ID OF WHAT YOU WANT TO SEE IN DETAIL\"\n fetch = gets.to_i\n result = Location.find(\"locations\", fetch)\n result.display_attributes\n end",
"def index\n @locs = Loc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @locs }\n end\n end",
"def locations id, date = Date.today.to_s\n uri = \"#{BASE_URL}/gauges/#{id}/locations?date=#{date}\"\n fetch uri\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /accession_location_entries/new GET /accession_location_entries/new.json
|
def new
@accession_location_entry = AccessionLocationEntry.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @accession_location_entry }
end
end
|
[
"def new\n @collection_location_entry = CollectionLocationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_location_entry }\n end\n end",
"def create\n @accession_location_entry = AccessionLocationEntry.new(params[:accession_location_entry])\n\n respond_to do |format|\n if @accession_location_entry.save\n format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully created.' }\n format.json { render json: @accession_location_entry, status: :created, location: @accession_location_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @loc = current_user.locs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loc }\n end\n end",
"def new\n @locationmap = Locationmap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @locationmap }\n end\n end",
"def new\n @location_url_map = LocationUrlMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_url_map }\n end\n end",
"def new\n @location = Location.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end",
"def new\n @location_map = LocationMap.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_map }\n end\n end",
"def new\n @location = Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location }\n end\n end",
"def new\n @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end",
"def new\n @map_location = Map::Location.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @map_location }\n end\n end",
"def new\n @entry = Entry.new\n\n render json: @entry\n end",
"def new\n @zone_entry = ZoneEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @zone_entry }\n end\n end",
"def new\n @processed_location = ProcessedLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @processed_location }\n end\n end",
"def new\n @lesion_location = LesionLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lesion_location }\n end\n end",
"def new\n @corp_location = CorpLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corp_location }\n end\n end",
"def new\n @class_location = ClassLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @class_location }\n end\n end",
"def new\n if current_user.is_not_member?\n flash[:error] = \"You do not have permissions to access that feature.\"\n redirect_to root_path and return\n end\n \n @location_history = LocationHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @location_history }\n end\n end",
"def new\n @records_location = RecordsLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @records_location }\n end\n end",
"def new\n @entry = Entry.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entry }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /accession_location_entries POST /accession_location_entries.json
|
def create
@accession_location_entry = AccessionLocationEntry.new(params[:accession_location_entry])
respond_to do |format|
if @accession_location_entry.save
format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully created.' }
format.json { render json: @accession_location_entry, status: :created, location: @accession_location_entry }
else
format.html { render action: "new" }
format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @collection_location_entry = CollectionLocationEntry.new(params[:collection_location_entry])\n\n respond_to do |format|\n if @collection_location_entry.save\n format.html { redirect_to @collection_location_entry, notice: 'Collection location entry was successfully created.' }\n format.json { render json: @collection_location_entry, status: :created, location: @collection_location_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @collection_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @accession_location_entry = AccessionLocationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @accession_location_entry }\n end\n end",
"def map_entry\n entry = {\n city: location['locality'],\n state: location['region'],\n address: address,\n zip_code: zip_code,\n event_source: 'mobilize',\n event_type: data['event_type'],\n event_title: data['title'],\n campaign: campaign_slug,\n include_on_carousel: show_on_carousel?,\n description: data['description'],\n location_name: location_name,\n featured_image_url: data['featured_image_url'],\n registration_link: data['browser_url'],\n timeslots: timeslots.map(&:as_json),\n latitude: latitude,\n longitude: longitude,\n hub_id: hub_id # this method comes from event.rb\n }\n entry[:end_date] = entry[:timeslots].last[:end_date]\n entry[:start_date] = entry[:timeslots].first[:start_date]\n entry[:end_date_string] = entry[:timeslots].last[:end_date_string]\n entry[:start_date_string] = entry[:timeslots].first[:start_date_string]\n entry\n end",
"def create\n @geo_entry = GeoEntry.new(geo_entry_params)\n\n respond_to do |format|\n if @geo_entry.save\n format.html { redirect_to @geo_entry, notice: 'Geo entry was successfully created.' }\n format.json { render :show, status: :created, location: @geo_entry }\n else\n format.html { render :new }\n format.json { render json: @geo_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @map_entry = MapEntry.new(map_entry_params)\n\n respond_to do |format|\n if @map_entry.save\n format.html { redirect_to @map_entry, notice: 'Map entry was successfully created.' }\n format.json { render :show, status: :created, location: @map_entry }\n else\n format.html { render :new }\n format.json { render json: @map_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @zone_entry = ZoneEntry.new(params[:zone_entry])\n\n respond_to do |format|\n if @zone_entry.save\n format.html { redirect_to @zone_entry, notice: 'Zone entry was successfully created.' }\n format.json { render json: @zone_entry, status: :created, location: @zone_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zone_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @map_entries = MapEntry.all\n end",
"def index\n @geo_entries = GeoEntry.all\n end",
"def create\n @entry = list.entries.build(params[:entry])\n\n respond_to do |format|\n if entry.save\n format.html { redirect_to list, notice: 'Entry was successfully created.' }\n format.json { render json: entry, status: :created, location: [list, entry] }\n else\n format.html { render action: \"new\" }\n format.json { render json: entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @collection_location_entry = CollectionLocationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_location_entry }\n end\n end",
"def create\n @recipe_location = RecipeLocation.new(recipe_location_params)\n\n respond_to do |format|\n if @recipe_location.save\n format.html { redirect_to @recipe_location, notice: 'Recipe location was successfully created.' }\n format.json { render :show, status: :created, location: @recipe_location }\n else\n format.html { render :new }\n format.json { render json: @recipe_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n @accession_location_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to accession_location_entries_url }\n format.json { head :no_content }\n end\n end",
"def create_entries\n\n #check if the same client has some address associated with it. Update the address if already present\n client_wallet_address = ClientWalletAddress.where(client_id: @client_id, sub_environment: GlobalConstant::Base.sub_environment_name).first\n\n if client_wallet_address.present?\n #update the new address\n client_wallet_address.address = @owner_address\n client_wallet_address.save!\n else\n ClientWalletAddress.create!(\n client_id: @client_id,\n sub_environment: GlobalConstant::Base.sub_environment_name,\n address: @owner_address.downcase,\n status:GlobalConstant::WalletAddressStatus.active_status\n )\n end\n\n @token_id = @token_details[:id]\n\n token_addresses = TokenAddresses.where(\n token_id: @token_id,\n kind: GlobalConstant::TokenAddresses.owner_address_kind\n ).first\n\n if token_addresses.present?\n\n if token_addresses[:known_address_id].present?\n request_saas_to_remove_known_address(token_addresses[:known_address_id])\n end\n\n token_addresses[:address] = @owner_address\n token_addresses[:known_address_id] = nil\n\n token_addresses.save!\n else\n TokenAddresses.create!(\n token_id: @token_id,\n kind: GlobalConstant::TokenAddresses.owner_address_kind,\n address: @owner_address\n )\n\n end\n\n success\n end",
"def create\r\n @location = Location.new(params[:location])\r\n\r\n respond_to do |format|\r\n if @location.save\r\n format.json { render json: @location, status: :created, location: @location }\r\n else\r\n format.json { render json: @location.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end",
"def add_location(kind, lat, long)\n # Read in the JSON file to a new object named \"data\"\n data = JSON.parse(File.read('tiles.json'))\n \n # Expect the JSON object, \"data\", to have a 'locations' attribute we can append to\n data['tiles'] << {\"kind\" => kind, \"latitude\" => latitude.to_i , \"longitude\" => longitude.to_i }\n \n # Open the JSON file in 'w' (overwrite) mode and write the new \"data\" back into JSON\n File.open('tiles.json', 'w') do |datafile|\n datafile.write(data.to_json)\n end\nend",
"def post_entity_entries(eid, entries)\n endpoint_url = URI.join(self.engine.base_url, \"entities/#{eid}/entries?v=#{self.engine.version}\")\n\n self.post(endpoint_url, entries.to_json)\n end",
"def enter_locations(test_data)\n locations = test_data[CoreUseOfCollectionsData::LOCATION_LIST.name] || [{CoreUseOfCollectionsData::LOCATION.name => ''}]\n hide_notifications_bar\n prep_fieldsets_for_test_data([fieldset(CoreUseOfCollectionsData::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n logger.info \"Entering location data set at index #{index}: #{location}\"\n enter_auto_complete(location_input(index), location_options(index), location[CoreUseOfCollectionsData::LOCATION.name], 'Local Places')\n end\n end",
"def lookup_response(request, entries); end",
"def enter_locations(test_data)\n locations = test_data[UseOfCollections::LOCATION_LIST.name] || [{ UseOfCollections::LOCATION.name => ''}]\n prep_fieldsets_for_test_data([fieldset(UseOfCollections::LOCATION_LIST.name)], locations)\n locations.each_with_index do |location, index|\n enter_auto_complete(location_input(index), location_options(index), location[UseOfCollections::LOCATION.name], 'Local Places')\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /accession_location_entries/1 PUT /accession_location_entries/1.json
|
def update
@accession_location_entry = AccessionLocationEntry.find(params[:id])
respond_to do |format|
if @accession_location_entry.update_attributes(params[:accession_location_entry])
format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @collection_location_entry = CollectionLocationEntry.find(params[:id])\n\n respond_to do |format|\n if @collection_location_entry.update_attributes(params[:collection_location_entry])\n format.html { redirect_to @collection_location_entry, notice: 'Collection location entry was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @collection_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end",
"def create\n @accession_location_entry = AccessionLocationEntry.new(params[:accession_location_entry])\n\n respond_to do |format|\n if @accession_location_entry.save\n format.html { redirect_to @accession_location_entry, notice: 'Accession location entry was successfully created.' }\n format.json { render json: @accession_location_entry, status: :created, location: @accession_location_entry }\n else\n format.html { render action: \"new\" }\n format.json { render json: @accession_location_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def inline_update\n respond_to do |format|\n if @location.update(location_params)\n format.json { render :show, status: :ok, location: @location }\n else\n format.json { render json: { error: @location.errors }, status: :ok }\n end\n end\n end",
"def update\n Location.update(params[:location].keys, params[:location].values)\n\n redirect_to admin_locations_path\n end",
"def update\n organization_timeline_entry.update_attributes(organization_timeline_entry_params)\n respond_with(@organization_timeline_entry, location: params[:url])\n end",
"def destroy\n @accession_location_entry = AccessionLocationEntry.find(params[:id])\n @accession_location_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to accession_location_entries_url }\n format.json { head :no_content }\n end\n end",
"def update\n @entry = Entry.find(params[:id])\n\n respond_to do |format|\n if @entry.update_attributes(params[:entry])\n format.json { render json: @entry, status: :created, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @map_entry.update(map_entry_params)\n format.html { redirect_to @map_entry, notice: 'Map entry was successfully updated.' }\n format.json { render :show, status: :ok, location: @map_entry }\n else\n format.html { render :edit }\n format.json { render json: @map_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @recipe_location.update(recipe_location_params)\n format.html { redirect_to @recipe_location, notice: 'Recipe location was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_location }\n else\n format.html { render :edit }\n format.json { render json: @recipe_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @entry.update(entry_params)\n format.json { render :show, status: :ok, location: @entry }\n else\n format.json { render json: @entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @historical_location.update(historical_location_params)\n format.html { redirect_to @historical_location, notice: 'Historical location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @historical_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @location_url_map = LocationUrlMap.find(params[:id])\n\n respond_to do |format|\n if @location_url_map.update_attributes(params[:location_url_map])\n format.html { redirect_to @location_url_map, notice: 'Location url map was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @location_url_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @service_location = @contract.service_locations.find(params[:id])\n\n respond_to do |format|\n if @service_location.update_attributes(params[:service_location])\n format.html { redirect_to @contract, notice: 'Service location was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @service_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @storage_entry.update(storage_entry_params)\n format.json { render :show, status: :ok, location: @storage_entry }\n else\n format.json { render json: @storage_entry.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @location_mapping.update(location_mapping_params)\n format.html { redirect_to @location_mapping, notice: 'Location mapping was successfully updated.' }\n format.json { render :show, status: :ok, location: @location_mapping }\n else\n format.html { render :edit }\n format.json { render json: @location_mapping.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @event_location = EventLocation.find(params[:id])\n\n respond_to do |format|\n if @event_location.update_attributes(event_location_params)\n format.html { redirect_to @event_location, notice: 'Event location was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @event_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @table_location.update(table_location_params)\n format.html { redirect_to @table_location, notice: 'Table location was successfully updated.' }\n format.json { render :show, status: :ok, location: @table_location }\n else\n format.html { render :edit }\n format.json { render json: @table_location.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n flash[:notice] = t('scaffold.notice.updated', :item => SicossLocation.model_name.human) if @sicoss_location.update_attributes(params[:sicoss_location])\n respond_with(@sicoss_location, :location => sicoss_locations_path)\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.