query
stringlengths 7
9.5k
| document
stringlengths 10
1.07M
| negatives
listlengths 19
19
| metadata
dict |
---|---|---|---|
Returns a css class name for kind of file
|
def icon_css_class
case file_mime_type
when *ARCHIVE_FILE_TYPES
then "archive"
when *AUDIO_FILE_TYPES
then "audio"
when *IMAGE_FILE_TYPES
then "image"
when *VIDEO_FILE_TYPES
then "video"
when "application/x-shockwave-flash"
then "flash"
when "image/x-psd"
then "psd"
when "text/plain"
then "text"
when "application/rtf"
then "rtf"
when "application/pdf"
then "pdf"
when "application/msword"
then "word"
when "application/vnd.ms-excel"
then "excel"
when *VCARD_FILE_TYPES
then "vcard"
else "file"
end
end
|
[
"def get_class_name\n \"#{ file_name }\".chop.capitalize\n end",
"def icon_css_class\n case file_mime_type\n when \"application/pdf\"\n \"file-pdf\"\n when \"application/msword\"\n \"file-word\"\n when *TEXT_FILE_TYPES\n \"file-alt\"\n when *EXCEL_FILE_TYPES\n \"file-excel\"\n when *POWERPOINT_FILE_TYPES\n \"file-powerpoint\"\n when *WORD_FILE_TYPES\n \"file-word\"\n when *VCARD_FILE_TYPES\n \"address-card\"\n when *ARCHIVE_FILE_TYPES\n \"file-archive\"\n when *AUDIO_FILE_TYPES\n \"file-audio\"\n when *IMAGE_FILE_TYPES\n \"file-image\"\n when *VIDEO_FILE_TYPES\n \"file-video\"\n else\n \"file\"\n end\n end",
"def classname\n return fileclass.classname if fileclass\n 'default'\n end",
"def get_file_name class_name\n class_name.underscore\n end",
"def io_class_name_for(seed_file)\n \"%sFile\" % ExtType.decision(seed_file).capitalize\n end",
"def getStyle(filename)\n DEFAULT_FILE_TYPES.invert[File.extname(filename)]\n end",
"def file_type_class\n self.file_type.downcase.split.join('-') + '-file'\n end",
"def css_class\n CLASS_NAMES[name]\n end",
"def class_name\n return file_name.sub(/.as$/,'') rescue 'Unknown'\n end",
"def defined_classname filename\r\n script = File.new filename\r\n script.each_line do |line|\r\n if line =~ /class(.*)[<|\\z]/ \r\n script.close\r\n return $1.strip\r\n end\r\n end \r\n script.close \r\n \"\"\r\nend",
"def build_class_name(file_path,file_name)\n file_path+\".\"+file_name.sub('.c','')\n end",
"def rule_class_name\n file_path.split('/').last.classify\n end",
"def class_file klass_name\n name = klass_name.split('::').last\n File.join class_path(klass_name), \"cdesc-#{name}.ri\"\n end",
"def extract_class_name(filename)\n filename.split('/')[2..-1].collect { |i| i.camelize }.join('::').chomp(\".rb\")\n end",
"def type\n class_to_filename(self.class.to_s.sub(/.*:/, ''))\n end",
"def as_css_background_with_class(klass=nil)\n klass=File.basename(@file_path).tr('.','_') unless klass\n \".#{klass} {\\n #{self.as_css_background}\\n}\"\n end",
"def extract_class_name(filename)\n #filename.split('/')[2..-1].join('/').split('.').first.camelize\n # Fixed by patch from ticket #12742\n File.basename(filename).chomp(\".rb\").camelize\n end",
"def css_template_filename\n self.class.name.downcase.gsub(/.*::/,'') << '.css.erb'\n end",
"def extract_class_name(filename)\n File.basename(filename).chomp(\".rb\").camelize\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /references/new GET /references/new.json
|
def new
@reference = @account.references.new
end
|
[
"def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference }\n end\n end",
"def new\n @refer = Refer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @refer }\n end\n end",
"def new\n @reference_datum = ReferenceDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_datum }\n end\n end",
"def new\n @ref = Ref.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ref }\n end\n end",
"def new\n @cms_reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cms_reference }\n end\n end",
"def new\n @ref_datum = RefDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ref_datum }\n end\n end",
"def new\n @reference = Reference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @reference }\n end\n end",
"def new\n @reference_database = ReferenceDatabase.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_database }\n end\n end",
"def new\n @topic = Topic.find params[:topic_id] \n @reference = @topic.references.new\n end",
"def new\n @fk_reference = FkReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fk_reference }\n end\n end",
"def new\n @penn_reference_info = PennReferenceInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @penn_reference_info }\n end\n end",
"def new\n @referer = Referer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @referer }\n end\n end",
"def new\n @through_reference = ThroughReference.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @through_reference }\n end\n end",
"def create\n @reference = Reference.new(reference_params)\n \n respond_to do |format|\n if @reference.save\n format.html { redirect_to references_path }\n format.json { render json: @reference, status: :created, location: @reference }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reference.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ref = Ref.new(ref_params)\n\n respond_to do |format|\n if @ref.save\n format.html { redirect_to @ref, notice: 'Ref was successfully created.' }\n format.json { render :show, status: :created, location: @ref }\n else\n format.html { render :new }\n format.json { render json: @ref.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @activity_ref = ActivityRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @activity_ref }\n end\n end",
"def new\n @reference_site = ReferenceSite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @reference_site }\n end\n end",
"def new\n @rebalance_ref = RebalanceRef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rebalance_ref }\n end\n end",
"def new\n @georef = Georef.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @georef }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /internets GET /internets.json
|
def index
@internets = Internet.all
end
|
[
"def index\n @internet_types = InternetType.all\n end",
"def index\n @networkings = Networking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @networkings }\n end\n end",
"def test_get_site_list\r\n endpoint = \"/sites\"\r\n uri = URI(\"#{@host}#{endpoint}\")\r\n request = Net::HTTP::Get.new(uri)\r\n request['Accept'] = 'application/json'\r\n \r\n test_start = Time.now\r\n response = Net::HTTP.start(uri.hostname, uri.port) do |http|\r\n http.request(request)\r\n end\r\n test_end = Time.now\r\n\r\n @results << {\r\n :api => 'GET /sites',\r\n :endpoint => endpoint,\r\n :start_time => test_start,\r\n :runtime => (test_end.to_f - test_start.to_f) * 1000.0,\r\n :status => response.code,\r\n :content_type => response['content-type']\r\n }\r\n end",
"def get_data\n uri = URI(\"https://taskboardv2.herokuapp.com/station1.json\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n response = http.request(Net::HTTP::Get.new(uri.request_uri))\n JSON.parse(response.body)\nend",
"def index\n @sites = Site.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sites }\n end\n end",
"def network_hosts_all\n begin\n print_verbose \"Retrieving all network hosts\"\n response = RestClient.get \"#{@url}network/hosts\", {:params => {:token => @token}}\n details = JSON.parse(response.body)\n print_good \"Retrieved #{details['count']} network hosts\"\n details\n rescue => e\n print_error \"Could not retrieve network hosts: #{e.message}\"\n end\nend",
"def index\n @network_sites = NetworkSite.all\n end",
"def index\n @aws_internet_gateways = AwsInternetGateway.all\n end",
"def index\n @websites = @website_user.websites\n render json: { websites: @websites }\n end",
"def swapi_fetch(url)\n JSON.parse(URI(url).read)\nend",
"def list_network\n network = Shout.fetch_network(params)\n if !network.blank?\n response_map={:network=>network}\n render json: response_map, status: 200\n else\n render json:{:response=>\"failed\"}, status:422\n end\n end",
"def index\n @api_v1_sites = Api::V1::Site.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @api_v1_sites }\n end\n end",
"def index\n @urls = Url.all\n\n render json: @urls\n end",
"def offline_browsers \n begin\n print_verbose \"Retrieving offline browsers\"\n response = RestClient.get \"#{@url}hooks\", {:params => {:token => @token}}\n result = JSON.parse(response.body)\n browsers = result[\"hooked-browsers\"][\"offline\"]\n print_good \"Retrieved offline browser list [#{browsers.size} offline]\"\n browsers\n rescue => e\n print_error \"Could not retrieve browser details: #{e.message}\"\n end\nend",
"def swapi_fetch(url)\n JSON.parse(open(url).read)\nend",
"def network_hosts session\n begin\n print_verbose \"Retrieving network hosts for hooked browser [session: #{session}]\"\n response = RestClient.get \"#{@url}network/hosts/#{session}\", {:params => {:token => @token}}\n details = JSON.parse(response.body)\n print_good \"Retrieved #{details['count']} network hosts\"\n details\n rescue => e\n print_error \"Could not retrieve network hosts: #{e.message}\"\n end\nend",
"def show\n @website = Website.find(params[:id])\n\n render json: @website\n end",
"def index\n @work_sites = WorkSite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @work_sites }\n end\n end",
"def network_services_all\n begin\n print_verbose \"Retrieving all network services\"\n response = RestClient.get \"#{@url}network/services\", {:params => {:token => @token}}\n details = JSON.parse(response.body)\n print_good \"Retrieved #{details['count']} network services\"\n details\n rescue => e\n print_error \"Could not retrieve network services: #{e.message}\"\n end\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /internets POST /internets.json
|
def create
@internet = Internet.new(internet_params)
respond_to do |format|
if @internet.save
format.html { redirect_to @internet, notice: 'Internet was successfully created.' }
format.json { render :show, status: :created, location: @internet }
else
format.html { render :new }
format.json { render json: @internet.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @internet = Internet.new(internet_params)\n\n respond_to do |format|\n if @internet.save\n InternetMailer.welcome_email(@internet).deliver_now\n InternetMailer.new_signup_email(@internet).deliver_now\n format.html { redirect_to thankyou_path from: 'internet' }\n format.json { render :show, status: :created, location: @internet }\n else\n format.html { render :new }\n format.json { render json: @internet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @internets = Internet.all\n end",
"def create\n @internet_order = InternetOrder.new(internet_order_params)\n\n respond_to do |format|\n if @internet_order.save\n format.html { redirect_to internet_orders_url, notice: 'Internet order was successfully created.' }\n format.json { render :index, status: :created, location: @internet_order }\n else\n format.html { render :new }\n format.json { render json: @internet_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @internet_type = InternetType.new(internet_type_params)\n\n respond_to do |format|\n if @internet_type.save\n format.html { redirect_to @internet_type, notice: 'Internet type was successfully created.' }\n format.json { render action: 'show', status: :created, location: @internet_type }\n else\n format.html { render action: 'new' }\n format.json { render json: @internet_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n parameters = params[:internet_address]\n @internet_address = InternetAddress.new(parameters[:number], parameters[:version])\n\n respond_to do |format|\n\n if @internet_address.save\n format.html { redirect_to @internet_address, :notice => 'Internet address was successfully created.' }\n format.json { render :json => @internet_address, :status => :created, :location => @internet_address }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @internet_address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @internet_link = InternetLink.new(internet_link_params)\n\n respond_to do |format|\n if @internet_link.save\n format.html { redirect_to @internet_link, notice: 'Internet link was successfully created.' }\n format.json { render :show, status: :created, location: @internet_link }\n else\n format.html { render :new }\n format.json { render json: @internet_link.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_internet_address(params)\n update_internet_address(0, params)\n end",
"def create\n @internet_interface = InternetInterface.new(internet_interface_params)\n\n respond_to do |format|\n if @internet_interface.save\n format.html { redirect_to @internet_interface, notice: 'Internet interface was successfully created.' }\n format.json { render :show, status: :created, location: @internet_interface }\n else\n format.html { render :new }\n format.json { render json: @internet_interface.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @network_site = NetworkSite.new(network_site_params)\n\n respond_to do |format|\n if @network_site.save\n format.html { redirect_to @network_site, notice: 'Network site was successfully created.' }\n format.json { render :show, status: :created, location: @network_site }\n else\n format.html { render :new }\n format.json { render json: @network_site.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @internet.update(internet_params)\n format.html { redirect_to @internet, notice: 'Internet was successfully updated.' }\n format.json { render :show, status: :ok, location: @internet }\n else\n format.html { render :edit }\n format.json { render json: @internet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @internet_address = InternetAddress.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @internet_address }\n end\n end",
"def index\n @internet_types = InternetType.all\n end",
"def create body = {}\n @connection.request(method: :post, path: \"/networks/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end",
"def add_network(params)\n post('network', params)\n end",
"def destroy\n @internet.destroy\n respond_to do |format|\n format.html { redirect_to internets_url, notice: 'Internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def test_a11y(url)\n data = {\n url: url,\n key: \"YOUR TENON KEY\",\n level: \"AA\"\n }\n\n uri = URI.parse('https://tenon.io/api/')\n https = Net::HTTP.new(uri.host, uri.port)\n https.use_ssl = true\n\n request = Net::HTTP::Post.new(uri.request_uri)\n request.set_form_data(data)\n response = https.request(request) \n\n return JSON.parse(response.body)\n end",
"def create\n @network = current_user.networks.new(network_params)\n\n respond_to do |format|\n if @network.save\n format.html { redirect_to @network, notice: t(:nertwork_created_ok) }\n format.json { render action: 'show', status: :created, location: @network }\n else\n format.html { render action: 'new' }\n format.json { render json: @network.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_server(zone: \"fi-hel1\", title:, hostname:, core_number: 1,\n memory_amount: 1024, storage_devices:, ip_addresses: :all)\n data = {\n \"server\" => {\n \"zone\" => zone,\n \"title\" => title,\n \"hostname\" => hostname,\n \"core_number\" => core_number,\n \"memory_amount\" => memory_amount,\n \"storage_devices\" => { \"storage_device\" => storage_devices }\n }\n }\n\n if ip_addresses != :all\n ips = []\n ips << { \"access\" => \"public\", \"family\" => \"IPv4\" } if ip_addresses.include? :public\n ips << { \"access\" => \"private\", \"family\" => \"IPv4\" } if ip_addresses.include? :private\n ips << { \"access\" => \"public\", \"family\" => \"IPv6\" } if ip_addresses.include? :ipv6\n\n data[\"server\"][\"ip_addresses\"] = {}\n data[\"server\"][\"ip_addresses\"][\"ip_address\"] = ips\n end\n\n json = JSON.generate data\n response = post \"server\", json\n response\n end",
"def createNetwork\n require 'rest_client'\n require 'uri'\n\n if @role.nil? and !current_actor.superadmin\n json_response({ message: \"You don't have permission to create networks\" }, :unauthorized)\n return\n end\n\n # Service name in the query\n networkName = params[\"network_name\"]\n\n # Env variables for Manager host and port\n serviceManagerHost = Settings.service_manager_host\n serviceManagerPort = Settings.service_manager_port.to_s\n serviceManagerURI = 'http://' + serviceManagerHost + ':' + serviceManagerPort + '/v1/network'\n\n # Create request for Service Manager\n stack = {\n 'name' => networkName,\n 'engine-url' => @cluster.endpoint,\n 'ca-cert' => @cluster.ca,\n 'cert' => @cluster.cert,\n 'cert-key' => @cluster.key\n }.to_json\n\n begin\n response = RestClient.post(\n serviceManagerURI,\n stack,\n 'Accept' => 'application/json',\n 'Content-Type' => 'application/json'\n )\n puts \"Deploy Response: \" + response\n json_response(response, :created)\n rescue Exception => e\n # If error, respond with it\n puts e\n json_response({message: e}, :unprocessable_entity)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /internets/1 PATCH/PUT /internets/1.json
|
def update
respond_to do |format|
if @internet.update(internet_params)
format.html { redirect_to @internet, notice: 'Internet was successfully updated.' }
format.json { render :show, status: :ok, location: @internet }
else
format.html { render :edit }
format.json { render json: @internet.errors, status: :unprocessable_entity }
end
end
end
|
[
"def patch *args\n make_request :patch, *args\n end",
"def update\n @internet_address = InternetAddress.find(params[:id])\n\n respond_to do |format|\n if @internet_address.update_attributes(params[:internet_address])\n format.html { redirect_to @internet_address, :notice => 'Internet address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @internet_address.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def put\n request_method('PUT')\n end",
"def favorite\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/contacts/2/favorite'\n ).to_s\n\n puts RestClient.patch(\n url,{}\n )\nend",
"def update\n respond_to do |format|\n if @internet_type.update(internet_type_params)\n format.html { redirect_to @internet_type, notice: 'Internet type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @internet_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @server = compute.get_server(params[:id]).update(:name=>params[:name])\n respond_to do |format|\n format.html { redirect_to servers_path, :notice => 'Server was successfully updated.' }\n format.json { head :ok }\n end\n end",
"def update\n respond_to do |format|\n if @internet_order.update(internet_order_params)\n format.html { redirect_to internet_orders_url, notice: 'Internet order was successfully updated.' }\n format.json { render :show, status: :ok, location: @internet_order }\n else\n format.html { render :edit }\n format.json { render json: @internet_order.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @internet_reservation.update(internet_reservation_params)\n format.html { redirect_to @internet_reservation, notice: 'Internet reservation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @internet_reservation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put(*a) route 'PUT', *a end",
"def put *args\n make_request :put, *args\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_item token, item_id, name, description\n uri = URI.parse \"https://#{get_hostname(token)}/sf/v3/Items(#{item_id})\"\n puts uri\n \n http = Net::HTTP.new uri.host, uri.port\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n \n item = {\"Name\"=>name, \"Description\"=>description}\n \n request = Net::HTTP::Patch.new uri.request_uri \n request[\"Content-Type\"] = \"application/json\"\n request[\"Authorization\"] = get_authorization_header(token)\n request.body = item.to_json\n \n response = http.request request\n puts \"#{response.code} #{response.message}\"\n \n if response.kind_of? Net::HTTPSuccess\n updated_item = JSON.parse response.body\n puts \"Updated Item: #{updated_item['Id']}\"\n end \nend",
"def update\n respond_to do |format|\n if @access_internet.update(access_internet_params)\n format.html { redirect_to @access_internet, notice: 'Access internet was successfully updated.' }\n format.json { render :show, status: :ok, location: @access_internet }\n else\n format.html { render :edit }\n format.json { render json: @access_internet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_mobile_carrier(args = {}) \n put(\"/mobile.json/#{args[:carrierId]}\", args)\nend",
"def put(path, params={}); make_request(:put, host, port, path, params); end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def patch(subnet_name, options = {})\n @uri += \"?api-version=#{api_version}\"\n end",
"def update\n official = Official.find(params[:id])\n if official.update(official_params)\n render json: official, status: 200, location: [:api, official]\n else\n failed_to_update(official, \"official\")\n end\n end",
"def update_optin(json_string)\n\t\tif !uri_valid?\n\t\t\treturn nil\n\t\tend\n\t\treq = Net::HTTP::Post.new(\"/update\", initheader = {'Content-Type' =>'application/json'})\n\t\treq.body = json_string\n\t\tresponse = Net::HTTP.new(@server, @port).start {|http| http.request(req) }\n\t\tif response.code == \"200\"\n\t\t\treturn true\n\t\telse\n\t\t\treturn nil\n\t\tend\n\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /internets/1 DELETE /internets/1.json
|
def destroy
@internet.destroy
respond_to do |format|
format.html { redirect_to internets_url, notice: 'Internet was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @access_internet.destroy\n respond_to do |format|\n format.html { redirect_to access_internets_url, notice: 'Access internet was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internet_address = InternetAddress.find(params[:id])\n @internet_address.destroy\n\n respond_to do |format|\n format.html { redirect_to internet_addresses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internet_type.destroy\n respond_to do |format|\n format.html { redirect_to internet_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internet_link.destroy\n respond_to do |format|\n format.html { redirect_to internet_links_url, notice: 'Internet link was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n http_api.delete(\"clients/#{@name}\")\n end",
"def destroy\n @storage = @client.storages.find(params[:id])\n @storage.destroy\n\n respond_to do |format|\n format.html { redirect_to client_url(@client) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @website = Website.find(params[:id])\n @website.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n @saved_network = SavedNetwork.find(params[:id])\n @saved_network.destroy\n\n respond_to do |format|\n format.html { redirect_to saved_networks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @internet_reservation.destroy\n respond_to do |format|\n format.html { redirect_to internet_reservations_url }\n format.json { head :no_content }\n end\n end",
"def delete endpoint\n do_request :delete, endpoint\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destroy\n onevnet \"delete\", resource[:name]\n end",
"def destroy\n @internet_interface.destroy\n respond_to do |format|\n format.html { redirect_to internet_interfaces_url, notice: 'Internet interface was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_from_server(url, payload = {}, &block)\n connection = Miniphonic.connect\n response = connection.delete url, payload\n if response.success?\n block.call(response) if block\n response\n else\n server_error(response)\n end\n end",
"def destroy\n @network.destroy\n\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end",
"def delete(path, params={}); make_request(:delete, host, port, path, params); end",
"def destroy\n @network = Network.find(params[:id])\n @network.destroy\n\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @network.destroy\n respond_to do |format|\n format.html { redirect_to networks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n name, type = resource[:name].split('/')\n nameserver = resource[:nameserver]\n nsupdate(\"server #{nameserver}\n update delete #{name}. #{type}\n send\")\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /admin/restaurants POST /admin/restaurants.json
|
def create
@admin_restaurant = Admin::Restaurant.new(admin_restaurant_params)
respond_to do |format|
if @admin_restaurant.save
format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully created.' }
format.json { render :show, status: :created, location: @admin_restaurant }
else
format.html { render :new }
format.json { render json: @admin_restaurant.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @restaurant = Restaurant.new(params[:restaurant])\n\n respond_to do |format|\n if @restaurant.save\n format.html { redirect_to admin_restaurant_path(@restaurant), notice: 'Restaurant was successfully created.' }\n format.json { render json: @restaurant, status: :created, location: @restaurant }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n json_response(Restaurant.create!(restaurant_params), :created)\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n\n if @restaurant.save\n render json: RestaurantSerializer.new(@restaurant)\n else\n render json: @restaurant.errors, status: :unprocessable_entity\n end\n end",
"def create\n @restaurant = Restaurant.new(restaurant_params)\n if @restaurant.save\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restaurant.errors}, status: :unprocessable_entity\n end\n end",
"def create\n @restaurant_admin = Restaurant::Admin.new(params[:restaurant_admin])\n\n respond_to do |format|\n if @restaurant_admin.save\n format.html { redirect_to @restaurant_admin, notice: 'Admin was successfully created.' }\n format.json { render json: @restaurant_admin, status: :created, location: @restaurant_admin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @restaurant_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_restaurants\n data = @user_restaurants\n ret = data.map do |value|\n {\n id: value.id,\n name: value.name,\n price: value.price,\n cuisine: value.type_of_cuisine,\n address: value.address,\n rating: value.rating\n }\n end\n # Will not store or save user input if it's invalid\n ret.each do |value|\n if value[:name].nil? || value[:name] == '' || (value[:price]).zero? || value[:cuisine].nil? || value[:cuisine] == '' || value[:address].nil? || value[:address] == '' || value[:rating].nil?\n ret.delete(value)\n end\n end\n\n File.write(\"#{File.dirname(__FILE__)}/../public/restaurants.json\", JSON.pretty_generate(ret))\n end",
"def create\n @type_restaurant = TypeRestaurant.new(type_restaurant_params)\n\n respond_to do |format|\n if @type_restaurant.save\n format.html { redirect_to @type_restaurant, notice: 'Type restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @type_restaurant }\n else\n format.html { render :new }\n format.json { render json: @type_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @get_restaurant_list = GetRestaurantList.new(params[:get_restaurant_list])\n\n if @get_restaurant_list.save\n render json: @get_restaurant_list, status: :created, location: @get_restaurant_list\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end",
"def index\n @restaurants = Restaurant.all\n # render json: @restaurants\n end",
"def create\n @listed_restaurant = ListedRestaurant.new(listed_restaurant_params)\n\n respond_to do |format|\n if @listed_restaurant.save\n format.html { redirect_to @listed_restaurant, notice: 'Listed restaurant was successfully created.' }\n format.json { render action: 'show', status: :created, location: @listed_restaurant }\n else\n format.html { render action: 'new' }\n format.json { render json: @listed_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant = Restaurant.new\n\n @restaurant.name = params[:restaurant][:name]\n @restaurant.address = params[:restaurant][:address]\n @restaurant.neighbourhood = params[:restaurant][:neighbourhood]\n @restaurant.price_range = params[:restaurant][:price_range]\n @restaurant.summary = params[:restaurant][:summary]\n @restaurant.menu = params[:restaurant][:menu]\n\n if @restaurant.save\n redirect_to restaurants_url\n else\n render :new\n end\n end",
"def index\n @restaurants = Restaurant.all\n render json: { \n status: 200,\n restaurants: @restaurants\n }\n end",
"def create\n @foodventure_restaurant = FoodventureRestaurant.new(foodventure_restaurant_params)\n\n respond_to do |format|\n if @foodventure_restaurant.save\n format.html { redirect_to @foodventure_restaurant, notice: 'Foodventure restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @foodventure_restaurant }\n else\n format.html { render :new }\n format.json { render json: @foodventure_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @order_restaurant = OrderRestaurant.new(order_restaurant_params)\n\n respond_to do |format|\n if @order_restaurant.save\n format.html { redirect_to @order_restaurant, notice: 'Order restaurant was successfully created.' }\n format.json { render :show, status: :created, location: @order_restaurant }\n else\n format.html { render :new }\n format.json { render json: @order_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurante = Restaurante.new(restaurante_params)\n\n respond_to do |format|\n if @restaurante.save\n format.html { redirect_to @restaurante, notice: 'Restaurante was successfully created.' }\n format.json { render :show, status: :created, location: @restaurante }\n else\n format.html { render :new }\n format.json { render json: @restaurante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @restaurant_type = RestaurantType.new(restaurant_type_params)\n\n respond_to do |format|\n if @restaurant_type.save\n format.html { redirect_to @restaurant_type, notice: 'Restaurant type was successfully created.' }\n format.json { render :show, status: :created, location: @restaurant_type }\n else\n format.html { render :new }\n format.json { render json: @restaurant_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end",
"def create\n @administrador_de_restaurante = AdministradorDeRestaurante.new(administrador_de_restaurante_params)\n\n respond_to do |format|\n if @administrador_de_restaurante.save\n format.html { redirect_to @administrador_de_restaurante, notice: 'Administrador de restaurante was successfully created.' }\n format.json { render :show, status: :created, location: @administrador_de_restaurante }\n else\n format.html { render :new }\n format.json { render json: @administrador_de_restaurante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def select_restaurant\n event = current_user.events.find(params[:id])\n event.event_restaurants.create(:yelp_restaurant_id => params[:yelp_id],\n :yelp_restaurant_name => params[:yelp_name],\n :yelp_restaurant_url => params[:yelp_url],\n :yelp_restaurant_phone => (params[:yelp_phone].blank? ? nil : params[:yelp_phone]))\n\n event.checklist_items.find_by_tag(\"food\").set_checked_true\n render :text => \"Success!\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /admin/restaurants/1 PATCH/PUT /admin/restaurants/1.json
|
def update
respond_to do |format|
if @admin_restaurant.update(admin_restaurant_params)
format.html { redirect_to @admin_restaurant, notice: 'Restaurant was successfully updated.' }
format.json { render :show, status: :ok, location: @admin_restaurant }
else
format.html { render :edit }
format.json { render json: @admin_restaurant.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n json_response(@restaurant.update!(restaurant_params))\n end",
"def update\n @restaurant_admin = Restaurant::Admin.find(params[:id])\n\n respond_to do |format|\n if @restaurant_admin.update_attributes(params[:restaurant_admin])\n format.html { redirect_to @restaurant_admin, notice: 'Admin was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restaurant_admin.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @restaurant.update(restaurant_params)\n render json: RestaurantSerializer.new(@restaurant)\n else\n render json: @restaurant.errors, status: :unprocessable_entity\n end\n end",
"def update\n if @restaurant.update(restaurant_params)\n render json: {success: true, restaurant: @restaurant} \n else\n render json: {success: false, errors: @restaurant.errors}, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @listed_restaurant.update(listed_restaurant_params)\n format.html { redirect_to @listed_restaurant, notice: 'Listed restaurant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @listed_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @type_restaurant.update(type_restaurant_params)\n format.html { redirect_to @type_restaurant, notice: 'Type restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @type_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @type_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n\n if @get_restaurant_list.update(params[:get_restaurant_list])\n head :no_content\n else\n render json: @get_restaurant_list.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @restaurant_owner.update(restaurant_owner_params)\n format.html { redirect_to @restaurant_owner, notice: 'Clinic lab was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_owner }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_owner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_restaurant_config = UserRestaurantConfig.find(params[:id])\n\n respond_to do |format|\n if @user_restaurant_config.update_attributes(params[:user_restaurant_config])\n format.html { redirect_to @user_restaurant_config, notice: 'User restaurant config was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_restaurant_config.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @order_restaurant.update(order_restaurant_params)\n format.html { redirect_to @order_restaurant, notice: 'Order restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @order_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @foodventure_restaurant.update(foodventure_restaurant_params)\n format.html { redirect_to @foodventure_restaurant, notice: 'Foodventure restaurant was successfully updated.' }\n format.json { render :show, status: :ok, location: @foodventure_restaurant }\n else\n format.html { render :edit }\n format.json { render json: @foodventure_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @gen_restaurant.update(gen_restaurant_params)\n format.html { redirect_to :gen_restaurants, notice: 'Gen restaurant was successfully updated.' }\n format.json { respond_with_bip(@gen_restaurant) }\n else\n format.html { render :edit }\n format.json { render json: @gen_restaurant.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @restaurant_type.update(restaurant_type_params)\n format.html { redirect_to @restaurant_type, notice: 'Restaurant type was successfully updated.' }\n format.json { render :show, status: :ok, location: @restaurant_type }\n else\n format.html { render :edit }\n format.json { render json: @restaurant_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @restaurant = Restaurant.find(params[:restaurant_id])\n @food = Food.find(params[:id])\n end",
"def update\n @restaurant = Restaurant.find(params[:id])\n\n respond_to do |format|\n if @restaurant.update_attributes(params[:restaurant])\n format.html { redirect_to(@restaurant, :notice => 'Restaurant was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @restaurant.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @administrador_de_restaurante.update(administrador_de_restaurante_params)\n format.html { redirect_to @administrador_de_restaurante, notice: 'Administrador de restaurante was successfully updated.' }\n format.json { render :show, status: :ok, location: @administrador_de_restaurante }\n else\n format.html { render :edit }\n format.json { render json: @administrador_de_restaurante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_response(@food_item.update!(food_item_params))\n end",
"def update\n # @restaurante = Restaurante.find params[:id]\n respond_to do |format|\n if @restaurante.update(restaurante_params)\n format.html { redirect_to @restaurante, notice: 'Restaurante editado com sucesso!.' }\n format.json { render :show, status: :ok, location: @restaurante }\n else\n format.html { render :edit }\n format.json { render json: @restaurante.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @restuarant = Restuarant.find(params[:id])\n\n respond_to do |format|\n if @restuarant.update_attributes(params[:restuarant])\n format.html { redirect_to @restuarant, notice: 'Restuarant was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @restuarant.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /admin/restaurants/1 DELETE /admin/restaurants/1.json
|
def destroy
@admin_restaurant.destroy
respond_to do |format|
format.html { redirect_to admin_restaurants_url, notice: 'Restaurant was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @restaurant_admin = Restaurant::Admin.find(params[:id])\n @restaurant_admin.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_admins_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @restaurant_restaurant = Restaurant::Restaurant.find(params[:id])\n @restaurant_restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_restaurants_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n # DELETE\n # TODO: removes a specific restaurant\n DB.execute(\"DELETE FROM restaurants WHERE id = #{@id}\")\n nil\n end",
"def destroy\n @listed_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to listed_restaurants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to type_restaurants_url, notice: 'Type restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant_owner.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_owners_url, notice: 'Clinic lab was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurator = Restaurator.find(params[:id])\n @restaurator.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurators_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant_type.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_types_url, notice: 'Restaurant type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant = Restaurant.find(params[:id])\n @restaurant.destroy\n\n respond_to do |format|\n format.html { redirect_to(restaurants_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @get_restaurant_list = GetRestaurantList.find(params[:id])\n @get_restaurant_list.destroy\n\n head :no_content\n end",
"def destroy\n @gen_restaurant.destroy\n respond_to do |format|\n format.html { redirect_to gen_restaurants_url, notice: 'Gen restaurant was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_restaurant_config = UserRestaurantConfig.find(params[:id])\n @user_restaurant_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_restaurant_configs_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @resturant = Resturant.find(params[:id])\n @resturant.destroy\n self.headers.merge!('Content-Type' => 'application/json' )\n self.response_body = {status: \"Deleted\"}\n end",
"def destroy\n @restaurant_location = Restaurant::Location.find(params[:id])\n @restaurant_location.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_locations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @administrador_de_restaurante.destroy\n respond_to do |format|\n format.html { redirect_to administrador_de_restaurantes_url, notice: 'Administrador de restaurante was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restuarant = Restuarant.find(params[:id])\n @restuarant.destroy\n\n respond_to do |format|\n format.html { redirect_to restuarants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @restaurant_dish = Restaurant::Dish.find(params[:id])\n @restaurant_dish.destroy\n\n respond_to do |format|\n format.html { redirect_to restaurant_dishes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @restaurante.destroy\n respond_to do |format|\n format.html { redirect_to restaurantes_url,\n notice: 'Restaurante eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /isps GET /isps.json
|
def index
@isps = Isp.all
end
|
[
"def index\n @isps_details = IspsDetail.all\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def show\n @sop = Sop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sop }\n end\n end",
"def index\n @socio_irpjs = SocioIrpj.all\n end",
"def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end",
"def show\n @socio = Socio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @socio }\n end\n end",
"def index\n @risp_services = RispService.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @risp_services }\n end\n end",
"def show\n @spl = Spl.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @spl }\n end\n end",
"def index\n @socio_spcs = SocioSpc.all\n end",
"def show\n @sip = Sip.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sip }\n end\n end",
"def show\n @sp_resource = SpResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sp_resource }\n end\n end",
"def show\n @wisp = Wisp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wisp }\n end\n end",
"def show\n @impesp = Impesp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @impesp }\n end\n end",
"def show\n @csosn = Csosn.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @csosn }\n end\n end",
"def index\n @siteships = Siteship.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @siteships }\n end\n end",
"def index\n @socios = Socio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socios }\n end\n end",
"def index\n @securities = Security.all\n\n render json: @securities\n end",
"def index\n @socio_irpfs = SocioIrpf.all\n end",
"def show\n @scoop = Scoop.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scoop }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /isps POST /isps.json
|
def create
@isp = Isp.new(isp_params)
respond_to do |format|
if @isp.save
format.html { redirect_to @isp, notice: 'Isp was successfully created.' }
format.json { render :show, status: :created, location: @isp }
else
format.html { render :new }
format.json { render json: @isp.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @isps_detail = IspsDetail.new(isps_detail_params)\n\n respond_to do |format|\n if @isps_detail.save\n format.html { redirect_to @isps_detail, notice: 'Isps detail was successfully created.' }\n format.json { render :show, status: :created, location: @isps_detail }\n else\n format.html { render :new }\n format.json { render json: @isps_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sop = Sop.new(params[:sop])\n\n respond_to do |format|\n if @sop.save\n format.html { redirect_to @sop, notice: 'Sop was successfully created.' }\n format.json { render json: @sop, status: :created, location: @sop }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sop = Sop.new(sop_params)\n\n respond_to do |format|\n if @sop.save\n format.html { redirect_to @sop, notice: 'Sop was successfully created.' }\n format.json { render :show, status: :created, location: @sop }\n else\n format.html { render :new }\n format.json { render json: @sop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @impesp = Impesp.new(params[:impesp])\n\n respond_to do |format|\n if @impesp.save\n format.html { redirect_to @impesp, notice: 'Impesp was successfully created.' }\n format.json { render json: @impesp, status: :created, location: @impesp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @impesp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @isps = Isp.all\n end",
"def create\n @socio_spc = SocioSpc.new(socio_spc_params)\n\n respond_to do |format|\n if @socio_spc.save\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_spc }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sculp = Sculp.new(sculp_params)\n\n respond_to do |format|\n if @sculp.save\n format.html { redirect_to sculps_url }\n format.json { render action: 'show', status: :created, location: @sculp }\n else\n format.html { render action: 'new' }\n format.json { render json: @sculp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @wisp = Wisp.new(params[:wisp])\n\n respond_to do |format|\n if @wisp.save\n format.html { redirect_to @wisp, notice: 'Wisp was successfully created.' }\n format.json { render json: @wisp, status: :created, location: @wisp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wisp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @sity = Sity.new(sity_params)\n\n respond_to do |format|\n if @sity.save\n format.html { redirect_to @sity, notice: 'Sity was successfully created.' }\n format.json { render :show, status: :created, location: @sity }\n else\n format.html { render :new }\n format.json { render json: @sity.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def create\n @spice = Spice.new(spice_params)\n\n if @spice.save\n render json: @spice, status: :created\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def create\n @socio_irpf = SocioIrpf.new(socio_irpf_params)\n\n respond_to do |format|\n if @socio_irpf.save\n format.html { redirect_to @socio_irpf, notice: 'Socio irpf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_irpf }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_irpf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @imp_survey = ImpSurvey.new(imp_survey_params)\n\n respond_to do |format|\n if @imp_survey.save\n format.html { redirect_to @imp_survey, notice: 'Imp survey was successfully created.' }\n format.json { render :show, status: :created, location: @imp_survey }\n else\n format.html { render :new }\n format.json { render json: @imp_survey.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @snp = Snp.new(params[:snp])\n\n respond_to do |format|\n if @snp.save\n format.html { redirect_to @snp, notice: 'Snp was successfully created.' }\n format.json { render json: @snp, status: :created, location: @snp }\n else\n format.html { render action: \"new\" }\n format.json { render json: @snp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @spl = Spl.new(params[:spl])\n\n respond_to do |format|\n if @spl.save\n format.html { redirect_to @spl, :notice => 'Spl was successfully created.' }\n format.json { render :json => @spl, :status => :created, :location => @spl }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @spl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @isp.update(isp_params)\n format.html { redirect_to @isp, notice: 'Isp was successfully updated.' }\n format.json { render :show, status: :ok, location: @isp }\n else\n format.html { render :edit }\n format.json { render json: @isp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n end",
"def index\n @isps_details = IspsDetail.all\n end",
"def create\n @socio_irpj = SocioIrpj.new(socio_irpj_params)\n\n respond_to do |format|\n if @socio_irpj.save\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_irpj }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /isps/1 PATCH/PUT /isps/1.json
|
def update
respond_to do |format|
if @isp.update(isp_params)
format.html { redirect_to @isp, notice: 'Isp was successfully updated.' }
format.json { render :show, status: :ok, location: @isp }
else
format.html { render :edit }
format.json { render json: @isp.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @sop = Sop.find(params[:id])\n\n respond_to do |format|\n if @sop.update_attributes(params[:sop])\n format.html { redirect_to @sop, notice: 'Sop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sop.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @isps_detail.update(isps_detail_params)\n format.html { redirect_to @isps_detail, notice: 'Isps detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @isps_detail }\n else\n format.html { render :edit }\n format.json { render json: @isps_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n spice = Spice.find_by(id: params[:id])\n spice.update(spice_params)\n render json: spice\nend",
"def update\n respond_to do |format|\n if @socio_spc.update(socio_spc_params)\n format.html { redirect_to @socio_spc, notice: 'Socio spc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_spc.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @squire.update(squire_params)\n format.html { redirect_to @squire, notice: 'Squire was successfully updated.' }\n format.json { render :show, status: :ok, location: @squire }\n else\n format.html { render :edit }\n format.json { render json: @squire.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @sculp.update(sculp_params)\n format.html { redirect_to sculps_url }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @sculp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @sp_resource = SpResource.find(params[:id])\n\n respond_to do |format|\n if @sp_resource.update_attributes(params[:sp_resource])\n format.html { redirect_to @sp_resource, notice: 'Sp resource was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sp_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def put\n request_method('PUT')\n end",
"def update\n if @spice.update(spice_params)\n head :no_content\n else\n render json: @spice.errors, status: :unprocessable_entity\n end\n end",
"def update\r\n respond_to do |format|\r\n if @sivic_model.update(sivic_model_params)\r\n format.html { redirect_to @sivic_model, notice: 'Sivic model was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_model.errors, status: :unprocessable_entity }\r\n end\r\n end\r\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 @myspec = Myspec.find(params[:id])\n\n respond_to do |format|\n if @myspec.update_attributes(params[:myspec])\n format.html { redirect_to @myspec, notice: 'Myspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @myspec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @socio_irpj.update(socio_irpj_params)\n format.html { redirect_to @socio_irpj, notice: 'Socio irpj was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_irpj.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @impesp = Impesp.find(params[:id])\n\n respond_to do |format|\n if @impesp.update_attributes(params[:impesp])\n format.html { redirect_to @impesp, notice: 'Impesp was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @impesp.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @slit_spec = SlitSpec.find(params[:id])\n\n respond_to do |format|\n if @slit_spec.update_attributes(params[:slit_spec])\n format.html { redirect_to @slit_spec, notice: 'Slit spec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @slit_spec.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @spl = Spl.find(params[:id])\n\n respond_to do |format|\n if @spl.update_attributes(params[:spl])\n format.html { redirect_to @spl, :notice => 'Spl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @spl.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spi.update(spi_params)\n format.html { redirect_to @spi, notice: 'Spi was successfully updated.' }\n format.json { render :show, status: :ok, location: @spi }\n else\n format.html { render :edit }\n format.json { render json: @spi.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @spice.update(spice_params)\n format.html { redirect_to @spice, notice: 'Spice was successfully updated.' }\n format.json { render :show, status: :ok, location: @spice }\n else\n format.html { render :edit }\n format.json { render json: @spice.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @scoop = Scoop.find(params[:id])\n\n respond_to do |format|\n if @scoop.update_attributes(params[:scoop])\n format.html { redirect_to @scoop, notice: 'Scoop was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scoop.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /isps/1 DELETE /isps/1.json
|
def destroy
@isp.destroy
respond_to do |format|
format.html { redirect_to isps_url, notice: 'Isp was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @sop = Sop.find(params[:id])\n @sop.destroy\n\n respond_to do |format|\n format.html { redirect_to sops_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @isps_detail.destroy\n respond_to do |format|\n format.html { redirect_to isps_details_url, notice: 'Isps detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_spc.destroy\n respond_to do |format|\n format.html { redirect_to socio_spcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sculp.destroy\n respond_to do |format|\n format.html { redirect_to sculps_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spc.destroy\n respond_to do |format|\n format.html { redirect_to spcs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n response = RestClient.delete $api_service+\"/claim_issues/\"+params['id']\n redirect_to :action => \"index\"\n end",
"def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sivic_discipulo.destroy\n respond_to do |format|\n format.html { redirect_to sivic_discipulos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spl = Spl.find(params[:id])\n @spl.destroy\n\n respond_to do |format|\n format.html { redirect_to spls_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @express_interst = ExpressInterst.find(params[:id])\n @express_interst.destroy\n\n respond_to do |format|\n format.html { redirect_to express_intersts_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @impesp = Impesp.find(params[:id])\n @impesp.destroy\n\n respond_to do |format|\n format.html { redirect_to impesps_url }\n format.json { head :no_content }\n end\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 destroy\n @socio_irpj.destroy\n respond_to do |format|\n format.html { redirect_to socio_irpjs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sitio = Sitio.find(params[:id])\n @sitio.destroy\n\n respond_to do |format|\n format.html { redirect_to sitios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @spi.destroy\n respond_to do |format|\n format.html { redirect_to spis_url, notice: 'Spi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @siswa = Siswa.find(params[:id])\n @siswa.destroy\n\n respond_to do |format|\n format.html { redirect_to siswas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @siswa.destroy\n respond_to do |format|\n format.html { redirect_to siswas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio = Socio.find(params[:id])\n @socio.destroy\n\n respond_to do |format|\n format.html { redirect_to socios_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sap.destroy\n respond_to do |format|\n format.html { redirect_to saps_url, notice: 'Sap was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get dispute details Returns all the details of a dispute using the dispute identifier.
|
def get_dispute_details(dispute_id, opts = {})
data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)
data
end
|
[
"def details(disbursement_id)\n API::request(:get, \"disbursements/#{disbursement_id}\")\n end",
"def list_dispute_evidence(dispute_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def get_dispute_details_with_http_info(dispute_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...'\n end\n # verify the required parameter 'dispute_id' is set\n if @api_client.config.client_side_validation && dispute_id.nil?\n fail ArgumentError, \"Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_details\"\n end\n pattern = Regexp.new(/^(dsp)_(\\w{26})$/)\n if @api_client.config.client_side_validation && dispute_id !~ pattern\n fail ArgumentError, \"invalid value for 'dispute_id' when calling DisputesApi.get_dispute_details, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/disputes/{dispute_id}'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'Dispute'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiSecretKey']\n\n new_options = opts.merge(\n :operation => :\"DisputesApi.get_dispute_details\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DisputesApi#get_dispute_details\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def get_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data\n end",
"def retrieve_dispute_evidence(dispute_id:,\n evidence_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true },\n 'evidence_id' => { 'value' => evidence_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def show\n @dispute = Dispute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dispute }\n end\n end",
"def get_dispute(params = {})\n commit(EbayTrading::Requests::GetDispute, params)\n end",
"def show\n @edetail = Edetail.find_by(id: params[:id])\n end",
"def details(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:details, ride_id: args.delete(:ride_id)),\n access_token: args.delete(:access_token)\n )\n end",
"def details\n get(\"v1/donation/#{@id}\")\n end",
"def get_details(restaurant_id)\n restaurant_id = Normalize.normalize(restaurant_id, :number)\n return call_api(:get, ['rd', restaurant_id])\n end",
"def detail(offer_id)\n fetch_json(\"detail/#{offer_id}\")\n end",
"def get_dispute(params = {})\n commit(Ebay::Requests::GetDispute, params)\n end",
"def index\n @disputes = Dispute.all\n end",
"def details\n @details\n end",
"def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end",
"def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end",
"def descr(quest_id)\n return nil.to_s unless id_valid?(quest_id)\n return text_get(46, quest_id)\n end",
"def details\n error = \"<h1>No disruption specified</h1> <a class=\\\"close-reveal-modal\\\">×</a>\"\n id = nil\n begin\n id = Integer(params[:id])\n rescue ArgumentError\n render text: error and return\n end\n\n if (id == nil)\n render text: error and return\n end\n begin\n @disruption = Disruption.includes(:fromStop, :toStop).find(id)\n rescue ActiveRecord::RecordNotFound\n render text: error and return\n end\n if (@disruption == nil)\n render text: error and return\n end\n # @sections = Section.includes(:startStop, :endStop, :latestLostTime).where(\"route = ? AND run = ? \", @disruption.route, @disruption.run).order(sequence: :asc)\n @sections = Section.find_by_sql(['SELECT * FROM (\nSELECT s.*, \"SectionsLostTime\".*,ROW_NUMBER() OVER(PARTITION BY s.id ORDER BY \"SectionsLostTime\".timestamp DESC) rn\nFROM \"SectionsLostTime\" JOIN \"Sections\" s ON \"SectionsLostTime\".\"sectionId\" = s.id\nWHERE s.\"route\" = ? AND s.run = ? AND \"SectionsLostTime\".timestamp <= ? )\na WHERE rn = 1 ORDER BY a.sequence', @disruption.route, @disruption.run, @disruption.clearedAt == nil ? Time.now : @disruption.clearedAt])\n ActiveRecord::Associations::Preloader.new.preload(@sections, [:startStop, :endStop, :latestLostTime])\n\n startIndex = Section.where(\"route = ? AND run = ? AND \\\"startStopLBSLCode\\\" = ?\", @disruption.route, @disruption.run, @disruption.fromStopLBSLCode)[0].sequence\n endIndex = Section.where(\"route = ? AND run = ? AND \\\"startStopLBSLCode\\\" = ?\", @disruption.route, @disruption.run, @disruption.toStopLBSLCode)[0].sequence\n data = Array.new\n data.push(['Section', 'Section Lost Time', {type: 'string', role: 'annotation'},\n {type: 'string', role: 'tooltip', p: {html: true}}, {type: 'boolean', role: 'scope'},\n 'Total Lost Time', {type: 'string', role: 'tooltip', p: {html: true}}, {type: 'boolean', role: 'scope'}])\n totalLostTime = 0\n sectionLostTime = 0\n @sections.each do |section|\n scope = false\n if (section.sequence == 1)\n label = capitalizeAll(section.startStop.name)\n elsif (section.sequence == @sections.length)\n label = capitalizeAll(section.endStop.name)\n else\n label = ''\n end\n lostTime = (section.latestLostTime.lostTimeInSeconds / 60).round\n lostTime = [lostTime, 0].max\n totalLostTime += lostTime\n\n if (section.sequence >= startIndex && section.sequence < endIndex)\n sectionLostTime += lostTime\n scope = true\n end\n\n tooltip = \"From: <strong>\"+getLinkToBusStop(section.startStop)+\n \"</strong><br>To: <strong>\" +getLinkToBusStop(section.endStop)+\n \"</strong><br>Number of observation: <strong>\" +\n section.latestLostTime.numberOfObservations.to_s+ \"</strong>\"\n\n totalTooltip = \"Total minutes lost: <strong>\"+totalLostTime.to_s+\n \"</strong><br>From: <strong>\" + getLinkToBusStop(section.startStop) +\n \"</strong><br>To: <strong>\" +getLinkToBusStop(section.endStop)\n\n data.push([label, lostTime, lostTime, tooltip, scope, totalLostTime, totalTooltip, true])\n end\n\n title = 'Route '+@disruption.route+' '+ @disruption.getRunString\n hAxisTitle = 'Total cumulative lost time observed along route '+totalLostTime.to_s+' minutes'\n @return = {:error => false, :update => true, :partial => render_to_string(:partial => \"details\"), :data => data, :title => title, :hAxisTitle => hAxisTitle}\n render :json => ActiveSupport::JSON.encode(@return)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get dispute details Returns all the details of a dispute using the dispute identifier.
|
def get_dispute_details_with_http_info(dispute_id, opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: DisputesApi.get_dispute_details ...'
end
# verify the required parameter 'dispute_id' is set
if @api_client.config.client_side_validation && dispute_id.nil?
fail ArgumentError, "Missing the required parameter 'dispute_id' when calling DisputesApi.get_dispute_details"
end
pattern = Regexp.new(/^(dsp)_(\w{26})$/)
if @api_client.config.client_side_validation && dispute_id !~ pattern
fail ArgumentError, "invalid value for 'dispute_id' when calling DisputesApi.get_dispute_details, must conform to the pattern #{pattern}."
end
# resource path
local_var_path = '/disputes/{dispute_id}'.sub('{' + 'dispute_id' + '}', CGI.escape(dispute_id.to_s))
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# HTTP header 'Accept' (if needed)
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type] || 'Dispute'
# auth_names
auth_names = opts[:debug_auth_names] || ['ApiSecretKey']
new_options = opts.merge(
:operation => :"DisputesApi.get_dispute_details",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: DisputesApi#get_dispute_details\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
[
"def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end",
"def details(disbursement_id)\n API::request(:get, \"disbursements/#{disbursement_id}\")\n end",
"def list_dispute_evidence(dispute_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def get_dispute_evidence(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)\n data\n end",
"def retrieve_dispute_evidence(dispute_id:,\n evidence_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true },\n 'evidence_id' => { 'value' => evidence_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def show\n @dispute = Dispute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dispute }\n end\n end",
"def get_dispute(params = {})\n commit(EbayTrading::Requests::GetDispute, params)\n end",
"def show\n @edetail = Edetail.find_by(id: params[:id])\n end",
"def details(args = {})\n make_request(\n http_method: :get,\n endpoint: path_for(:details, ride_id: args.delete(:ride_id)),\n access_token: args.delete(:access_token)\n )\n end",
"def details\n get(\"v1/donation/#{@id}\")\n end",
"def get_details(restaurant_id)\n restaurant_id = Normalize.normalize(restaurant_id, :number)\n return call_api(:get, ['rd', restaurant_id])\n end",
"def detail(offer_id)\n fetch_json(\"detail/#{offer_id}\")\n end",
"def get_dispute(params = {})\n commit(Ebay::Requests::GetDispute, params)\n end",
"def index\n @disputes = Dispute.all\n end",
"def details\n @details\n end",
"def disruption(disruption_id)\n data = request(\"disruptions/#{disruption_id}\")\n data[\"disruption\"]\n end",
"def disc(id)\n get(\"/catalog/titles/discs/#{id.to_s}\")\n end",
"def descr(quest_id)\n return nil.to_s unless id_valid?(quest_id)\n return text_get(46, quest_id)\n end",
"def details\n error = \"<h1>No disruption specified</h1> <a class=\\\"close-reveal-modal\\\">×</a>\"\n id = nil\n begin\n id = Integer(params[:id])\n rescue ArgumentError\n render text: error and return\n end\n\n if (id == nil)\n render text: error and return\n end\n begin\n @disruption = Disruption.includes(:fromStop, :toStop).find(id)\n rescue ActiveRecord::RecordNotFound\n render text: error and return\n end\n if (@disruption == nil)\n render text: error and return\n end\n # @sections = Section.includes(:startStop, :endStop, :latestLostTime).where(\"route = ? AND run = ? \", @disruption.route, @disruption.run).order(sequence: :asc)\n @sections = Section.find_by_sql(['SELECT * FROM (\nSELECT s.*, \"SectionsLostTime\".*,ROW_NUMBER() OVER(PARTITION BY s.id ORDER BY \"SectionsLostTime\".timestamp DESC) rn\nFROM \"SectionsLostTime\" JOIN \"Sections\" s ON \"SectionsLostTime\".\"sectionId\" = s.id\nWHERE s.\"route\" = ? AND s.run = ? AND \"SectionsLostTime\".timestamp <= ? )\na WHERE rn = 1 ORDER BY a.sequence', @disruption.route, @disruption.run, @disruption.clearedAt == nil ? Time.now : @disruption.clearedAt])\n ActiveRecord::Associations::Preloader.new.preload(@sections, [:startStop, :endStop, :latestLostTime])\n\n startIndex = Section.where(\"route = ? AND run = ? AND \\\"startStopLBSLCode\\\" = ?\", @disruption.route, @disruption.run, @disruption.fromStopLBSLCode)[0].sequence\n endIndex = Section.where(\"route = ? AND run = ? AND \\\"startStopLBSLCode\\\" = ?\", @disruption.route, @disruption.run, @disruption.toStopLBSLCode)[0].sequence\n data = Array.new\n data.push(['Section', 'Section Lost Time', {type: 'string', role: 'annotation'},\n {type: 'string', role: 'tooltip', p: {html: true}}, {type: 'boolean', role: 'scope'},\n 'Total Lost Time', {type: 'string', role: 'tooltip', p: {html: true}}, {type: 'boolean', role: 'scope'}])\n totalLostTime = 0\n sectionLostTime = 0\n @sections.each do |section|\n scope = false\n if (section.sequence == 1)\n label = capitalizeAll(section.startStop.name)\n elsif (section.sequence == @sections.length)\n label = capitalizeAll(section.endStop.name)\n else\n label = ''\n end\n lostTime = (section.latestLostTime.lostTimeInSeconds / 60).round\n lostTime = [lostTime, 0].max\n totalLostTime += lostTime\n\n if (section.sequence >= startIndex && section.sequence < endIndex)\n sectionLostTime += lostTime\n scope = true\n end\n\n tooltip = \"From: <strong>\"+getLinkToBusStop(section.startStop)+\n \"</strong><br>To: <strong>\" +getLinkToBusStop(section.endStop)+\n \"</strong><br>Number of observation: <strong>\" +\n section.latestLostTime.numberOfObservations.to_s+ \"</strong>\"\n\n totalTooltip = \"Total minutes lost: <strong>\"+totalLostTime.to_s+\n \"</strong><br>From: <strong>\" + getLinkToBusStop(section.startStop) +\n \"</strong><br>To: <strong>\" +getLinkToBusStop(section.endStop)\n\n data.push([label, lostTime, lostTime, tooltip, scope, totalLostTime, totalTooltip, true])\n end\n\n title = 'Route '+@disruption.route+' '+ @disruption.getRunString\n hAxisTitle = 'Total cumulative lost time observed along route '+totalLostTime.to_s+' minutes'\n @return = {:error => false, :update => true, :partial => render_to_string(:partial => \"details\"), :data => data, :title => title, :hAxisTitle => hAxisTitle}\n render :json => ActiveSupport::JSON.encode(@return)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get dispute evidence Retrieves a list of the evidence submitted in response to a specific dispute.
|
def get_dispute_evidence(dispute_id, opts = {})
data, _status_code, _headers = get_dispute_evidence_with_http_info(dispute_id, opts)
data
end
|
[
"def list_dispute_evidence(dispute_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def retrieve_dispute_evidence(dispute_id:,\n evidence_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true },\n 'evidence_id' => { 'value' => evidence_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def evidence\n return @evidence\n end",
"def get_evidence(agent)\n @evidence[agent]\n end",
"def evidence=(value)\n @evidence = value\n end",
"def index\n @evidence = Evidence.all\n end",
"def index\n @evidences = Evidence.all\n end",
"def get_dispute(params = {})\n commit(EbayTrading::Requests::GetDispute, params)\n end",
"def index\n @scientific_evidences = ScientificEvidence.all\n end",
"def get_dispute(params = {})\n commit(Ebay::Requests::GetDispute, params)\n end",
"def delete_dispute_evidence(dispute_id:,\n evidence_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/disputes/{dispute_id}/evidence/{evidence_id}',\n 'default')\n .template_param(new_parameter(dispute_id, key: 'dispute_id')\n .should_encode(true))\n .template_param(new_parameter(evidence_id, key: 'evidence_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def submit_dispute_evidence(dispute_id, opts = {})\n submit_dispute_evidence_with_http_info(dispute_id, opts)\n nil\n end",
"def index\n @evidence_methods = EvidenceMethod.all\n end",
"def evidence_descriptors\n if request.put?\n post_many2many(:left_class => Control,\n :right_class => DocumentDescriptor,\n :right_relation => :evidence_descriptors,\n :right_ids => :evidence_descriptor_ids,\n :lefts => filtered_controls)\n else\n get_many2many(:left_class => Control,\n :lefts => filtered_controls,\n :right_class => DocumentDescriptor,\n :right_ids => :evidence_descriptor_ids,\n :show_slugfilter => true)\n end\n end",
"def get_dispute_details(dispute_id, opts = {})\n data, _status_code, _headers = get_dispute_details_with_http_info(dispute_id, opts)\n data\n end",
"def show\n @evidence = Evidence.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evidence }\n end\n end",
"def disclaimers_get(opts = {})\n data, _status_code, _headers = disclaimers_get_with_http_info(opts)\n data\n end",
"def remove_dispute_evidence(dispute_id:,\n evidence_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence/{evidence_id}'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true },\n 'evidence_id' => { 'value' => evidence_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.delete(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def index\n @disputes = Dispute.all\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get disputes Returns a list of all disputes against your business. The results will be returned in reverse chronological order, showing the last modified dispute (for example, where you've recently added a piece of evidence) first. You can use the optional parameters below to skip or limit results.
|
def get_disputes(opts = {})
data, _status_code, _headers = get_disputes_with_http_info(opts)
data
end
|
[
"def index\n @disputes = Dispute.all\n end",
"def get_dispute(params = {})\n commit(EbayTrading::Requests::GetDispute, params)\n end",
"def disputes\n @disputes ||= DisputesApi.new config\n end",
"def get_dispute(params = {})\n commit(Ebay::Requests::GetDispute, params)\n end",
"def disputes\n @disputes ||= DisputesApi.new @global_configuration\n end",
"def get_user_disputes(params = {})\n commit(EbayTrading::Requests::GetUserDisputes, params)\n end",
"def get_user_disputes(params = {})\n commit(Ebay::Requests::GetUserDisputes, params)\n end",
"def list_dispute_evidence(dispute_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/disputes/{dispute_id}/evidence'\n _query_builder = APIHelper.append_url_with_template_parameters(\n _query_builder,\n 'dispute_id' => { 'value' => dispute_id, 'encode' => true }\n )\n _query_url = APIHelper.clean_url _query_builder\n\n # Prepare headers.\n _headers = {\n 'accept' => 'application/json'\n }\n\n # Prepare and execute HttpRequest.\n _request = config.http_client.get(\n _query_url,\n headers: _headers\n )\n OAuth2.apply(config, _request)\n _response = execute_request(_request)\n\n # Return appropriate response type.\n decoded = APIHelper.json_deserialize(_response.raw_body)\n _errors = APIHelper.map_response(decoded, ['errors'])\n ApiResponse.new(\n _response, data: decoded, errors: _errors\n )\n end",
"def get_chargeback_disputes(opts = {})\n data, _status_code, _headers = get_chargeback_disputes_with_http_info(opts)\n data\n end",
"def index\n @disorders = Disorder.all\n end",
"def index\n @discs = Disc.all\n end",
"def index\n @discursos = Discurso.all\n end",
"def index\n @dis_doseforms = DisDoseform.all\n end",
"def disclaimers_get(opts = {})\n data, _status_code, _headers = disclaimers_get_with_http_info(opts)\n data\n end",
"def index\n @disabilities = Disability.all\n end",
"def index\n @disclosures = Disclosure.all.order(:description).page(params[:page])\n end",
"def all_rated_disabilities\n settings = Settings.lighthouse.veteran_verification.form526\n icn = UserAccount.where(id: user_account_id).first&.icn\n service = ApiProviderFactory.rated_disabilities_service_provider(\n { auth_headers:, icn: }\n )\n @all_rated_disabilities ||= begin\n response = service.get_rated_disabilities(settings.access_token.client_id, settings.access_token.rsa_key)\n response.rated_disabilities\n end\n end",
"def list_disbursement(opts = {})\n data, _status_code, _headers = list_disbursement_with_http_info(opts)\n data\n end",
"def index\n @disbursments = @case.disbursments\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Submit dispute evidence With this final request, you can submit the evidence that you have previously provided. Make sure you have provided all the relevant information before using this request. You will not be able to amend your evidence once you have submitted it.
|
def submit_dispute_evidence(dispute_id, opts = {})
submit_dispute_evidence_with_http_info(dispute_id, opts)
nil
end
|
[
"def submit_evidence(dispute_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/disputes/{dispute_id}/submit-evidence',\n 'default')\n .template_param(new_parameter(dispute_id, key: 'dispute_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def certify_event_attendence_post\n #create approval if create approval selected\n @event = Event.find_by_id(params[:event_id])\n if @event != nil && !@event.submitted_for_certification && !@event.certified && @event.event_certification_request == nil\n # check to make sure debriefing is submitted\n # TODO: ^^ This\n # update the event first\n if @event.update(event_certify_params)\n #create certification request\n ecr = EventCertificationRequest.new(event_id: @event.id)\n #create approval\n ecr.approval_id = new_approval(6)\n ecr.user_id = current_user.id\n if ecr.save\n @event.submitted_for_certification = true\n @event.event_certification_request_id = ecr.id\n if @event.save\n render status: 200, json: @event\n else\n render status: 500, json: { message: 'Error Occured. Event could not be submitted for certification' }\n end\n else\n @event.submitted_for_certification = false\n if @event.save\n render status: 500, json: { message: 'ERROR: ECR could not be saved. Event reverted so certification could be made.' }\n else\n render status: 500, json: { message: 'ERROR: ECR could not be saved and the event could not be updated. Data wise this is probably really messed up you will need to contact Rindzer.' }\n end\n end\n else\n render status: 500, json: { message: \"An error occured and the event could not be updated.\" }\n end\n else\n render status: 404, json: { message: 'Either this event was not found or has already been submitted for certification.' }\n end\n end",
"def create\n @scientific_evidence = ScientificEvidence.new(scientific_evidence_params)\n\n respond_to do |format|\n if @scientific_evidence.save\n format.html { redirect_to @scientific_evidence.ailment, notice: 'Scientific evidence was successfully created.' }\n format.json { render :show, status: :created, location: @scientific_evidence }\n else\n format.html { render :new }\n format.json { render json: @scientific_evidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evidence = Evidence.new(evidence_params)\n\n respond_to do |format|\n if @evidence.save\n format.html { redirect_to @evidence, notice: 'Evidence was successfully created.' }\n format.json { render :show, status: :created, location: @evidence }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evidence = Evidence.new(evidence_params)\n\n respond_to do |format|\n if @evidence.save\n format.html { redirect_to '/evidences', notice: 'Evidence was successfully created.' }\n format.json { render :index, status: :created }\n else\n format.html { render :new }\n format.json { render json: @evidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @yes_evidence = YesEvidence.new(yes_evidence_params)\n\n respond_to do |format|\n if @yes_evidence.save\n format.html { redirect_to @yes_evidence, notice: 'Yes evidence was successfully created.' }\n format.json { render :show, status: :created, location: @yes_evidence }\n else\n format.html { render :new }\n format.json { render json: @yes_evidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nop_evidence = NopEvidence.new(nop_evidence_params)\n\n respond_to do |format|\n if @nop_evidence.save\n format.html { redirect_to @nop_evidence, notice: 'Nop evidence was successfully created.' }\n format.json { render :show, status: :created, location: @nop_evidence }\n else\n format.html { render :new }\n format.json { render json: @nop_evidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @evidence_source = current_user.submit(evidence_source_params)\n respond_to do |format|\n if @evidence_source.save\n format.html { redirect_to @evidence_source, notice: 'Evidence source was successfully created.' }\n format.json { render :show, status: :created, location: @evidence_source }\n else\n format.html { render :new }\n format.json { render json: @evidence_source.errors, status: :unprocessable_entity }\n end\n end\n end",
"def evidence=(value)\n @evidence = value\n end",
"def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end",
"def create\n @evidence_method = EvidenceMethod.new(evidence_method_params)\n\n respond_to do |format|\n if @evidence_method.save\n format.html { redirect_to @evidence_method, notice: 'Evidence method was successfully created.' }\n format.json { render :show, status: :created, location: @evidence_method }\n else\n format.html { render :new }\n format.json { render json: @evidence_method.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_evidence(target, *args)\n params = args.extract_options!.merge(title: @name)\n target.evidences.create(params)\n end",
"def delete_dispute_evidence(dispute_id:,\n evidence_id:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::DELETE,\n '/v2/disputes/{dispute_id}/evidence/{evidence_id}',\n 'default')\n .template_param(new_parameter(dispute_id, key: 'dispute_id')\n .should_encode(true))\n .template_param(new_parameter(evidence_id, key: 'evidence_id')\n .should_encode(true))\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def execute()\n # Retrieve the initial field values from the triggering base record. These\n # will be copied into the approval record so that the data submitted by the\n # original submission can be used within the approval.\n submission = retrieve_submission(@parameters['lookup_id'],\n @fields_to_clone + @additional_fields)\n\n # Initialize the Hash of field values based on the retrieved request record.\n # This builds a Hash that maps the KS_SRV_CustomerSurey_base database field\n # name to its values (and skips fields that should not be mapped, such as\n # 'Request Id' and 'instanceId').\n submission_values = submission.field_values.inject({}) do |hash, (field_id, field_value)|\n # Determine the database name of the associated field\n field_name = @@remedy_forms['KS_SRV_CustomerSurvey_base'].field_for(field_id).name\n # Add the field name to value map unless the field was specified in the\n # @additional_fields attribute (this prevents the duplicating of instance\n # id and request id).\n @additional_fields.include?(field_name) ? hash : hash.merge!(field_name => field_value)\n end\n\n # Retrieve the originating submission so that we can manually populate the\n # originating id values. This is necessary since Kinetic Request does not\n # set the OriginatingID or OriginatingID_Display on the originating record\n # itself, so these are not populated in the submission to be approved.\n originating_submission = retrieve_submission(submission['OriginatingID'], \n ['instanceId', 'CustomerSurveyID', 'Survey_Template_Name'])\n\n # Merge the originating request values with the field values specified as\n # parameters (such as the Message Template and Approval Template). This\n # gives precedence to the field values specified by the node.xml mapping.\n @field_values = submission_values.merge(@field_values)\n\n # Merge in the specified lookup Ids. These are used to relate the approval\n # record to the originating record.\n # * Form (labeled as Originating Form) - This field is used to hold the name\n # of the originating service item.\n # * LookupValueId - The instance id of the Kinetic Request submission that\n # the approval is being created for. This is different from the\n # OriginatingID only when doing nested approvals.\n # * OriginatingID - The instance id of the original Kinetic Request\n # submission.\n # * OriginatingID_Display - The request id of the original Kinetic Request\n # submission.\n @field_values.merge!(\n 'LookupValueId' => submission['instanceId'],\n 'Form' => originating_submission['Survey_Template_Name'],\n 'OriginatingID' => originating_submission['instanceId'],\n 'OriginatingID_Display' => originating_submission['CustomerSurveyID']\n )\n\n # Use the Approval Template Name and Approval Template Catalog Name\n # parameters to retrieve and add the SurveyInstanceID to the @field_values\n # hash.\n @field_values['SurveyInstanceID'] = get_survey_template_id(\n @parameters['approval_template_name'], @parameters['approval_template_catalog_name'])\n # Use the Message Template Name parameter to retrieve and add the\n # MessageTemplateInstanceID to the @field_values hash.\n if (@parameters['message_template_name'])\n @field_values['MessageTemplateInstanceID'] = get_message_template_id(\n @parameters['message_template_name'], @field_values['ApplicationName'])\n end\n\n # Log the field value map (if debug logging is enabled)\n puts(format_hash(\"Approval Record Field Values:\", @field_values)) if @debug_logging_enabled\n \n # Create the KS_SRV_CustomerSurvey_base record using the @field_values hash\n # that was built up. Pass 'instanceId' is passed to the fields argument to\n # explicitely specify the field values to return (this improves performance\n # over retrieving all fields on the submission record).\n entry = @@remedy_forms['KS_SRV_CustomerSurvey_base'].create_entry!(\n :field_values => @field_values,\n :fields => ['instanceId']\n )\n \n # Build the results xml that will be returned by this handler.\n results = <<-RESULTS\n <results>\n <result name=\"Instance Id\">#{escape(entry['instanceId'])}</result>\n </results>\n RESULTS\n puts(\"Results: \\n#{results}\") if @debug_logging_enabled\n\n # Return the results String\n return results\n end",
"def assess_data_with_vro\n response = vro_client.assess_claim(veteran_icn: claim_context.user_icn)\n claim_context.assessed_data = response.dig('body', 'evidence').transform_keys(&:to_sym)\n claim_context.sufficient_evidence = sufficient_evidence?\n end",
"def update\n respond_to do |format|\n if @nop_evidence.update(nop_evidence_params)\n format.html { redirect_to @nop_evidence, notice: 'Nop evidence was successfully updated.' }\n format.json { render :show, status: :ok, location: @nop_evidence }\n else\n format.html { render :edit }\n format.json { render json: @nop_evidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n evidence = Evidence.find(evidencefile_params[:evidence_id])\n if (current_user == evidence.recommendation.area.user || current_user.role == 0)\n @evidencefile = Evidencefile.new(evidencefile_params)\n if @evidencefile.document.attachment then\n respond_to do |format|\n if @evidencefile.save\n format.js\n format.html { redirect_to edit_evidence_path @evidencefile.evidence }\n format.json { render :show, status: :created, location: @evidencefile }\n else\n format.html { render :new }\n format.json { render json: @evidencefile.errors, status: :unprocessable_entity }\n end\n end\n end\n else\n redirect_to root_path, notice: \"No tienes permisos para realizar esta acción\"\n return\n end\n end",
"def submit\n general_violations = generate_general_violations\n submission_body = generate_body\n\n # If the review resolver says that there is nothing to submit we skip submission\n return unless ReviewResolver.should_submit?(self, submission_body)\n\n @review_json = @client.create_pull_request_review(@ci_source.repo_slug, @ci_source.pull_request_id, event: generate_event(general_violations), body: submission_body)\n end",
"def unofficial_submit\n \n feedback_str = request.body.read\n\n @course = Course.where(:id => params[:course_id]).first\n @assessment = Assessment.where(:id => params[:id]).first\n @user = User.where(:email => params[:user]).first\n\n if !@course then\n puts \"ERROR: invalid course\"\n exit\n end\n\n if !@user then\n puts \"ERROR: invalid username (#{user}) for class #{course.id}\"\n exit\n end\n\n if !@assessment then\n puts \"ERROR: Invalid Assessment (#{assessment}) for course #{course.id}\"\n exit\n end\n\n if !@assessment.allow_unofficial then\n puts \"ERROR: This assessment does not allow Unofficial Submissions\"\n exit\n end\n\n @result = params[:result]\n\n if !@result then\n puts \"ERROR: No result!\"\n exit\n end\n\n # Everything looks OK, so append the autoresult to the log.txt file for this lab\n @logger = Logger.new(\"#{Rails.root}/courses/#{@course.name}/#{@assessment.name}/log.txt\")\n @logger.add(Logger::INFO) { \"#{@user.email},0,#{@result}\" }\n\n # Load up the lab.rb file\n modName = @assessment.name + (@course.name).gsub(/[^A-Za-z0-9]/,\"\")\n require(\"#{Rails.root}/assessmentConfig/#{@course.name}-#{@assessment.name}.rb\")\n eval(\"extend #{modName.camelcase}\")\n\n begin\n # Call the parseAutoresult function defined in the lab.rb file. If\n # the list of scores it returns is empty, then we the lab developer is\n # asking us not to create an unofficial submission in the\n # database. Simply return a successful status string to the client and\n # exit.\n scores = parseAutoresult(@result,false)\n\n if scores.keys.length == 0 then \n render :nothing => true and return\n end\n\n # Try to find an existing unofficial submission (always version 0). \n submission = @assessment.submissions.where(:version=>0,:user_id=>@user.id).first\n if !submission then\n submission = @assessment.submissions.new(:version=>0,\n :autoresult=>@result,\n :user_id=>@user.id,\n :submitted_by_id=>0)\n submission.save!()\n else\n #update this one\n submission.autoresult= @result\n submission.created_at = Time.now()\n submission.save!()\n end\n\n\n # Update the scores in the db's unofficial submission using the list\n # returned by the parseAutoresult function\n for key in scores.keys do\n problem = @assessment.problems.where(:name => key).first\n score = submission.scores.where(:problem_id => problem.id).first\n if !score then \n score = submission.scores.new(:problem_id=>problem.id)\n end\n score.score = scores[key]\n score.released = true\n score.grader_id= 0\n score.save!()\n end\n rescue Exception => e\n print e\n end\n\n\n render :nothing => true and return\n\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Login to Cherwell using the given credentials. Return true if login succeeded, or raise `LoginFailed` if login failed.
|
def login(username=nil, password=nil)
creds = {
:userId => username || @username,
:password => password || @password,
}
begin
response = @client.call(:login, :message => creds)
rescue => e
# This can happen if a bad URL is given
raise Cherby::LoginFailed, e.message
end
# This can happen if invalid credentials are given
if response.body[:login_response][:login_result] == false
raise Cherby::LoginFailed, "Cherwell returned false status"
end
# Store cookies so subsequent requests will be authorized
@client.cookies = response.http.cookies
# Double-check that login worked
if self.last_error
raise Cherby::LoginFailed, "Cherwell returned error: '#{self.last_error}'"
end
return true
end
|
[
"def login\n username = find_username\n password = find_password\n\n Log.info(\"Logging in as #{username}... \", newline: false)\n\n conn = Faraday.new(url: \"https://redacted.ch/\")\n response = conn.post do |request|\n request.url \"login.php\"\n request.headers[\"User-Agent\"] = RedactedBetter.user_agent\n request.body = { username: username, password: password }\n end\n\n handle_login_response(response)\n rescue Faraday::TimeoutError\n Log.error(\"Logging in timed out. Perhaps Redacted is down?\")\n false\n end",
"def login(**credentials)\n authentication(**credentials).authenticated?.tap do |success|\n setup_session if success\n end\n end",
"def login!\n @user_id = common.login db_name, user, password\n\n logged_in?\n end",
"def login\n return true if self.authenticated?\n\n page = self.fetch_login_page\n return true if self.logged_in?(page)\n\n form = self.get_login_form(page)\n self.set_username_and_password(form)\n page = self.post_login(form)\n\n @authenticated = self.logged_in?(page)\n end",
"def login\n form_data = {\"j_username\" => @username, \"j_password\" => @password}\n response = rally_post(\"/slm/platform/j_platform_security_check.op\", form_data, true)\n # essential for subsequent calls to rally to authenticate internally\n @session_cookie = get_session_cookie(response)\n end",
"def login(username, password)\n unless empty_or_whitespace?(username, password)\n encrypted_password = Digest::SHA1.hexdigest(password)\n if exists?(:username => username, :password => encrypted_password)\n update(id_from_username(username), :login => true)\n return true\n end\n end\n false\n end",
"def login\n logged_in? || login!\n rescue\n false\n end",
"def do_login(login, password)\n if user = CortexReaver::User.authenticate(login, password)\n # Successful login\n session[:user] = user\n else\n false\n end\n end",
"def login(username, password)\n @username = username\n @password = password\n challenge, response = getchallenge\n login_vars = {\n 'username' => @username,\n 'clientversion' => CLIENT,\n 'auth_method' => 'challenge',\n 'auth_challenge' => challenge,\n 'auth_response' => response\n }\n if @mood_list == true\n login_vars['getmoods'] = 0\n elsif @mood_list.kind_of? Array\n i = @mood_list.max { |a,b| a['id'] <=> b['id'] }\n login_vars['getmoods'] = i['id']\n end\n login = self.call('LJ.XMLRPC.login', login_vars)\n @fastserver = login['fastserver'] == 1\n @usejournals = login['usejournals']\n @logged_in = true\n @next_check_ok = 0\n @friendgroups = login['friendgroups']\n if @mood_list\n if @mood_list == true\n @mood_list = login['moods']\n else\n @mood_list << login['moods']\n end\n end\n if login.has_key?('message')\n @message = login['message']\n return true\n else\n return false\n end\n rescue XMLRPC::FaultException => e\n raise LjException.new(e.faultCode, e.faultString)\n end",
"def logon(browser, creds=credentials)\n name, email, password = creds\n browser.goto COMMUNITY_URL\n browser.url.should == COMMUNITY_URL\n\n # note, mac ff needs a couple of attempts to scroll view to Login\n login_elem = browser.link(:text, 'Login')\n scroll_right browser, login_elem\n attempt(3) { login_elem.hover }\n attempt(3) { login_elem.click }\n\n email_xpath = '//*[@id=\"login_form\"]//*[@id=\"email\"]'\n password_xpath = '//*[@id=\"login_form\"]//*[@id=\"password\"]'\n\n browser.text_field(:xpath, email_xpath).when_present.set email\n browser.text_field(:xpath, password_xpath).set password\n browser.button(:name, 'login').click\n end",
"def login\n execute command(:login).on_reply { |reply|\n\n challenge = Mikrotik::Utilities.hex_to_bin(reply.result :ret) \n response = \"00\" + Digest::MD5.hexdigest(0.chr + @options[:password] + challenge)\n\n execute command(:login).with(\n :name => @options[:username],\n :response => response\n ).on_done { |replies|\n Mikrotik.debug [:client, :on_login_success]\n @logged_in = true\n on_login_success(self)\n }.on_trap { |trap|\n Mikrotik.debug [:client, :on_login_failure]\n if has_event_handler? :on_login_failure then\n on_login_failure(self)\n else\n raise Mikrotik::Errors::UnhandledTrap, 'Login failed'\n end\n }\n\n }\n end",
"def login\n return if transport.handles_login?\n if @url.user != ''\n transport.command(@url.user, prompt: %r{^Password:})\n else\n transport.expect(%r{^Password:})\n end\n transport.command(@url.password)\n end",
"def attempt_login\n salt_packet = @connection.send_request(\"login.hashed\")\n \n salt = salt_packet.words[1]\n result = @connection.send_request(\"login.hashed\", hash_password(salt))\n\n result.response == \"OK\"\n end",
"def do_login\n if not @@connected\n begin\n if @nexpose_api.login\n @@connected = true\n end\n rescue Exception => e\n puts e.message\n end\n end\n end",
"def login(username = \"root\", password = \"root\")\n # open login page\n open \"auth/login\"\n wait_for_text_present($page_titles[\"auth_login\"])\n\n # type username & password\n type(\"login\", username)\n type(\"password\", password)\n\n # log in\n click \"commit\"\n wait_for_page_to_load \"30000\"\n end",
"def login(username, password)\n session.context.login(name, username, password)\n end",
"def do_login\n\t\tif not @@connected\n\t\t\tbegin\n\t\t\t\tif @nexpose_api.login\n\t\t\t\t\t@@connected = true\n\t\t\t\tend\n\t\t\trescue Exception => e\n\t\t\t\tputs e.message\n\t\t\tend\n\t\tend\n\tend",
"def login(username, pwd)\n # we don't really need the @login_token. If login fails, an exception will be thrown\n @login_token = @jira.login(username, pwd)\n puts \"Logged in user #{username} to Jira with access token #{@login_token}\" if @dry_run\n @login_token\n end",
"def login\n validate_arguments!\n\n Pebbles::Auth.login\n display \"Authentication successful.\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the Cherwell incident with the given public ID, and return an Incident object.
|
def incident(id)
incident_xml = get_object_xml('Incident', id)
error = self.last_error
if error
raise Cherby::NotFound.new("Cannot find Incident '#{id}': #{error}")
else
return Incident.new(incident_xml.to_s)
end
end
|
[
"def create_incident(data)\n incident = Incident.create(data)\n result = @client.create_business_object({\n :busObNameOrId => 'Incident',\n :creationXml => incident.to_xml\n })\n\n # Result contains the public ID of the new incident, or nil if the\n # incident-creation failed.\n if !result.nil?\n incident['IncidentID'] = result\n return incident\n else\n return nil\n end\n end",
"def incident_id\n @incident_id || IncidentId.new(self)\n end",
"def incident\n if @incident\n @incident\n elsif !self[Report.incident_predicate].empty?\n @incident = Incident.find(self[Report.incident_predicate].first)\n else\n nil\n end\n end",
"def incident_id\n return @incident_id\n end",
"def incident(incident, options = {})\n get \"incidents/#{incident}\", options\n end",
"def incident_id\n @attrs['IncidentID']\n end",
"def get_public_invoice(id:)\n invoice = get(path: \"invoices/#{id}\", public_request: true)\n invoice[\"data\"]\n end",
"def update\n @incident = Incident.retrieve(params[:id], server_auth)\n end",
"def get_incident_by_problemid(problemid)\n # use problemid from nagios as a filter passed as incident_key\n res = RestClient.get INCIDENT_QUERY_URL, :params => {:fields => \"#{problemid}\"} \n end",
"def fetch_by_id(invoice_id)\n response = do_http_get(\"#{url_for_resource(Quickeebooks::Online::Model::Invoice::REST_RESOURCE)}/#{invoice_id}\")\n Quickeebooks::Online::Model::Invoice.from_xml(response.body)\n end",
"def get_invoice_by_id(invoice_id)\n get_invoice(invoice_id)\n end",
"def get_client_by_id client_id\n @clients[client_id]\n end",
"def iccid\n return @iccid\n end",
"def get_incident(incident_id, opts = {})\n data, _status_code, _headers = get_incident_with_http_info(incident_id, opts)\n data\n end",
"def show\n @encounter = Encounter.find(params[:id])\n end",
"def find_incident_by_vehicle\n @incident_by_vehicle = current_user.company.incidents.where(vehicle_id: params[:id])\n end",
"def client_by_id(id)\n clients.select { |client| client.id == id }.first\n end",
"def find_client(id:)\n response = get(\"clients/#{id}\")\n PhysitrackApi::Response.from(response)\n end",
"def retrieve(id)\n @client.make_request(:get, \"insurances/#{id}\", MODEL_CLASS)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get the Cherwell task with the given public ID, and return a Task object.
|
def task(id)
task_xml = get_object_xml('Task', id)
error = self.last_error
if error
raise Cherby::NotFound.new("Cannot find Task '#{id}': #{error}")
else
return Task.new(task_xml.to_s)
end
end
|
[
"def get_task_by_id(id)\n require_relative 'task'\n Task.new(@api, @api.do_request(\"GET\", get_base_api_path() + \"/tasks/#{id}\"))\n end",
"def getTaskByID(id) \n @Tasks.each do |task|\n return task if task.ID == id\n end\n return nil \n end",
"def task(project_id, task_id)\n c_r Lokalise::Resources::Task, :find, [project_id, task_id]\n end",
"def getTaskByID(id) \n ret = nil \n\n @Tasks.each do |task| \n ret = task if task.ID == id\n end \n end",
"def find_task\n task = KanbanpadAPI::Task.find(\n id,\n :params => { :project_id => project_id, :step_id => step_id }\n )\n if task\n return task\n else\n raise TaskMapper::Exception.new \"Task with #{id} was not found\"\n end\n end",
"def init_task_by_id(id)\n require_relative 'task'\n return Task.new(@api, {'project_id' => self.id, 'id' => id}, false)\n end",
"def find(task_id)\n raise \"task_id is required\" if task_id.nil?\n task = @tasks.select { |task| task.id == task_id.to_i }.first\n raise \"No task with id #{task_id}\" if task.nil?\n task\n end",
"def task(task_id, tasklist_id = '@default')\n get gtasks_task_url(task_id, tasklist_id)\n end",
"def task\n Task.all.find {|task| task.id == self.task_id}\n end",
"def get_by_id(node_id, task_id, params = {})\n raise ArgumentError, \"invalid node ID provided: #{node_id.inspect}\" if node_id.to_s.empty?\n raise ArgumentError, \"invalid task ID provided: #{task_id.inspect}\" unless task_id.is_a?(Integer)\n\n # in this API, the task ID is included in the path, not as a request parameter.\n response = client.get \"/_tasks/{task_id}\", params.merge(task_id: \"#{node_id}:#{task_id}\", action: \"tasks.get\", rest_api: \"tasks.get\")\n response.body\n end",
"def load_task\n @task = Task.find(params[:id])\n end",
"def find_by_id(task_id, account)\n if account.nil?\n raise ArgumentError, \"account must not be nil.\"\n end\n task = Task.find(task_id)\n unless task.allows_view?(account)\n raise SecurityError,\n \"#<Account id:#{account.id}> is not allowed to access #<Task id:#{task.id}>.\"\n end\n return task\n end",
"def get(projectId, taskId)\r\n\t\t\t\turl = getBaseURL+\"projects/\"+String(projectId)+\"/tasks/\"+String(taskId)+\"/\"\r\n\t\t\t\tresponse = ZohoHTTPClient.get(url, getQueryMap)\t\t\r\n\t\t\t\treturn $taskParser.getTask(response)\r\n\t\t\tend",
"def get_task(taskid)\n params = {\n 'method' => :get,\n 'command' => \"/task/#{taskid}\"\n }\n\n response, headers = send_request(params)\n\n task = response.css('Task').first\n status = task['status']\n start_time = task['startTime']\n end_time = task['endTime']\n\n { :status => status, :start_time => start_time, :end_time => end_time, :response => response }\n end",
"def get_by_parent_id(parent_node_id, parent_task_id, params = {})\n raise ArgumentError, \"invalid parent node ID provided: #{parent_node_id.inspect}\" if node_id.to_s.empty?\n raise ArgumentError, \"invalid parent task ID provided: #{parent_task_id.inspect}\" unless parent_task_id.is_a?(Integer)\n\n parent_task_id = \"#{parent_node_id}:#{parent_task_id}\"\n params = params.merge(action: \"tasks.parent\", rest_api: \"tasks.list\")\n\n params[:parent_task_id] = parent_task_id\n\n response = client.get \"/_tasks\", params\n response.body\n end",
"def getTask(response)\r\n\t\t\t\ttasks_json = JSON.parse response\r\n\t\t\t\ttasks_array = tasks_json[\"tasks\"]\r\n\t\t\t\treturn jsonToTask(tasks_array[0])\r\n\t\t\tend",
"def next_task\n task = ::Client::Task.claim(owner: owner)\n task.id = task._id\n task\n rescue\n nil # indicates ._id wasn't found\n end",
"def get_item_by_id(task_id)\n @logger.info \"Obtaining the details of task with ID '#{task_id}'\"\n @client.api_get_request(\"/queue/item/#{task_id}\")\n end",
"def task(name)\n get \"#{base_url}/tasks/#{name}\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get a BusinessObject instance
|
def get_business_object(object_type, id)
xml = self.get_object_xml(object_type, id)
return BusinessObject.new(xml)
end
|
[
"def get_instance(payload)\n BusinessInstance.new(@version, payload, )\n end",
"def get_instance(payload)\n BrandInstance.new(@version, payload, business_sid: @solution[:business_sid], )\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def get\n\n BabboBackend.instance ||= BabboBackend.new\n end",
"def get_instance(payload)\n BrandsInformationInstance.new(@version, payload, )\n end",
"def get_instance(payload)\n BrandedChannelInstance.new(\n @version,\n payload,\n business_sid: @solution[:business_sid],\n brand_sid: @solution[:brand_sid],\n )\n end",
"def get_bean(bean_metadata)\n @bean_factory.create_bean_and_save(bean_metadata, {})\n end",
"def get_instance(payload)\n BalanceInstance.new(@version, payload, account_sid: @solution[:account_sid], )\n end",
"def retrieve_business_booking_profile\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::GET,\n '/v2/bookings/business-booking-profile',\n 'default')\n .header_param(new_parameter('application/json', key: 'accept'))\n .auth(Single.new('global')))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end",
"def get_instance(payload)\n InsightsInstance.new(@version, payload, business_sid: @solution[:business_sid], )\n end",
"def get_instance(payload)\n BrandedCallInstance.new(@version, payload, )\n end",
"def business_type\n return @business_type\n end",
"def retrieve_business(opts = {})\n data, _status_code, _headers = retrieve_business_with_http_info(opts)\n return data\n end",
"def new\n @business_object = BusinessObject.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @business_object }\n end\n end",
"def get_instance(payload)\n DomainInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end",
"def show\n @business_object = BusinessObject.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @business_object }\n format.xml { render :xml => @business_objects }\n end\n end",
"def get_instance(payload)\n AddressInstance.new(@version, payload, account_sid: @solution[:account_sid])\n end",
"def get_instance(payload)\n BindingInstance.new(@version, payload, service_sid: @solution[:service_sid])\n end",
"def get_instance(payload)\n AddressInstance.new(@version, payload, account_sid: @solution[:account_sid],)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Update a given Cherwell object by submitting its XML to the SOAP interface.
|
def update_object_xml(object_type, id, xml)
@client.update_business_object_by_public_id({
:busObNameOrId => object_type,
:busObPublicId => id,
:updateXml => xml
})
return last_error
end
|
[
"def update\n @client.soap_client.call(:update, message: \"<Entity xsi:type=\\\"#{self.class.to_s.demodulize}\\\">#{fields_to_xml}</Entity>\")\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update(obj)\n logger.debug { \"Submitting update #{obj.pp_s(:single_line)} to application service #{name}...\" }\n dispatch { |svc| svc.update_object(obj) }\n end",
"def update\n respond_to do |format|\n if @xml_builder.update(xml_builder_params)\n format.html { redirect_to @xml_builder, notice: 'Xml builder was successfully updated.' }\n format.json { render :show, status: :ok, location: @xml_builder }\n else\n format.html { render :edit }\n format.json { render json: @xml_builder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end",
"def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n \n \n format.xml \n else\n \n format.xml { render :xml => @company.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @well = Well.find(params[:id])\n\n respond_to do |format|\n if @well.update_attributes(params[:well])\n flash[:notice] = 'Well was successfully updated.'\n format.html { redirect_to(@well) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @well.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @draft_company_category = DraftCompanyCategory.find(params[:id])\n\n respond_to do |format|\n if @draft_company_category.update_attributes(params[:draft_company_category])\n\n format.xml \n else\n \n format.xml \n end\n end\n end",
"def update\n @scrap_xml = ScrapXml.find(params[:id])\n\n respond_to do |format|\n if @scrap_xml.update_attributes(params[:scrap_xml])\n flash[:notice] = 'ScrapXml was successfully updated.'\n format.html { redirect_to(@scrap_xml) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @scrap_xml.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n Transaction::Xml.transaction do\n @transaction_xml = Transaction::Xml.find(params[:id])\n respond_to do |format|\n if @transaction_xml.parse(params[:transaction_xml][:xml].open) and @transaction_xml.update_attributes(params[:transaction_xml])\n format.html { redirect_to(@transaction_xml, :notice => 'Xml was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_xml.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update(objecthash)\n\t\txml = build_xml(objecthash, 'update')\n\t\treturn execute(xml)\n\tend",
"def update!\n raise RuntimeError.new(\"Can't update a non-persisted object\") if !persisted?\n self.message = self.class.client.request path: \"#{self.class.base_path}/#{id}\",\n method: Net::HTTP::Put,\n message: message,\n response_type: self.class.message\n end",
"def update\n @envelope = Envelope.find(params[:id])\n\n respond_to do |format|\n if @envelope.update_attributes(params[:envelope])\n flash[:notice] = 'Envelope was successfully updated.'\n format.html { redirect_to(@envelope) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @envelope.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n #ensure empty groups get cleared out\n if !params['wsdl']['xsd_ids']\n @wsdl.xsds.clear\n end\n\n respond_to do |format|\n if @wsdl.update_attributes(params[:wsdl])\n flash[:notice] = 'Wsdl was successfully updated.'\n format.html { redirect_to wsdl_url(@wsdl) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wsdl.errors.to_xml }\n end\n end\n end",
"def update\n @component = Component.find(params[:component][:id])\n\n respond_to do |format|\n if @component.update_attributes(params[:component])\n format.xml { head :ok }\n end\n end\n end",
"def update\n @element.update_attributes(element_params)\n respond_with @element\n end",
"def update\n @support_contract = @object\n\n respond_to do |format|\n if @support_contract.update_attributes(params[:support_contract])\n flash[:notice] = 'SupportContract was successfully updated.'\n format.html { redirect_to support_contract_url(@support_contract) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @support_contract.errors.to_xml, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n # YOUR CODE HERE\n # Receive the parameters in the `params` hash and update the relevant Buyer object (if it exists!)\n end",
"def update\n @draft_investment = DraftInvestment.find(params[:id])\n\n respond_to do |format|\n if @draft_investment.update_attributes(params[:investment])\n\n format.xml \n else\n\n format.xml { render :xml => @draft_investment.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Save the given Cherwell incident
|
def save_incident(incident)
update_object_xml('Incident', incident.id, incident.to_xml)
end
|
[
"def store_incident_code(choice_event)\n log(\"#{choice_event.inspect}\")\n @incident ||= {}\n @incident['id'] = choice_event\n @incident['data'] = INCIDENTS[choice_event]\n log(\"##############################Incident is: #{@incident['id']}: #{@incident['data']}\") if DEBUG\n end",
"def attach_to_incident(report, incident)\n with_report_logger do\n report.incident_id = incident.id\n report.save!\n Geoincident.logger.info \"Report #{report.id} attached to incident #{incident.id}\"\n end\n end",
"def update\n @incident = Incident.retrieve(params[:id], server_auth)\n end",
"def create_incident(data)\n incident = Incident.create(data)\n result = @client.create_business_object({\n :busObNameOrId => 'Incident',\n :creationXml => incident.to_xml\n })\n\n # Result contains the public ID of the new incident, or nil if the\n # incident-creation failed.\n if !result.nil?\n incident['IncidentID'] = result\n return incident\n else\n return nil\n end\n end",
"def create\n @incidences_tracking = IncidencesTracking.new(incidences_tracking_params)\n\n respond_to do |format|\n if @incidences_tracking.save\n format.html { redirect_to @incidences_tracking, notice: 'Incidences tracking ha sido creado.' }\n format.json { render :show, status: :created, location: @incidences_tracking }\n else\n format.html { render :new }\n format.json { render json: @incidences_tracking.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n respond_to do |format|\n if @incident.update_attributes(params[:incident])\n format.html { redirect_to(@incident) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @incident.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save!\n response = self.class.client.\n create_issue(self.class.repo, @title, @body, labels: @labels, assignees: @assignees)\n\n @number = response[:number]\n\n self.class.client.close_issue(self.class.repo, @number) if @closed\n end",
"def closeIncident\n\t\texpire_action :action => :getIncidents\n\t\texpire_action :action => :getIncident\n\t\tif (params[:id].present?) && (Incident.exists?(params[:id]))\n\t\t\tid = params[:id].to_i\n\t\t\t@inc = Incident.find(id)\n\t\t\t@new_params = {\n\t\t\t\t\t\t:title => @inc[:title].to_s,\n\t\t\t\t\t\t:user_id => @inc[:user_id].to_i,\n\t\t\t\t\t\t:category_id => @inc[:category_id].to_i,\n\t\t\t\t\t\t:severity => @inc[:severity].to_i,\n\t\t\t\t\t\t:location => @inc[:location].to_s,\n\t\t\t\t\t\t:description => @inc[:description].to_s,\n\t\t\t\t\t\t:is_closed => true,\n\t\t\t\t\t\t:date_closed => DateTime.now,\n\t\t\t\t\t\t:closing_comment => \"\"\n\t\t\t\t\t}\n\t\t\tif params[:closing_comment].present?\n\t\t\t\t@new_params[:closing_comment] = params[:closing_comment]\n\t\t\tend\n\t\t\tIncident.find(id).update(@new_params)\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json {render :json => Incident.find(id).to_json}\n\t\t\t\tformat.html {render :json => Incident.find(id).to_json}\n\t\t\tend\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tformat.json {render status: 400, json: {\n\t\t\t\t\t \tmessage: \"incident with that id does not exist\",\n\t\t\t\t\t\t\t}.to_json}\n\t\t\t\tformat.html {render status: 400, json: {\n\t\t\t\t\t \tmessage: \"incident with that id does not exist\",\n\t\t\t\t\t\t\t}.to_json}\n\t\t\tend\n\t\tend\n\tend",
"def save_encounter_form\n patient = Patient.find(params[:id])\n filename = \"temp#{Time.current.to_i}.png\"\n File.open(filename, \"wb\") do|f|\n f.write(Base64.decode64(params[:image]))\n end\n file = File.open(filename)\n document = patient.documents.new(:file=> file, :name=>Time.current.to_s)\n document.save!\n file.close\n File.delete(filename)\n flash[:notice] = \"Successfully saved the EMR for patient.\"\n redirect_to \"/patients/#{patient.id}/documents\"\n end",
"def create\n @incidence = Incidence.new(incidence_params)\n\n respond_to do |format|\n if @incidence.save\n format.html { redirect_to @incidence, notice: 'Incidencia creada exitosamente.' }\n format.json { render :show, status: :created, location: @incidence }\n else\n format.html { render :new }\n format.json { render json: @incidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save\n now = Time.now\n\n data = {\n :id => @id,\n :desc => @desc,\n :ctime => Timestamp.dump(@ctime) || Timestamp.dump(now),\n :mtime => Timestamp.dump(now),\n :ppg_filename => @ppg_filename,\n }\n jobinfo.write(YAML.dump(data))\n end",
"def create\n #@incident = @quote.incidents.new(incident_params)\n logger.info params[:incident]\n params[:incident].each do |incident|\n @incident = @quote.incidents.new(incident)\n @incident.save\n end\n respond_to do |format|\n format.json { render :json => { :code => \"201\", :description => \"Created incidents\"} }\n end\n end",
"def update\n @incident = Incident.find(params[:id])\n\n if @incident.update(incident_params)\n head :no_content\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def incident_id\n return @incident_id\n end",
"def incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\n end",
"def save\n if invoice_id.nil?\n create\n else\n update\n end\n end",
"def save!(*)\n super\n self.bcspec.save! if self.bcspec()\n end",
"def save_observation(observation)\n success = true\n args = {}\n if observation.new_record?\n args[:method] = \"post\"\n args[:action] = \"observation\"\n args[:date] = observation.when\n if observation.location_id\n args[:location] = observation.location\n else\n args[:location] = observation.where\n end\n args[:notes] = observation.notes.to_s\n args[:specimen] = observation.specimen ? true : false\n args[:thumbnail] = observation.thumb_image_id.to_i\n args[:is_collection_location] = observation.is_collection_location\n else\n args[:method] = \"put\"\n args[:action] = \"observation\"\n args[:set_date] = observation.when if observation.when_changed?\n if observation.where_changed? || observation.location_id_changed?\n if observation.location_id\n args[:set_location] = observation.location\n else\n args[:set_location] = observation.where\n end\n end\n args[:set_notes] = observation.notes if observation.notes_changed?\n if observation.specimen_changed?\n args[:set_specimen] = observation.specimen\n end\n if observation.thumb_image_id_changed?\n args[:set_thumbnail] = observation.thumb_image_id.to_i\n end\n args[:set_is_collection_location] = observation.is_collection_location\n end\n if observation.save\n args[:id] = observation\n Transaction.create(args)\n else\n flash_error(:runtime_no_save_observation.t)\n flash_object_errors(observation)\n success = false\n end\n success\n end",
"def update\n if @inciting_incident.update(inciting_incident_params)\n render json: @inciting_incident\n else\n render json: @inciting_incident.errors, status: :unprocessable_entity\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Create a new Cherwell incident with the given data. If creation succeeds, return the Incident instance; otherwise, return `nil`.
|
def create_incident(data)
incident = Incident.create(data)
result = @client.create_business_object({
:busObNameOrId => 'Incident',
:creationXml => incident.to_xml
})
# Result contains the public ID of the new incident, or nil if the
# incident-creation failed.
if !result.nil?
incident['IncidentID'] = result
return incident
else
return nil
end
end
|
[
"def incident(id)\n incident_xml = get_object_xml('Incident', id)\n error = self.last_error\n if error\n raise Cherby::NotFound.new(\"Cannot find Incident '#{id}': #{error}\")\n else\n return Incident.new(incident_xml.to_s)\n end\n end",
"def incident_create(statuspage_id, incident_name, incident_details, infrastructure_affected, current_status, current_state, notifications = 0, all_infrastructure_affected = \"0\", message_subject = \"Status Notification\")\n data = get_notify(notifications)\n data['statuspage_id'] = statuspage_id\n data['incident_name'] = incident_name\n data['incident_details'] = incident_details\n data['infrastructure_affected'] = infrastructure_affected\n data['current_status'] = current_status\n data['current_state'] = current_state\n data['all_infrastructure_affected'] = all_infrastructure_affected\n data['message_subject'] = message_subject\n\n request :method => :post,\n \t :url => @url + 'incident/create',\n \t :payload => data\n end",
"def create\n Rails.logger.info \"==========================\"\n Rails.logger.info request.raw_post\n Rails.logger.info \"==========================\"\n data = JSON.parse(request.raw_post).symbolize_keys\n ignore = [\"victims\", \"offenders\", \"attachments\"]\n incident_params = data[:incident]\n incident_params = incident_params.except(*ignore)\n @incident = Incident.new(incident_params)\n @incident.status = \"pending\"\n @incident.offender = \"N/A\"\n if @user\n @incident.user_id = @user.id\n end\n if @incident.save\n data[:incident][\"victims\"].each do |record|\n victim = Victim.new(record)\n victim.incident_id = @incident.id\n victim.save\n end\n data[:incident][\"offenders\"].each do |record|\n offender = Offender.new(record)\n offender.incident_id = @incident.id\n oc = Offendercategory.find_by_id(offender.offendercategory_id)\n if !oc\n Offendercategory.create(name: \"General\",id: offender.offendercategory_id)\n end\n offender.save\n end\n json_response(@incident)\n else\n render json: @incident.errors, status: :unprocessable_entity\n end\n end",
"def create_incident(args_hash)\n options = { body: { 'incident[name]' => args_hash[:name], 'incident[status]' => args_hash[:status], 'incident[message]' => args_hash[:message] } }\n options[:body].merge!({ 'incident[scheduled_for]=' => args_hash[:start_time], 'incident[scheduled_until]' => args_hash[:end_time] }) if args_hash[:start_time]\n httparty_send(:post, \"#{@api_url}/incidents.json\", options).body\n end",
"def create\n type_id, patient_id, program_id = params.require(%i[encounter_type_id patient_id program_id])\n\n encounter = encounter_service.create(\n type: EncounterType.find(type_id),\n patient: Patient.find(patient_id),\n program: Program.find(program_id),\n provider: params[:provider_id] ? Person.find(params[:provider_id]) : User.current.person,\n encounter_datetime: TimeUtils.retro_timestamp(params[:encounter_datetime]&.to_time || Time.now)\n )\n\n if encounter.errors.empty?\n render json: encounter, status: :created\n else\n render json: encounter.errors, status: :bad_request\n end\n end",
"def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n if @incidentcategory.save\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end",
"def create\n @condition_incidence = ConditionIncidence.new(condition_incidence_params)\n\n respond_to do |format|\n if @condition_incidence.save\n format.html { redirect_to @condition_incidence, notice: 'Condition incidence was successfully created.' }\n format.json { render :show, status: :created, location: @condition_incidence }\n else\n format.html { render :new }\n format.json { render json: @condition_incidence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_kind = IncidentKind.new(params[:incident_kind])\n\n respond_to do |format|\n if @incident_kind.save\n format.html { redirect_to @incident_kind, notice: 'Incident kind was successfully created.' }\n format.json { render json: @incident_kind, status: :created, location: @incident_kind }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_kind.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incidentcategory = Incidentcategory.new(incidentcategory_params)\n\n respond_to do |format|\n if @incidentcategory.save\n format.html { redirect_to incidentcategories_path, notice: 'Incidentcategory was successfully created.' }\n format.json { render :show, status: :created, location: @incidentcategory }\n else\n format.html { render :new }\n format.json { render json: @incidentcategory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createEncounter()\n newEncounter = FHIR::Encounter.new()\nend",
"def create\n @incident_class = IncidentClass.new(params[:incident_class])\n\n respond_to do |format|\n if @incident_class.save\n format.html { redirect_to @incident_class, notice: 'Incident class was successfully created.' }\n format.json { render json: @incident_class, status: :created, location: @incident_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_class.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @critical = Critical.new(critical_params)\n\n respond_to do |format|\n if @critical.save\n format.html { redirect_to @critical, notice: 'Critical was successfully created.' }\n format.json { render :show, status: :created, location: @critical }\n else\n format.html { render :new }\n format.json { render json: @critical.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_type = IncidentType.new(params[:incident_type])\n\n respond_to do |format|\n if @incident_type.save\n format.html { redirect_to @incident_type, notice: 'Incident type was successfully created.' }\n format.json { render json: @incident_type, status: :created, location: @incident_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @incident_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @incidence = Incidence.new(params[:incidence])\n\n respond_to do |format|\n if @incidence.save\n format.html { redirect_to(@incidence, :notice => 'Incidence was successfully created.') }\n format.xml { render :xml => @incidence, :status => :created, :location => @incidence }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @incidence.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @incident_proof = IncidentProof.new(incident_proof_params)\n\n respond_to do |format|\n if @incident_proof.save\n format.html { redirect_to @incident_proof, notice: 'Incident proof was successfully created.' }\n format.json { render :show, status: :created, location: @incident_proof }\n else\n format.html { render :new }\n format.json { render json: @incident_proof.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n expose Challenge.create(@oauth_token, params[:data])\n end",
"def incident\n if @incident\n @incident\n elsif !self[Report.incident_predicate].empty?\n @incident = Incident.find(self[Report.incident_predicate].first)\n else\n nil\n end\n end",
"def create_incident_service(body, opts = {})\n data, _status_code, _headers = create_incident_service_with_http_info(body, opts)\n data\n end",
"def create\n @type_incidence = TypeIncidence.new(type_incidence_params)\n\n respond_to do |format|\n if @type_incidence.save\n format.html { redirect_to @type_incidence, notice: 'Type incidence was successfully created.' }\n format.json { render :show, status: :created, location: @type_incidence }\n else\n format.html { render :new }\n format.json { render json: @type_incidence.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Get a business object definition as a hash ex. get_object_definition('Incident') TODO: Use this as the basis for building templates?
|
def get_object_definition(object_type)
result = {}
definition = @client.get_business_object_definition(object_type)
selector = 'BusinessObjectDef > FieldList > Field'
Nokogiri::XML(definition).css(selector).map do |field|
result[field['Name']] = field.css('Description').inner_html
end
return result
end
|
[
"def find_object_definition_name\n if Rails.env.test?\n @object_definition_name = request.env[\"X_AP_OBJECT_DEFINITION_NAME\"]\n else\n @object_definition_name = request.env[\"HTTP_X_AP_OBJECT_DEFINITION_NAME\"]\n end\n end",
"def object(conf); {\n :fields => conf.fields.map do |name, conf|; {\n :name => name,\n :descripton => conf.description,\n :required => conf.required,\n :type => conf.type\n }; end,\n # Just reference names of objects\n :objects => conf.objects.map do |name, conf|; {\n :name => name,\n :object_type => conf[:object_type]\n }; end\n }; end",
"def get_definition\n\n end",
"def complex_type_hash(class_name, object, ancestors)\n {\n class: class_name,\n obj: object,\n ancestors: ancestors\n }\n end",
"def getEmploymentBusinessDetailObjName\r\n\t\t\treturn \"Employment_Business_Detail__c\"\r\n\t\tend",
"def getEmploymentBusinessDetailObjName\r\n\t\t\treturn \"mfiforce__Employment_Business_Detail__c\"\r\n\t\tend",
"def to_h(stack = nil)\n raise WCC::Contentful::CircularReferenceError.new(stack, id) if stack&.include?(id)\n\n stack = [*stack, id]\n typedef = self.class.content_type_definition\n fields =\n typedef.fields.each_with_object({}) do |(name, field_def), h|\n if field_def.type == :Link || field_def.type == :Asset\n if _resolved_field?(name, 0)\n val = public_send(name)\n val =\n _try_map(val) { |v| v.to_h(stack) }\n else\n ids = field_def.array ? public_send(\"#{name}_ids\") : public_send(\"#{name}_id\")\n val =\n _try_map(ids) do |id|\n {\n 'sys' => {\n 'type' => 'Link',\n 'linkType' => field_def.type == :Asset ? 'Asset' : 'Entry',\n 'id' => id\n }\n }\n end\n end\n else\n val = public_send(name)\n val = _try_map(val) { |v| v.respond_to?(:to_h) ? v.to_h.stringify_keys! : v }\n end\n\n h[name] = val\n end\n\n {\n 'sys' => @raw['sys'].dup,\n 'fields' => fields\n }\n end",
"def get_schema(object_name)\n s = @client.describe(object_name)\n object_schema = {}\n s[\"fields\"].each do |field|\n object_schema[field[\"name\"]]= {\n type: field[\"type\"],\n # http://salesforce.stackexchange.com/questions/25233/is-there-a-way-to-find-required-fields-on-an-objects\n required: field[\"createable\"] && !field[\"nillable\"] && !field[\"defaultedOnCreate\"]\n }\n end\n object_schema\n end",
"def to_h\n result = Hash[\n name: name,\n type: type.to_h,\n dynamic: !!dynamic?,\n doc: (doc || \"\")]\n if value = self.default_value\n if value.respond_to?(:to_simple_value)\n result[:default] = value.to_simple_value\n else\n result[:default] = value\n end\n end\n result\n end",
"def definition\n @definition ||= self.class.definition_for(key)\n end",
"def to_jaxb_json_hash\n _h = super\n _h['concept'] = concept.to_jaxb_json_hash unless concept.nil?\n _h['conceptVersion'] = conceptVersion.to_jaxb_json_hash unless conceptVersion.nil?\n _h['isConceptDefined'] = isConceptDefined.to_jaxb_json_hash unless isConceptDefined.nil?\n _h['conceptDescription'] = conceptDescription.to_jaxb_json_hash unless conceptDescription.nil?\n return _h\n end",
"def object_definition_metadata\n version = @account.api_version.nil? ? 'latest' : @account.api_version\n response = ap_client(version).metadata.fetch\n\n Rails.logger.info \"response: \" + response.inspect\n parsed_json = []\n case response.status\n when 200\n begin\n parsed_json = ActiveSupport::JSON.decode(response.body)\n rescue MultiJson::DecodeError\n raise \"Unable to decode the JSON message.\"\n end\n else\n raise \"Unable to get a response.\"\n end\n\n parsed_json\n end",
"def business(business_id)\n begin\n get_hash_by_object(@client.business(business_id))\n rescue Exception => e\n {:application_code => 400}\n end\n end",
"def definition\n if @data['definition']\n @data['definition']\n else\n @data['definition'] = field_fetch('D')\n end\n end",
"def definition\n return @definition\n end",
"def definition\n definition = self.class.definition_for(self.name)\n if definition.blank?\n log_warning \"Could not find cell definition for #{self.name}. Please check your cells.yml!\"\n return {}\n else\n definition\n end\n end",
"def get_business_object(object_type, id)\n xml = self.get_object_xml(object_type, id)\n return BusinessObject.new(xml)\n end",
"def getBusinessEventObjName\r\n\t\t\treturn \"mfiforce__Business_Event__c\"\r\n\t\tend",
"def to_h\n hash = {}\n fields = rendering_fields\n fields.each do |field|\n hash[field.to_s] = __send__(field)\n end\n hash\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Redirects to a single constituency given an external source and an id that identifies this constituency in that source.
|
def lookup
@constituency = @request.get.first
redirect_to constituency_path(@constituency.graph_id)
end
|
[
"def redirect\n id = params[\"id\"]\n content_type = request.headers.env[\"HTTP_ACCEPT\"]\n if content_type == APPLICATION_JSON\n url = individual_export_url(id: id, format: \"jsonld\")\n elsif content_type == TEXT_TURTLE\n url = individual_export_url(id: id, format: \"ttl\")\n elsif content_type == APPLICATION_RDF_XML\n url = individual_export_url(id: id, format: \"rdf\")\n else\n # default to the HTML representation\n url = display_show_url(id)\n end\n redirect_to url, status: SEE_OTHER\n rescue => ex\n backtrace = ex.backtrace.join(\"\\r\\n\")\n Rails.logger.error(\"Could not redirect to record #{id}. Exception: #{ex} \\r\\n #{backtrace}\")\n render \"error\", status: 500\n end",
"def redirect\n url = Url.first(conditions: {short_url: params[:code]})\n if url\n referral = url.forwardable\n redirect_to offer_referral_path(referral, src: params[:src])\n else\n # TODO handle exception\n end\n end",
"def link\n id = session[:id].to_s\n url =\"http://ourco2.org/dopplr/?userid=\"+id\n redirect_to \"https://www.dopplr.com/api/AuthSubRequest?scope=http://www.dopplr.com&next=\"+url+\"&session=1\"\n end",
"def redirect_to(url)\n response.code = 301\n response.headers['Location'] = url\n end",
"def redirect_back_to_source\n # If we've been requested to do so, redirect back to an external whitelisted service\n if (redirect_url = params[\"redirect\"]) && redirect_url.present?\n if UmlautBorrowDirect::UrlWhitelister.new(self.umlaut_config.lookup!(\"borrow_direct.redirect_whitelist\", [])).whitelisted?(redirect_url)\n redirect_to redirect_url\n return\n else\n # We used to redirect to plain umlaut page on URL unallowed by whitelist,\n # but that made debugging a confusing situation even harder. Just error\n # message it. \n error_msg = \"Error: UmlautBorrowDirect Controller: Ignoring redirect URL which does not match whitelist: #{redirect_url}\"\n logger.warn(error_msg)\n render :status => 403, :text => error_msg\n return\n end\n end\n\n # redirect back to /resolve menu, for same object, add explicit request_id\n # in too. \n redirect_to_resolve_menu\n end",
"def redirect_to_original_link\n if params[:unique_code].present?\n id = UniqueCodeMethods.decode_unique_code(params[:unique_code])\n link = Link.find_record(id)\n if link.present?\n link.increase_visit_count\n redirect_to link.original_link\n end\n else\n render nothing: true\n end\n end",
"def legacy_redirect\n community = Community.where(\"lower(legacy_url) = ?\", params[:legacy_community_name].to_s.downcase).first\n \n if community\n redirect_to community, status: 301\n elsif college = College.where(\"lower(short_name) = ?\", params[:legacy_college_name].to_s.downcase).first\n redirect_to college, status: 301\n else\n flash[:notice] = \"The link you clicked is out of date! We couldn't figure out where you wanted to go...\"\n redirect_to listings_url, status: 301\n end\n end",
"def redirect(language, id)\n if language == 'de'\n return nil\n end\n\n base_url = 'https://eblocker.org'\n\n if id == nil\n return base_url + '/en/docs/'\n end\n\n return base_url + @docs_links[id]\n end",
"def redirect_to(shortcode)\n url = ''\n url += if shortcode.ssl?\n 'https://'\n else\n 'http://'\n end\n url += shortcode.destination\n shortcode.hit\n redirect url, 301\n end",
"def friendly_redirect(resource, id_param)\n if request.request_method_symbol == :get && resource.friendly_id != id_param\n redirect_to request.params.merge(id: resource.friendly_id), status: :moved_permanently\n end\n end",
"def getit\n @record = Record.find(params[:id])\n head :bad_request and return if @record.nil?\n @record.rebuild_openurl!(current_primary_institution.code) if @record.expired?\n # If external system is primo and we have a primo_id, link to primo\n if has_primo_as_external_system? && @record.external_id && ENV['PERSISTENT_LINKER_URL']\n redirect_to \"#{ENV['PERSISTENT_LINKER_URL']}#{@record.external_id}?institution=#{current_primary_institution.code.upcase}\"\n else\n # Otherwise use getit\n redirect_to getit_url + strip_getit_prefix(@record.url)\n end\n end",
"def redirect(location, status = '302'); request.redirect(location, status); end",
"def redirect_to_clicked_page\n if session[:show_adwords]\n @google_redirect_url = '/google_analytics/adwords'\n else\n @google_redirect_url = '/google_analytics'\n end\n end",
"def external_link\n\n url = params[:url]\n if url.nil?\n render nothing: true\n return\n end\n\n ExternalLinkLog.log url, request, current_user\n\n redirect_to url\n\n end",
"def external_link\n\n url = params[:url]\n if url.nil?\n render :nothing => true\n return\n end\n\n ExternalLinkLog.log url, request, current_user\n\n redirect_to url\n\n end",
"def redirect_to_url\n domain = request.original_url\n @tiny_url = TinyUrl.find_by(shortend_url: domain.split('?')[1]) if domain\n if @tiny_url\n full_url = @tiny_url.full_url\n redirect_to full_url\n else\n render status: :not_found, json: { message: t('api.tiny_urls.no_data_found') }\n end\n end",
"def redirect_incident_id=(value)\n @redirect_incident_id = value\n end",
"def redirect uri, *args\n if @env[HTTP_VERSION] == 'HTTP/1.1' && @env[REQ_METHOD] != 'GET'\n status 303\n else\n status 302\n end\n\n @response[LOCATION] = url_to(uri.to_s)\n halt(*args)\n end",
"def redirect\n begin\n short_url = request.url.gsub(/(https?:\\/\\/)|(www\\.)/, '') #remove the https:,http: and www part from the url\n original_link = ShortUrl.find_by_short_url!(short_url)\n redirect_to original_link.long_url\n rescue Exception => e\n logger.error { \"Error while redirecting to the original link. Params: #{params.inspect}, ErrorMessage: #{e.message}\" }\n redirect_to index_path\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Post method which accepts form parameters from postcode lookup and redirects to constituency_path.
|
def postcode_lookup
flash[:postcode] = params[:postcode]
redirect_to constituency_path(params[:constituency_id])
end
|
[
"def redirect_submit\n # for amendments, provide the amendment reason and check if they want to request a repayment\n if @lbtt_return.amendment?\n redirect_to returns_lbtt_amendment_reason_path\n elsif @lbtt_return.any_lease_review?\n redirect_to returns_lbtt_repayment_claim_path\n else\n redirect_to returns_lbtt_declaration_path\n end\n end",
"def post\n\t redirect_to search_path( query: params[:query] )\n\tend",
"def create\n @post_code = PostCode.new(post_code_params)\n\n respond_to do |format|\n if @post_code.save\n format.html { redirect_to @post_code, notice: 'Post code was successfully created.' }\n format.json { render :show, status: :created, location: @post_code }\n else\n format.html { render :new }\n format.json { render json: @post_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @postcode = Postcode.new(params[:postcode])\n\n respond_to do |format|\n if @postcode.save\n format.html { redirect_to(@postcode, :notice => 'Postcode was successfully created.') }\n format.xml { render :xml => @postcode, :status => :created, :location => @postcode }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @postcode.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def employee_post\n if params[\"new\"] \n redirect_to \"/employee/new\" and return\n else\n redirect_to \"/employee/#{params[\"edit\"]}\" and return\n end\n end",
"def create\n @postal_code = PostalCode.new(params[:postal_code])\n\n respond_to do |format|\n if @postal_code.save\n format.html { redirect_to @postal_code, notice: 'Postal code was successfully created.' }\n format.json { render json: @postal_code, status: :created, location: @postal_code }\n else\n format.html { render action: \"new\" }\n format.json { render json: @postal_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def process_approve_fab_houses\n\n design_review = DesignReview.find(params[:design_review][:id])\n fab_msg = post_fab_house_approvals(design_review, params[\"fab_house_ids\"] )\n\n redirect_to(:action => :view, :id => params[:design_review][:id])\nend",
"def create\n @place_of_residence = PlaceOfResidence.new(params[:place_of_residence])\n\n respond_to do |format|\n if @place_of_residence.save\n format.html { redirect_to PersonalDetail.find(@place_of_residence.personal_detail_id), notice: 'Place of residence was successfully created.' }\n format.json { render json: @place_of_residence, status: :created, location: @place_of_residence }\n else\n format.html { render action: \"new\" }\n format.json { render json: @place_of_residence.errors, status: :unprocessable_entity }\n end\n end\n end",
"def placement_routing_post\n flash[:design_id] = flash[:design_id]\n flash[:review_type_id] = flash[:review_type_id]\n end",
"def create\n @post_code_electorate_map = PostCodeElectorateMap.new(post_code_electorate_map_params)\n\n respond_to do |format|\n if @post_code_electorate_map.save\n format.html { redirect_to @post_code_electorate_map, notice: 'Post code electorate map was successfully created.' }\n format.json { render :show, status: :created, location: @post_code_electorate_map }\n else\n format.html { render :new }\n format.json { render json: @post_code_electorate_map.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @address_with_postal_code = AddressWithPostalCode.new(params[:address_with_postal_code])\n\n respond_to do |format|\n if @address_with_postal_code.save\n format.html { redirect_to @address_with_postal_code, notice: 'Address with postal code was successfully created.' }\n format.json { render json: @address_with_postal_code, status: :created, location: @address_with_postal_code }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_with_postal_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def plans_post\n if params[\"new\"] \n redirect_to \"/plans/new\" and return\n else\n redirect_to \"/plans/#{params[\"edit\"]}\" and return\n end\n end",
"def create\n @discount_code = DiscountCode.new(discount_code_params)\n if @discount_code.save\n redirect_to dashboard_discount_code_path(@discount_code), notice: 'Discount code was successfully created.'\n else\n render :new\n end\n end",
"def create\n# @country_code = CountryCode.new(params[:country_code])\n#\n# respond_to do |format|\n# if @country_code.save\n# flash[:notice] = 'CountryCode was successfully created.'\n# format.html { redirect_to(@country_code) }\n# format.xml { render :xml => @country_code, :status => :created, :location => @country_code }\n# else\n# format.html { render :action => \"new\" }\n# format.xml { render :xml => @country_code.errors, :status => :unprocessable_entity }\n# end\n# end\n end",
"def create\n @distributor_missed_pincode = DistributorMissedPincode.new(distributor_missed_pincode_params)\n\n respond_to do |format|\n if @distributor_missed_pincode.save\n format.html { redirect_to @distributor_missed_pincode, notice: 'Distributor missed pincode was successfully created.' }\n format.json { render :show, status: :created, location: @distributor_missed_pincode }\n else\n format.html { render :new }\n format.json { render json: @distributor_missed_pincode.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ncit_disease_code = NcitDiseaseCode.new(ncit_disease_code_params)\n\n respond_to do |format|\n if @ncit_disease_code.save\n format.html { redirect_to @ncit_disease_code, notice: 'Ncit disease code was successfully created.' }\n format.json { render :show, status: :created, location: @ncit_disease_code }\n else\n format.html { render :new }\n format.json { render json: @ncit_disease_code.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post\n # Make sure cid belongs to user\n if check_id(params[:cid])\n flash[:danger] = \"Try not to post in places that doesn't belong to you\"\n return redirect_to '/'\n end\n\n @grade = Grade.new(:courseItem => params[:courseItem],\n :worth => params[:worth],\n :mark => params[:mark],\n :courseMark => \"%.2f\" % (params[:worth].to_f*(params[:mark].to_f/100)),\n :subject_id => params[:cid])\n\n #Data Validation - Blank values\n if !@grade.valid?\n flash[:danger] = \"Please Input Valid Values\"\n return redirect_to '/'\n elsif @grade.save\n update_subject_grade(Grade.where(subject_id: params[:cid]), params[:cid])\n return redirect_to action: \"show\",\n id:params[:cid]\n else\n flash[:warning] = \"A Random Bug Occured, Please Try Again\"\n return redirect_to '/'\n end\n end",
"def create\n @designated_national_authority = DesignatedNationalAuthority.new(params[:designated_national_authority])\n\n respond_to do |format|\n if @designated_national_authority.save\n format.html { redirect_to @designated_national_authority, notice: 'Designated national authority was successfully created.' }\n format.json { render json: @designated_national_authority, status: :created, location: @designated_national_authority }\n else\n format.html { render action: \"new\" }\n format.json { render json: @designated_national_authority.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @address_without_postal_code = AddressWithoutPostalCode.new(params[:address_without_postal_code])\n\n respond_to do |format|\n if @address_without_postal_code.save\n format.html { redirect_to @address_without_postal_code, notice: 'Address without postal code was successfully created.' }\n format.json { render json: @address_without_postal_code, status: :created, location: @address_without_postal_code }\n else\n format.html { render action: \"new\" }\n format.json { render json: @address_without_postal_code.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Renders a constituency that has a constituency area object on map view given a constituency id. Will respond with GeoJSON data using the geosparqltogeojson gem if JSON is requested.
|
def map
respond_to do |format|
format.html do
@constituency = Parliament::Utils::Helpers::FilterHelper.filter(@request, 'ConstituencyGroup').first
@json_location = constituency_map_path(@constituency.graph_id, format: 'json')
end
format.json do
@constituency = Parliament::Utils::Helpers::RequestHelper.filter_response_data(
Parliament::Utils::Helpers::ParliamentHelper.parliament_request.constituency_map.set_url_params({ constituency_id: params[:constituency_id] }),
Parliament::Utils::Helpers::RequestHelper.namespace_uri_schema_path('ConstituencyGroup')
).first
raise ActionController::RoutingError, 'Not Found' unless @constituency.current?
render json: GeosparqlToGeojson.convert_to_geojson(
geosparql_values: @constituency.area.polygon,
geosparql_properties: {
name: @constituency.name,
start_date: @constituency.start_date,
end_date: @constituency.end_date
},
reverse: false
).geojson
end
end
end
|
[
"def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constituency }\n end\n end",
"def show\n @curriculum_area = CurriculumArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.haml\n format.json { render json: @curriculum_area }\n end\n end",
"def show\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @constituency }\n end\n end",
"def county_json\n respond_to do |format|\n format.json {render file: \"/workplace_shapes/us_counties.json\" }\n format.html\n end\n end",
"def render_index_mapview\n static_geojson_file_loc = \"#{Rails.root}/#{GEOJSON_STATIC_FILE['filepath']}\"\n if Rails.env.to_s == 'production' && params[:action] == 'map' && File.exist?(static_geojson_file_loc)\n geojson_for_map = File.open(static_geojson_file_loc).first\n else\n geojson_for_map = serialize_geojson(map_facet_values)\n end\n render partial: 'catalog/index_mapview',\n locals: { geojson_features: geojson_for_map }\n end",
"def show\n @area_of_interest = AreaOfInterest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_of_interest }\n end\n end",
"def show\n @spatial_coverage = SpatialCoverage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @spatial_coverage }\n end\n end",
"def show\n @polygon = Polygon.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @polygon }\n end\n end",
"def show\n @congressional_district = CongressionalDistrict.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @congressional_district }\n end\n end",
"def show\n @constitution = Constitution.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @constitution }\n end\n end",
"def polygons\n geofence = Geofence.find(params[:id])\n @collection = geofence.polygons\n end",
"def index\n @statistical_map = StatisticalMap.new\n @json = Town.find_all_by_state_id_and_cve_loc(8,1).to_gmaps4rails \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @statistical_map }\n end\n end",
"def show\n \n @building = nil \n if !params[:building_id].nil?\n @building = Building.find(:first, :conditions => {:id => params[:building_id]})\n else #params[:poi_id]\n @building = Building.find(:first, :conditions => {:poi_id => params[:poi_id]})\n end\n \n @vertex = Vertex.find(:all, :conditions => {:building_id => @building.id})\n @poi = @building.poi\n \n render 'show_polygon'\n \n end",
"def update\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n if @constituency.update_attributes(params[:constituency])\n format.html { redirect_to @constituency, notice: 'Constituency was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constituency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @constituency = Constituency.find(params[:id])\n\n respond_to do |format|\n if @constituency.update_attributes(params[:constituency])\n format.html { redirect_to @constituency, notice: 'Constituency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @constituency.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @area_of_law = AreaOfLaw.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @area_of_law }\n end\n end",
"def show\n @tramite_constitucional = TramiteConstitucional.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tramite_constitucional }\n end\n end",
"def show\n @geopoint = Geopoint.find(params[:id])\n @json = @geopoint.to_gmaps4rails\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @geopoint }\n end\n end",
"def show\n @area = Area.find(params[:id])\n render :json => @area\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
UC2 Put information about Users and contracts with Vendors
|
def put_contract(q)
$LOG.info('put_contract');
@USER=q["USER"];
@CONTRACT=q["CONTRACT"];
@CID=@USER["CID"];
@user=$CACHE.get("USER",@CID)
$LOG.info(@USER.to_s()+' - '+@CONTRACT.to_s());
if (@user == nil)
@user=$STORAGE.get("USER",@CID)
if (@user == nil)
$STORAGE.put("USER",@CID,@USER)
@user=$STORAGE.get("USER",@CID)
end
if (@user != nil)
@user=$CACHE.put("USER",@CID,@user) ## new user added
end
end
## add new contract with vendor
if (@CONTRACT!=nil)
@VID=@CONTRACT["VID"];
@vendor=get_vendor(@VID)
if (@vendor != nil)
## vendor exists - OK!!!
@contracts=get_contracts_by_vendor(@VID);
$LOG.info(@VID.to_s()+' get_contracts_by_vendor '+@contracts.to_s());
@contract=@contracts[@CID]
$LOG.info(@CID.to_s()+' get_contract '+@contract.to_s());
if (@contract!=nil)
clear_price_for_contract(@contract)
end
put_contract_for_vendor(@USER, @CONTRACT)
end
end
end
|
[
"def create\n @vendor = current_user.vendors.new(vendor_params)\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }\n format.json { render :show, status: :created, location: @vendor }\n else\n format.html { render :new }\n format.json { render json: @vendor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def mf_api_user_update_tags\n\n # Get User From DB with client_id\n user = User.where(clientid: params[:client_id]).first\n\n # If user not found, return error response\n if user.empty?\n response = {\n success: false,\n message: 'User with ClientID not found'\n }\n\n render json: response\n end\n\n # Get the Infusionsoft contact info\n contact = Infusionsoft.data_load('Contact', user.clientid, [:Groups])\n\n # Update User Tags\n user.put('', {\n :client_tags => contact['Groups']\n })\n\n\n response = {\n success: true,\n message: 'User Tags Updated'\n }\n\n render json: response\n\n end",
"def create\n @vendor = current_user.vendors.new(params[:vendor])\n\n respond_to do |format|\n if @vendor.save\n format.html { redirect_to(@vendor, :notice => 'Vendor was successfully created.') }\n format.xml { render :xml => @vendor, :status => :created, :location => @vendor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vendor.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def provision_okta_user\n\n first = params[:firstname]\n last = params[:lastname]\n email = params[:username]\n pass = params[:password]\n\n # create new okta user\n okta_client = HTTPClient.new\n headers = {\"Authorization\" => \"SSWS #{ENV['OKTA_TOKEN']}\",\n \"Content-Type\" => \"application/json\",\n \"Accept\" => \"application/json\"}\n\n # create user in Okta\n uri = \"#{ENV['OKTA_DOMAIN']}/api/v1/users?activate=true\"\n userQuery = {}\n userQuery[:profile] = {'firstName' => first,\n 'lastName' => last,\n 'email' => email,\n 'login' => email,\n 'mobilePhone' => \"\"}\n userQuery[:credentials] = {'password' => pass}\n res = okta_client.post(uri, body: Oj.dump(userQuery), header: headers)\n json = Oj.load(res.body)\n\n # did we receive an error creating the okta user?\n if (!json['errorCode'].nil?)\n flash[:notice] = \"Error #{json['errorCauses'][0]['errorSummary']}\"\n else\n # create box app user\n box_user = Box.admin_client.create_user(email, is_platform_access_only: true)\n\n # store the box id in Okta as metadata\n uri = \"#{ENV['OKTA_DOMAIN']}/api/v1/users/#{json['id']}\"\n query = {}\n query[:profile] = {}\n query[:profile][:boxId] = box_user.id\n res = okta_client.post(uri, body: Oj.dump(query), header: headers)\n setup_box_account(email, box_user.id)\n send_grid(email, pass, first)\n flash[:notice] = \"Provisioned new account. Email sent to #{email}\"\n end\n\n redirect_to user_management_path\n end",
"def update(options = {})\n if options\n options = options.select { |k,v| FIELDS.include?(k.to_s) }\n options.each_pair { |k,v| instance_variable_set(\"@#{k}\", v) }\n end\n \n response = client.request(:create_owner) do\n soap.input = [\"update-owner-request\", {\"xmlns\" => \"http://intercall.com/ownerAPI\"}]\n soap.body = Owner.create_body({\n 'owner-number' => self.owner_number,\n 'update-owner' => {\n 'owner-info' => self.create_intercall_hash \n }\n })\n soap.element_form_default = :unqualified\n end\n\n if response\n if response.to_hash[:response_intercall_owner_service][:status] == \"error\"\n self.class.log_response(client.http.url, response.to_xml, client.http.body, self.class.get_class_method(__method__), 'ERROR')\n false\n else\n self.class.log_response(client.http.url, response.to_xml, client.http.body, self.class.get_class_method(__method__), 'SUCCESS')\n return true\n end\n end\n end",
"def co_update_from_organization\n organization = params[:company]\n if organization != '0'\n @organization = Organization.find(organization)\n @users = @organization.blank? ? users_dropdown : users_dropdown\n #@users = @organization.blank? ? users_dropdown : @organization.users.order(:email)\n else\n @users = users_dropdown\n end\n @json_data = { \"users\" => @users }\n render json: @json_data\n end",
"def update\n #update venues trought users controller\n\n @user = User.find_by(authentication_token: request.headers['Authorization'])\n\n if @user.is_venue?\n @user.venue.update(venue_params)\n if @user.venue.update(venue_params)\n render json: {status: :ok}\n else\n render json: {msg: 'Invalid params'}\n end\n else\n render json: {msg: 'You dont own a venue'}, status: :error\n end\n \n\n end",
"def search_for_owner\n params.require(:license_tag)\n # get the police lookup contract\n pc = PoliceContract.first\n @result = {}\n return unless pc\n # initialize the ethereum_client and the PoliceLookup contract\n client = ethereum_client\n contract = Ethereum::Contract.create(name: \"PoliceLookup\",\n address: pc.contract_address,\n abi: pc.contract_abi,\n client: client)\n # create the license_tag hash\n license_tag_hash = Digest::SHA3.hexdigest(params[:license_tag].capitalize, 256)\n # lookup matching registration in ethereum\n reg_address = contract.call.lookup_register_contract([license_tag_hash].pack('H*'))\n reg = CarRegistration.find_by(contract_address: \"0x\" + reg_address)\n return unless reg\n # create the registration contract, if a matching registration address was found\n reg_contract = Ethereum::Contract.create(name: \"RegisterCar\",\n address: reg.contract_address,\n abi: reg.contract_abi,\n client: client)\n # halterdaten\n @result[:owner_firstname] = reg_contract.call.owner_firstname\n @result[:owner_lastname] = reg_contract.call.owner_lastname\n @result[:street] = \"#{reg_contract.call.owner_street} #{reg_contract.call.owner_street_number}\"\n @result[:city] = \"#{reg_contract.call.owner_zipcode} #{reg_contract.call.owner_city}\"\n @result[:birthdate] = reg_contract.call.owner_birthdate\n\n # kfz daten\n @result[:status_id] = reg_contract.call.state\n @result[:status] = CarRegistration::REGISTER_STATE[reg_contract.call.state]\n @result[:updated] = Time.at(reg_contract.call.update_time.to_i).getlocal('+02:00').strftime(\"%d.%m.%Y %H:%M\")\n @result[:license_tag] = reg_contract.call.license_tag\n @result[:vehicle_number] = reg_contract.call.vehicle_number\n end",
"def index\n\t\t@company = Company.find(params[:company_id])\n\t\t@user = @company.users.find(params[:user_id])\n\t\t@contracts = @user.contracts\n\tend",
"def postContractFreeactivate( contract_id, user_name, user_surname, user_email_address)\n params = Hash.new\n params['contract_id'] = contract_id\n params['user_name'] = user_name\n params['user_surname'] = user_surname\n params['user_email_address'] = user_email_address\n return doCurl(\"post\",\"/contract/freeactivate\",params)\n end",
"def save\n unless operational?\n propose unless @user1_confirmed\n return confirm\n end\n response = begin\n CoachClient::Request.put(url, username: @user1.username,\n password: @user1.password,\n payload: payload,\n content_type: :xml)\n rescue CoachClient::Exception\n CoachClient::Request.put(url, username: @user2.username,\n password: @user2.password,\n payload: payload,\n content_type: :xml)\n end\n unless response.code == 200 || response.code == 201\n fail CoachClient::NotSaved.new(self), 'Could not save partnership'\n end\n self\n end",
"def assign_tenant_circles_to_an_aos_version_box(args = {}) \n body_put(\"/aosversions.json/aosversionbox/circles/#{args[:aosVersionBoxId]}\", args[:array_of_ids])\nend",
"def update\n @os_vendor = OsVendor.find(params[:id])\n\n respond_to do |format|\n if @os_vendor.update_attributes(params[:os_vendor])\n format.html { redirect_to @os_vendor, notice: 'Os vendor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @os_vendor.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_owner!(owner_key, data)\n put \"/owner/#{owner_key}\", body: data\n end",
"def contractor_add\n\n # get the cliebt\n @client = Client.find(params[:client_id])\n\n # get the contract\n @contract = Contract.find(params[:id])\n\n # get the contractor\n @contractor = ContractorUser.find(params[:contractor_id])\n\n # if the contractor is not already added, add!\n\n @contract.contractor_user=@contractor\n @contract.save!\n redirect_to edit_client_contract_path(@client, @contract, :contracts_page => @contracts_page, :status => @status)\n\n end",
"def update\n @vendor.update(vendor_params)\n if @vendor.valid?\n render json: @vendor\n end\n end",
"def specific_endorsing_orgs\n candidate = Candidate.find_by(user: self)\n endorsements = Endorsement.where(candidate: candidate)\n twitterusers = endorsements.reverse.map { |endorsement| endorsement.user.twitteruser\n }\n end",
"def register_account_request_other(taxes)\n { UserServices: { 'ins2:UserService' => taxes.compact_blank } }\n end",
"def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Creates a new SexpProcessor. Use super to invoke this initializer from SexpProcessor subclasses, then use the attributes above to customize the functionality of the SexpProcessor
|
def initialize
@expected = Sexp
# we do this on an instance basis so we can subclass it for
# different processors.
@processors = {}
@context = []
public_methods.each do |name|
if name.to_s.start_with? "process_" then
@processors[name[8..-1].to_sym] = name.to_sym
end
end
end
|
[
"def initialize\n @expected = Sexp\n @processors = self.class.processors\n @context = []\n\n if @processors.empty?\n public_methods.each do |name|\n if name.to_s.start_with? \"process_\" then\n @processors[name[8..-1].to_sym] = name.to_sym\n end\n end\n end\n end",
"def process exp\n @processors.each do |processor|\n exp = processor.process(exp)\n end\n exp\n end",
"def process_source exp, klass = nil, method = nil, template = nil\n @current_class = klass\n @current_method = method\n @current_template = template\n process exp\n end",
"def processor\n @processor ||= Processor.new(options)\n end",
"def process exp\n return nil if exp.nil?\n\n unless Sexp === exp then\n raise SexpTypeError, \"exp must be a Sexp, was #{exp.class}:#{exp.inspect}\"\n end\n\n if self.context.empty? then\n p :rewriting unless debug.empty?\n exp = self.rewrite(exp)\n p :done_rewriting unless debug.empty?\n end\n\n unless @unsupported_checked then\n m = public_methods.grep(/^process_/) { |o| o.to_s.sub(/^process_/, \"\").to_sym }\n supported = m - (m - @unsupported)\n\n raise UnsupportedNodeError, \"#{supported.inspect} shouldn't be in @unsupported\" unless supported.empty?\n\n @unsupported_checked = true\n end\n\n result = self.expected.new\n\n type = exp.sexp_type\n raise \"type should be a Symbol, not: #{exp.first.inspect}\" unless\n Symbol === type\n\n in_context type do\n if @debug.key? type then\n str = exp.inspect\n puts \"// DEBUG:(original ): #{str}\" if str =~ @debug[type]\n end\n\n exp_orig = nil\n exp_orig = exp.deep_clone if $DEBUG or\n @debug.key? type or @exceptions.key?(type)\n\n raise UnsupportedNodeError, \"'#{type}' is not a supported node type\" if\n @unsupported.include? type\n\n # now do a pass with the real processor (or generic)\n meth = @processors[type] || @default_method\n if meth then\n\n if @warn_on_default and meth == @default_method then\n warn \"WARNING: Using default method #{meth} for #{type}\"\n end\n\n exp = exp.sexp_body if @auto_shift_type and meth != @default_method # HACK\n\n result = error_handler(type, exp_orig) {\n self.send meth, exp\n }\n\n if @debug.key? type then\n str = exp.inspect\n puts \"// DEBUG (processed): #{str}\" if str =~ @debug[type]\n end\n\n raise SexpTypeError, \"Result of #{type} must be a #{@expected}, was #{result.class}:#{result.inspect}\" unless\n @expected === result\n\n self.assert_empty(meth, exp, exp_orig) if @require_empty\n else\n unless @strict then\n until exp.empty? do\n sub_exp, *exp = exp # HACK\n sub_result = nil\n if Array === sub_exp then\n sub_result = error_handler(type, exp_orig) do\n process(sub_exp)\n end\n raise \"Result is a bad type\" unless Array === sub_exp\n raise \"Result does not have a type in front: #{sub_exp.inspect}\" unless\n Symbol === sub_exp.sexp_type unless\n sub_exp.empty?\n else\n sub_result = sub_exp\n end\n # result << sub_result\n result = result.class.new(*result, sub_result) # HACK\n end\n\n # NOTE: this is costly, but we are in the generic processor\n # so we shouldn't hit it too much with RubyToC stuff at least.\n result.c_type ||= exp.c_type if Sexp === exp and exp.respond_to?(:c_type)\n else\n msg = \"Bug! Unknown node-type #{type.inspect} to #{self.class}\"\n msg += \" in #{exp_orig.inspect} from #{caller.inspect}\" if $DEBUG\n raise UnknownNodeError, msg\n end\n end\n end\n\n result\n end",
"def ps\n [VishParser.new, SexpTransform.new]\nend",
"def full_process(obj)\n obj.is_a?(Sexp) ? Processor.new(@rails, @mocha).process(obj) : obj\n end",
"def stream_processor\n @stream_processor ||= StreamProcessor.new(@parent, @name, @metadata)\n end",
"def initialize (application_context={})\n\n super(:s_engine, application_context)\n\n @engine_name = (application_context[:engine_name] || 'engine').to_s\n\n $OWFE_LOG = application_context[:logger]\n\n unless $OWFE_LOG\n FileUtils.mkdir('logs') unless File.exist?('logs')\n $OWFE_LOG = Logger.new('logs/ruote.log', 10, 1024000)\n $OWFE_LOG.level = Logger::INFO\n end\n\n # build order matters.\n #\n # especially for the expstorage which 'observes' the expression\n # pool and thus needs to be instantiated after it.\n\n build_scheduler\n #\n # for delayed or repetitive executions (it's the engine's clock)\n # see http://openwferu.rubyforge.org/scheduler.html\n\n build_expression_map\n #\n # mapping expression names ('sequence', 'if', 'concurrence',\n # 'when'...) to their implementations (SequenceExpression,\n # IfExpression, ConcurrenceExpression, ...)\n\n build_wfid_generator\n #\n # the workflow instance (process instance) id generator\n # making sure each process instance has a unique identifier\n\n build_workqueue\n #\n # where apply/reply get queued and processed asynchronously\n # by a single thread\n\n build_expression_pool\n #\n # the core (hairy ball) of the engine\n\n build_expression_storage\n #\n # the engine persistence (persisting the expression instances\n # that make up process instances)\n\n build_participant_map\n #\n # building the services that maps participant names to\n # participant implementations / instances.\n\n build_error_journal\n #\n # builds the error journal (keeping track of failures\n # in business process executions, and an opportunity to\n # fix and replay)\n\n build_tree_checker\n #\n # builds the tree checker (the thing that checks incoming external\n # ruby code for evil things)\n\n build_def_parser\n #\n # builds the definition parser (the thing that turns process definitions\n # into actual expression trees, ready for execution).\n\n linfo { \"new() --- engine started --- #{self.object_id}\" }\n end",
"def initialize\n @condition_transform = Transformer.new\n super\n end",
"def exp_class=(_arg0); end",
"def process exp, _src = nil, _timeout = nil\n result = super(exp)\n result.c_type ||= exp.c_type if Sexp === exp and exp.c_type\n result\n end",
"def new_processor(server_client, session)\n self.class::Processor.new(self, server_client, session)\n end",
"def process(sexp, level = :expr)\n return fragment('', scope) if sexp.nil?\n\n if handler = handlers[sexp.type]\n return handler.new(sexp, level, self).compile_to_fragments\n else\n error \"Unsupported sexp: #{sexp.type}\"\n end\n end",
"def setup_sre(gather=true)\n @sre_object = ::ISS::SRE::ObjectHandler.new(self) if gather\n @sre_engine = ::ISS::SRE::ActionCommandEngine.new(self)\n end",
"def process(sexp, level)\n type = sexp.shift\n meth = \"process_#{type}\"\n raise \"Unsupported sexp: #{type}\" unless respond_to? meth\n\n @line = sexp.line\n\n __send__ meth, sexp, level\n end",
"def process_attributes!\n if !@current_command_type.nil?\n @expression = Confinicky::Parsers::Expression.new(statement: @line.gsub(/\\A#{@current_command_type} /,\"\"))\n @name = @expression.name\n @value = @expression.value\n end\n end",
"def initialize(lexical_scope, calling_scope, template, matches)\n @lexical_scope = lexical_scope\n @calling_scope = calling_scope\n @hygienic = lexical_scope.runtime.hygienic?\n @expression = expand(template, matches)\n end",
"def initialize(regex, options = {})\n @@parse_options = options\n @@parse_options[:reg_options] ||= Regextest::RegexOption.new\n @verification = (options && options[:verification] == false)?false:true\n @reg_string = nil\n @reg_exp = nil\n \n # Set seed for randomizing\n @seed = set_seed_for_randomizing(@@parse_options[:seed])\n\n # Covert to source string if necessary\n set_regex(regex)\n\n # Parse string\n @front_end = Regextest::Front.new(@reg_string, @@parse_options)\n \n # Prepare back-end process. (use generate method for generating string)\n @back_end = Regextest::Back.new(@front_end)\n \n @result = nil\n @reason = nil\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Default Sexp processor. Invokes process_ methods matching the Sexp type given. Performs additional checks as specified by the initializer.
|
def process(exp)
return nil if exp.nil?
result = nil
type = exp.first
raise "type should be a Symbol, not: #{exp.first.inspect}" unless
Symbol === type
in_context type do
# now do a pass with the real processor (or generic)
meth = @processors[type]
if meth then
if $DEBUG
result = error_handler(type) do
self.send(meth, exp)
end
else
result = self.send(meth, exp)
end
else
result = self.process_default(exp)
end
end
raise SexpTypeError, "Result must be a #{@expected}, was #{result.class}:#{result.inspect}" unless @expected === result
result
end
|
[
"def process exp\n return nil if exp.nil?\n\n unless Sexp === exp then\n raise SexpTypeError, \"exp must be a Sexp, was #{exp.class}:#{exp.inspect}\"\n end\n\n if self.context.empty? then\n p :rewriting unless debug.empty?\n exp = self.rewrite(exp)\n p :done_rewriting unless debug.empty?\n end\n\n unless @unsupported_checked then\n m = public_methods.grep(/^process_/) { |o| o.to_s.sub(/^process_/, \"\").to_sym }\n supported = m - (m - @unsupported)\n\n raise UnsupportedNodeError, \"#{supported.inspect} shouldn't be in @unsupported\" unless supported.empty?\n\n @unsupported_checked = true\n end\n\n result = self.expected.new\n\n type = exp.sexp_type\n raise \"type should be a Symbol, not: #{exp.first.inspect}\" unless\n Symbol === type\n\n in_context type do\n if @debug.key? type then\n str = exp.inspect\n puts \"// DEBUG:(original ): #{str}\" if str =~ @debug[type]\n end\n\n exp_orig = nil\n exp_orig = exp.deep_clone if $DEBUG or\n @debug.key? type or @exceptions.key?(type)\n\n raise UnsupportedNodeError, \"'#{type}' is not a supported node type\" if\n @unsupported.include? type\n\n # now do a pass with the real processor (or generic)\n meth = @processors[type] || @default_method\n if meth then\n\n if @warn_on_default and meth == @default_method then\n warn \"WARNING: Using default method #{meth} for #{type}\"\n end\n\n exp = exp.sexp_body if @auto_shift_type and meth != @default_method # HACK\n\n result = error_handler(type, exp_orig) {\n self.send meth, exp\n }\n\n if @debug.key? type then\n str = exp.inspect\n puts \"// DEBUG (processed): #{str}\" if str =~ @debug[type]\n end\n\n raise SexpTypeError, \"Result of #{type} must be a #{@expected}, was #{result.class}:#{result.inspect}\" unless\n @expected === result\n\n self.assert_empty(meth, exp, exp_orig) if @require_empty\n else\n unless @strict then\n until exp.empty? do\n sub_exp, *exp = exp # HACK\n sub_result = nil\n if Array === sub_exp then\n sub_result = error_handler(type, exp_orig) do\n process(sub_exp)\n end\n raise \"Result is a bad type\" unless Array === sub_exp\n raise \"Result does not have a type in front: #{sub_exp.inspect}\" unless\n Symbol === sub_exp.sexp_type unless\n sub_exp.empty?\n else\n sub_result = sub_exp\n end\n # result << sub_result\n result = result.class.new(*result, sub_result) # HACK\n end\n\n # NOTE: this is costly, but we are in the generic processor\n # so we shouldn't hit it too much with RubyToC stuff at least.\n result.c_type ||= exp.c_type if Sexp === exp and exp.respond_to?(:c_type)\n else\n msg = \"Bug! Unknown node-type #{type.inspect} to #{self.class}\"\n msg += \" in #{exp_orig.inspect} from #{caller.inspect}\" if $DEBUG\n raise UnknownNodeError, msg\n end\n end\n end\n\n result\n end",
"def process exp, _src = nil, _timeout = nil\n result = super(exp)\n result.c_type ||= exp.c_type if Sexp === exp and exp.c_type\n result\n end",
"def initialize\n @expected = Sexp\n\n # we do this on an instance basis so we can subclass it for\n # different processors.\n @processors = {}\n @context = []\n\n public_methods.each do |name|\n if name.to_s.start_with? \"process_\" then\n @processors[name[8..-1].to_sym] = name.to_sym\n end\n end\n end",
"def process exp\n @processors.each do |processor|\n exp = processor.process(exp)\n end\n exp\n end",
"def initialize\n @expected = Sexp\n @processors = self.class.processors\n @context = []\n\n if @processors.empty?\n public_methods.each do |name|\n if name.to_s.start_with? \"process_\" then\n @processors[name[8..-1].to_sym] = name.to_sym\n end\n end\n end\n end",
"def process_source exp, klass = nil, method = nil, template = nil\n @current_class = klass\n @current_method = method\n @current_template = template\n process exp\n end",
"def full_process(obj)\n obj.is_a?(Sexp) ? Processor.new(@rails, @mocha).process(obj) : obj\n end",
"def process(sexp, level)\n type = sexp.shift\n meth = \"process_#{type}\"\n raise \"Unsupported sexp: #{type}\" unless respond_to? meth\n\n @line = sexp.line\n\n __send__ meth, sexp, level\n end",
"def process_class exp\n if exp.class_name == :ERB\n @inside_erb = true\n process_all exp.body\n @inside_erb = false\n end\n\n exp\n end",
"def process_class exp\n exp.shift unless auto_shift_type # node type\n in_klass exp.shift do\n if block_given? then\n yield\n else\n process_until_empty exp\n end\n end\n s()\n end",
"def call_processor(processor, input); end",
"def process(name = :raw, *args, &block)\n case name\n when :headers then process_with_headers(&block)\n when :header then process_with_header(*args, &block)\n when :raw then process_with_raw(*args, &block)\n else\n raise TypeError, \"Unknown pre-processing type\"\n end\n end",
"def process(sexp, level = :expr)\n return fragment('', scope) if sexp.nil?\n\n if handler = handlers[sexp.type]\n return handler.new(sexp, level, self).compile_to_fragments\n else\n error \"Unsupported sexp: #{sexp.type}\"\n end\n end",
"def process_module exp\n exp.shift unless auto_shift_type # node type\n in_klass exp.shift do\n if block_given? then\n yield\n else\n process_until_empty exp\n end\n end\n s()\n end",
"def process_defn exp\n meth_name = exp.method_name\n\n Railroader.debug \"Processing #{@current_class}##{meth_name}\"\n\n # Skip if instructed to only process a specific method\n # (but don't skip if this method was called from elsewhere)\n return exp if @current_method.nil? and @only_method and @only_method != meth_name\n\n is_route = route? meth_name\n other_method = @current_method\n @current_method = meth_name\n @rendered = false if is_route\n\n meth_env do\n if is_route\n before_filter_list(@current_method, @current_class).each do |f|\n process_before_filter f\n end\n end\n\n process_all exp.body\n\n if is_route and not @rendered\n process_default_render exp\n end\n end\n\n @current_method = other_method\n exp\n end",
"def processes(*types)\n types.each do |type|\n raise 'processor already registered for type %s'%type if @@processor_registry[type]\n @@processor_registry[type] = self\n end\n\n @allowed_command_types ||= []\n @allowed_command_types.concat types\n end",
"def process_expression_item(item)\n case item.to_s\n when 'FIELD_ACCESSOR'\n FieldAccessorInterpreter.new(item).field\n when 'INDEX_ACCESSOR'\n IndexAccessorInterpreter.new(item).index\n when 'FUNCTION_EXPRESSION'\n FunctionInterpreter.new(item, @objects).function\n when 'EXPRESSION'\n ExpressionInterpreter.new(item).expression\n when 'LITERAL'\n LiteralInterpreter.new(item).literal\n when 'ABS_EXPRESSION'\n AbsoluteInterpreter.new(item).absolute\n when 'NOT_EXPRESSION'\n NotInterpreter.new(item).not\n end\n end",
"def method_missing(symbol, *args)\n\t\t\t\tif(args == nil or args.length == 0)\n\t\t\t\t\tregex = Regexp.new(Regexp.escape(symbol.id2name))\n\t\t\t\t\treturn has_process?(regex)\n\t\t\t\tend\n\n\t\t\t\tsuper.method(symbol).call(args)\n\t\t\tend",
"def process_source exp, opts\n @current_class = opts[:class]\n @current_method = opts[:method]\n @current_template = opts[:template]\n @current_file = opts[:file]\n @current_call = nil\n process exp\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
A fairly generic processor for a dummy node. Dummy nodes are used when your processor is doing a complicated rewrite that replaces the current sexp with multiple sexps. Bogus Example: def process_something(exp) return s(:dummy, process(exp), s(:extra, 42)) end
|
def process_dummy(exp)
result = @expected.new(:dummy) rescue @expected.new
until exp.empty? do
result << self.process(exp.shift)
end
result
end
|
[
"def process_dummy exp\n result = @expected.new(:dummy) rescue @expected.new\n result << self.process(exp.shift) until exp.empty?\n result\n end",
"def process exp\n return nil if exp.nil?\n\n unless Sexp === exp then\n raise SexpTypeError, \"exp must be a Sexp, was #{exp.class}:#{exp.inspect}\"\n end\n\n if self.context.empty? then\n p :rewriting unless debug.empty?\n exp = self.rewrite(exp)\n p :done_rewriting unless debug.empty?\n end\n\n unless @unsupported_checked then\n m = public_methods.grep(/^process_/) { |o| o.to_s.sub(/^process_/, \"\").to_sym }\n supported = m - (m - @unsupported)\n\n raise UnsupportedNodeError, \"#{supported.inspect} shouldn't be in @unsupported\" unless supported.empty?\n\n @unsupported_checked = true\n end\n\n result = self.expected.new\n\n type = exp.sexp_type\n raise \"type should be a Symbol, not: #{exp.first.inspect}\" unless\n Symbol === type\n\n in_context type do\n if @debug.key? type then\n str = exp.inspect\n puts \"// DEBUG:(original ): #{str}\" if str =~ @debug[type]\n end\n\n exp_orig = nil\n exp_orig = exp.deep_clone if $DEBUG or\n @debug.key? type or @exceptions.key?(type)\n\n raise UnsupportedNodeError, \"'#{type}' is not a supported node type\" if\n @unsupported.include? type\n\n # now do a pass with the real processor (or generic)\n meth = @processors[type] || @default_method\n if meth then\n\n if @warn_on_default and meth == @default_method then\n warn \"WARNING: Using default method #{meth} for #{type}\"\n end\n\n exp = exp.sexp_body if @auto_shift_type and meth != @default_method # HACK\n\n result = error_handler(type, exp_orig) {\n self.send meth, exp\n }\n\n if @debug.key? type then\n str = exp.inspect\n puts \"// DEBUG (processed): #{str}\" if str =~ @debug[type]\n end\n\n raise SexpTypeError, \"Result of #{type} must be a #{@expected}, was #{result.class}:#{result.inspect}\" unless\n @expected === result\n\n self.assert_empty(meth, exp, exp_orig) if @require_empty\n else\n unless @strict then\n until exp.empty? do\n sub_exp, *exp = exp # HACK\n sub_result = nil\n if Array === sub_exp then\n sub_result = error_handler(type, exp_orig) do\n process(sub_exp)\n end\n raise \"Result is a bad type\" unless Array === sub_exp\n raise \"Result does not have a type in front: #{sub_exp.inspect}\" unless\n Symbol === sub_exp.sexp_type unless\n sub_exp.empty?\n else\n sub_result = sub_exp\n end\n # result << sub_result\n result = result.class.new(*result, sub_result) # HACK\n end\n\n # NOTE: this is costly, but we are in the generic processor\n # so we shouldn't hit it too much with RubyToC stuff at least.\n result.c_type ||= exp.c_type if Sexp === exp and exp.respond_to?(:c_type)\n else\n msg = \"Bug! Unknown node-type #{type.inspect} to #{self.class}\"\n msg += \" in #{exp_orig.inspect} from #{caller.inspect}\" if $DEBUG\n raise UnknownNodeError, msg\n end\n end\n end\n\n result\n end",
"def process(node, anonymous = false)\n case node.type\n when :begin\n result = node.children.map { |child| process(child) }.join(\"\\n\")\n if !anonymous && assignment?(node.children[-1])\n result << process_load(@last_store)\n end\n result\n when :send\n process_message(node, *node.children)\n when :lvasgn\n process_lvasgn(*node.children)\n when :op_asgn\n process_op_assign(*node.children)\n when :lvar\n process_load(node.children[0])\n when :int, :float\n @factory.process(node).to_s\n when :def\n process_def(*node.children)\n when :defs\n process_defs(*node.children)\n when :block\n process_loop(*node.children)\n when :module\n process_module(*node.children)\n when :class\n process_class(*node.children)\n when :if\n process_conditional(*node.children)\n when :while\n process_while(*node.children)\n when :break\n '2Q'\n when :return\n process(*node.children) << \" #{@frames.length * 2}Q\"\n else\n raise UnimplementedNodeError,\n \"Unknown node type #{node.type} (#{node.inspect})\"\n end\n end",
"def process_begin(dummy, output)\n nil\n end",
"def isDummyNode?(node) \n return node.name == Tag_Dummy ;\n end",
"def process_module exp\n exp.shift unless auto_shift_type # node type\n in_klass exp.shift do\n if block_given? then\n yield\n else\n process_until_empty exp\n end\n end\n s()\n end",
"def process_node(node)\n method(:process).super_method.call(node)\n end",
"def visit_call(node); end",
"def process_special node\n add_text node\n setup_relation node\n add_tag_type node\n add_attributes node\n increment_index node\n @tag_count += 1\n increment_depth node\n end",
"def process(exp)\n return nil if exp.nil?\n\n result = nil\n\n type = exp.first\n raise \"type should be a Symbol, not: #{exp.first.inspect}\" unless\n Symbol === type\n\n in_context type do\n # now do a pass with the real processor (or generic)\n meth = @processors[type]\n if meth then\n if $DEBUG\n result = error_handler(type) do\n self.send(meth, exp)\n end\n else\n result = self.send(meth, exp)\n end\n\n else\n result = self.process_default(exp)\n end\n end\n \n raise SexpTypeError, \"Result must be a #{@expected}, was #{result.class}:#{result.inspect}\" unless @expected === result\n \n result\n end",
"def visit_ProcessingInstruction(pi, *rest)\n end",
"def process exp\n @processors.each do |processor|\n exp = processor.process(exp)\n end\n exp\n end",
"def visit_undef(node); end",
"def call_processor(processor, input); end",
"def process(node)\n return node unless node.is_a?(Parser::AST::Node)\n\n process_node(node)\n end",
"def visit_massign(node); end",
"def full_process(obj)\n obj.is_a?(Sexp) ? Processor.new(@rails, @mocha).process(obj) : obj\n end",
"def visit_defined(node); end",
"def register_processor(pattern, klass, replace_all: T.unsafe(nil)); end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /bid_winners GET /bid_winners.json
|
def index
@bid_winners = BidWinner.all
end
|
[
"def index\n @winners = Winner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @winners }\n end\n end",
"def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end",
"def all_booking_of_client\n\t\t@bookings = Booking.where(client_id: params[:client_id])\n\t\trender json: @bookings, status: 200\n\tend",
"def index\n @winners = Winner.all\n end",
"def show\n @auction = Auction.find(params[:id])\n @bids = @auction.bids.sort_by(&:bid_at).reverse\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @auction }\n end\n end",
"def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end",
"def beers_list\n \t@url = 'https://api.punkapi.com/v2/beers' \t\t\n \tresponse = RestClient.get beer_url\n \tjson_response = JSON.parse response.body\n\n \tcreate_list = ::Beers::Create.call(\n \t\tuser: @current_user,\n \t\tbeers_data: json_response\n \t)\n \t\n \trender json: create_list.beers, adapter: :json_api, each_serializer: BeerSerializer\n end",
"def friend\n invs = Invite.where(invitee: params[:id], status: \"accepted\").to_a\n @bets = []\n invs.each do |inv|\n @bets.push(inv.bet) if inv.bet.status != \"won\" && inv.bet.status != \"lost\"\n end\n render 'my-bets.json.jbuilder'\n end",
"def index\n @bunners = Bunner.all\n end",
"def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end",
"def index\n @bids = Bid.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bids }\n end\n end",
"def index\n @bids = @swarm_request.bids.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @bids }\n end\n end",
"def index\n @bid_requests = BidRequest.all\n end",
"def get_brandings\n request :get,\n '/v3/brandings.json'\n end",
"def find_winning_bidder\n if b=find_winning_bid\n return b.bidder\n end\n nil\n end",
"def get_brandings\n request :get, \"/v3/brandings.json\"\n end",
"def index\n @bills = @dwelling.bills\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end",
"def index\n @bidings = Biding.all\n end",
"def show\n @winner = Winner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @winner }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /bid_winners POST /bid_winners.json
|
def create
@bid_winner = BidWinner.new(bid_winner_params)
respond_to do |format|
if @bid_winner.save
format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully created.' }
format.json { render :show, status: :created, location: @bid_winner }
else
format.html { render :new }
format.json { render json: @bid_winner.errors, status: :unprocessable_entity }
end
end
end
|
[
"def index\n @bid_winners = BidWinner.all\n end",
"def create\n @bet_winner = BetWinner.new(bet_winner_params)\n\n respond_to do |format|\n if @bet_winner.save\n format.html { redirect_to @bet_winner, notice: 'Bet winner was successfully created.' }\n format.json { render :show, status: :created, location: @bet_winner }\n else\n format.html { render :new }\n format.json { render json: @bet_winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @auction = Auction.find(params[:auction_id])\n params[:bid].reverse_merge!({owner_id: current_user.id})\n @bid = @auction.bids.build(params[:bid])\n \n respond_to do |format|\n if @bid.save\n format.html { redirect_to @auction, notice: 'You submitted a bid!'}\n format.json { render json: @bid, status: :created, location: @bid }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n megam_rest.post_billings(to_hash)\n end",
"def create\n @winner = Winner.new(params[:winner])\n\n respond_to do |format|\n if @winner.save\n format.html { redirect_to @winner, notice: 'Winner was successfully created.' }\n format.json { render json: @winner, status: :created, location: @winner }\n else\n format.html { render action: \"new\" }\n format.json { render json: @winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bidding = Bidding.new(params[:bidding])\n\n respond_to do |format|\n if @bidding.save\n format.html { redirect_to @bidding, notice: 'Bidding was successfully created.' }\n format.json { render json: @bidding, status: :created, location: @bidding }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Get the bike associated with this sighting\n @bike = Bike.find_by(number: sighting_params[:bike_number])\n\n # Add this sighting to the bike\n @sighting = @bike.sightings.create(sighting_params)\n\n respond_to do |format|\n if @sighting.save\n format.html { redirect_to @sighting, notice: 'Sighting was successfully created.' }\n format.json { render :show, status: :created, location: @sighting }\n else\n format.html { render :new }\n format.json { render json: @sighting.errors, status: :unprocessable_entity }\n end\n end\n \n end",
"def acceptBidWon *args\n options=fill_args [:projectid,:state],[:projectid],*args\n request \"/Freelancer/acceptBidWon.json\", options\n end",
"def bid\n @auction = Auction.find(params[:auction_id])\n @reward = Reward.find(params[:reward_id])\n @hours_already_bid = @reward.hours_already_bid_by(current_user)\n @hours_entry = HoursEntry.new\n @bid = Bid.new\n end",
"def create\n @bowler = Bowler.new(bowler_params)\n @bowler.save\n respond_with(@bowler)\n end",
"def pay_winning_betters\n\n winning_id = winner_id\n\n # Pay all users who's favorite pick equals winner_id\n self.bets.each do |bet|\n if bet.favorite_id == winning_id\n user = User.find(bet.better_id)\n user.update_attribute(:fight_bucks, bet.wager_amount * 2)\n\n # Notify the user that they won the bet.\n bet.create_bet_won_notification(bet.wager_amount * 2) \n else\n # Notify the user that they lost the bet.\n bet.create_bet_lost_notification(bet.wager_amount)\n end\n end\n \n end",
"def create\n\n @bid = current_user.bids.build(bid_params)\n logger.debug @bid.inspect\n respond_to do |format|\n if @bid.save\n format.html { redirect_to @bid, notice: 'Bid was successfully created.' }\n format.json { render :show, status: :created, location: @bid }\n else\n logger.debug @bid.errors.inspect\n format.html { render :new }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @bid = @swarm_request.bids.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end",
"def create\n @winner = Winner.new(winner_params)\n\n respond_to do |format|\n if @winner.save\n format.html {redirect_to @winner, notice: 'Winner was successfully created.'}\n format.json {render :show, status: :created, location: @winner}\n else\n format.html {render :new}\n format.json {render json: @winner.errors, status: :unprocessable_entity}\n end\n end\n end",
"def create\n @bid = @order.bids.new(bid_params)\n @bid.user = current_user\n\n respond_to do |format|\n if @bid.save\n format.html { redirect_to @bid, notice: 'Bid was successfully created.' }\n format.json { render :show, status: :created, location: @bid }\n else\n format.html { render :new }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bowler = Bowler.new(bowler_params)\n\n respond_to do |format|\n if @bowler.save\n format.html { redirect_to @bowler, notice: 'Bowler was successfully created.' }\n format.json { render :show, status: :created, location: @bowler }\n else\n format.html { render :new }\n format.json { render json: @bowler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bet_to_ride = BetToRide.new(bet_to_ride_params)\n\n respond_to do |format|\n if @bet_to_ride.save\n format.html { redirect_to @bet_to_ride, notice: 'Bet to ride was successfully created.' }\n format.json { render :show, status: :created, location: @bet_to_ride }\n else\n format.html { render :new }\n format.json { render json: @bet_to_ride.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @bingo_hall = BingoHall.new(name: bingo_hall_params[:name])\n\n respond_to do |format|\n if @bingo_hall.save\n bingo_board = @bingo_hall.bingo_boards.create\n Player.create(name: bingo_hall_params[:player_name], bingo_board: bingo_board)\n format.html { redirect_to @bingo_hall, notice: \"Bingo hall was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo_hall }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo_hall.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ko16_winner = Ko16Winner.new(ko16_winner_params)\n @ko16_winner.user = current_user\n\n respond_to do |format|\n if @ko16_winner.save\n format.html { redirect_to @ko16_winner, notice: 'Ko16 winner was successfully created.' }\n format.json { render :show, status: :created, location: @ko16_winner }\n else\n format.html { render :new }\n format.json { render json: @ko16_winner.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /bid_winners/1 PATCH/PUT /bid_winners/1.json
|
def update
respond_to do |format|
if @bid_winner.update(bid_winner_params)
format.html { redirect_to @bid_winner, notice: 'Bid winner was successfully updated.' }
format.json { render :show, status: :ok, location: @bid_winner }
else
format.html { render :edit }
format.json { render json: @bid_winner.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @bid = @swarm_request.bids.find(params[:id])\n\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(swarm_request_bid_url(:id => @bid.to_param, :swarm_request_id => @swarm_request.to_param), :notice => 'Bid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n# @bid = Bid.find(params[:id])\n @bid = current_user.bids.find([:id])\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to @bid, notice: 'Bid was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bowler.update(bowler_params)\n\n @bowler.record :update, current_user, selected_tournament\n \n format.html { redirect_to @bowler, notice: \"Bowler [#{@bowler.full_name}] was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bowler.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n if @bidding.update_attributes(params[:bidding])\n format.html { redirect_to @bidding, notice: 'Bidding was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bidding.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bowler.update(bowler_params)\n respond_with(@bowler)\n end",
"def update\n beer = Beer.find(params[:id])\n beer.update(beer_params)\n render json: beer\n end",
"def update\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n if @borrower.update_attributes(params[:borrower])\n \n format.json { render json: @borrower, status: :created, location: @borrower }\n else\n \n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bet_winner.update(bet_winner_params)\n format.html { redirect_to @bet_winner, notice: 'Bet winner was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet_winner }\n else\n format.html { render :edit }\n format.json { render json: @bet_winner.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_bid = UserBid.find(params[:id])\n\n respond_to do |format|\n if @user_bid.update_attributes(params[:user_bid])\n format.html { redirect_to @user_bid, notice: 'User bid was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_bid.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bid_request.update(bid_request_params)\n format.html { redirect_to @bid_request, notice: 'Bid request was successfully updated.' }\n format.json { render :show, status: :ok, location: @bid_request }\n else\n format.html { render :edit }\n format.json { render json: @bid_request.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bid = Bid.find(params[:id])\n respond_to do |format|\n if @bid.update_attributes(params[:bid])\n format.html { redirect_to(root_path, :notice => 'Bid was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { redirect_to(root_path, :notice => 'Bid could not be updated.') }\n format.xml { render :xml => @bid.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @super_bowl_pick = SuperBowlPick.find(params[:id])\n\n respond_to do |format|\n if @super_bowl_pick.update_attributes(params[:super_bowl_pick])\n format.html { redirect_to @super_bowl_pick, notice: 'Super bowl pick was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @super_bowl_pick.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @my_bike = MyBike.find(params[:id])\n \n if @my_bike.update(my_bike_params)\n render json: @my_bike, status: :ok\n else\n render json: @my_bike.errors, status: :unprocessable_entity\n end\nend",
"def update\n respond_with Biblebook.update(params[:id], params[:biblebook])\n end",
"def update\n @mlb_win_bet = MlbWinBet.find(params[:id])\n\n respond_to do |format|\n if @mlb_win_bet.update_attributes(params[:mlb_win_bet])\n format.html { redirect_to @mlb_win_bet, notice: 'Mlb win bet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mlb_win_bet.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @bet_to_ride.update(bet_to_ride_params)\n format.html { redirect_to @bet_to_ride, notice: 'Bet to ride was successfully updated.' }\n format.json { render :show, status: :ok, location: @bet_to_ride }\n else\n format.html { render :edit }\n format.json { render json: @bet_to_ride.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n if @bounty.update_attributes(params[:bounty])\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bounty = Bounty.find(params[:id])\n\n respond_to do |format|\n if @bounty.update_attributes(params[:bounty])\n format.html { redirect_to admin_bounties_path, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @setbreak.update(setbreak_params)\n format.json { respond_with_bip @setbreak }\n else\n format.json { respond_with_bip @setbreak }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /bid_winners/1 DELETE /bid_winners/1.json
|
def destroy
@bid_winner.destroy
respond_to do |format|
format.html { redirect_to bid_winners_url, notice: 'Bid winner was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @bid = @swarm_request.bids.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(swarm_request_bids_url(:swarm_request_id => @swarm_request.to_param)) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bidding = Bidding.find(params[:id])\n @bidding.destroy\n\n respond_to do |format|\n format.html { redirect_to biddings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n name = @bowler.full_name\n @bowler.record :destroy, current_user, selected_tournament\n @bowler.destroy\n respond_to do |format|\n format.html { redirect_to bowlers_url, notice: \"Bowler #{name} has been successfully deleted.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @brewhouse = Brewhouse.find(params[:id])\n @brewhouse.destroy\n\n respond_to do |format|\n format.html { redirect_to brewhouses_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_bid = UserBid.find(params[:id])\n @user_bid.destroy\n\n respond_to do |format|\n format.html { redirect_to user_bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bounty = Bounty.find(params[:id])\n @bounty.destroy\n\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mlb_win_bet = MlbWinBet.find(params[:id])\n @mlb_win_bet.destroy\n\n respond_to do |format|\n format.html { redirect_to mlb_win_bets_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @admin_bid = Bid.find(params[:id])\n @admin_bid.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_bids_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @waybill = Waybill.find(params[:id])\n @waybill.destroy\n\n respond_to do |format|\n format.html { redirect_to waybills_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @borrower = Borrower.find(params[:id])\n @borrower.destroy\n\n respond_to do |format|\n \n format.json { head :no_content }\n end\n end",
"def destroy\n @winner = Winner.find(params[:id])\n @winner.destroy\n\n respond_to do |format|\n format.html { redirect_to winners_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to(bids_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @bid_request.destroy\n respond_to do |format|\n format.html { redirect_to bid_requests_url, notice: 'Bid request was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @auction = Auction.find(params[:id])\n @auction.remove_auction\n\n respond_to do |format|\n format.html { redirect_to auctions_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @bunner.destroy\n respond_to do |format|\n format.html { redirect_to bunners_url, notice: 'Bunner was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @blocking_client = BlockingClient.find(params[:id])\n @blocking_client.destroy\n\n respond_to do |format|\n format.html { redirect_to blocking_clients_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Build an instance of TrunkInstance
|
def get_instance(payload)
TrunkInstance.new(@version, payload)
end
|
[
"def trunk code, options = {}\n TrunkCode.new code, options\n end",
"def get_instance(payload)\n TranscriptInstance.new(@version, payload)\n end",
"def get_instance(payload)\n RecordingInstance.new(@version, payload, trunk_sid: @solution[:trunk_sid])\n end",
"def new_instance(suite, platform, index)\n Instance.new(\n :busser => new_busser(suite, platform),\n :driver => new_driver(suite, platform),\n :logger => new_logger(suite, platform, index),\n :suite => suite,\n :platform => platform,\n :provisioner => new_provisioner(suite, platform),\n :binding => new_binding(suite, platform),\n :state_file => new_state_file(suite, platform)\n )\n end",
"def instantiateTurf\n @turf = Turf.new\n end",
"def new_instance(suite, platform, index)\n Instance.new(\n driver: new_driver(suite, platform),\n lifecycle_hooks: new_lifecycle_hooks(suite, platform),\n logger: new_instance_logger(suite, platform, index),\n suite: suite,\n platform: platform,\n provisioner: new_provisioner(suite, platform),\n transport: new_transport(suite, platform),\n verifier: new_verifier(suite, platform),\n state_file: new_state_file(suite, platform)\n )\n end",
"def create\n @trunk = Trunk.new(params[:trunk])\n\n respond_to do |format|\n if @trunk.save\n format.html { redirect_to @trunk.snake || @trunk, :notice => 'Trunk was successfully created.' }\n format.json { render :json => @trunk.snake || @trunk, :status => :created, :location => @trunk }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @trunk.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def get_instance(payload)\n TollFreeInstance.new(\n @version,\n payload,\n account_sid: @solution[:account_sid],\n country_code: @solution[:country_code],\n )\n end",
"def create_copy_of_instance(instance, count)\n if count > 1\n i = OrderedInstance.create({'shelfLocator' => instance.shelfLocator,\n 'dateCreated' => instance.dateCreated,\n 'dateIssued' => instance.dateIssued,\n 'tableOfContents' => instance.tableOfContents,\n 'physicalDescriptionForm' => instance.physicalDescriptionForm,\n 'physicalDescriptionNote' => instance.physicalDescriptionNote,\n 'recordOriginInfo' => instance.recordOriginInfo,\n 'languageOfCataloging' => instance.languageOfCataloging,\n 'dateOther' => instance.dateOther})\n else\n i = SingleFileInstance.create({'shelfLocator' => instance.shelfLocator,\n 'dateCreated' => instance.dateCreated,\n 'dateIssued' => instance.dateIssued,\n 'tableOfContents' => instance.tableOfContents,\n 'physicalDescriptionForm' => instance.physicalDescriptionForm,\n 'physicalDescriptionNote' => instance.physicalDescriptionNote,\n 'recordOriginInfo' => instance.recordOriginInfo,\n 'languageOfCataloging' => instance.languageOfCataloging,\n 'dateOther' => instance.dateOther})\n end\n # Metadata objects\n i.identifier = instance.identifier\n i.note = instance.note\n\n # Relations\n i.hasTopic = instance.hasTopic\n i.hasContributor = instance.hasContributor\n i.hasOwner = instance.hasOwner\n i.hasPatron = instance.hasPatron\n i.hasPublisher = instance.hasPublisher\n i.hasPrinter = instance.hasPrinter\n i.hasScribe = instance.hasScribe\n i.hasDigitizer = instance.hasDigitizer\n i.hasOrigin = instance.hasOrigin\n i.save\n\n i\n end",
"def index\n @trunks = Trunk.all\n end",
"def get_instance(payload)\n WorkspaceInstance.new(@version, payload)\n end",
"def get_instance(payload)\n TollFreeInstance.new(@version, payload, account_sid: @solution[:account_sid], )\n end",
"def create_fOOrth_instance(vm)\r\n obj = @instance_template.new\r\n obj.init(vm) # <<< ????? I'm not sure about this!!!\r\n obj\r\n end",
"def get_instance(payload)\n FlowRevisionInstance.new(@version, payload, sid: @solution[:sid])\n end",
"def new\r\n\t\t@newinstance = Instance.new\r\n\tend",
"def initialize(fruit_profile, root_stock, trunk = nil)\n @root_stock = root_stock\n @fruit_profile = fruit_profile\n @trunk = trunk ? trunk : Trunk.new(Node.new(root_stock.loc), self)\n self.trunk.parent = self\n @height = 0\n @branch_structure = {}\n @diseases = []\n @photo_energy = 100\n end",
"def create(instance)\n index_key = source_for(instance)\n if not index_key.nil?\n column = indexed_identifier_for(instance)\n instance.connection.insert(column_family, index_key, {column => instance.key})\n state = state_for(instance)\n state.source_value = index_key\n state.identifier_value = column\n end\n instance\n end",
"def create_instance_core() \r\n @log.debug(\"Create core scopetta\")\r\n return CoreGameScopetta.new\r\n end",
"def build_instances\n filter_instances.map.with_index do |(suite, platform), index|\n new_instance(suite, platform, index)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: Write a method that rotates an array by moving the first element to the end of the array. The original array should not be modified. Do not use the method Arrayrotate or Arrayrotate! for your implementation. E: rotate_array([7, 3, 5, 2, 9, 1]) == [3, 5, 2, 9, 1, 7] rotate_array(['a', 'b', 'c']) == ['b', 'c', 'a'] rotate_array(['a']) == ['a'] x = [1, 2, 3, 4] rotate_array(x) == [2, 3, 4, 1] => true x == [1, 2, 3, 4] D: Input an array, output a new array A: Create a method rotate_array that takes one argument an array called array_of_numbers set variable rotated_array to array_of_numbers cloned Set the first element in rotated_array equal to the last element of array_of_numbers Set the last element of rotate_array equal to the first element of array_of_numbers return rotated_array
|
def rotate_array(array_of_numbers)
rotated_array = array_of_numbers.clone
rotated_array << rotated_array.shift
rotated_array
end
|
[
"def rotate_array(input_array)\n return input_array if input_array.size <= 1\n new_array = []\n index_counter = 1\n loop do\n new_array << input_array[index_counter]\n index_counter += 1\n break if index_counter >= input_array.size\n end\n new_array << input_array[0]\n new_array\nend",
"def rotate_array(array)\n result = []\n 1.upto(array.size - 1) {|index| result << array[index]}\n result << array[0]\n result\nend",
"def rotate1(input_array)\n # TODO\nend",
"def rotate_array(array)\n new_arr = []\n new_arr << array.first\n new_arr.prepend(array[1..-1])\nend",
"def rotate_array(starting_array)\n return_array = []\n starting_array.map {|element| return_array << element }\n return_array << return_array.first\n return_array.delete_at(0)\n return_array\nend",
"def rotate2(input_array)\n # TODO\nend",
"def rotate_array(array, number)\n number.times{array.unshift(array.pop)}\n array\nend",
"def rotate_without_changing(arr)\n\nend",
"def rotate_array(unrotated)\n unrotated[1..] + [unrotated.first]\nend",
"def rotate_array(arr, num_rotations)\n num_rotations = (num_rotations - arr.size).abs if num_rotations > arr.size\n Utility.reverse(arr, 0, arr.size-1)\n Utility.reverse(arr, 0, num_rotations-1)\n Utility.reverse(arr, num_rotations, arr.size-1)\n return arr\nend",
"def rotate_array(arr)\n outcome = []\n arr.each_with_index { |el, idx| outcome << el unless idx == 0 }\n outcome << arr[0]\n outcome\nend",
"def rotate_array(arr, num)\n num.times {\n arr.unshift(arr.pop)\n }\n return arr\nend",
"def rotate_array(aArray, off_x, off_y, rel_angle, change_in_place=false)\r\n # - - - - - - - - - - - - - - - - - - - - -\r\nend",
"def rotate_array(arr)\n result = []\n arr.reverse.each { |e| e == arr.first ? result << e : result.prepend(e) }\n result\nend",
"def rotate(array, shift)\nend",
"def rotate_array(ary)\n rotated = []\n ary.each_with_index do |elem, idx|\n idx < ary.size - 1 ? rotated << ary[idx + 1] : rotated << ary[0]\n end\n rotated\nend",
"def my_rotate_test()\n a = [ \"a\", \"b\", \"c\", \"d\" ]\n p a.my_rotate #=> [\"b\", \"c\", \"d\", \"a\"]\n p a.my_rotate(2) #=> [\"c\", \"d\", \"a\", \"b\"]\n p a.my_rotate(-3) #=> [\"b\", \"c\", \"d\", \"a\"]\n p a.my_rotate(15) #=> [\"d\", \"a\", \"b\", \"c\"]\nend",
"def my_rotate(arr, offset=1)\n # your code goes here\n arr.drop(offset%arr.length) + arr.take(offset%arr.length)\nend",
"def my_rotate(arr, offset=1)\n # your code goes here\n arr.drop(offset % arr.length) + arr.take(offset % arr.length)\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Problem 4: ========= PEDAC. Problem, Examples, Data Structure, Algorithum, Code P: You have a bank of switches before you, numbered from 1 to n. Each switch is connected to exactly one light that is initially off. You walk down the row of switches and toggle every one of them. You go back to the beginning, and on this second pass, you toggle switches 2, 4, 6, and so on. On the third pass, you go back again to the beginning and toggle switches 3, 6, 9, and so on. You repeat this process and keep going until you have been through n repetitions. Write a method that takes one argument, the total number of switches, and returns an Array that identifies which lights are on after n repetitions. Example with n = 5 lights: round 1: every light is turned on round 2: lights 2 and 4 are now off; 1, 3, 5 are on round 3: lights 2, 3, and 4 are now off; 1 and 5 are on round 4: lights 2 and 3 are now off; 1, 4, and 5 are on round 5: lights 2, 3, and 5 are now off; 1 and 4 are on The result is that 2 lights are left on, lights 1 and 4. The return value is [1, 4]. With 10 lights, 3 lights are left on: lights 1, 4, and 9. The return value is [1, 4, 9]. D: Input an integer, output results A: create a method light_sequence that takes one argument an integer called n set variable lights equal to an empty hash iterate from 1 to n adding the value of each iteration as keys to lights and the value as "on" display message "round 1: every light is turned on" do the following n number of times iterate through the lights variable if the key is a multiple of the current iteration index then set the value to "off" if is on and "on" if it is off display message "round [current iteration]: lights [list lights off] are now off; [list lights on] are on"
|
def light_sequence(n)
lights = {}
n.times {|num| lights[num+1] = "on"}
n.times do |num|
lights.each do |light, status|
if light % (num+1) == 0
lights[light] == "on" ? lights[light] = "off" : lights[light] = "on"
end
end
end
lights.select {|light, status| status == 'off'}.keys
end
|
[
"def light_switches(n)\n light_hash = {}\n 1.upto(n) { |i| light_hash[i] = true }\n 2.upto(n) do |current_pass|\n light_hash.map do |light, state|\n light_hash[light] = !state if light % current_pass == 0\n end\n end\n lights_left_on = light_hash.select do |_, state|\n state\n end\n result = []\n lights_left_on.to_a.flatten.each_with_index do |element, index|\n result << element if index.even?\n end\n result\nend",
"def light_switches(n)\n all_lights = (1..n).to_a\n final_lights = []\n\n all_lights.each do |index|\n next final_lights = all_lights if index == 1\n\n lights = all_lights[(index - 1)..]\n\n lights.each do |light|\n next unless light % index == 0\n\n if final_lights.include?(light)\n final_lights -= [light]\n else\n final_lights += [light]\n end\n end\n end\n\n final_lights.sort\nend",
"def switches(n)\n lights = Array.new(n) { |el| el = false }\n\n 1.upto(n) do |i|\n lights = lights.map.with_index do |light, idx|\n (idx + 1) % i == 0 ? !light : light\n end\n end\n\n lights_on = []\n lights.each_with_index do |light, idx|\n lights_on << (idx + 1) if light\n end\n\n lights_on\nend",
"def flip_lights(n)\n lights = Array.new(n, false)\n # Number of times walking down the line\n\n n.times do |n|\n\n # selected_switches = lights.each_with_index do |light, idx|\n lights.map!.with_index do |light, idx|\n if (idx + 1) % (n + 1) == 0\n light == true ? false : true\n else \n light\n end\n\n end\n \n\n # for i in 1..n do\n\n# Firs time through, toggle if index+1 is divisible by i (1)\n# Second time, toggle if index+1 is divisible by i (2)\n\n # if lights[i-1] % i \n\n end\n final_state = []\n lights.each_with_index do |light, idx|\n if light == true\n final_state << idx + 1\n end\n end\n\n final_state\nend",
"def lights_1000(n)\n switches = []\n on_arr = []\n n.times { |_| switches << false }\n i = 1\n\n loop do\n switches.each_with_index do |switch, idx|\n switches[idx] = !switch if (idx + 1) % i == 0 \n end\n break if i > n\n i += 1\n end\n switches.each_with_index { |switch, idx| on_arr << (idx + 1) if switch == true }\n on_arr\nend",
"def lights_switches(n)\n lights_arr = [false] * n\n 1.upto(n) do |stp|\n (stp..n).step(stp) do |idx|\n lights_arr[idx - 1] = !lights_arr[idx - 1]\n end\n end\n (1..n).each_with_object([]) do |idx, obj|\n obj << idx if lights_arr[idx - 1]\n end\nend",
"def generate_lights(n)\n lights = {}\n light = 1\n n.times do \n lights[light] = true\n light += 1\n end\n lights\nend",
"def toggle_lights(n)\n multipled_substring = []\n\n (1..n).each do |count|\n multiplier = 1\n\n loop do\n product = count * multiplier\n break if product > n\n multipled_substring << product\n multiplier += 1\n end\n end\n #multipled_substring\n\n final_result = []\n (1..n).each do |number|\n times_of_toggle = multipled_substring.count(number)\n \n final_result << number if times_of_toggle.odd?\n end\n p final_result\nend",
"def toggle_sequence(bank)\n interval = 1\n\n until interval > bank.size\n position = interval - 1\n\n while position < bank.size\n bank[position] = !bank[position]\n position += interval\n end\n\n if interval == 1\n puts \"Round 1: every light is turned on\"\n sleep(3)\n else\n off_switches, on_switches = current_switch_state(bank)\n print_switch_state(off_switches, on_switches, interval)\n end\n\n interval += 1\n end\n\n sequence_to_array(bank)\nend",
"def thousand_lights3(n)\n lights = {}\n 1.upto(n) { |i| lights[i] = false }\n 1.upto(n) { |i| i.step(n, i) { |j| lights[j] = !lights[j] } }\n lights.keys.select { |idx| lights[idx] }\nend",
"def initialize_lights(number_of_lights)\n lights = Hash.new # initialize new hash\n 1.upto(number_of_lights) { |number| lights[number] = \"off\" } # initially all lights are off\n lights # return hash\nend",
"def print_switch_state(off_switches, on_switches, iteration)\n output = \"Round #{iteration}: \"\n\n output << \"Lights #{off_switches[0]}\"\n off_switches[1..-2].each do |switch|\n output << \", #{switch}\"\n end\n output << \" and #{off_switches[-1]} are off;\"\n\n output << \" #{on_switches[0]}\"\n on_switches[1..-2].each do |switch|\n output << \", #{switch}\"\n end\n output << \" and #{on_switches[-1]} are on\"\n\n puts output\n sleep(3)\nend",
"def initialize_lights(number_of_lights)\n lights = Hash.new\n 1.upto(number_of_lights) { |number| lights[number] = \"off\" }\n lights\nend",
"def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_light(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"def toggle_every_nth_light(lights, nth)\n lights.each do |position, state|\n if position % nth == 0\n lights[position] = (state == \"off\") ? \"on\" : \"off\"\n end\n end\nend",
"def thousand_switches(integer)\n array = Array.new(integer, false)\n 1.upto(integer) do |n|\n array.map!.with_index do |element, index| \n if (index + 1) % n == 0\n !element\n else\n element\n end\n end\n end\n output = []\n array.each_with_index {|element, index| output << (index + 1) if element == true }\n output\nend",
"def toggle_lights(number_of_lights)\n lights = initialize_lights(number_of_lights)\n binding.pry\n 1.upto(lights.size) do |iteration_number|\n toggle_every_nth_lights(lights, iteration_number)\n end\n\n on_lights(lights)\nend",
"def red_knight(n, p)\n # starting positions\n knight = [n, 0]\n white = [0, p]\n black = [1, p]\n\n # the race\n while true\n white[1] += 1\n black[1] += 1\n\n knight[0] ^= 1\n knight[1] += 2\n\n break ['White', white[1]] if knight == white\n break ['Black', black[1]] if knight == black\n end\nend",
"def monty_hall_proof(trials)\n #tracker for conditions wins\n switch_wins = 0\n stay_wins = 0\n\n #run logic as many trial as desired\n trials.times do \n #create doors array with 2 goats(false) and 1 car(true) and shuffle position each loop\n doors = [true, false, false].shuffle\n\n #make random selection of which door to choose initially\n selection = doors.slice!(rand(doors.length))\n\n #if the car is behind the choosen door, always staying would win\n #if the car is behind the choosen door, switching would always lose since the only choices left are goats(false)\n #this is the only case staying wins and switching loses, therefore 1/3 chance losing if you switch\n if selection\n stay_wins += 1\n #if selection isnt correct the other goat(false) is revealed meaning the switch chooses the only other door with the car(true) therefore winning\n #if selection isnt correct staying would leave you with a goat(false) thwerefore losing\n else\n switch_wins += 1\n end\n end\n\n puts \"Win_Pct: #{(stay_wins/trials.to_f * 100).round(2)}% Total Stay Wins: #{stay_wins} \"\n puts \"Win_Pct: #{(switch_wins/trials.to_f * 100).round(2)}% Total Switch Wins: #{switch_wins} \"\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /resource_types/new GET /resource_types/new.json
|
def new
@resource_type = ResourceType.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @resource_type }
end
end
|
[
"def new\n @resource_type = ResourceType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource_type }\n end\n end",
"def create\n @resource_type = ResourceType.new(resource_type_params)\n\n respond_to do |format|\n if @resource_type.save\n format.html { redirect_to @resource_type, notice: 'Resource type was successfully created.' }\n format.json { render :show, status: :created, location: @resource_type }\n else\n format.html { render :new }\n format.json { render json: @resource_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end",
"def new\n @type = Type.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end",
"def new\n @type = Type.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end",
"def create\n @type_resource = TypeResource.new(type_resource_params)\n\n respond_to do |format|\n if @type_resource.save\n format.html { redirect_to @type_resource, notice: 'EL tipo de recurso fue cread éxitosamente.' }\n format.json { render :show, status: :created, location: @type_resource }\n else\n format.html { render :new }\n format.json { render json: @type_resource.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @request_type = RequestType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_type }\n end\n end",
"def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def new\n @model_type = ModelType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model_type }\n end\n end",
"def new\n\tputs \"new\"\n @resource = Resource.new\n\n respond_to do |format|\n format.json { render json: @resource }\n#\t format.html { render html: @resources }\n end\n end",
"def new\n @regiontype = Regiontype.new\n @title = 'New Region Type'\n @context_menu = {'cancel' => regiontypes_path}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @regiontype }\n end\n end",
"def new\n @resource = Resource.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @resource = Resource.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end",
"def new\n @entity_type = EntityType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end",
"def new\n @type_info = TypeInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type_info }\n end\n end",
"def new\n @attribute_type = AttributeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @attribute_type }\n end\n end",
"def new\n @attribute_type = AttributeType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @attribute_type }\n end\n end",
"def new\n @item_type = ItemType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_type }\n end\n end",
"def new\n @collection_type = CollectionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @collection_type }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /resource_types POST /resource_types.jsojoins(:field_type)n
|
def create
@resource_type = ResourceType.new(params[:resource_type])
respond_to do |format|
if @resource_type.save
if params[:fields]
params[:fields].each do |param|
@field = Field.new(
:name => param[:name],
:field_type_id => param[:field_type_id],
:resource_type_id => @resource_type.id,
:resource_type_reference_id => param[:resource_type_reference_id]
)
param[:validator_ids].each do |index|
@field.field_validations.build(validator_id: index)
end
@field.save
end
end
format.html { redirect_to @resource_type, notice: 'Resource type was successfully created.' }
format.json { render json: @resource_type, status: :created, location: @resource_type }
else
format.html { render action: "new" }
format.json { render json: @resource_type.errors, status: :unprocessable_entity }
end
end
end
|
[
"def add_dummy_type\n params[:data] ||= {}\n params[:data][:type] = resource_klass._type.to_s\n end",
"def get_field_basic_types\n custom_form = CustomForms::CustomForm.find(params[:custom_form_id])\n @basic_field_types = custom_form.basic_field_types\n respond_to do |format|\n format.js\n end\n end",
"def simplified_type(field_type)\n if field_type == 'jsonb'\n :json\n else\n super\n end\n end",
"def create\n @field_type = get_field_type\n @data_types = FieldType.data_types_list.map {|k, v| [v, k]}\n if @field_type.save and not request.xhr?\n flash[:notice] = t('create.success', :scope => get_i18n_scope)\n end\n respond_with @event, @field_type, :location => {:action => 'index'}\n end",
"def enabled_dynamic_fields_for_type(digital_object_type)\n enabled_dynamic_fields.includes(:dynamic_field).where(digital_object_type: digital_object_type).to_a\n end",
"def field_types\r\n return @field_types\r\n end",
"def create\n @ref_type_field = RefTypeField.new(ref_type_field_params)\n\n respond_to do |format|\n if @ref_type_field.save\n format.html { redirect_to @ref_type_field, notice: 'Ref type field was successfully created.' }\n format.json { render :show, status: :created, location: @ref_type_field }\n else\n @ref_attributes = RefAttribute.all\n @reftypes = Reftype.all\n format.html { render :new }\n format.json { render json: @ref_type_field.errors, status: :unprocessable_entity }\n end\n end\n end",
"def to_post_json\n type = self.class.name.split(\"::\").last.downcase\n to_json(:root => type)\n end",
"def related_types(contact_method)\n params = {\n name: contact_method\n }\n contact_method_related = JSON.parse(connection.get(\"/ContactMethod/RelatedTypes\", params ).body )\n end",
"def _field_types\n special_attribute('@fieldTypes'.freeze)\n end",
"def normalize_create_types(params)\n type_ids = []\n\n params[:types].split(/\\s*,\\s*/).uniq.each{ |type_name|\n nf = Type.i18n_name_field\n tn = ActiveRecord::Base.connection.quote(ActionController::Base.helpers.sanitize(type_name))\n t = Type.where(\"(COALESCE(#{nf}, name) || CASE WHEN scientific_name IS NULL THEN '' ELSE ' ['||scientific_name||']' END)=#{tn}\")\n\n # if it's not found, make it a pending type\n if t.nil? or t.empty?\n t = Type.new\n t.name = type_name\n t.pending = true # this is database default, but setting here just in case\n t.category_mask = params[:c].blank? ? array_to_mask([\"forager\"],Type::Categories) :\n array_to_mask(params[:c].split(/,/),Type::Categories)\n t.save\n else\n t = t.first\n end\n type_ids.push t.id\n } if params[:types].present?\n\n logger.debug params[:location][:type_ids]\n\n if params[:location].present? and params[:location][:type_ids].present?\n v = []\n if params[:location][:type_ids].kind_of? Hash\n v = params[:location][:type_ids].values.map{ |x| x.to_i }\n elsif params[:location][:type_ids].kind_of? Array\n v = params[:location][:type_ids].map{ |x| x.to_i }\n else\n # if we couldn't get it in a reasonable format, delete it\n params[:location].delete(:type_ids)\n end\n logger.debug Type.ids\n logger.debug v\n type_ids += (v & Type.ids) if v.length > 0\n end\n\n logger.debug \"TYPES!\"\n logger.debug type_ids\n type_ids\n end",
"def get_field_type(field_name)\n\t\tend",
"def set_field_types(search_field, custom_form_id)\n @field_types = CustomForms::CustomForm.find(custom_form_id).form_sections.\n map(&:section_fields).flatten.map(&:field_type).\n select{|f| f.field_type == search_field}.uniq\n end",
"def create\n field_type_ids = params[:entry_type].delete(\"field_type_ids\")\n @entry_type = EntryType.new(params[:entry_type])\n @entry_type.field_type_ids = field_type_ids\n @entry_type.form_code = build_form_code(@entry_type.field_types)\n @entry_type.model_code = build_model_code(@entry_type.name, @entry_type.field_types)\n @entry_type.model = build_model_from_code(@entry_type)\n\n respond_to do |format|\n if @entry_type.save\n format.html { redirect_to @entry_type, notice: 'Entry type was successfully created.' }\n format.json { render json: @entry_type, status: :created, location: @entry_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entry_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def get_field_type\n\t\tend",
"def type\n custom_field.type\n end",
"def process_method_field_types(fields)\n fields.each do |field|\n field_type = field[:type]\n next if STANDARD_TYPES.include?(field_type)\n @raw_types << field_type unless @raw_types.include?(field_type)\n end\n end",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n end",
"def get_resource_type_identifiers\n get_entity_types_related_to Occi::Core::Resource.kind.type_identifier\n\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /resource_types/1 DELETE /resource_types/1.json
|
def destroy
begin
if @resource_type.destroy
respond_to do |format|
format.html { redirect_to resource_types_url }
format.json { head :no_content }
end
end
rescue
respond_to do |format|
format.html { redirect_to "index", notice: "Resource_type cann't delete." }
end
end
end
|
[
"def destroy\n @resource_type = ResourceType.find(params[:id])\n @resource_type.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_types_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @resource_type = ResourceType.find(params[:id])\n @resource_type.destroy\n\n respond_to do |format|\n format.html { redirect_to resource_types_url }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end",
"def delete(resource_type_identifier); end",
"def destroy\n authorize :resquest_type, :destroy?\n @resquest_type.destroy\n respond_to do |format|\n format.html { redirect_to resquest_types_url, notice: 'Resquest type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_type = RequestType.find(params[:id])\n @request_type.destroy\n\n respond_to do |format|\n format.html { redirect_to request_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @type = Type.find(params[:id])\n @type.destroy\n\n respond_to do |format|\n format.html { redirect_to types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crust_type.destroy\n respond_to do |format|\n format.html { redirect_to crust_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reagent_type = ReagentType.find(params[:id])\n @reagent_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reagent_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @client_type = ClientType.find(params[:id])\n @client_type.destroy\n\n respond_to do |format|\n format.html { redirect_to client_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n asset_type = AssetType.find(params[:id])\n asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @clienttype = Clienttype.find(params[:id])\n @clienttype.destroy\n\n respond_to do |format|\n format.html { redirect_to clienttypes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @request_type.destroy\n\n respond_to do |format|\n format.html { redirect_to request_types_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.request_type')) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @realty_type = RealtyType.find(params[:id])\n @realty_type.destroy\n\n respond_to do |format|\n format.html { redirect_to realty_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @storage_entry_type.destroy!\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @incident_type = IncidentType.find(params[:id])\n @incident_type.destroy\n\n respond_to do |format|\n format.html { redirect_to incident_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @reform_type = ReformType.find(params[:id])\n @reform_type.destroy\n\n respond_to do |format|\n format.html { redirect_to reform_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_type = AssetType.find(params[:id])\n @asset_type.destroy\n\n respond_to do |format|\n format.html { redirect_to asset_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @device_type = DeviceType.find(params[:id])\n @device_type.destroy\n\n respond_to do |format|\n format.html { redirect_to device_types_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @crate_type = CrateType.find(params[:id])\n @crate_type.destroy\n\n respond_to do |format|\n format.html { redirect_to crate_types_url }\n format.json { head :ok }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns the comments on the given startup.
|
def startup_comments(id)
get("1/startups/#{id}/comments")
end
|
[
"def startup_comments_url\n 'https://api.angel.co/1/startups/%s/comments?access_token=%s' % [\n startup_id, access_token]\n end",
"def description\n comment_sections.first\n end",
"def get_comments\n self.comments = []\n IO.popen \"svn log r#{self.end_revision}\" do |f|\n revision = nil\n author_dt = nil\n data = \"\"\n range = (self.start_revision.to_i + 1)..self.end_revision.to_i\n f.read.split(/\\n/).each do |line|\n if line =~ /^\\-+$/\n if not revision.nil? and range.include?(revision.to_i)\n self.comments << \"#{data.strip}\\n#{author_dt}\"\n end\n revision = nil\n author_dt = nil\n data = \"\" \n elsif line =~ /^r(\\d+) \\| (.+) \\|[^\\|]+$/\n revision = $1\n author_dt = $2\n data = \"\" \n else\n data = \"#{data}\\n#{line}\"\n end\n end\n end\n puts \"Fetched #{self.comments.size} comments.\"\n self.comments\n end",
"def comment_sections\n @comment_sections ||= raw ? raw.split(\"\\n\\n\") : []\n end",
"def full_comments\n client.get(\"/checkin/#{id}/comments\")[\"comments\"]\n end",
"def comments\n comments = \"\"\n first = true # used for splitting lines\n # search for all meta keys which names starts with 'comments/#'\n # and concat its values line by line\n @resource_key.meta.each do |e|\n if /^(comments?)\\/#_*\\d+$/ =~ e.name\n puts \"update comments key name to #{$1}\" if @verbose\n @comments_key_name = $1\n comments << \"\\n\" unless first\n comments << e.value.sub(/^# ?/, '')\n first = false\n end\n end\n return comments\n end",
"def comments\n @properties[\"C\"]\n end",
"def extract_comments\n @extracted_comments ||= begin\n scan\n code_objects\n end\n end",
"def comments\n [ comment, inline_comment ].compact\n end",
"def comments\n results = []\n return results unless @comments\n\n comment = ''\n @comments.split(\"\\n\").each do |line|\n if line =~ /^\\S/\n results << comment unless comment.empty?\n comment = line\n else\n comment += \"\\n\" + line\n end\n end\n\n results << comment unless comment.empty?\n return results\n end",
"def _zlist\n @config.ffi_delegate.comments\n end",
"def comments\n worksheets.map(&:comments).compact\n end",
"def processing_comments(opts = {})\n find_collection(\"processingComments\", opts)\n end",
"def comments\n block.split(\"\\n\").select{|l| l =~ /^\\s*#/}.map{|l| l.gsub(/^\\s*#\\s*/, \"\").strip}\n end",
"def comments\r\n return node_list(TYPE_COMMENT, nil)\r\n end",
"def show_comments(post_num_input)\n puts ''\n puts '----COMMENTS----'\n BLOG[post_num_input].comments.each do |x|\n puts x.username\n puts x.comment\n puts ''\n end\n puts ''\n end",
"def getComments\r\n\tend",
"def find_comments text\n return \"\" unless text\n lines = text.split(\"\\n\")\n lines.reverse! if COMMENTS_ARE_UPPER\n comment_block = Array.new\n lines.each do |line|\n break if line =~ /^\\s*?\\w/ || line =~ /^\\s*?$/\n if COMMENTS_ARE_UPPER\n comment_block.unshift line.sub(/^\\s*?!\\s?/,\"\")\n else\n comment_block.push line.sub(/^\\s*?!\\s?/,\"\")\n end\n end\n nice_lines = comment_block.join(\"\\n\").split \"\\n\\s*?\\n\"\n nice_lines[0] ||= \"\"\n nice_lines.shift\n end",
"def comments\n return @comments\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns up to 50 startups at a time, given an Array of ids.
|
def get_startups(ids)
params = { :ids => ids.join(',') }
get("1/startups/batch", params)
end
|
[
"def gather_user_profiles_from_ids(ids)\n ids = ids.map{|i| Integer(i) }\n profiles = []\n count = 0\n ids.each_slice(100) do |arr|\n count += 1\n puts \"On count: #{count}\"\n begin\n data = Twit.fetch_users_by_ids(arr)\n rescue Twitter::Error::TooManyRequests => err\n puts err\n puts \"Sleeping for 30\"\n sleep 30\n retry\n rescue Twitter::Error::NotFound => err\n puts err\n puts \"moving on...\"\n else\n profiles.concat(data)\n sleep 5\n end\n end\n\n return profiles\n end",
"def get_msruns_from_array_of_ids(ids)\n Msrun.all(:id => ids)\n end",
"def limited_id_set(ids)\n ids.map(&:to_i).uniq[0, MO.query_max_array]\n end",
"def poll_all(ids)\n return ids.map { |id| poll(id) }\n end",
"def get_users(ids)\n params = { :ids => ids.join(',') }\n get(\"1/users/batch\", params)\n end",
"def load_by_ids ids\n items = @api.fetch_multiple_items ids\n create_by_api_items(items)\n end",
"def fetch_user_batched(ids)\n fetch_ids = ids.reject { |id| @user_store.has_key? id }\n\n fetch_ids.each_slice(100) do |ids_batch|\n next unless ids_batch.size > 0\n\n puts \"Hitting the API (users for #{ids_batch.inspect})\"\n\n begin\n client.users(ids_batch).each do |user|\n @user_store[user.id] = UserWrapper.new(user)\n end\n rescue Twitter::Error::NotFound => error\n # Nothing\n rescue Twitter::Error::TooManyRequests => error\n puts \"Hit the rate limit while fetching users, waiting for #{error.rate_limit.reset_in} seconds\"\n sleep error.rate_limit.reset_in + 1\n retry\n end\n end\n end",
"def fetch_records(ids)\n model.where(id: ids)\n end",
"def search_entities_by_ids(ids)\n start.uri('/api/entity/search')\n .url_parameter('ids', ids)\n .get()\n .go()\n end",
"def find_many(ids)\n existing, required = ids.partition { |id| has_record_for_id?(id) }\n if required.any?\n where(ids: ids) + existing.map { |id| record_for_id(id) }\n else\n existing.map { |id| record_for_id(id) }\n end\n end",
"def get_company_jobs(startupIds)\n augmentation = startupIds.map{|id| \"startup_ids%5B%5D=#{id}\"}.join(\"&\")\n uri = URI.parse(StartupTableUrl+augmentation)\n response = makeHttpRequest(uri, $headers, nil, nil, MaxQps)\n if response == nil\n return\n end\n doc = Nokogiri::HTML(response.body)\n node = doc.xpath(\"//div[contains(@class, 'startup-row')]\")\n if node == nil\n return\n end\n startupCompanies = node.map{|startupNode| parseStartupInfo(startupNode)};\n \n # spanning threads to get and save jobs\n pool = Thread.pool(ThreadPoolLimit)\n startupCompanies.each{|company| pool.process {get_save_jobs(company)}};\n \n #waiting for pools to exit\n pool.shutdown\nend",
"def create_retrievals\n article_ids = RetrievalStatus.where(:source_id => id).pluck(:article_id)\n\n (0...article_ids.length).step(1000) do |offset|\n ids = article_ids[offset...offset + 1000]\n delay(priority: 2, queue: \"retrieval-status\").insert_retrievals(ids)\n end\n end",
"def request_launch_new_instances(num=1)\n out = []\n num.times {out << request_launch_one_instance_at_a_time}\n out\n end",
"def ids_in_list_limit\n 1499\n end",
"def fetch_multiple_items(ids)\n responses = []\n\n @conn.in_parallel do\n ids.each do |id|\n # responses.push @conn.get \"item/#{id}.json\"\n (@conn.get \"item/#{id}.json\").on_complete { |res| responses << res }\n end\n end\n\n items = responses.each do |response|\n item = response.body\n raise HackerNewsApiError.new \"Response must be an item object.\", response unless item.kind_of?(Hash) && item.has_key?('id')\n item\n end\n\n Rails.logger.info \"Fetch multiple items succeed (count: #{responses.length})\"\n items\n end",
"def associated_records(ids)\n max_ids_in_a_list = connection.ids_in_list_limit || ids.size\n records = []\n ids.each_slice(max_ids_in_a_list) do |some_ids|\n records += yield(some_ids)\n end\n records\n end",
"def find_all(ids, options = {})\n keys = []\n\n ids.each do |id|\n keys.push(get_key(id))\n end\n\n return [] if keys.empty?\n\n items = Dynamo::Client.batch_get_item(self.table_name, keys, options)\n items ? items.map{|i| from_database(i)} : []\n end",
"def load_all(ids)\n ids.map { |id| self.load(id) }\n end",
"def id_with_partitions(ids)\n Array(ids).collect {|id| (0...Dynamoid::Config.partition_size).collect{|n| id.is_a?(Array) ? [\"#{id.first}.#{n}\", id.last] : \"#{id}.#{n}\"}}.flatten(1)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Search for a startup given a URL slug. Responds like GET /startups/:id.
|
def startup_search(options={})
get("1/startups/search", options)
end
|
[
"def startup_search(options={})\n get(\"1/startups/search\", options, :format => :json, :phoenix => true)\n end",
"def find_by_slug(slug)\n find(Client.get(\"/families/#{slug}\")['id'])\n end",
"def find_competition(slug)\n self.competitions.where(slug: slug.downcase).first\n end",
"def first_available_slug(slug)\n slugs = Location.find(:all, :conditions => \"slug LIKE '#{slug}%'\", :select => 'slug').map(&:slug)\n redirects = SlugRedirect.find(:all, :conditions => \"slug LIKE '#{slug}%'\")\n\n if slugs.include?(slug) || detect_redirect_conflict(slug, redirects)\n i = 2\n while(slugs.include?(candidate = \"#{slug}-#{i}\") || detect_redirect_conflict(candidate, redirects))\n i += 1\n end\n\n candidate\n else\n slug\n end\n end",
"def find_by_slug slug\n (Page.all :conditions => { :slug => slug }).first\n end",
"def find_slugged(id)\n find(id.split(\"-\").send(_friendly_use_key))\n end",
"def find(slug)\n target_url = fetch_target_url(slug)\n\n fail(Errors::SlugNotFound, slug) unless target_url\n\n to_url(slug, target_url)\n end",
"def find_run\n if Run.where(:id => params[:id]).blank?\n respond_to do |format|\n flash[:error] = 'The run you are looking for does not exist.'\n format.html { redirect_to runs_path }\n format.json { render :nothing => true, :status => \"404\" }\n end\n else\n @run = Run.find(params[:id])\n end\n end",
"def find(klass, *args, **keywords)\n get(klass.search_uri(*args, **keywords))\n end",
"def show_startup\n authorize! :investor_connect_with_startups, current_user\n # Only allow temporary investor account access to their suggested startups\n if [2367, 2375, 2435, 2436, 2437, 2438, 2459, 2466].include?(current_user.id)\n calculate_suggested_startup_completeness\n @startup = current_user.suggested_startups(1).first\n else\n @startup = Startup.find 319\n Relationship.suggest_connection(current_user, @startup, :startup_investor)\n end\n \n if @startup.blank?\n flash[:notice] = \"Thanks, you've reviewed all of the startups currently available to you.\"\n redirect_to :action => :index\n return\n end\n\n @checkin_history = Checkin.history_for_startup(@startup)\n @screenshots = @startup.screenshots.ordered\n\n @rating = Rating.new\n @rating.startup = @startup\n @rating.interested = false\n\n @instrument = @startup.instruments.first\n @measurements = @instrument.measurements.ordered_asc.all unless @instrument.blank?\n\n @checkins = @startup.checkins.ordered\n end",
"def find(slug)\n type = slug.to_s.demodulize.classify\n\n subclasses.find do |subclass|\n subclass.name.gsub(prefix, '') == type.to_s.gsub(prefix, '')\n end || raise(TypeError.new(type, types.to_sentence))\n end",
"def find_by_slug!(*args)\n slugs = args.__find_args__\n raise_invalid if slugs.any?(&:nil?)\n for_slugs(slugs).execute_or_raise_for_slugs(slugs, args.multi_arged?)\n end",
"def get_entry\n id = params[:id]\n if /\\A\\d+\\z/.match(id)\n @entry = Entry.find(id)\n else\n @entry = Entry.find_by_slug(id)\n end\n raise ActiveRecord::RecordNotFound if @entry.nil?\n end",
"def by_slug(slug, conditions = {})\n Pages::Finder.by_slug(slug, conditions)\n end",
"def find_by_slug slug\n (Post.all :conditions => { :slug => slug }).first\n end",
"def found_using_friendly_id?\n finder_slug\n end",
"def find_slug(name_part, opts={})\n s = self.slugs(project_name).values.find_all { |f| f.attributes[:key].include?(name_part) }\n if s.size == 0\n raise error_class, \"unable to find a slug from '#{name_part}'. Use 'wrangler list' command to see available slugs\" unless opts[:raise] == false\n return nil\n elsif s.size > 1\n return s.last if opts[:latest]\n raise error_class, \"ambiguous slug name. Found more than one slug with '#{name_part}' in their names.\\n#{s.map{|sl| File.basename(sl.key)} * \"\\n\"}\\n Use 'wrangler list' command to see available slugs\"\n end\n s[0]\n end",
"def oss_home\n page.search('ul#menu li.sub-menu').each do |submenu|\n sn = submenu.search('a.slicknav_item').first\n if sn && (sn.text.match 'Spices')\n # Launch a scraper for each product collection: blends|salts|herbs|chiles|peppercorns|single-origin|spices\n submenu.search('ul li a').each do |link|\n url = link.attribute('href').to_s\n scrape url if Oaktownspiceshop_com_Scraper.handler(url)\n end\n end\n end\n scrape 'blogs/recipes'\n end",
"def find_one_with_slug(id_or_slug, options = {})\n return find_one_without_slug(id_or_slug, options) if id_or_slug.is_a?(Fixnum)\n\n slug_column = has_slug_options[:slug_column]\n\n if result = send(\"find_by_#{slug_column}\", id_or_slug, options)\n result.found_by_slug!\n else\n result = find_one_without_slug(id_or_slug, options)\n end\n \n result\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
output to a file, and the streaming output handler
|
def log_and_stream(output)
write_file output, @filename if @filename
@block.call(output)
end
|
[
"def output_handle\n if @options[:output].is_a? String\n File.open(@options[:output], 'w')\n else\n $stdout\n end\n end",
"def output_file\n @output\n end",
"def write_to_output filename, content = nil # :yields: file\n self.create_output_file(filename) do |output_path|\n File.open(output_path, 'w') do |f|\n if content\n f.write(content)\n else\n yield f\n end\n end\n end\n end",
"def output( file, line )\n file.syswrite( line.to_s + \"\\n\" )\nend",
"def create_output_file\n File.open(\"#{@output_file}\", \"a+\") do |f|\n f.puts @output\n end\n end",
"def open_output_file(&block)\r\n outfile = options[:outfile]\r\n if outfile\r\n File.open(outfile, 'w') { |f| block.call(f) }\r\n else\r\n block.call(STDOUT)\r\n end\r\n end",
"def output_stream=(value); end",
"def output_file(filename)\n @output_file = filename\n end",
"def build_output_stream(options)\n case options[:output]\n when :file\n Command::Output::FileOutputStream.new\n else\n Command::Output::StandardOutputStream.new\n end\n end",
"def out_file(in_response, file_name)\n\ttarget = File.open(file_name, \"w\")\n\ttarget.write(in_response)\nend",
"def write\n path = \"#{site.root}/_site/#{output_file}\"\n File.open(path, 'w') do |f|\n f.write(@output)\n end\n end",
"def output(filename)\n @output = \" #{filename}\"\n end",
"def save_to_file\n File.open(@output, 'w+') do |file|\n file.puts HEADER if @additional_html\n file.puts @data_for_output.join(\"\\n\")\n file.puts FOOTER if @additional_html\n end\n end",
"def render(output = '', opts = {})\n @options = options.merge!(opts)\n\n ::File.write(filename, out(output)) if write_file?\n\n out(output)\n end",
"def file_output output_lines, friend\n # using 'write_to' method with given parameters\n write_to \"#{friend}.txt\" do |file|\n file.write output_lines[0]\n file.write output_lines[1]\n end\nend",
"def output=(io); end",
"def output(hash, path)\n File.open(path, 'w') { |f| _output(hash, f) }\n end",
"def create_output_file output\n File.open(OUTPUT_FILE, \"a+\") do |file|\n file.puts output\n file.puts \"\\n\"\n end\n end",
"def log_and_stream(output)\n write_file output, runlog_filename if runlog_filename\n return @block.call(output) unless @block.nil?\n \"\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
pokemon_name = [] def pokemons_names(pokemon_name) Pokemon.each do |pokemon| pokemon_name << pokemon[:name] end pokemon_name end def pokemons_names pokemon_name = [] Pokemon.each do |pokemon| pokemon_name << pokemon[:name] end pokemon_name end
|
def pokemons_names
Pokemon.collect do |pokemon|
pokemon[:name]
end
end
|
[
"def pokemon_names(pokemon)\n pokemon.collect{|poke_profile|\n poke_profile[:name]\n }\nend",
"def all_names(pokemon_array)\n pokemon_name = []\n pokemon_array.each do |monster_hash|\n pokemon_name << monster_hash[:name]\n end\n pokemon_name\nend",
"def list_pokemon_names(list = @silph_dex)\n list.map do |pokemon|\n display_name(pokemon.name)\n end.join('\\n')\n end",
"def get_pokemon\n PokemonInfoFinder::Scraper.scrape_pokemon_name\n @pokemon_name_list = PokemonInfoFinder::Pokemon.all_names\n #make pokemon class to make new pokemon and give them types and info \n end",
"def get_name(pokemon)\n pokemon['species']['name']\nend",
"def get_names(spicy_foods)\n spicy_food_names = []\n spicy_foods.map do |spicy_food|\n spicy_food_names.append(spicy_food[:name])\n end\n spicy_food_names\nend",
"def store_names(potter)\n store = []\n potter.each {|spot| store << spot[:name]}\n return store\nend",
"def get_names(spicy_foods)\n # your code here\n array_of_names = spicy_foods.collect do |food|\n food[:name]\n end\n array_of_names\nend",
"def choose_pokemon(pokemon_array)\n pokemon_array.each do |pokemon|\n self.pokemons << pokemon\n end\n end",
"def list_pokemon\n puts \"\"\n puts \"See below for the list of the original Pokemon!\"\n puts \"\"\n @pokemon_objects.each.with_index(1) do |a, i|\n puts \"#{i}. #{a.name}\"\n end\n puts \"\"\n end",
"def get_names(spicy_foods)\n spicy_foods.map { |spicy_food_hash| spicy_food_hash[:name] }\nend",
"def choose_pokemon(pokemon_array)\n pokemons << pokemon_array\n end",
"def animal_nicknames\n total_animals = animals.map do |animal|\n animal.nickname \n end\t\n end",
"def find_pokemon_by_name(name)\n sanitized_name = name.gsub(/[^a-zA-Z]+/, '-').downcase\n poke_array = @silph_dex.values.find_all do |pokemon|\n pokemon.name.include?(sanitized_name)\n end\n poke_hash = poke_array.map do |silph_poke|\n [silph_poke, @gg_dex[silph_poke.number_with_form]]\n end\n poke_hash.count > 0 ? poke_hash : nil\n end",
"def ability_names(pokemon)\n\t\tability_names = []\n\t\tpokemon[\"abilities\"].each do |i|\n\t\t\tability_names.push(i[\"ability\"][\"name\"])\n\t\tend\n\t\treturn ability_names\n\tend",
"def name_all_players\n (0..num_players - 1).each { |i| @players[i].name_player('Player' + i.to_s)}\n end",
"def whos_that_pokemon\n who_is_it = \"id: #{id}, name: #{name}, hp: #{hp}, attack: #{attack}, defense: #{defense}, speed #{speed}\"\n end",
"def patients_name\n self.pets.map {|p| p.name}\n end",
"def get_list_playersname\n\t\t\tres = []\n\t\t\t@players_for_core.each do |k,v|\n\t\t\t\tres << k\n\t\t\tend\n\t\t\treturn res\n\t\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Update institution by id Handling errors from not finding the id and wrong data
|
def update
institution = Institution.find(params[:id])
if institution.update(institution_params)
render json: { status: '200', message: "Updated Institution with id #{params[:id]}", data: institution }, status: :ok
else
render json: { status: '422', error: 'Institution not updated', data: institution.errors }, status: :unprocessable_entity
end
rescue ActiveRecord::RecordNotFound
render json: { status: '404', error: "No Institution with id #{params[:id]}", data: institution }, status: :not_found
end
|
[
"def update\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n if @institution.update_attributes(params[:institution])\n format.html { redirect_to @institution, notice: 'Institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @financial_institution = FinancialInstitution.find(params[:id])\n\n if @financial_institution.update(financial_institution_params)\n head :no_content\n else\n render json: @financial_institution.errors, status: :unprocessable_entity\n end\n end",
"def update\n @issuing_institution = IssuingInstitution.find(params[:id])\n\n respond_to do |format|\n if @issuing_institution.update_attributes(params[:issuing_institution])\n format.html { redirect_to @issuing_institution, :notice => 'Orgão Emissor atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @issuing_institution.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @one_reg_institution = OneRegInstitution.find(params[:id])\n\n respond_to do |format|\n if @one_reg_institution.update_attributes(params[:one_reg_institution])\n format.html { redirect_to @one_reg_institution, notice: 'One reg institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @one_reg_institution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @institution_ad = InstitutionAd.find(params[:id])\n\n respond_to do |format|\n if @institution_ad.update_attributes(params[:institution_ad])\n format.html { redirect_to ([:administrator, @institution_ad]), notice: 'Institution ad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institution_ad.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @institution = Institution.find(params[:id])\n\n respond_to do |format|\n if @institution.update_attributes(params[:institution])\n format.html { redirect_to(@institution, :notice => 'Institution was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@institutions} }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @institution.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @admin_banking_institution = Admin::BankingInstitution.find(params[:id])\n\n respond_to do |format|\n if @admin_banking_institution.update_attributes(params[:admin_banking_institution])\n format.html { redirect_to admin_banking_institutions_url }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_banking_institution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @institution_update = InstitutionUpdate.find(params[:id])\n\n respond_to do |format|\n if @institution_update.update_attributes(params[:institution_update])\n format.html { redirect_to ([:administrator, @institution_update]), notice: 'Institution update was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institution_update.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_institution(inst_name, inst_site, inst_phone, inst_email)\n old_institution = @institutions.select { |hash| hash[:name] == inst_name }.first\n if inst_name == old_institution[:name] && inst_site == old_institution[:website] &&\n inst_phone == old_institution[:phone_number] && inst_email == old_institution[:email]\n return old_institution\n else\n inst = Institution.find_by(id: old_institution[:id])\n inst.update(website: inst_site, phone_number: inst_phone,\n email: inst_email)\n @institutions.delete_if { |hash| hash[:id] == old_institution[:id] }\n @institutions << inst\n end\n end",
"def update\n @financial_institution = FinancialInstitution.find(params[:id])\n\n respond_to do |format|\n if @financial_institution.update_attributes(financial_institution_params)\n format.html { redirect_to @financial_institution, notice: 'Financial institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @financial_institution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @admin_institution.update(admin_institution_params)\n format.html { redirect_to @admin_institution, notice: 'Institution was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_institution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_institution = UserInstitution.find(params[:id])\n\n respond_to do |format|\n if @user_institution.update_attributes(params[:user_institution])\n format.html { redirect_to(@user_institution, :notice => 'UserInstitution was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_institution.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def set_institution\n @institution = params[:id].nil? ? current_user.institution : Institution.find(params[:id])\n end",
"def update\n @educational_institution = EducationalInstitution.find(params[:id])\n\n respond_to do |format|\n if @educational_institution.update_attributes(params[:educational_institution])\n flash[:notice] = 'EducationalInstitution was successfully updated.'\n format.html { redirect_to(@educational_institution) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @educational_institution.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @counselor = Counselor.find(params[:id])\n flash[:notice] = 'Counselor was successfully updated.' if @counselor.update_attributes(params[:counselor])\n respond_with([@institution, @counselor], :location => institution_url(@institution))\n end",
"def update\n @type_institution = TypeInstitution.find(params[:id])\n\n respond_to do |format|\n if @type_institution.update_attributes(params[:type_institution])\n format.html { redirect_to(@type_institution, :notice => 'Type institution was successfully updated.') }\n format.xml { head :ok }\n format.json {render :json => {\"success\"=>true,\"data\"=>@type_institution}}\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @type_institution.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @educational_institution.update(educational_institution_params)\n format.html { redirect_to @educational_institution, notice: 'Educational institution was successfully updated.' }\n format.json { render :show, status: :ok, location: @educational_institution }\n else\n format.html { render :edit }\n format.json { render json: @educational_institution.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @institution_type = InstitutionType.find(params[:id])\n\n respond_to do |format|\n if @institution_type.update_attributes(params[:institution_type])\n format.html { redirect_to @institution_type, notice: 'Institution type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @institution_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @institutional_entity.update(institutional_entity_params)\n format.html { redirect_to @institutional_entity, notice: 'Institutional entity was successfully updated.' }\n format.json { render :show, status: :ok, location: @institutional_entity }\n else\n format.html { render :edit }\n format.json { render json: @institutional_entity.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Removes the specified class. Examples: const_get 'String' String const_get ['ActiveRecord', 'Base'] ActiveRecord::Base
|
def const_remove(klass)
klass = [klass] unless klass.kind_of? Array
if klass.length > 1
Utility.const_get(klass[0..-2]).send :remove_const, klass.last
elsif klass.any?
Object.send :remove_const, klass.last
end
end
|
[
"def delete_class(klass)\n Object.class_eval do\n remove_const(klass.name.intern) if const_defined?(klass.name.intern)\n end\n end",
"def force_remove_const(klass, const)\n klass.send(:remove_const, const) if klass.const_defined?(const)\n end",
"def remove_constant(const)\n base, _, object = const.to_s.rpartition('::')\n base = base.empty? ? Object : constantize(base)\n base.send :remove_const, object\n log \"Removed constant #{const}\"\n rescue NameError\n log \"Error removing constant: #{const}\"\n end",
"def remove_constant(const)\n return if constant_excluded?(const)\n base, _, object = const.to_s.rpartition('::')\n base = base.empty? ? Object : base.constantize\n base.send :remove_const, object\n logger.devel \"Removed constant #{const} from #{base}\"\n rescue NameError\n end",
"def remove_constant(const)\n return if exclude_constants.any? { |c| const._orig_klass_name.index(c) == 0 } &&\n !include_constants.any? { |c| const._orig_klass_name.index(c) == 0 }\n begin\n parts = const.to_s.sub(/^::(Object)?/, 'Object::').split('::')\n object = parts.pop\n base = parts.empty? ? Object : Inflector.constantize(parts * '::')\n base.send :remove_const, object\n logger.devel \"Removed constant: #{const} from #{base}\"\n rescue NameError; end\n end",
"def remove_class(*klasses)\n klasses.flatten.each do |klass|\n # Skip this class if there is nothing bound to this name\n next unless defined?(klass.name)\n \n basename = klass.to_s.split(\"::\").last\n parent = klass.parent\n \n # Skip this class if it does not match the current one bound to this name\n next unless parent.const_defined?(basename) && klass = parent.const_get(basename)\n\n parent.instance_eval { remove_const basename } unless parent == klass\n end\n end",
"def deleteclass(cl)\n params = self.params\n params.delete_if { |k,v| k.to_s.match(/#{cl}::.*/) }\n write(params)\n end",
"def remove_const(sym) end",
"def remove(all = false)\n\t\tremove_subclasses if all\n\t\tObject.__send__(:remove_const, self.name)\n\t\tnil\n\tend",
"def remove_class(klass)\n unless @classes.include?(klass)\n raise DatabaseError.new(\"Class #{klass} is not linked with #{self}!\")\n end\n @classes.delete(klass)\n end",
"def unload(unrequire=true)\n const = nesting.empty? ? Object : Constant.constantize(nesting) { Object }\n \n if const.const_defined?(name)\n require_paths.each do |require_path|\n require_path = File.extname(require_path).empty? ? \"#{require_path}.rb\" : require_path\n regexp = /#{require_path}$/\n \n $\".delete_if {|path| path =~ regexp }\n end if unrequire\n \n return const.send(:remove_const, name)\n end\n \n nil\n end",
"def remove_class_variable(sym) end",
"def delete_class o_class\n cl = classname(o_class)\n return if cl.nil?\n logger.progname = 'RestDelete#DeleteClass'\n\n begin\n ## to do: if cl contains special characters, enclose with backticks\n response = @res[\"/class/#{ActiveOrient.database}/#{cl}\"].delete\n if response.code == 204\n\tlogger.info{\"Class #{cl} deleted.\"}\n\tActiveOrient.database_classes.delete(cl)\n end\n rescue RestClient::InternalServerError => e\n sentence= JSON.parse( e.response)['errors'].last['content']\n if ActiveOrient.database_classes.has_key? cl\n\tlogger.error{\"Class #{cl} still present.\"}\n\tlogger.error{ sentence }\n\tfalse\n else\n\tlogger.error{e.inspect}\n\ttrue\n end\n rescue Exception => e\n logger.error{e.message}\n logger.error{e.inspect}\n end\n end",
"def delete_class o_class\n cl = classname(o_class)\n logger.progname = 'RestDelete#DeleteClass'\n if @classes.include? cl\n begin\n \t response = @res[\"/class/#{@database}/#{cl}\"].delete\n if response.code == 204\n \t logger.info{\"Class #{cl} deleted.\"}\n @classes.delete(cl)\n end\n rescue RestClient::InternalServerError => e\n \t if get_database_classes(requery: true).include?(cl)\n \t logger.error{\"Class #{cl} still present.\"}\n \t logger.error{e.inspect}\n \t false\n \t else\n logger.error{e.inspect}\n \t true\n \t end\n rescue Exception => e\n logger.error{e.message}\n logger.error{e.inspect}\n end\n else\n cl.nil? ? logger.info{\"Class #{o_class} not present.\"} : logger.info{\"Class #{cl} not present.\"}\n end\n end",
"def remove_class(sym)\n `var el=this.__native__,klass=sym.__value__`\n `el.className=el.className.replace(new(RegExp)('(^|\\\\\\\\s)'+klass+'(?:\\\\\\\\s|$)'),'$1')`\n return self\n end",
"def reset_constant(klass, constant, new_value)\n klass.send(:remove_const, constant)\n klass.const_set(constant, new_value)\nend",
"def remove_class c\n each do |q|\n str = q.get_attribute(\"class\")\n\n str = str.split(\" \").find_all do |n|\n n != c.to_s\n end.join(\" \")\n \n q.set_attribute(\"class\",str)\n end\n end",
"def destroy_model_class(name)\n if name.is_a?(Hash) && name.size == 1\n class_name, superclass_name = *name.to_a.flatten\n else\n class_name, superclass_name = name, 'ActiveRecord::Base'\n end\n need_table = superclass_name.to_s == 'ActiveRecord::Base'\n\n table_name = class_name.to_s.underscore.pluralize\n ActiveRecord::Base.connection.drop_table(table_name) if need_table\n Object.send(:remove_const, class_name)\n end",
"def delete_by_classname(string)\n key = string.underscore.to_sym\n @config_params.delete(key)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Public: Iterates through contours and yields them.
|
def with_each_contour
contours.each do |contour|
# Generate a MASK based on the current contour, and erode it so
# that we can get rid of some of the shadow around the piece.
# The whole map is black and the piece is white.
yield contour, grab_color_from_contour(contour)
end
end
|
[
"def findContours(group)\n\t\t\tcontours = []\n\t\t\twhile group.length > 0\n\t\t\t\tcontours << findContour(group)\n\t\t\tend\n\t\t\tcontours\n\t\tend",
"def plot_contour; end",
"def get_contour_points_adv()\r\n result = []\r\n idx = 0\r\n result[idx] = Offset.vertices(@active_face.outer_loop.vertices, -(@bit_diameter * 0.5)).offsetPoints\r\n# puts \" outer #{result[idx].length} #{result[idx]} \"\r\n @active_face.loops.each { |lp|\r\n if (!lp.outer?)\r\n idx += 1\r\n result[idx] = Offset.vertices(lp.vertices, -(@bit_diameter * 0.5) ).offsetPoints \r\n# puts \" inner[#{idx}] #{result[idx]}\" \r\n end\r\n }\r\n return result \r\nend",
"def colors_from_contours!(contours, previous)\n contours = contours.sort_by { |c| c.rect.y }\n\n contours.to_enum.with_index.each_with_object(previous) do |(contour, index), hash|\n piece = Piece.all[index]\n color = grab_color_from_contour(contour)\n\n Theia.logger.info \"FOUND! contour for #{ Piece.all[index].key } \" +\n \"with y: #{ contour.rect.y } with color: \" +\n \"#{ color.to_a }\"\n\n (hash[piece.key] ||= []).push(color)\n end\n end",
"def plot_contourf; end",
"def findContour(group)\n\t\t\tcontour = group.delete_at(0)\n\t\t\twhile !contour.closed? and group.length > 0 and at = findConnectedTo(contour,group)\n\t\t\t\tcontour = contour.append( group[at] )\n\t\t\t\tgroup.delete_at(at)\n\t\t\tend\n\t\t\tcontour\n\t\tend",
"def each(&block)\n vertices.each(&block)\n end",
"def each(&block) vertices.each(&block); end",
"def each\n vertices.values.each { |v| yield v }\n end",
"def iter()\n return [@dx, @dy, @dz].iter()\n end",
"def graphkit(*args)\n\t\tif args.size == 0\n\t\t\tconts = @last_contours\n\t\telse\n\t\t\tconts = contours(*args)\n\t\tend\n\t\tgraphs = conts.map do |val, cons|\n\t\t\tunless cons[0]\n\t\t\t\tnil\n\t\t\telse\n\t\t\t\t(cons.map do |con|\n\t# \t\t\t\tp con\n\t\t\t\t\tcontour = con.transpose\n\t\t\t\t\tkit = CodeRunner::GraphKit.autocreate({x: {data: contour[0]}, y: {data: contour[1], title: val.to_s}})\n\t\t\t\t\tkit.data[0].with = \"l\"\n\t\t\t\t\tkit\n\t\t\t\tend).sum\n\t\t\tend\n\t\tend\n\t\tgraphs.compact.reverse.sum\n\tend",
"def each_coordination_object(&block)\n @coordination_objects.each(&block)\n end",
"def each_cec(&proc)\n cecs.each(&proc)\n end",
"def each\n start = self.class.start_index\n (start..max_index).each { |i| yield @subcomposites[i] } if max_index\n end",
"def each_segment(&block)\n return to_enum(__method__) unless block_given?\n @polygons.each {|polygon| polygon.each_segment(&block) }\n end",
"def each_file_in_tree\n self.directories_in_tree.find_each do |directory|\n next if directory.nil?\n directory.cfs_files.find_each do |cfs_file|\n next if cfs_file.nil?\n\n yield cfs_file if block_given?\n end\n end\n end",
"def nr_of_contours\n @polygons.size\n end",
"def each\n @photos.each { |photo| yield photo }\n end",
"def each &blk\n @photos.values.each &blk\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /nature_financings GET /nature_financings.json
|
def index
@nature_financings = NatureFinancing.all
end
|
[
"def index\n @financings = Financing.all\n end",
"def show\n @financiation = Financiation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @financiation }\n end\n end",
"def show\n @nature_of_business = NatureOfBusiness.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @nature_of_business }\n end\n end",
"def index\n @filials = Filial.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @filials }\n end\n end",
"def show\n @founder = Founder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @founder }\n end\n end",
"def show\n @facilitation = Facilitation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @facilitation }\n end\n end",
"def show\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foiltype }\n end\n end",
"def index\n @finanses = Finanse.all\n end",
"def show\n @finanzen = Finanzen.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finanzen }\n end\n end",
"def index\n\n @daily_finances = DailyFinance.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @daily_finances }\n end\n end",
"def index\n @festivals = Festival.all\n end",
"def show\n @foil = Foil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @foil }\n end\n end",
"def show\n @feast = Feast.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @feast }\n end\n end",
"def index\n @fretes = Frete.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fretes }\n end\n end",
"def show\n @featuring = Featuring.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @featuring }\n end\n end",
"def index\n @finais = Finai.all\n end",
"def index\n\t @fares = Fare.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @fares }\n\t end\n\tend",
"def index\n @fiction = Fiction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fiction }\n end\n end",
"def index\n @frais_hebergements = FraisHebergement.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @frais_hebergements }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /nature_financings POST /nature_financings.json
|
def create
@nature_financing = NatureFinancing.new(nature_financing_params)
@nature_financing.institute = current_institute
respond_to do |format|
if @nature_financing.save
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully created.' }
format.json { render :show, status: :created, location: @nature_financing }
else
format.html { render :new }
format.json { render json: @nature_financing.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @financiation = Financiation.new(params[:financiation])\n\n respond_to do |format|\n if @financiation.save\n format.html { redirect_to @financiation, notice: 'Financiation was successfully created.' }\n format.json { render json: @financiation, status: :created, location: @financiation }\n else\n format.html { render action: \"new\" }\n format.json { render json: @financiation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @nature_financings = NatureFinancing.all\n end",
"def create\n @nature_of_business = NatureOfBusiness.new(params[:nature_of_business])\n\n respond_to do |format|\n if @nature_of_business.save\n format.html { redirect_to @nature_of_business, notice: 'Nature of business was successfully created.' }\n format.json { render json: @nature_of_business, status: :created, location: @nature_of_business }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nature_of_business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finanse = Finanse.new(finanse_params)\n\n respond_to do |format|\n if @finanse.save\n format.html { redirect_to @finanse, notice: 'Finanse was successfully created.' }\n format.json { render :show, status: :created, location: @finanse }\n else\n format.html { render :new }\n format.json { render json: @finanse.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @nature = Nature.new(nature_params)\n\n respond_to do |format|\n if @nature.save\n format.html { redirect_to @nature, notice: 'Nature was successfully created.' }\n format.json { render :show, status: :created, location: @nature }\n else\n format.html { render :new }\n format.json { render json: @nature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'FOAF was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n\n # Rails.logger.warn \"====================\"\n # Rails.logger.warn foaf_params[:interests_attributes]\n # Rails.logger.warn \"====================\"\n\n \n @foaf = Foaf.new(name: foaf_params[:name], work: foaf_params[:work], \n slug: foaf_params[:slug], birthday: foaf_params[:birthday])\n\n if(foaf_params.has_key?(:interests_attributes))\n interest_ids = foaf_params[:interests_attributes].split(\",\").map { |s| s.to_i }\n interest_ids.each do |i|\n @foaf.interests << Interest.find(i)\n end\n end\n\n respond_to do |format|\n if @foaf.save \n format.html { redirect_to @foaf, notice: 'Foaf was successfully created.' }\n format.json { render action: 'show', status: :created, location: @foaf }\n else\n format.html { render action: 'new' }\n format.json { render json: @foaf.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nature_financing.update(nature_financing_params)\n format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }\n format.json { render :show, status: :ok, location: @nature_financing }\n else\n format.html { render :edit }\n format.json { render json: @nature_financing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finance_inflow = FinanceInflow.new(params[:finance_inflow])\n\n respond_to do |format|\n if @finance_inflow.save\n format.html { redirect_to polymorphic_path([:personal_finance, :income]), notice: 'Finance inflow was successfully created.' }\n format.json { render json: @finance_inflow, status: :created, location: @finance_inflow }\n else\n format.html { render action: \"new\" }\n format.json { render json: @finance_inflow.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @financingtype = Financingtype.new(financingtype_params)\n\n respond_to do |format|\n if @financingtype.save\n format.html { redirect_to @financingtype, notice: 'Financingtype was successfully created.' }\n format.json { render :show, status: :created, location: @financingtype }\n else\n format.html { render :new }\n format.json { render json: @financingtype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def post_spoonacular\n # %encode ingredients to url\n encoded_ingr = URI.escape(@translated_recipe[:ingredients_list])\n # post call block :\n url = URI(\"https://spoonacular-recipe-food-nutrition-v1.p.rapidapi.com/recipes/parseIngredients?includeNutrition=true\")\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n request = Net::HTTP::Post.new(url)\n request[\"content-type\"] = \"application/x-www-form-urlencoded\"\n request[\"x-rapidapi-key\"] = ENV[\"X_RAPIDAPI_KEY\"]\n request[\"x-rapidapi-host\"] = \"spoonacular-recipe-food-nutrition-v1.p.rapidapi.com\"\n # body of the call with ingredients and servings\n request.body = \"ingredientList=#{encoded_ingr}&#{@recipe_hash[:servings]}\"\n # response\n response = http.request(request)\n end",
"def create\n @fetznedition = Fetznedition.new(params[:fetznedition])\n\n respond_to do |format|\n if @fetznedition.save\n format.html { redirect_to @fetznedition, notice: 'Fetznedition was successfully created.' }\n format.json { render json: @fetznedition, status: :created, location: @fetznedition }\n else\n format.html { render action: \"new\" }\n format.json { render json: @fetznedition.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @fining_period = FiningPeriod.new(params[:fining_period])\n\n respond_to do |format|\n if @fining_period.save\n format.html { redirect_to @fining_period, :notice => 'Fining period was successfully created.' }\n format.json { render :json => @fining_period, :status => :created, :location => @fining_period }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @fining_period.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @founder = Founder.new(params[:founder])\n\n respond_to do |format|\n if @founder.save\n format.html { redirect_to @founder, notice: 'Founder was successfully created.' }\n format.json { render json: @founder, status: :created, location: @founder }\n else\n format.html { render action: \"new\" }\n format.json { render json: @founder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @financiation = Financiation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @financiation }\n end\n end",
"def create\n @foiltype = Foiltype.new(params[:foiltype])\n\n respond_to do |format|\n if @foiltype.save\n format.html { redirect_to @foiltype, notice: 'Foil Type was successfully created.' }\n format.json { render json: @foiltype, status: :created, location: @foiltype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @foiltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @finantial_product = FinantialProduct.new(finantial_product_params)\n\n respond_to do |format|\n if @finantial_product.save\n format.html { redirect_to @finantial_product, notice: \"Finantial product was successfully created.\" }\n format.json { render :show, status: :created, location: @finantial_product }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @finantial_product.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @infomation = Infomation.new(params[:infomation])\n\n respond_to do |format|\n if @infomation.save\n format.html { redirect_to @infomation, :notice => 'Infomation was successfully created.' }\n format.json { render :json => @infomation, :status => :created, :location => @infomation }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @infomation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @nfi_pregnancy_category = NfiPregnancyCategory.new(nfi_pregnancy_category_params)\n\n respond_to do |format|\n if @nfi_pregnancy_category.save\n format.html { redirect_to @nfi_pregnancy_category, notice: 'Nfi pregnancy category was successfully created.' }\n format.json { render :show, status: :created, location: @nfi_pregnancy_category }\n else\n format.html { render :new }\n format.json { render json: @nfi_pregnancy_category.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /nature_financings/1 PATCH/PUT /nature_financings/1.json
|
def update
respond_to do |format|
if @nature_financing.update(nature_financing_params)
format.html { redirect_to @nature_financing, notice: 'Nature financing was successfully updated.' }
format.json { render :show, status: :ok, location: @nature_financing }
else
format.html { render :edit }
format.json { render json: @nature_financing.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n json_update(factType,factType_params, FactType)\n end",
"def update\n @nature_of_business = NatureOfBusiness.find(params[:id])\n\n respond_to do |format|\n if @nature_of_business.update_attributes(params[:nature_of_business])\n format.html { redirect_to @nature_of_business, notice: 'Nature of business was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nature_of_business.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @finantial_info.update(finantial_info_params)\n format.html { redirect_to @finantial_info, notice: \"Finantial info was successfully updated.\" }\n format.json { render :show, status: :ok, location: @finantial_info }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @finantial_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nature.update(nature_params)\n format.html { redirect_to @nature, notice: 'Nature was successfully updated.' }\n format.json { render :show, status: :ok, location: @nature }\n else\n format.html { render :edit }\n format.json { render json: @nature.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @financiation = Financiation.find(params[:id])\n\n respond_to do |format|\n if @financiation.update_attributes(params[:financiation])\n format.html { redirect_to @financiation, notice: 'Financiation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @financiation.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @nutritional_information = @food.nutritional_information\n @nutritional_information.update_attributes(params[:nutritional_information])\n respond_with(@food,@nutritional_information)\n end",
"def update\n respond_to do |format|\n if @financing.update(financing_params)\n format.html { redirect_to @financing, notice: 'Данные о финансировании успешно отредактированы.' }\n format.json { render :show, status: :ok, location: @financing }\n else\n format.html { render :edit }\n format.json { render json: @financing.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n feeling = Feeling.find(params[:id])\n feeling.update(feeling_params)\n render json: feeling\n end",
"def update\n respond_to do |format|\n if @firefly.update(firefly_params)\n format.html { redirect_to @firefly, notice: 'Firefly was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @firefly.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @infomation = Infomation.find(params[:id])\n\n respond_to do |format|\n if @infomation.update_attributes(params[:infomation])\n format.html { redirect_to @infomation, :notice => 'Infomation was successfully updated.' }\n #format.json { head :ok }\n\tformat.json {render :json => {:data => @infomation , :success => true } }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @infomation.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @insurance_fee.update(insurance_fee_params)\n format.html { redirect_to @insurance_fee, notice: 'Insurance fee was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @insurance_fee.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @nutrition_fact.update(nutrition_fact_params)\n format.html { redirect_to @nutrition_fact, notice: 'Nutrition fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @nutrition_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @foiltype = Foiltype.find(params[:id])\n\n respond_to do |format|\n if @foiltype.update_attributes(params[:foiltype])\n format.html { redirect_to @foiltype, notice: 'Foiltype was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @foiltype.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @fun_fact = FunFact.find(params[:id])\n\n respond_to do |format|\n if @fun_fact.update_attributes(params[:fun_fact])\n format.html { redirect_to @fun_fact, notice: 'Fun fact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fun_fact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @family_recipe.update(family_recipe_params)\n format.html { redirect_to @family_recipe, notice: \"'#{@family_recipe.title}' recipe was successfully updated.\" }\n format.json { render :show, status: :ok, location: @family_recipe }\n else\n format.html { render :edit }\n format.json { render json: @family_recipe.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @food_nutrient = FoodNutrient.find(params[:id])\n\n if @food_nutrient.update(food_nutrient_params)\n head :no_content\n else\n render json: @food_nutrient.errors, status: :unprocessable_entity\n end\n end",
"def update\n @fatigue = Fatigue.find(params[:id])\n\n respond_to do |format|\n if @fatigue.update_attributes(params[:fatigue])\n format.html { redirect_to @fatigue, notice: 'Fatigue was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fatigue.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @founder = Founder.find(params[:id])\n\n respond_to do |format|\n if @founder.update_attributes(params[:founder])\n format.html { redirect_to @founder, notice: 'Founder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @founder.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @invoiceable_fee.update(invoiceable_fee_params)\n format.html { redirect_to @invoiceable_fee, notice: 'Invoiceable fee was successfully updated.' }\n format.json { render :show, status: :ok, location: @invoiceable_fee }\n else\n format.html { render :edit }\n format.json { render json: @invoiceable_fee.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /nature_financings/1 DELETE /nature_financings/1.json
|
def destroy
@nature_financing.destroy
respond_to do |format|
format.html { redirect_to nature_financings_url, notice: 'Nature financing was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @financing.destroy\n respond_to do |format|\n format.html { redirect_to financings_url, notice: 'Данные о финансировании успешно удалены.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @financiation = Financiation.find(params[:id])\n @financiation.destroy\n\n respond_to do |format|\n format.html { redirect_to financiations_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @nature_of_business = NatureOfBusiness.find(params[:id])\n @nature_of_business.destroy\n\n respond_to do |format|\n format.html { redirect_to nature_of_businesses_url }\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 @nature.destroy\n respond_to do |format|\n format.html { redirect_to natures_url, notice: 'Nature was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @finantial_info.destroy\n respond_to do |format|\n format.html { redirect_to finantial_infos_url, notice: \"Finantial info was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end",
"def destroy\n @socio_doc_fiscais_coring.destroy\n respond_to do |format|\n format.html { redirect_to socio_doc_fiscais_corings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @featuring = Featuring.find(params[:id])\n @featuring.destroy\n\n respond_to do |format|\n format.html { redirect_to featurings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @foiltype = Foiltype.find(params[:id])\n @foiltype.destroy\n\n respond_to do |format|\n format.html { redirect_to foiltypes_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @personal_finance.destroy\n respond_to do |format|\n format.html { redirect_to personal_finances_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fine.destroy\n respond_to do |format|\n format.html { redirect_to fines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @firefly.destroy\n respond_to do |format|\n format.html { redirect_to fireflies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @doc_fiscais_coring.destroy\n respond_to do |format|\n format.html { redirect_to doc_fiscais_corings_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @frient.destroy\n respond_to do |format|\n format.html { redirect_to frients_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @fine = Fine.find(params[:id])\n @fine.destroy\n\n respond_to do |format|\n format.html { redirect_to fines_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @insurance_fee.destroy\n respond_to do |format|\n format.html { redirect_to insurance_fees_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inhabitant = Inhabitant.find_by_id(params[:id])\n @inhabitant.destroy\n\n respond_to do |format|\n format.html { redirect_to inhabitants_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @infomation = Infomation.find(params[:id])\n @infomation.destroy\n\n respond_to do |format|\n format.html { redirect_to infomations_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @taxon_determination.destroy\n respond_to do |format|\n format.html { redirect_to taxon_determinations_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /inventory_snapshot_contents GET /inventory_snapshot_contents.json
|
def index
@inventory_snapshot_contents = InventorySnapshotContent.all
end
|
[
"def show\n @inventory_snapshot = InventorySnapshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_snapshot }\n end\n end",
"def index\n @inventory_snapshots = InventorySnapshot.all\n end",
"def new\n @inventory_snapshot = InventorySnapshot.new params[:inventory_snapshot]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_snapshot }\n end\n end",
"def index\n @snapshots = current_account.snapshots.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @snapshots }\n end\n end",
"def get_snapshots\n ensure_uri && ensure_client\n uri = \"#{@data['uri']}/snapshots\"\n self.class.find_with_pagination(@client, uri)\n end",
"def get_snapshots()\n u = build_uri(\"/snapshots\")\n response = @client.get(u, nil, ACCEPT_RDF)\n return response \n end",
"def get_snapshot(snapshot_id)\n path = api_root + \"/api/repository/v1/snapshots/#{snapshot_id}\"\n process_api_request(:get, path)\n end",
"def create\n @inventory_snapshot = InventorySnapshot.new(params[:inventory_snapshot])\n\n respond_to do |format|\n if @inventory_snapshot.save\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully created.' }\n format.json { render json: @inventory_snapshot, status: :created, location: @inventory_snapshot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventory_snapshot = InventorySnapshot.new(inventory_snapshot_params)\n respond_to do |format|\n if @inventory_snapshot.save\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_snapshot }\n else\n format.html { render :new }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def snapshots()\n service.local_list_snapshots(id)\n end",
"def index\n @ebs_snapshots = EbsSnapshot.all\n end",
"def update\n respond_to do |format|\n if @inventory_snapshot.update(inventory_snapshot_params)\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_snapshot }\n else\n format.html { render :edit }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @environment = Environment.find(params[:environment_id])\n @melodie_snapshot = @environment.melodie_snapshots.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @melodie_snapshot }\n end\n end",
"def snapshots\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n conf_file_response = @vm.conf_file\n return conf_file_response unless conf_file_response.successful?\n\n command = \"#{vmrun_cmd} listSnapshots \"\n command << \"'#{conf_file_response.data}' 2>&1\"\n\n command_exec = Fission::Action::ShellExecutor.new command\n result = command_exec.execute\n\n response = Response.new :code => result['process_status'].exitstatus\n\n if response.successful?\n response.data = parse_snapshot_names_from_output result['output']\n else\n response.message = result['output']\n end\n\n response\n end",
"def getSnapshots()\n\t\tsnaps = JSON.parse(RestClient.get(\"https://#{Cbthelper.username}:#{Cbthelper.authkey}@crossbrowsertesting.com/api/v3/selenium/#{@testId}/snapshots/\"))\t\n\t\tret = []\n\n\t\tfor snap in snaps\n\t\t\tret.push(Snapshot.new(snap[\"hash\"], @testId))\n\n\t\tend\n\t\treturn ret\n\tend",
"def new\n @snapshot = current_account.snapshots.new\n @volumes = current_account.volumes\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snapshot }\n end\n end",
"def get_snapshots\n state_colors = {\n 'SUCCESS' => 'GREEN',\n 'PARTIAL' => 'RED',\n 'IN_PROGRESS' => 'YELLOW',\n }\n repo_response = get_request(\"/_snapshot\").body\n repo_info = JSON.parse(repo_response)\n # Print information about the most recent n snaphots, per repo.\n printf(\"#UNDERLINE%-12s|%-24s|%-13s|%-21s|%-21s|%-17s#NORMAL\\n\", \" REPO \", \" SNAPSHOT NAME \", \" STATE \", \" START \", \" END \", \" DURATION \")\n cluster = ARGV[1]\n bundle = ARGV[2]\n\n repo_info.each_key do |repo_name|\n next if is_es() and repo_name != cluster + \"-\" + bundle\n snapshot_response = get_request(\"/_snapshot/#{repo_name}/_all\").body\n snapshot_info = JSON.parse(snapshot_response)\n\n if snapshot_info['snapshots'].empty?\n printf(\"%-15s|%-32s|%-13s|%-26s|%-26s\\n\", repo_name, \" - \", \" - \", \" - \", \" - \")\n else\n # Temporarily store all snapshot results for later sorting.\n # Snapshot details are keyed by the epoch of their start date.\n all_snapshots = {}\n snapshot_info['snapshots'].each do |snapshot|\n # Snapshot start.\n snapshot_start_datetime = DateTime.iso8601(snapshot['start_time'])\n snapshot_start_epoch = snapshot_start_datetime.to_time.to_i\n snapshot_start_timestamp = snapshot_start_datetime.strftime('%Y-%m-%d %H:%M:%S')\n # Snapshot end.\n if snapshot['end_time'].nil?\n snapshot_end_epoch = 0\n snapshot_end_timestamp = '-'\n else\n snapshot_end_datetime = DateTime.iso8601(snapshot['end_time'])\n snapshot_end_epoch = snapshot_end_datetime.to_time.to_i\n snapshot_end_timestamp = snapshot_end_datetime.strftime('%Y-%m-%d %H:%M:%S')\n end\n if snapshot_end_epoch <= 0\n snapshot_duration = '-'\n else\n # Contrived, but working, method to get time duration.\n snapshot_timediff = snapshot_end_epoch - snapshot_start_epoch\n min, sec = snapshot_timediff.divmod(60)\n hours, min = min.divmod(60)\n days, hours = hours.divmod(24)\n snapshot_duration = sprintf(\"%dd %dh %dm %ds\", days, hours, min, sec)\n end\n all_snapshots[snapshot_start_epoch] = {'state' => snapshot['state'], 'snapshot_name' => snapshot['snapshot'], 'start_time' => snapshot_start_timestamp, 'end_time' => snapshot_end_timestamp, 'duration' => snapshot_duration }\n end\n # Sort (by keys, default) and get first 3 items returned in the AoA.\n most_recent_snaps = all_snapshots.sort.reverse.take(3)\n\n most_recent_snaps.each do |snap| \n snap_start_epoch = snap[0]\n snap_details = snap[1]\n printf(\"%-12s|%-24s|##{state_colors[snap_details['state']]}%-13s#NORMAL|%-21s|%-21s|%-17s\\n\", repo_name, \" #{snap_details['snapshot_name']} \", \" #{snap_details['state']} \", \" #{snap_details['start_time']} \", \" #{snap_details['end_time']} \", \" #{snap_details['duration']} \")\n end\n end\n end\nend",
"def show\n @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stashed_inventory }\n end\n end",
"def get_managed_snapshot(url)\n result = get_resource_by_id(url)\n snapshot = nil\n unless result.nil?\n snapshot = {}\n snapshot[:id] = result['id']\n snapshot[:name] = result['name']\n snapshot[:location] = result['location']\n snapshot[:tags] = result['tags']\n\n properties = result['properties']\n snapshot[:provisioning_state] = properties['provisioningState']\n snapshot[:disk_size] = properties['diskSizeGB']\n end\n snapshot\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /inventory_snapshot_contents POST /inventory_snapshot_contents.json
|
def create
@inventory_snapshot_content = InventorySnapshotContent.new(inventory_snapshot_content_params)
respond_to do |format|
if @inventory_snapshot_content.save
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully created.' }
format.json { render :show, status: :created, location: @inventory_snapshot_content }
else
format.html { render :new }
format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }
end
end
end
|
[
"def index\n @inventory_snapshot_contents = InventorySnapshotContent.all\n end",
"def create\n @inventory_snapshot = InventorySnapshot.new(params[:inventory_snapshot])\n\n respond_to do |format|\n if @inventory_snapshot.save\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully created.' }\n format.json { render json: @inventory_snapshot, status: :created, location: @inventory_snapshot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @inventory_snapshot = InventorySnapshot.new(inventory_snapshot_params)\n respond_to do |format|\n if @inventory_snapshot.save\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_snapshot }\n else\n format.html { render :new }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def index\n @inventory_snapshots = InventorySnapshot.all\n end",
"def new\n @inventory_snapshot = InventorySnapshot.new params[:inventory_snapshot]\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_snapshot }\n end\n end",
"def create\n @snapshot = current_account.snapshots.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n flash[:notice] = 'Snapshot was successfully created.'\n format.html { redirect_to(@snapshot) }\n format.xml { render :xml => @snapshot, :status => :created, :location => @snapshot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_snapshot.update(inventory_snapshot_params)\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_snapshot }\n else\n format.html { render :edit }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_snapshot\n @snapshot = ec2.volumes[volume_id].\n create_snapshot(\"#{description}\")\n message.info \"Created snapshot \\\"#{snapshot.id}\\\"\"\n tag_snapshot\n return @snapshot\n end",
"def show\n @inventory_snapshot = InventorySnapshot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inventory_snapshot }\n end\n end",
"def update\n respond_to do |format|\n if @inventory_snapshot_content.update(inventory_snapshot_content_params)\n format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_snapshot_content }\n else\n format.html { render :edit }\n format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @snapshot = Snapshot.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n format.html { redirect_to @snapshot, notice: 'Snapshot was successfully created.' }\n format.json { render json: @snapshot, status: :created, location: @snapshot }\n else\n format.html { render action: \"new\" }\n format.json { render json: @snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @ebs_snapshot = EbsSnapshot.new(ebs_snapshot_params)\n\n respond_to do |format|\n if @ebs_snapshot.save\n format.html { redirect_to @ebs_snapshot, notice: 'Ebs snapshot was successfully created.' }\n format.json { render :show, status: :created, location: @ebs_snapshot }\n else\n format.html { render :new }\n format.json { render json: @ebs_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def createEBSSnapshot(client=nil,description='',volume_id=nil)\n return false if volume_id.nil? || client.nil?\n # Fetch the Volume Name. This will be used in the description of the snapshot\n resp = client.describe_volumes({dry_run: false, volume_ids: [volume_id] })\n resp.volumes[0].tags.each do |t|\n if t.key=='Name'\n description = t.value unless t.value.empty?\n break\n end\n end\n # puts \"Taking snapshot of volume #{volume_id}...\"\n return client.create_snapshot({\n dry_run: false,\n volume_id: volume_id,\n description: description\n })\nend",
"def update\n @inventory_snapshot = InventorySnapshot.find(params[:id])\n\n respond_to do |format|\n if @inventory_snapshot.update_attributes(params[:inventory_snapshot])\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @snapshot = Snapshot.new(params[:snapshot])\n\n respond_to do |format|\n if @snapshot.save\n flash[:notice] = 'Snapshot was successfully created.'\n format.html { redirect_to(@snapshot) }\n format.xml { render :xml => @snapshot, :status => :created, :location => @snapshot }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def save_snapshot\n return unless @current_snapshot\n current_state = @bitmap.to_json\n return if snapshots_match?(@current_snapshot, current_state)\n\n @snapshots << @current_snapshot\n end",
"def copy_tags_to_snapshot\n data[:copy_tags_to_snapshot]\n end",
"def new\n @snapshot = current_account.snapshots.new\n @volumes = current_account.volumes\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @snapshot }\n end\n end",
"def snapshot(snapshot = nil)\n client.snapshot(name, snapshot)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /inventory_snapshot_contents/1 PATCH/PUT /inventory_snapshot_contents/1.json
|
def update
respond_to do |format|
if @inventory_snapshot_content.update(inventory_snapshot_content_params)
format.html { redirect_to @inventory_snapshot_content, notice: 'Inventory snapshot content was successfully updated.' }
format.json { render :show, status: :ok, location: @inventory_snapshot_content }
else
format.html { render :edit }
format.json { render json: @inventory_snapshot_content.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n if @inventory_snapshot.update(inventory_snapshot_params)\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_snapshot }\n else\n format.html { render :edit }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @inventory_snapshot = InventorySnapshot.find(params[:id])\n\n respond_to do |format|\n if @inventory_snapshot.update_attributes(params[:inventory_snapshot])\n format.html { redirect_to @inventory_snapshot, notice: 'Inventory snapshot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @inventory_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @snapshot = Snapshot.find(params[:id])\n\n respond_to do |format|\n if @snapshot.update_attributes(params[:snapshot])\n format.html { redirect_to @snapshot, notice: 'Snapshot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @ebs_snapshot.update(ebs_snapshot_params)\n format.html { redirect_to @ebs_snapshot, notice: 'Ebs snapshot was successfully updated.' }\n format.json { render :show, status: :ok, location: @ebs_snapshot }\n else\n format.html { render :edit }\n format.json { render json: @ebs_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @snapshot.update(snapshot_params)\n format.html { redirect_to @snapshot, notice: 'Snapshot was successfully updated.' }\n format.json { render :show, status: :ok, location: @snapshot }\n else\n format.html { render :edit }\n format.json { render json: @snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @snapshot.update_attributes(params[:snapshot])\n flash[:notice] = 'Snapshot was successfully updated.'\n format.html { redirect_to(@snapshot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snapshot.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 @stashed_inventory = StashedInventory.find(params[:id])\n\n respond_to do |format|\n if @stashed_inventory.update_attributes(params[:stashed_inventory])\n format.html { redirect_to @stashed_inventory, notice: 'Stashed inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @stashed_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @snapshot = Snapshot.find(params[:id])\n\n respond_to do |format|\n if @snapshot.update_attributes(params[:snapshot])\n flash[:notice] = 'Snapshot was successfully updated.'\n format.html { redirect_to(@snapshot) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @snapshot.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @mounted_inventory.update(params[:mounted_inventory])\n format.html { redirect_to @mounted_inventory, notice: 'A mounted inventory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mounted_inventory.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @availability_snapshot = AvailabilitySnapshot.find(params[:id])\n\n respond_to do |format|\n if @availability_snapshot.update_attributes(params[:availability_snapshot])\n format.html { redirect_to @availability_snapshot, notice: 'Availability snapshot was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @availability_snapshot.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
"def update\n respond_to do |format|\n if @inventory_own.update(inventory_own_params)\n format.html { redirect_to @inventory_own }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_own.errors, status: :unprocessable_entity }\n end\n end\n end",
"def vagrant_json_update(image_name, version_entry)\n # Load the vagrant JSON file\n json_file = File.new(\"#{Packer::OUTPUT_DIR}/#{image_name}.json\", 'w+')\n json_str = json_file.read\n \n # Load the JSON data\n begin\n json_data = JSON.load json_str\n rescue JSON::ParserError\n json_data = {\n \"name\" => image_name,\n \"versions\" => []\n }\n end\n\n # This will make sure there are no duplicate\n # entries for each box version specified in the\n # JSON file\n json_data['versions'].each_index do |i|\n box_version = json_data['versions'][i]\n if box_version['version'] == version_entry['version']\n json_data['versions'][i].delete\n break\n end\n end\n\n # Insert the new version entry\n json_data['versions'].push version_entry\n \n # Write the thing\n json_file.puts JSON.dump json_data\nend",
"def update\n @artifact = Artifact.find(params[:id])\n\n respond_to do |format|\n if @artifact.update_attributes(params[:artifact])\n format.html { redirect_to @artifact, notice: 'Artifact was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @artifact.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_file.update(inventory_file_params)\n format.html { redirect_to @inventory_file, notice: 'Inventory file was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventory_file }\n else\n format.html { render :edit }\n format.json { render json: @inventory_file.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @inventory_detail.update(inventory_detail_params)\n format.html { redirect_to @inventory_detail, notice: 'Inventory detail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @inventory_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_rest\n @instrument_content = InstrumentContent.find(params[:id])\n\n respond_to do |format|\n if @instrument_content.update_attributes(params[:instrument_content])\n flash[:notice] = 'InstrumentContent was successfully updated.'\n format.html { redirect_to(@instrument_content) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @instrument_content.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update_snapshot(aws_id,commit_state)\n params = {:aws_id => aws_id, :commit_state => commit_state, :api_version => 1.0 }\n json=nil\n SystemTimer.timeout_after(@api_snap_timeout) do\n body = RestClient.put @api_url+\"/update_ebs_snapshot.js\",params\n puts \"UPDATED SNAP: #{aws_id}\"\n end\n json \n rescue Exception => e\n display_exception(e, \"update_snapshot(#{aws_id}, #{commit_state})\")\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /inventory_snapshot_contents/1 DELETE /inventory_snapshot_contents/1.json
|
def destroy
@inventory_snapshot_content.destroy
respond_to do |format|
format.html { redirect_to inventory_snapshot_contents_url, notice: 'Inventory snapshot content was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @inventory_snapshot = InventorySnapshot.find(params[:id])\n @inventory_snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_snapshots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @inventory_snapshot.destroy\n respond_to do |format|\n format.html { redirect_to inventory_snapshots_url, notice: 'Inventory snapshot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @snapshot = Snapshot.find(params[:id])\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to snapshots_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @snapshot = Snapshot.find(params[:id])\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @ebs_snapshot.destroy\n respond_to do |format|\n format.html { redirect_to ebs_snapshots_url, notice: 'Ebs snapshot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def destroy\n @snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(snapshots_url) }\n format.xml { head :ok }\n end\n end",
"def delete_floor_plan(args = {}) \n delete(\"/files.json/floorplan/images\", args)\nend",
"def destroy\n @availability_snapshot = AvailabilitySnapshot.find(params[:id])\n @availability_snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to availability_snapshots_url }\n format.json { head :ok }\n end\n end",
"def delete_aos_version_box(args = {}) \n delete(\"/aosversions.json/aosversionbox/#{args[:aosVersionBoxId]}\", args)\nend",
"def delete(params = {})\n response = client.delete \"/_snapshot/{repository}/{snapshot}\", update_params(params, action: \"snapshot.delete\", rest_api: \"snapshot.delete\")\n response.body\n end",
"def destroy\n @inventory_file.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_files_url }\n format.json { head :no_content }\n end\n end",
"def delete_snapshot(name)\n service.local_delete_snapshot(id, name)\n end",
"def delete_snapshot(name)\n command = 'deleteSnapshot'\n vm_command = %Q{#{@base_command} #{command} \"#{@datastore}\" #{name}}\n log vm_command\n result = system(vm_command)\n result ? log(\"SnapShot deleted successful\") : log(\"Error! VM SnapShot delete failed.\")\n result\n end",
"def destroy\n @s3_snapshot = S3Snapshot.find(params[:id])\n @s3_snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to(s3_snapshots_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @snap = Snap.find(params[:id])\n @snap.destroy\n\n respond_to do |format|\n format.html { redirect_to snaps_url }\n format.json { head :no_content }\n end\n end",
"def delete_snapshot(name)\n unless @vm.exists?\n return Response.new :code => 1, :message => 'VM does not exist'\n end\n\n if Fusion.running?\n running_response = @vm.running?\n return running_response unless running_response.successful?\n\n unless running_response.data\n message = 'A snapshot cannot be deleted when the GUI is running '\n message << 'and the VM is not running.'\n return Response.new :code => 1, :message => message\n end\n end\n\n conf_file_response = @vm.conf_file\n return conf_file_response unless conf_file_response.successful?\n\n snapshots_response = @vm.snapshots\n return snapshots_response unless snapshots_response.successful?\n\n unless snapshots_response.data.include? name\n message = \"Unable to find a snapshot named '#{name}'.\"\n return Response.new :code => 1, :message => message\n end\n\n command = \"#{vmrun_cmd} deleteSnapshot \"\n command << \"'#{conf_file_response.data}' \\\"#{name}\\\" 2>&1\"\n\n command_exec = Fission::Action::ShellExecutor.new command\n Response.from_shell_executor command_exec.execute\n end",
"def delete\n response = Profitbricks.request :delete_snapshot, snapshot_id: self.id\n return true\n end",
"def destroy\n @price_snapshot = PriceSnapshot.find(params[:id])\n @price_snapshot.destroy\n\n respond_to do |format|\n format.html { redirect_to price_snapshots_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Take a file, get all the lines until matching termination_pattern. We are searching for // in particular, which are the termination characters for the cds. TODO: make the method general for any String object, and not for file objects.
|
def get_sequence(file, termination_pattern, keep_last = nil)
assert(file.class == File, "#{file} is not a valid File object.")
assert(termination_pattern.class == Regexp, "#{termination_pattern} is not a valid Regexp object.")
out = ""
line = file.gets
# Continue reading file lines until file ends or
# line match termination_pattern
while (!file.eof? && !line.match(termination_pattern)) do
out += line
line = file.gets # read next line
end
if keep_last
out += line
end
if (!line.match(termination_pattern))
abort("Error: Cannot find termination pattern.")
end
out
end
|
[
"def get_sequence(file, termination_pattern)\n \n assert(file.class == File, \"#{file} is not a valid File object.\")\n assert(termination_pattern.class == Regexp, \"#{termination_pattern} is not a valid Regexp object.\")\n out = \"\"\n line = file.gets\n matchp = !!line.match(termination_pattern) # initialize to False to enter the loop\n \n # Continue reading file lines until file ends or\n # line match termination_pattern\n while (!file.eof? && !line.match(termination_pattern)) do\n out += line\n line = file.gets # read next line\n end\n \n if (!line.match(termination_pattern))\n abort(\"Error: Cannot find termination pattern.\")\n end\n\n out\nend",
"def getFileLineEndings(file)\n File.open(file, 'rb') do |f|\n return f.readline[/\\r?\\n$/]\n end\nend",
"def determine_line_ending(file) \n\t\tdelimiter = nil\n\t\tsaw_cr = false\n\t\tfile.each_byte do |c| \n\t\t\tif c == ?\\n \n\t\t\t\tdelimiter = nil # Let CSV take care of it\n\t\t\t\tbreak\n\t\t\telsif c == ?\\r then\n\t\t\t\tsaw_cr = true\n\t\t\telsif saw_cr then\n\t\t\t\tif c == ?\\n then\n\t\t\t\t\tdelimiter = nil # Let CSV take care of it\n\t\t\t\t\tbreak\n\t\t\t\telse\n\t\t\t\t\tdelimiter = ?\\r\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tfile.rewind\n\t\treturn delimiter\n\tend",
"def collect_lines_matching(pattern = //, &block)\n pattern = [pattern].flatten\n lines = Lines.new\n self.each { |f|\n io = File.open(f)\n io.each { |line|\n if matching?(line, pattern)\n lines << MatchedLine.new(line, :file => f, :line_number => io.lineno, :pattern => pattern)\n end\n }\n }\n lines\n end",
"def find_next_newline\n @line_cursor = @search_boundary.cursor\n @file.seek(@line_cursor)\n while (current_char = @file.getc) != NEWLINE_CHAR && !current_char.nil?\n @line_cursor += 1\n end\n if @file.eof?\n \"\"\n else\n @line_cursor += 1\n @file.seek(@line_cursor)\n @file.readline\n end\n end",
"def filter\n read = []\n @file.each do |line|\n line = line.strip\n if !line[0].nil? && (line[0] != '/') # if line is not comment or blank append to output\n line = line.split(' ')[0] # removes inline comments\n read.append(line)\n end\n end\n read\n end",
"def match_multilines(pattern)\n data = Array.new\n content = File.open(IN_FILE, 'r') {|f| f.read}\n content.scan(pattern).each do |m|\n data << m\n end\n data\n end",
"def grep_file(file_path, grep_pattern)\n logc(\"method: #{__method__}, params: #{file_path}, #{grep_pattern}\")\n\n # with File.open(file_path, 'r').each.grep(grep_pattern) possible invalid byte sequence in UTF-8 (ArgumentError)\n # so we use \"match\" to check if line match pattern and 'scrub' to skip bad encoding symbols\n res = []\n File.open(file_path, 'r').each {|line| res << line if line.scrub.match(grep_pattern)}\n return res\nend",
"def get_lines(filename); end",
"def find_matching_lines file_path, search_string, results\n #puts file_path\n begin\n f = File.new file_path\n i=0\n f.each do |line|\n i += 1\n unless line.index(search_string).nil?\n # match\n results.push \"#{file_path}:#{i}: #{line}\"\n end\n end\n rescue\n # ignore\n end\nend",
"def read_file(file)\n lines = []\n IO.foreach(find(file)) do |line|\n lines << line.strip unless line.strip == ''\n end\n lines\n end",
"def lines(textFile)\n textFile.to_a.select {|line| /\\S/ =~ line and /^\\#/ !~ line}.length\nend",
"def iterate_several_file file_path\n #Iterate file line by line\n result_lines_in_file = []\n reg = /.*#{@phrase_we_have_now}.*/\n file = File.open(file_path, \"r\") do |f|\n f.each_line do |line|\n if line.match?(reg)\n result_lines_in_file << line\n end\n end\n end\n result_lines_in_file\n end",
"def parse_file(filename)\n entry_text = \"\"\n entries = []\n File.open(filename).each_line do |line|\n if line.include? @@entry_separator\n entry = parse_entry(entry_text)\n entry_text = \"\"\n entries << entry\n else\n entry_text << line\n end\n end\n entries\n end",
"def edit_text_detect_line_endings(input_file, opts = {})\n data, _status_code, _headers = edit_text_detect_line_endings_with_http_info(input_file, opts)\n data\n end",
"def read_lines\n\t\t@open_file.read.split(/\\n/).reject{ |r| r == \" \"}\n\tend",
"def find_post_content(file_contents, match, close_length)\n lines = file_contents.split(\"\\n\")\n length = (match.length - 1)\n lines.each do |line|\n next unless line[0..length] == match\n chars = line.split('')\n chars.shift(match.length)\n chars.pop(close_length)\n return chars.join('')\n end\n false\n end",
"def read_file( file_name )\n if File.exists?( file_name )\n file = File.open( file_name, \"r\" )\n contents = []\n file.each do |line|\n unless line.match( /^#/ ) || line.match( /^ *$/ )\n contents << line.chomp\n end\n end\n file.close\n return contents\n end\n end",
"def filter_lines(options={}) \n options = { :regexp => '', # regexp to use for filtering out\n :print_to_file => false, # where to print result\n }.merge(options)\n\n line_no = 0\n per_input_line do |line|\n begin\n line_no = line_no + 1\n if (!line.match(options[:regexp]))\n print_line(line, options[:print_to_file])\n end\n rescue\n print \"Error scanning through file : #{options[:inputfilename]} at line no #{line_no} \\n\"\n print \" Likely an invalid character, please check\\n\"\n raise\n end\n end\n\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
group sequence in 80 characters lines long the 80th character is '\n' TODO: try to pass sequence by reference (think 'yeld' statement is involved)
|
def group_sequence (sequence, length)
temp_sequence = ""
index = 0; cont = 0
while sequence[index] != nil do
temp_sequence += sequence[index]
index += 1
if cont < length - 1
cont += 1
else
temp_sequence += "\n"
cont = 0
end
end
temp_sequence
end
|
[
"def group_sequence (sequence)\n\n temp_sequence = \"\"\n index = 0; cont = 0\n while sequence[index] != nil do\n temp_sequence += sequence[index]\n index += 1\n if cont < $MAX_LENGTH - 1\n cont += 1\n else\n temp_sequence += \"\\n\"\n cont = 0\n end\n end\n temp_sequence\nend",
"def line_to_wrap; end",
"def lines_groups\n @lines_groups = []\n #current_split = ''\n split_count = 0\n\n #@lines_groups ||= text.collect.with_index do |line, i|\n text.each do |line|\n split_line = line.split( /\\s{2,}/ ).reject! {|e| e == '' }\n $stderr.puts \"SPLIT LINE: #{split_line}\"\n # If we're looking at at least one blank area, we need to start a new group.\n if split_line.nil? || split_count == 0\n split_count += 1\n @lines_groups << []\n # Guard against possibly first line being nil.\n @lines_groups.last << split_line unless split_line.nil?\n elsif !split_line.nil? && split_count > 0\n @lines_groups.last << split_line.flatten #.map {|e| e.squish }\n #unless split_line.nil?\n #{\n # index: i, \n # line: split_line, \n # line_size: split_line.length\n #}\n else\n end\n end\n @lines_groups.flatten\n end",
"def word_wrap(text, line_width: 80, break_sequence: \"\\n\")\n text.split(\"\\n\").collect! do |line|\n line.length > line_width ? line.gsub(/(.{1,#{line_width}})(\\s+|$)/, \"\\\\1#{break_sequence}\").rstrip : line\n end * break_sequence\n end",
"def split_long_line(line)\n if line.length <= 90\n yield line\n else\n until line.empty?\n if line.length <= 90\n yield line\n line = ''\n else\n yield line.slice(0, find_space(line, 90))\n line = line.slice(find_space(line, 90), line.length).strip\n end\n end\n end\n end",
"def dump_new_lines\n collection.each do |group_of_chars|\n group_of_chars.reject! { |string| string == NEW_LINE unless group_of_chars.size == 1 }\n end\n end",
"def range_by_lines(range); end",
"def print_sequence\n @sequence.each_slice(8, &method(:print_group))\n end",
"def wrap(text, line_width = 100)\n text.gsub(/(.{1,#{line_width}})/, \"\\\\1\\n\")\n end",
"def string_wrap(text)\n if text.length < 75\n text\n else\n text.strip.split(\"\\n\").join(\"\").gsub(/(.{1,75})( +|$\\n?)|(.{1,75})/,\"\\\\1\\\\3\\n\")\n end\n end",
"def alignContinuations(theLines)\n\n\tsplitAndAlign(theLines, /^(.*?)\\s+(\\\\)$/, \"\");\n\nend",
"def break_to_newline\n end",
"def sequence_separator; end",
"def wrap_lines(input_string)\n return [' '] if input_string.empty?\n output_string = ''\n if input_string.length > 40\n (input_string.length / 40).times do\n if input_string[39].scan(/[\\^#]/).empty?\n output_string += input_string.slice!(input_string[0..39]) + \"\\n\"\n else\n output_string += input_string.slice!(input_string[0..38]) + \"\\n\"\n end\n end\n end\n output_string += input_string\n output_string\n\n output_string.split(\"\\n\")\n end",
"def group_in(n = 0)\n self.scan(/.{#{n}}|.+/).join(\" \")\n end",
"def split_lines(str, length = 79, delim = \"\\n\\t\")\n str.to_s.scan(/.{#{length}}/).join(delim)\n end",
"def pad_multi_line(text)\n text.split(\"\\n\", -1).map { |part| pad_around(part) }.join(\"\\n\")\n end",
"def join_lines\n\t\toutput = []\n\t\tn = 0\n\t\twhile n < @lines.length do\n\t\t\tcur_line = n \n\t\t\tlonger_line = String.new;\n\t\t\t\n\t\t\tif @lines[cur_line].text[-1] == '\\\\'\n\t\t\t\tlonger_line = @lines[cur_line].text.chop()\n\t\t\t\tcur_line += 1\n\t\t\t\tlonger_line += @lines[cur_line].text\n\t\t\t\tlonger_line.chop!() if longer_line[-1] == '\\\\'\n\t\t\tend\n\t\t\twhile @lines[cur_line].text[-1] == '\\\\'\n\t\t\t\tcur_line += 1\n\t\t\t\tlonger_line += @lines[cur_line].text[0..-2]\n\t\t\tend\n\t\t\t\n\t\t\t# if there were joined lines\n\t\t\tif n < cur_line\n\t\t\t\t@lines[n].text = longer_line\n\t\t\t\t\n\t\t\t\t# catch up\n\t\t\t\twhile n < cur_line\n\t\t\t\t\tn += 1\n\t\t\t\t\t@lines[n].text = nil\n\t\t\t\tend\n\t\t\tend\n\t\t\tn += 1\n\t\tend\n\tend",
"def print_line(ch); 80.times{print ch}; print \"\\n\"; end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Send the user an email saying the bulk observation import encountered an error.
|
def bulk_observation_error( user, filename, error_details )
@user = user
@message = error_details[:reason]
@errors = error_details[:errors]
@field_options = error_details[:field_options]
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:were_sorry_but_your_bulk_import_of_filename_has_failed,
{ filename: filename }
]
)
end
|
[
"def bulk_observation_error(user, observation_file, error_details)\n setup_email(user)\n @subject << \"We're sorry but your bulk import of #{observation_file} has failed.\"\n\n @message = error_details[:reason]\n @errors = error_details[:errors]\n @field_options = error_details[:field_options]\n\n mail(:to => \"#{user.name} <#{user.email}>\", :subject => @subject, :from => @from)\n end",
"def bulk_observation_success(user, observation_file)\n setup_email(user)\n @subject << \"The bulk import of #{observation_file} has been completed successfully.\"\n @filename = observation_file\n mail(:to => \"#{user.name} <#{user.email}>\", :subject => @subject, :from => @from)\n end",
"def startup_import_failed(user)\n @user = user\n mail(:to => user.email, :subject => _('Startup import failed on %s.') % [\n Doers::Config.app_name])\n end",
"def bulk_observation_success( user, filename )\n @user = user\n @filename = filename\n mail_with_defaults(\n to: \"#{user.name} <#{user.email}>\",\n subject: [\n :bulk_import_of_filename_is_complete,\n { filename: filename }\n ]\n )\n end",
"def notify_admin_parse_launch_fail(study, study_file, corresponding_user, ingest_action, error)\n dev_email_config = AdminConfiguration.find_by(config_type: 'QA Dev Email')\n # if QA Dev email is configured, use that over individual admin emails\n if dev_email_config.present?\n emails = [dev_email_config.value]\n else\n emails = User.where(admin: true).map(&:email)\n end\n @user = corresponding_user\n @study = study\n @study_file = study_file\n @error = error\n @action = ingest_action\n title = 'Ingest Pipeline Launch Failure'\n mail(to: emails, subject: '[Single Cell Portal Admin Notification] ' + title)\n end",
"def import_finished_error_email(user)\n @user = user\n @url = read_url locale: user.locale\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def handleLIMSUploadError(cmd)\n obj = EmailHelper.new()\n\n emailFrom = \"sol-pipe@bcm.edu\"\n emailTo = obj.getErrorRecepientEmailList()\n emailSubject = \"Error in uploading analysis results to LIMS\"\n emailText = \"Results could not be uploaded to LIMS. Cmd used was : \" +\n cmd\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n end",
"def failed_items_controller_api_request(error_code_and_message)\n begin\n emails = AdminUser.where(email_notifications:true).pluck(:email)\n mail(:to => emails, :subject => \"Problem occurred updating bib availability\")\n rescue => e\n LogWrapper.log('ERROR', {\n 'message' => \"Cannot send failed_items_controller_api_request notification email. Backtrace=#{e.backtrace}.\",\n 'method' => 'AdminMailer.failed_items_controller_api_request'\n })\n raise e\n end\n end",
"def notify_user_upload_fail(study_file, study, user)\n @study_file = study_file\n @study = study\n dev_email_config = AdminConfiguration.find_by(config_type: 'QA Dev Email')\n dev_email = dev_email_config.present? ? dev_email_config.value : nil\n title = \"#{study_file.upload_file_name} did not finish uploading\"\n mail(to: user.email, bcc: dev_email, subject: '[Single Cell Portal Notifier] ' + title)\n end",
"def exception_occured(exception)\n @exception = exception\n mail subject: \"Exception Occured During Running\"\n end",
"def send_error_email(error)\n @error = error\n mail( :to => 'cave.survey.project+error@gmail.com',\n :subject => 'Error reported' )\n end",
"def export_finished_error_email(user)\n @user = user\n @url = read_url locale: user.locale\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def send_failure_report\n return if @failed_orders.blank?\n failed_orders = ['Order, Tracking, ParcelId, Quantity, Date, Error_Message, Country'] + @failed_orders\n Spree::InnotracMailer.csv(failed_orders.join(\"\\n\"), 'innotrac', \"Sand & Sky : INNOTRAC Failed Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def send_failure_report\n failed_orders = ['Order, Tracking, ParcelId, Quantity, Date, Error_Message, Country'] + @failed_orders\n Spree::NinjavanMailer.csv(failed_orders.join(\"\\n\"), 'ninjavan', \"Sand & Sky : NINJAVAN Failed Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def send_email\n emails = @all_notices\n emails = emails.concat(@error_notices).uniq unless @errors.empty?\n\n LoaderMailer.output_email(title, emails, output).deliver_now\n log_warning(SENT_EMAIL, \"to #{emails.join(', ')} on #{Time.now.strftime('%c')}\")\n end",
"def notify_submitter_of_import_errors(commit)\n @commit = commit\n submitter_emails = [@commit.author_email, @commit.user.try!(:email)].compact.uniq\n if submitter_emails.present? && @commit.import_errors.present?\n mail to: submitter_emails, subject: t('mailer.commit.notify_submitter_of_import_errors.subject')\n end\n end",
"def failed_bibs_controller_api_request(request_body, error_code_and_message, action_name, teacher_set)\n begin\n @teacher_set = teacher_set\n @action_name = action_name\n @request_body = request_body\n @error_code_and_message = error_code_and_message\n emails = AdminUser.where(email_notifications:true).pluck(:email)\n mail(:to => emails, :subject => \"Problem occurred updating bib from Sierra\")\n rescue => e\n LogWrapper.log('ERROR', {\n 'message' => \"Cannot send failed_bibs_controller_api_request notification email. Backtrace=#{e.backtrace}.\",\n 'method' => 'AdminMailer.failed_bibs_controller_api_request'\n })\n raise e\n end\n end",
"def send_failure_report\n return if @failed_orders.blank?\n failed_orders = ['Order, Tracking, Quantity, Date, Error_Message, Country'] + @failed_orders\n send_report_email(failed_orders.join(\"\\n\"), \"Sand & Sky : #{@carrier.upcase} Failed Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\")\n end",
"def error(error_recipients, job, execution_message, error_message)\n @application = Ubiquo::Settings.get(:app_name)\n @job = job\n @error_message = error_message\n @execution_message = execution_message\n\n subject = \"[#{app_name} #{Rails.env} CRON JOB ERROR] for job: #{job}\"\n mail(:to => error_recipients,\n :subject => subject)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Send the user an email saying the bulk observation import was successful.
|
def bulk_observation_success( user, filename )
@user = user
@filename = filename
mail_with_defaults(
to: "#{user.name} <#{user.email}>",
subject: [
:bulk_import_of_filename_is_complete,
{ filename: filename }
]
)
end
|
[
"def bulk_observation_success(user, observation_file)\n setup_email(user)\n @subject << \"The bulk import of #{observation_file} has been completed successfully.\"\n @filename = observation_file\n mail(:to => \"#{user.name} <#{user.email}>\", :subject => @subject, :from => @from)\n end",
"def bulk_observation_error(user, observation_file, error_details)\n setup_email(user)\n @subject << \"We're sorry but your bulk import of #{observation_file} has failed.\"\n\n @message = error_details[:reason]\n @errors = error_details[:errors]\n @field_options = error_details[:field_options]\n\n mail(:to => \"#{user.name} <#{user.email}>\", :subject => @subject, :from => @from)\n end",
"def bulk_observation_error( user, filename, error_details )\n @user = user\n @message = error_details[:reason]\n @errors = error_details[:errors]\n @field_options = error_details[:field_options]\n mail_with_defaults(\n to: \"#{user.name} <#{user.email}>\",\n subject: [\n :were_sorry_but_your_bulk_import_of_filename_has_failed,\n { filename: filename }\n ]\n )\n end",
"def startup_imported(project)\n @project = project\n mail(:to => project.user.email, :subject => _('%s imported to %s.') % [\n project.title, Doers::Config.app_name])\n end",
"def send_email\n emails = @all_notices\n emails = emails.concat(@error_notices).uniq unless @errors.empty?\n\n LoaderMailer.output_email(title, emails, output).deliver_now\n log_warning(SENT_EMAIL, \"to #{emails.join(', ')} on #{Time.now.strftime('%c')}\")\n end",
"def startup_import_failed(user)\n @user = user\n mail(:to => user.email, :subject => _('Startup import failed on %s.') % [\n Doers::Config.app_name])\n end",
"def import_finished_error_email(user)\n @user = user\n @url = read_url locale: user.locale\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def export_finished_success_email(user, filename, opml)\n @user = user\n @url = read_url locale: user.locale\n attachments[filename] = opml\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def notify_success!\n mail[:subject] = \"[Backup::Succeeded] #{model.label} (#{model.trigger})\"\n mail[:body] = read_template('notify_success', Binder.bind(:model => @model))\n mail.deliver!\n end",
"def documents_finished_processing(account, document_count)\n @account = account\n @count = document_count\n mail({\n :to => account.email, :subject => DC.t(account,'documents_are_ready'),\n :content_type => \"text/plain\",\n :template_path => translation_path_for( account.language )\n })\n end",
"def send_success_report\n return if @success_orders.blank?\n success_orders = ['Order, SKU, Tracking, ParcelId, Quantity, Date, Country'] + @success_orders\n Spree::InnotracMailer.csv(success_orders.join(\"\\n\"), 'innotrac', \"Sand & Sky : INNOTRAC Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def perform\n current_time = Time.now\n packages = find_packages(city_db_id)\n emails = find_emails(city_db_id)\n\n ## Create list of recipients as array of strings\n recipients = []\n emails.each do |email|\n recipients << email.email_value\n end\n\n Emailer.packages_notification(current_time,packages,recipients).deliver\n end",
"def send_success_report\n success_orders = ['Order, SKU, Tracking, ParcelId, Quantity, Date, Country'] + @success_orders\n Spree::NinjavanMailer.csv(success_orders.join(\"\\n\"), 'ninjavan', \"Sand & Sky : NINJAVAN Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\").deliver\n end",
"def notify_success!\n twitter_client.update(\"[Backup::Succeeded] #{model.label} (#{ File.basename(Backup::Model.file) })\")\n end",
"def export_finished_error_email(user)\n @user = user\n @url = read_url locale: user.locale\n I18n.with_locale user.locale do\n mail to: @user.email\n end\n end",
"def email_on_complete\n count = options['email_me']\n return unless count && count > 0\n if Document.owned_by(document.account).pending.count == 0\n LifecycleMailer.documents_finished_processing(document.account, count).deliver_now\n end\n end",
"def import_all\n EmailAccount.active.each do |email_account|\n log \"Importing #{email_account.username}\"\n email_account.loggers = self.loggers\n email_account.import_emails\n log \"Done importing #{email_account.username}\"\n end\n true\n end",
"def send_success_report\n return if @success_orders.blank?\n success_orders = ['Order, SKU, Tracking, Quantity, Date, Country'] + @success_orders\n send_report_email(success_orders.join(\"\\n\"), \"Sand & Sky : #{@carrier.upcase} Shipments Report(#{Time.now.strftime('%d/%m/%Y')})\")\n end",
"def send_survey_completion_emails\n return unless EMAILS_ENABLED\n\n UserMailer.survey_completed(@sheet).deliver_now\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns name; converts broadcast label to shared to be consistent with google
|
def name
@name == 'broadcast' ? 'shared' : @name
end
|
[
"def symbol_to_name(sym)\n parts = sym.to_s.split(\"_\").map(&:capitalize)\n parts[0].downcase!\n \"ga:\" + parts.join('')\n end",
"def handle_name(event)\n broadcast :name, @room, @name = event['content']['name']\n end",
"def label\n @client.get('host', :name_label, @uuid)\n end",
"def broadcast_target_default\n model_name.plural\n end",
"def name label\n label(label)\n end",
"def join_event_name\n if self.shared_to == TrackedLink::SHARED_TO_EMAIL && self.link_type != TrackedLink::TYPE_INVITATION\n return \"invitation.#{self.link_type}.join\"\n else\n return \"invitation.#{self.shared_to}.join\"\n end\n\n end",
"def label(name, global = false)\n global_opt = (global) ? 'global ' : ''\n microcode global_opt + name + ':' unless @inhibit_vectors\n end",
"def shortname\n Socket.gethostname.split(\".\")[0]\n end",
"def route_name\n @name = start_station + '-' + last_station\n end",
"def sender_name(kh)\n @names[kh]\n end",
"def activity_name\n @prefix_name\n end",
"def activity_name_from_activity_type(name)\n return name.to_s.split(\".\").last.to_sym\n end",
"def network_coded_name\n network.coded_name\n end",
"def common_event_name(id)\n name(DataManager.common_events[id].name)\n end",
"def network_name\n return self.class.generate_network_name(@configuration_id) unless use_existing_network?\n\n @gcp_config['network']\n end",
"def network_label\n network == \"users\" ? \"\" : network\n end",
"def common_event_name(id)\n name($data_common_events[id].name)\n end",
"def tracking_service_name\n end",
"def predict_group_name(cluster)\n first_val = cluster[0][:val]\n # find longest common substring\n group_name = cluster.inject(first_val) do |intersection, point|\n find_longest_common_substring(intersection, point[:val])\n end\n # take the longest word possibly joined with '&' or '-'\n if (group_name != '')\n group_name = group_name.scan(/[[:alnum:]|&|-[:alnum]]+/).sort_by(&:length).last\n else\n puts group_name.class\n group_name = 'Person'\n end\n group_name\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Usage: Google::Reader::Label.new('friends').entries Google::Reader::Label.new('friends').entries(:all, :n => 25) Google::Reader::Label.new('friends').entries(:unread) Google::Reader::Label.new('friends').entries(:unread, :n => 25) To use with continuations: unread = Google::Reader::Label.new('friends').entries(:unread) next_unread = Google::Reader::Label.new('friends').entries(:unread, :c => unread.continuation) The examples above would grab the first 15 unread entries and then using google reader's continuations, the next 15 unread after the first 15.
|
def entries(which=nil, o={})
options = {:n => 15,}.merge(o)
query_str = valid_keys_to_query_string(o)
url = case which.to_s
when 'unread'
sprintf(LABEL_URL, @name) + "?xt=#{State::READ}&#{query_str}"
else
sprintf(LABEL_URL, @name)
end
self.class.get_entries(url, :continuation => true)
end
|
[
"def unread_items(limit = 5)\n # Find labeled items, excluding read items.\n label = \"atom/user/-/label/#{CGI.escape @label}\"\n filter = \"user/-/state/com.google/read\"\n order = \"o\" # oldest first\n response = @google_reader_api.get_link label, :n => limit, :xt => filter, :r => order\n @entry_api.entries(response).map { |e| Tweader::ReaderItem.new(e, @entry_api) }\n end",
"def unread_items(count = 20)\n create_entries get_feed_items(:n => count,:xt => 'user/-/state/com.google/read')\n end",
"def delegates_get_next_forgers limit = 10\n params = { :limit => limit }\n forgers = @client.query_get \"delegates/getNextForgers\", params\n end",
"def last_n_messages n = 1\n messages(:per_page => n, :page => 1)\n end",
"def get_entries(limit = nil)\n limit ||= -1\n prepare_entries(LiveJournal::Request::GetFriendsPage.new(@user, :recent => limit, :strict => false).run)\n rescue exception_block\n end",
"def initial_unread_entries\n update unread_entries: feed.entries.count\n end",
"def feed_entries(feed, include_read: false, page: nil)\n EntriesPagination.feed_entries feed, self, include_read: include_read, page: page\n end",
"def following(count=10)\n count = 0 if count.is_a?(Symbol) && count == :all\n query = \"SELECT * FROM meme.following(#{count}) WHERE owner_guid='#{self.guid}'\"\n parse = Request.parse(query)\n if parse\n results = parse['query']['results']\n results.nil? ? nil : results['meme'].map {|m| Info.new(m)}\n else\n parse.error!\n end\n end",
"def retrieve_notifications\n\tunread = self.notifications.where(\"read = ?\", false).order(\"created_at DESC\")\n\t\n\tif unread.count < 10\n\t\tread = self.notifications.where(\"read = ?\", true).order(\"created_at DESC\").limit(10 - unread.count)\n\t\t\n\t\tunread = unread.concat(read)\n\tend\n\t\n\treturn unread\n end",
"def fetch_pages(response, limit, type)\n pages = [GoogleApps::Atom.feed(response.body)]\n\n while (pages.last.next_page) and (pages.count * PAGE_SIZE[:user] < limit)\n pages << get_next_page(pages.last.next_page, type)\n end\n pages\n end",
"def latest_entries(n)\n Entry.find(:all, :order => 'created_at DESC', :limit => n)\n end",
"def activities(start = 0, limit = 100)\n redis.call 'LRANGE', key[:activities], start, start + limit\n end",
"def more_messages\n log \"Getting more_messages\"\n log \"Old start_index: #@start_index\"\n max = @start_index - 1\n @start_index = [(max + 1 - @limit), 1].max\n log \"New start_index: #@start_index\"\n fetch_ids = search_query? ? @ids[@start_index..max] : (@start_index..max).to_a\n log fetch_ids.inspect\n message_ids = fetch_and_cache_headers(fetch_ids)\n res = get_message_headers message_ids\n with_more_message_line(res)\n end",
"def get_envelopes text\n @current_label = text\n $break_fetch = false\n #@message_uids = []\n @messages = [] # hopefully unused\n #Thread.new {\n begin\n ctr = 0\n @gmail.label(text) do |mailbox|\n # TODO. praps a progress bar also.\n unreaduids = []\n unread = mailbox.emails(:unread)\n urc = unread.size\n dispstr = \" #{text} : unread #{urc} \"\n message_immediate dispstr\n $unread_hash[text] = urc\n allmails = mailbox.emails(:read)\n allmails.insert 0, *unread\n total = allmails.size\n dispstr << \" total: #{total} \"\n unread.each do |email|\n unreaduids << email.uid\n end\n @unreaduids = unreaduids\n dispstr << \" getting UIDs ..\"\n message_immediate dispstr\n uids = []\n allmails.each do |email|\n uids << email.uid\n @uid_message[email.uid] = email\n end\n message_immediate \"getting envelopes. unread: #{urc} total: #{total} \"\n raw_progress 0.25\n\n envelopes = @gmail.connection.uid_fetch(uids, \"(UID ENVELOPE)\")\n # may need to reverse sort this !! TODO\n # reversing means we've lost the link to UID !!! so we redo the list\n return unless envelopes\n lines = []\n envelopes.reverse.each_with_index { |ee, index| \n raw_progress([index+1, total])\n e = ee.attr[\"ENVELOPE\"]\n uid = ee.attr[\"UID\"]\n #@message_uids << uid UNUSED\n flag = unreaduids.include?(uid) ? \"N \" : \" \"\n if @starred_uids.include?(uid)\n flag[1]=\"+\"\n end\n date = e.date # .to_s #[5..10]\n date = Date.parse(date).strftime(\"%b %d\")\n #$log.debug \"name: XXX #{e.from[0].name} \"\n #$log.debug \"name: XXX #{e.from[0].class} \" unless e.from[0].nil?\n # name returns an Array, which crashes sort - therefore to_s, but says String\n from = e.from[0].name.to_s # why blank some times FIXME\n from = e.from[0].mailbox.to_s if from == \"\"\n #@lb2.append([ flag, ctr+1 , from, e.subject ,date])\n #lines << [ flag, ctr+1 , from, e.subject ,date, uid]\n lines << [ flag, from, e.subject ,date, uid]\n ctr+=1\n @messages << e\n break if ctr >= @max_to_read\n break if $break_fetch # can only happen in threaded mode\n }\n @lb2.estimate_column_widths=true # this sort of fails if we keep pushing a row at a time\n @lb2.set_content lines\n #message \" #{text} showing #{ctr} of #{total} messages\"\n #@message_label.repaint\n @form.repaint\n end\n rescue => ex\n $log.debug( \"EXC thread.rb rescue reached. \")\n if ex\n $log.debug( ex)\n $log.debug(ex.backtrace.join(\"\\n\"))\n message \"EXCEPTION IN THREAD: #{ex} Reconnect using M-c\"\n @message_label.repaint\n @window.refresh\n gmail_connect # this should only happen in imap error not just any\n end\n end\n #}\nend",
"def refresh\n #@gmail.inbox.find(:unread) do |email|\n raw_message \"Fetching ...\"\n ctr = 0\n begin\n @gmail.label(\"INBOX\") do |mailbox|\n unread = mailbox.emails(:unread) \n total = unread.size\n unread.each_with_index do |email, index| \n uid = email.uid\n if !@unreaduids.include? uid\n @unreaduids << uid\n ctr += 1\n env = email.envelope\n row = convert_message_to_row env, uid\n @lb2.insert 0, row\n end\n raw_progress([index, total])\n end\n end\n raw_message \"#{ctr} new messages in inbox.\"\n #refresh_labels\n rescue => ex\n $log.debug( \"EXC refresh rescue reached. \")\n print_error ex\n end\n\nend",
"def refresh_labels\n #message_immediate \" inside refresh labels \"\n raw_message \"Getting label information...\"\n @labels ||= @gmail.labels.all\n total = @labels.size\n @labels.each_with_index { |text, index| \n next if text == \"[GMAIL]\"\n begin\n @gmail.label(text) do |mailbox|\n unread = mailbox.emails(:unread) # maybe this causes an issue internally\n urc = unread.size\n #message_immediate \" mailbox #{text} has #{urc} unread \"\n $unread_hash[text] = urc\n raw_progress([index+1, total])\n end\n rescue => ex\n $log.debug \" refresh_labels :: ERROR in mailbox #{text} ... #{ex}\" if $log.debug? \n next\n end\n }\n @dirs.repaint_required(true)\n message_immediate \" Ready\"\nend",
"def entries(n=Readline::HISTORY.size)\n size=Readline::HISTORY.size\n Readline::HISTORY.to_a[(size - n)..size-1]\n end",
"def folder_entries(folder, include_read: false, page: nil)\n EntriesPagination.folder_entries folder, self, include_read: include_read, page: page\n end",
"def new_judgings(n = 100)\n\t\tresult = api_get('judgings', cid: contest_id, limit: n,\n\t\t fromid: last_judging)\n\t\tself.last_judging = result.last['id'] + 1 unless result.empty?\n\t\tresult\n\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /multi_boards/1 GET /multi_boards/1.json
|
def show
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @multi_board }
end
end
|
[
"def index\n\t\tuid = current_user().id\n\t\t@boards = User.find(uid).boards\n\n\t\trender :json => @boards\n end",
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def boards\n return @boards if @boards\n @boards = Client.get(\"/organizations/#{id}/boards/all\").json_into(Board)\n end",
"def get_user_boards\n board = Board.where(user_id: current_user.id)\n render json: board\n end",
"def boards(options = { :filter => :all })\n return @boards if @boards\n @boards = Client.get(\"/members/#{username}/boards\", options).json_into(Board)\n end",
"def get_shared_boards\n boards = BoardAccess.where(user_id: current_user.id)\n render json: boards.map {|access| Board.find(access.board_id)}\n end",
"def boards\n return @boards unless @boards.empty?\n\n endpoint = \"/1/members/#{username}/boards?\"\n response = Client.get(endpoint)\n\n @boards = response.map do |board|\n Board.new(id: board['id'], name: board['name'])\n end\n end",
"def index\n @boards = Board.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end",
"def index\n @boards = query(Board, :name, :fullname)\n\n respond_to do |format|\n format.html\n format.xml { render :xml => @boards }\n end\n end",
"def get_boards options\n make_request :get, APPS_URL, :boards, options, [:sorttype]\n end",
"def index\n @man_boards = ManBoard.all\n end",
"def index\n @boards = Board.root_boards\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @boards }\n end\n end",
"def index\n @project_boards = ProjectBoard.all\n end",
"def boards\n options = { query: credentials.merge(filter: 'open') }\n self.class.get('/members/me/boards', options)\n end",
"def index\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @message_boards }\n end\n end",
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def show\n @motherboard = Motherboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @motherboard }\n end\n end",
"def show\n @baseboard = Baseboard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baseboard }\n end\n end",
"def boards(fields: nil)\n get_boards_collection(\"/me/boards/\", nil, fields)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /multi_boards/new GET /multi_boards/new.json
|
def new
@multi_board = MultiBoard.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @multi_board }
end
end
|
[
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @board = Board.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board }\n end\n end",
"def new\n return\n @board = Board.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @board }\n end\n end",
"def create\n @board = current_user.boards.new(board_params)\n if @board.save\n render :show, status: :created\n else\n render json: @board.errors, status: :unprocessable_entity\n end\n end",
"def new\n @board2 = Board2.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board2 }\n end\n end",
"def new\n @board_info = BoardInfo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_info }\n end\n end",
"def new\n @motherboard = Motherboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @motherboard }\n end\n end",
"def new\n @motherboard = Motherboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @motherboard }\n end\n end",
"def create\n @user = current_user\n @board = @user.boards.create(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def new\n @mainboard = Mainboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mainboard }\n end\n end",
"def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_board }\n end\n end",
"def new\n @toushikomon_board = ToushikomonBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @toushikomon_board }\n end\n end",
"def new\n @test_board = TestBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_board }\n end\n end",
"def new\n @newsboard = Newsboard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsboard }\n end\n end",
"def new\n @corkboard = current_user.corkboards.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @corkboard }\n end\n end",
"def new\n @board_content = BoardContent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @board_content }\n end\n end",
"def new\n @user_collaborates_on_board = UserCollaboratesOnBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user_collaborates_on_board }\n end\n end",
"def new\n @free_board = FreeBoard.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @free_board }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /multi_boards POST /multi_boards.json
|
def create
@multi_board = MultiBoard.new(params[:multi_board])
respond_to do |format|
if @multi_board.save
format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }
format.json { render json: @multi_board, status: :created, location: @multi_board }
else
format.html { render action: "new" }
format.json { render json: @multi_board.errors, status: :unprocessable_entity }
end
end
end
|
[
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def create\n @board = current_user.boards.new(board_params)\n if @board.save\n render :show, status: :created\n else\n render json: @board.errors, status: :unprocessable_entity\n end\n end",
"def create\n @user = current_user\n @board = @user.boards.create(board_params)\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board }\n format.json { render :show, status: :created, location: @board }\n else\n format.html { render :new }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def save_board\n if params[:_json].nil?\n render json: {error: \"Invalid parameters\"}\n return\n end\n params[:_json].each do |table|\n if table[:id].nil?\n card_table = CardTable.new({name: table[:name], column_index: table[:column_index], board_id: table[:board_id]})\n card_table.save\n table[:id] = card_table.id\n else\n board = CardTable.find_by(id: table[:id])\n board.update({name: table[:name], column_index: table[:column_index], board_id: table[:board_id]})\n end\n table[:cards].each do |card|\n if card[:id].nil?\n saved_card = Card.new({card_table_id: table[:id], name: card[:name], completed: card[:completed], description: card[:description], priority: card[:priority], due_date: card[:due_date]})\n saved_card.save\n else\n saved_card = Card.find_by(id: card[:id])\n saved_card.update({card_table_id: table[:id], name: card[:name], completed: card[:completed], description: card[:description], priority: card[:priority], due_date: card[:due_date]})\n end\n end\n end\n end",
"def create\n @board = Roxiware::Forum::BoardGroup.order(:display_order).last.boards.build\n @board.assign_attributes(params[:forum_board], :as=>@role)\n @board.display_order = Roxiware::Forum::Board.maximum('display_order')+1;\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, :notice => 'Forum Board was successfully created.' }\n format.json { render :json => @board.ajax_attrs(@role) }\n else\n format.html { redirect_to @board, :alert => 'Failure in creating forum board.' }\n format.json { render :json=>report_error(@board)}\n end\n end\n end",
"def create_new_board(name)\n headers = {\n \"X-CSRFToken\" => csrftoken(),\n \"X-Pinterest-Referrer\" => \"http://pinterest.com/\",\n \"X-Requested-With\" => \"XMLHttpRequest\",\n }\n body = {\n :name => name,\n :pass_category => true,\n } \n res = post \"https://pinterest.com/board/create/\", body, headers\n JSON.parse res.content\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, :notice => 'Board was successfully created.' }\n format.json { render :json => @board, :status => :created, :location => @board }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @board.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def destroy\n @multi_board = MultiBoard.find(params[:id])\n @multi_board.destroy\n\n respond_to do |format|\n format.html { redirect_to multi_boards_url }\n format.json { head :no_content }\n end\n end",
"def create\n @board = Board.new(params[:board])\n\n respond_to do |format|\n if @board.save\n format.html { redirect_to @board, notice: 'Board was successfully created.' }\n format.json { render json: @board, status: :created, location: @board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create_group_board(group, name)\n body = { name: name }\n post(\"/groups/#{url_encode group}/boards\", body: body)\n end",
"def dump_board_json(board)\n $stderr.puts(\"Backing up board #{board.name}...\")\n\n # This can take a Trello::Board or a board ID\n board = board(board) unless board.respond_to? :id\n\n # Yes, we have to try two different URL schemes because one works\n # for some boards, one works for others, and then we STILL get to\n # fall back to the API call if neither work. :/\n board_json_url = board.url.gsub(/\\/[^\\/]+$/, '.json')\n board_json_other_url = \"#{board.url}.json\"\n\n # API request to pull down the same content as the export URL, but limited to 100 actions\n api_call_uri = Addressable::URI.parse(\"https://trello.com/1/boards/#{board.id}\")\n api_call_uri.query_values = { fields: 'all',\n actions: 'all',\n actions_limit: '1000',\n action_fields: 'all',\n cards: 'all',\n card_fields: 'all',\n card_attachments: 'true',\n labels: 'all',\n lists: 'all',\n list_fields: 'all',\n members: 'all',\n member_fields: 'all',\n checklists: 'all',\n checklist_fields: 'all',\n organization: 'false' }\n i = 0\n request_timeout = 30\n while true\n request = Trello::Request.new :get, board_json_url, {}, nil\n response = nil\n begin\n response = long_request_execute(Trello.auth_policy.authorize(request), request_timeout)\n return response.body if response.code == 200\n rescue RestClient::RequestTimeout => e\n err_msg = \"Error with dump_board_json backing up board '#{board.name}' at URL #{request.uri}: \" + (e.http_code.nil? ? \"HTTP Timeout?\" : \"HTTP response code: #{e.http_code}, response body: #{e.http_body}\")\n $stderr.puts err_msg\n end\n request = Trello::Request.new :get, board_json_other_url, {}, nil\n begin\n response = long_request_execute(Trello.auth_policy.authorize(request), request_timeout)\n return response.body if response.code == 200\n rescue RestClient::RequestTimeout => e\n err_msg = \"Error with dump_board_json backing up board '#{board.name}' at alternate URL #{request.uri}: \" + (e.http_code.nil? ? \"HTTP Timeout?\" : \"HTTP response code: #{e.http_code}, response body: #{e.http_body}\")\n $stderr.puts err_msg\n end\n $stderr.puts \"Retrying with API-based backup URL to work around failed request.\"\n request = Trello::Request.new :get, api_call_uri, {}, nil\n begin\n response = long_request_execute(Trello.auth_policy.authorize(request), request_timeout)\n return response.body if response.code == 200\n rescue RestClient::RequestTimeout => e\n err_msg = \"Error with dump_board_json backing up board '#{board.name}' using all URL endpoints and API call: \" + (e.http_code.nil? ? \"HTTP Timeout?\" : \"HTTP response code: #{e.http_code}, response body: #{e.http_body}\")\n end\n if i >= DEFAULT_RETRIES\n raise err_msg\n end\n $stderr.puts err_msg\n retry_sleep i\n request_timeout += 15\n i += 1\n end\n end",
"def update\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n if @multi_board.update_attributes(params[:multi_board])\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def boards\n return @boards if @boards\n @boards = Client.get(\"/organizations/#{id}/boards/all\").json_into(Board)\n end",
"def scoreboards\n sid = current_user.id\n if not TeachingService.is_teacher?(sid)\n render :json => {\"error\" => \"Et ole opettaja.\"}, status: 401\n else\n sbs = ScoreboardService.build_scoreboards(sid)\n render :json => sbs, status: 200\n end \n end",
"def create\n @motherboard = Motherboard.new(params[:motherboard])\n\n respond_to do |format|\n if @motherboard.save\n format.html { redirect_to @motherboard, :notice => 'Motherboard was successfully created.' }\n format.json { render :json => @motherboard, :status => :created, :location => @motherboard }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @motherboard.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n trello_board_id = scrum_board_params[:trello_board_id]\n trello_board = TrelloService.board(trello_board_id)\n\n unless trello_board\n redirect_to trello_boards_path, notice: 'Trello backlog not found.'\n return\n end\n\n @scrum_board = ScrumBoard.by_trello_board_or_create(trello_board)\n\n respond_to do |format|\n if @scrum_board.save\n format.html { redirect_to @scrum_board, notice: 'Board was successfully created.' }\n format.json { render :show, status: :created, location: @scrum_board }\n else\n format.html { render :new }\n format.json { render json: @scrum_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n \n @follow_board = current_user.follow_boards.build(:board_id => params[:board_id])\n\n respond_to do |format|\n if @follow_board.save\n format.html { redirect_to @follow_board, notice: 'Follow board was successfully created.' }\n format.json { render json: @follow_board, status: :created, location: @follow_board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @follow_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def join\n # get channel name and set event name in each session\n @channel_name = get_channel_name(request.referer)\n @update_boards_event = 'update_boards'\n @board = Board.find(params[:board_id])\n user = User.find(params[:user_id])\n result = {\"joined\" => false, \"redirect_to_id\" => ''}\n if @board.teams.count == 0\n @board.create_teams\n end\n if @board.number_of_players < @board.number_of_seats\n @board.teams.each do |team|\n if team.users.count < @board.number_of_players_per_team\n old_team = user.current_team\n user.current_team = team\n user.state = :waiting\n user.save\n @board.update_number_of_players\n @board.save\n unless old_team == nil\n old_board = old_team.board\n old_board.update_number_of_players\n old_board.save\n end\n result[\"joined\"] = true\n result[\"redirect_to_id\"] = @board.id\n break\n end\n end\n end\n push_boards_info\n # redirect_to @board\n render :json => result\n end",
"def create\n args = board_params\n args[\"user_id\"] = current_user.id\n # Simple validation\n if args[\"user_id\"].nil? or args[\"name\"].nil? or args[\"color\"].nil? or args[\"custom_url\"].nil?\n render json: {error: \"Invalid parameters\"}\n return\n end\n board = Board.new(args)\n\n begin\n board.save\n render json: {message: \"Board created\"}\n rescue Exception => e\n puts e\n render json: {error: \"Try another name or custom url\"}\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PUT /multi_boards/1 PUT /multi_boards/1.json
|
def update
@multi_board = MultiBoard.find(params[:id])
respond_to do |format|
if @multi_board.update_attributes(params[:multi_board])
format.html { redirect_to @multi_board, notice: 'Multi board was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @multi_board.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n @user = User.find(params[:user_id])\n @board = @user.boards.find(params[:id])\n @board.update_column(:content, params[:board].as_json)\n respond_to do |format|\n format.json { render json: @board }\n end\n end",
"def update\n authorize @board\n @board.update!(board_params)\n json_response(@board)\n end",
"def create\n @multi_board = MultiBoard.new(params[:multi_board])\n\n respond_to do |format|\n if @multi_board.save\n format.html { redirect_to @multi_board, notice: 'Multi board was successfully created.' }\n format.json { render json: @multi_board, status: :created, location: @multi_board }\n else\n format.html { render action: \"new\" }\n format.json { render json: @multi_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n \n @scrum_board = ScrumBoard.find(params[:id])\n \n respond_to do |format|\n if @scrum_board.update_attributes(params[:scrum_board])\n format.html { redirect_to :action => 'current_board', :un_id => \"#{@scrum_board.unique_id}\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @scrum_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, notice: 'board was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def destroy\n @multi_board = MultiBoard.find(params[:id])\n @multi_board.destroy\n\n respond_to do |format|\n format.html { redirect_to multi_boards_url }\n format.json { head :no_content }\n end\n end",
"def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to @board, :notice => 'Board was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @board.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def show\n @multi_board = MultiBoard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def new\n @multi_board = MultiBoard.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @multi_board }\n end\n end",
"def update\n @motherboard = Motherboard.find(params[:id])\n\n respond_to do |format|\n if @motherboard.update_attributes(params[:motherboard])\n format.html { redirect_to @motherboard, :notice => 'Motherboard was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @motherboard.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @board2 = Board2.find(params[:id])\n\n respond_to do |format|\n if @board2.update_attributes(params[:board2])\n format.html { redirect_to @board2, notice: 'Board2 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board2.errors, status: :unprocessable_entity }\n end\n end\n end",
"def putBoardOrganization(boardId, idOrganization)\n\tresponse = RestClient.put(\n\t\t\t'https://api.trello.com/1/boards/'+boardId+'/idOrganization',\n\t\t\t:value \t=> idOrganization,\n\t\t\t:key => $key,\n\t\t\t:token => $token\n\t)\nend",
"def update\n if @board.update(board_params)\n redirect_to @board\n flash[:success] = 'Board successfully updated!'\n else\n render 'edit', status: 422\n end\n end",
"def save_board\n if params[:_json].nil?\n render json: {error: \"Invalid parameters\"}\n return\n end\n params[:_json].each do |table|\n if table[:id].nil?\n card_table = CardTable.new({name: table[:name], column_index: table[:column_index], board_id: table[:board_id]})\n card_table.save\n table[:id] = card_table.id\n else\n board = CardTable.find_by(id: table[:id])\n board.update({name: table[:name], column_index: table[:column_index], board_id: table[:board_id]})\n end\n table[:cards].each do |card|\n if card[:id].nil?\n saved_card = Card.new({card_table_id: table[:id], name: card[:name], completed: card[:completed], description: card[:description], priority: card[:priority], due_date: card[:due_date]})\n saved_card.save\n else\n saved_card = Card.find_by(id: card[:id])\n saved_card.update({card_table_id: table[:id], name: card[:name], completed: card[:completed], description: card[:description], priority: card[:priority], due_date: card[:due_date]})\n end\n end\n end\n end",
"def update\n @motherboard = Motherboard.find(params[:id])\n\n respond_to do |format|\n if @motherboard.update_attributes(params[:motherboard])\n format.html { redirect_to @motherboard, notice: 'Motherboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @motherboard.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @toushikomon_board = ToushikomonBoard.find(params[:id])\n\n respond_to do |format|\n if @toushikomon_board.update_attributes(params[:toushikomon_board])\n format.html { redirect_to @toushikomon_board, notice: 'Toushikomon board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @toushikomon_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @board_info = BoardInfo.find(params[:id])\n\n respond_to do |format|\n if @board_info.update_attributes(params[:board_info])\n format.html { redirect_to @board_info, notice: 'Board info was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @board_info.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @test_board = TestBoard.find(params[:id])\n\n respond_to do |format|\n if @test_board.update_attributes(params[:test_board])\n format.html { redirect_to \"/test_boards\" , notice: 'Test board was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_board.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @board = Board.find(params[:id])\n\n respond_to do |format|\n if @board.update_attributes(params[:board])\n format.html { redirect_to(root_url, :notice => 'Board was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @board.errors, :status => :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /multi_boards/1 DELETE /multi_boards/1.json
|
def destroy
@multi_board = MultiBoard.find(params[:id])
@multi_board.destroy
respond_to do |format|
format.html { redirect_to multi_boards_url }
format.json { head :no_content }
end
end
|
[
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @m3_board.destroy\n respond_to do |format|\n format.html { redirect_to m3_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @toushikomon_board = ToushikomonBoard.find(params[:id])\n @toushikomon_board.destroy\n\n respond_to do |format|\n format.html { redirect_to toushikomon_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @test_board = TestBoard.find(params[:id])\n @test_board.destroy\n\n respond_to do |format|\n format.html { redirect_to test_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @mainboard = Mainboard.find(params[:id])\n @mainboard.destroy\n\n respond_to do |format|\n format.html { redirect_to mainboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find_by_slug(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @motherboard = Motherboard.find(params[:id])\n @motherboard.destroy\n\n respond_to do |format|\n format.html { redirect_to motherboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @motherboard = Motherboard.find(params[:id])\n @motherboard.destroy\n\n respond_to do |format|\n format.html { redirect_to motherboards_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @message_board.destroy\n\n respond_to do |format|\n format.html { redirect_to message_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board2 = Board2.find(params[:id])\n @board2.destroy\n\n respond_to do |format|\n format.html { redirect_to board2s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @board = Board.find_by_permalink(params[:id])\n @board.destroy\n\n respond_to do |format|\n format.html { redirect_to(boards_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @board_info = BoardInfo.find(params[:id])\n @board_info.destroy\n\n respond_to do |format|\n format.html { redirect_to board_infos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @side_board.destroy\n respond_to do |format|\n format.html { redirect_to side_boards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dartboard = Dartboard.find(params[:id])\n @dartboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dartboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @story_board.destroy\n\n respond_to do |format|\n format.html { redirect_to story_boards_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @gameboard = Gameboard.find(params[:id])\n @gameboard.destroy\n\n respond_to do |format|\n format.html { redirect_to gameboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @man_board.destroy\n respond_to do |format|\n format.html { redirect_to man_boards_url, notice: 'Man board was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Retrieve the client vpn config for current user Returns the client vpn config for the currently loggedin user.
|
def find_current_user_vpn_config(code, opts = {})
data, _status_code, _headers = find_current_user_vpn_config_with_http_info(code, opts)
data
end
|
[
"def client_config\r\n JSON.parse(api_get('Configurations.egg', 'IphoneClient').body)\r\n end",
"def vpn_configuration_id\n return @vpn_configuration_id\n end",
"def get_current_user_options\n response = get_current_user_meta('options')\n ret = {}\n response['query']['userinfo']['options'].each { |k, v| ret[k] = v }\n end",
"def get_config(view = nil)\n path = _path() + '/config'\n resp = @_resource_root.get(path, view && { 'view' => view } || nil)\n ::CmApi::Endpoints::Types::json_to_config(resp, view == 'full')\n end",
"def user_config\n @user_config ||= UserConfig.parse\n end",
"def get_resource_configurations(user_id)\n self.class.available_hosts.map do |host|\n {name: short_name.to_sym, params: {plgrid_host: host}}\n end\n end",
"def current_auth\n if @current_auth_user_key != current_user\n @current_auth_user_key = current_user['key']\n @current_auth_client = get_pmp_client(current_user)\n end\n @current_auth_client\n end",
"def user\n return @user ? @user : Dotfu.config_user\n end",
"def client_configuration\n return @client_configuration\n end",
"def client_settings\n @client_settings ||= ConfigurationSetting.current_client_settings\n end",
"def vm_get_other_config(vm_uuid)\n vm_opaqueref = vm_get_ref(vm_uuid)\n vm_opaqueref.key?('Value') ? @connect.call('VM.get_other_config', @session, vm_opaqueref['Value']) : vm_opaqueref\n end",
"def config\n $VHOST.config\n end",
"def config\n @config ||= ViteRuby::Config.resolve_config(**@config_options)\n end",
"def show\n @vpn = current_user.try(:vpn)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vpn }\n end\n end",
"def get_resource_configurations(user_id)\n hosts = self.class.available_hosts\n grant_ids = PlGridFacade.retrieve_grants(GridCredentials.find_by_user_id(user_id))\n\n hosts.flat_map do |host|\n grant_ids.flat_map do |grant_identifier|\n {name: short_name.to_sym, params: {plgrid_host: host, grant_identifier: grant_identifier}}\n end\n end\n end",
"def config_path\n NginxStage.pun_config_path(user: user)\n end",
"def _get_config(rel_path, view, api_version = 1)\n _require_min_api_version(api_version)\n params = view && { 'view' => view } || nil\n resp = @_resource_root.get(_path + '/' + rel_path, params)\n ::CmApi::Endpoints::Types::json_to_config(resp, view == 'full')\n end",
"def global_config\n # This entire VM Pooler config\n @config\n end",
"def user_configuration\n\t\t\tread_configuration(user_configuration_filename)\n\t\tend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Turn off vpn for the current user Turns off vpn for the currently loggedin user.
|
def turn_off_current_user_vpn(opts = {})
turn_off_current_user_vpn_with_http_info(opts)
nil
end
|
[
"def turn_off_current_user_vpn_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'\n end\n # resource path\n local_var_path = '/user/vpn'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type]\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['x_auth_token']\n\n new_options = opts.merge(\n :operation => :\"VPNApi.turn_off_current_user_vpn\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VPNApi#turn_off_current_user_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end",
"def deactivate_user(user_id)\n start.uri('/api/user')\n .url_segment(user_id)\n .delete()\n .go()\n end",
"def deactivate_user(user_id)\n start.uri('/api/user')\n .url_segment(user_id)\n .delete()\n .go()\n end",
"def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end",
"def deactivate_user(user_id)\n post(\"/users/#{user_id}/deactivate\")\n end",
"def untrust!\n MTurkUtils.untrust_user self\n end",
"def disable_two_factor(user_id)\n patch(\"/users/#{user_id}/disable_two_factor\")\n end",
"def disable_two_factor(user_id, code)\n start.uri('/api/user/two-factor')\n .url_parameter('userId', user_id)\n .url_parameter('code', code)\n .delete()\n .go()\n end",
"def unset_current_user\n Strongbolt.current_user = nil\n end",
"def stop_impersonating\n stop_impersonating_user\n redirect_to root_path\n end",
"def unban_user user\n mturk(user).unblockWorker :WorkerId => user.id\n user.banned = false\n user.save!\n end",
"def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end",
"def disable_user(handle)\n request(Net::HTTP::Delete, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end",
"def revoke(user, skip_remote: false)\n raise NotImplementedError\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def unbind_user(user)\n omni_ref = OmniauthRef.where(pid: self.pid,\n uuid: @omni_data[:uuid],\n user_id: user.id).take\n return false unless omni_ref\n omni_ref.destroy\n end",
"def network_disable(vid)\n perform_request(action: 'vserver-network-disable', vserverid: vid)\n end",
"def unvote_for_option(option)\n option.unvote(self)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Turn off vpn for the current user Turns off vpn for the currently loggedin user.
|
def turn_off_current_user_vpn_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: VPNApi.turn_off_current_user_vpn ...'
end
# resource path
local_var_path = '/user/vpn'
# query parameters
query_params = opts[:query_params] || {}
# header parameters
header_params = opts[:header_params] || {}
# form parameters
form_params = opts[:form_params] || {}
# http body (model)
post_body = opts[:debug_body]
# return_type
return_type = opts[:debug_return_type]
# auth_names
auth_names = opts[:debug_auth_names] || ['x_auth_token']
new_options = opts.merge(
:operation => :"VPNApi.turn_off_current_user_vpn",
:header_params => header_params,
:query_params => query_params,
:form_params => form_params,
:body => post_body,
:auth_names => auth_names,
:return_type => return_type
)
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
if @api_client.config.debugging
@api_client.config.logger.debug "API called: VPNApi#turn_off_current_user_vpn\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
end
return data, status_code, headers
end
|
[
"def turn_off_current_user_vpn(opts = {})\n turn_off_current_user_vpn_with_http_info(opts)\n nil\n end",
"def deactivate_user(user_id)\n start.uri('/api/user')\n .url_segment(user_id)\n .delete()\n .go()\n end",
"def deactivate_user(user_id)\n start.uri('/api/user')\n .url_segment(user_id)\n .delete()\n .go()\n end",
"def deactivate!(user)\n return false unless self.active?\n\n @user = user\n\n remove_hook!\n\n self.active = false\n self.save!\n end",
"def deactivate_user(user_id)\n post(\"/users/#{user_id}/deactivate\")\n end",
"def untrust!\n MTurkUtils.untrust_user self\n end",
"def disable_two_factor(user_id)\n patch(\"/users/#{user_id}/disable_two_factor\")\n end",
"def disable_two_factor(user_id, code)\n start.uri('/api/user/two-factor')\n .url_parameter('userId', user_id)\n .url_parameter('code', code)\n .delete()\n .go()\n end",
"def unset_current_user\n Strongbolt.current_user = nil\n end",
"def stop_impersonating\n stop_impersonating_user\n redirect_to root_path\n end",
"def unban_user user\n mturk(user).unblockWorker :WorkerId => user.id\n user.banned = false\n user.save!\n end",
"def unblock\n current_user.unblock_user(@user.id)\n render json: {ok: 1}\n end",
"def disable_user(handle)\n request(Net::HTTP::Delete, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end",
"def revoke(user, skip_remote: false)\n raise NotImplementedError\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def turn_on_current_user_vpn(opts = {})\n turn_on_current_user_vpn_with_http_info(opts)\n nil\n end",
"def unbind_user(user)\n omni_ref = OmniauthRef.where(pid: self.pid,\n uuid: @omni_data[:uuid],\n user_id: user.id).take\n return false unless omni_ref\n omni_ref.destroy\n end",
"def network_disable(vid)\n perform_request(action: 'vserver-network-disable', vserverid: vid)\n end",
"def unvote_for_option(option)\n option.unvote(self)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Turn on vpn for the current user Turns on vpn for the currently loggedin user.
|
def turn_on_current_user_vpn(opts = {})
turn_on_current_user_vpn_with_http_info(opts)
nil
end
|
[
"def activate_user(user_id)\n post(\"/users/#{user_id}/activate\")\n end",
"def activate_user(user)\n user.status_id=0\n user.save\n end",
"def set_ViaUser(value)\n set_input(\"ViaUser\", value)\n end",
"def activate!(user)\n return false if self.active?\n\n @user = user\n\n create_hook!\n\n self.active = true\n self.save!\n end",
"def vote_up(user_ip)\n if user_already_voted?(user_ip)\n false\n else\n if self.votes.create(:user_ip => user_ip)\n true\n else\n false\n end\n end\n end",
"def vote_up(user_ip)\r\n if user_already_voted?(user_ip)\r\n false\r\n else\r\n if self.votes.create(:user_ip => user_ip)\r\n true\r\n else\r\n false\r\n end\r\n end\r\n end",
"def check_if_user_wants_to_make_their_votes_public\n if params[:go_public] == \"1\"\n @user.votes_anonymous = :no\n @user.save\n flash_notice(:show_votes_gone_public.t)\n elsif params[:go_private] == \"1\"\n @user.votes_anonymous = :yes\n @user.save\n flash_notice(:show_votes_gone_private.t)\n end\n end",
"def track_online_user\n if user_signed_in? && !current_settings.invisible?\n users_online.track_user(current_user)\n end\n end",
"def activate_if_invited\n invited_user = Invite.find_by_invited_user_email(self.email)\n if ! invited_user.nil?\n invited_user.update_attribute(:invited_user_id, self.id)\n self.account_active = 1\n self.save!\n end\n end",
"def user_onoff_flag\n @requested_user = User.find_by_account_number(params[:id])\n if @requested_user.is_active?\n @requested_user.update_columns(:is_active => false)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully de-activated.\"}\n else\n @requested_user.update_columns(:is_active => true)\n redirect_to admin_index_path, :flash => {:notice => \"Requested user(#{@requested_user.first_name} #{@requested_user.last_name}) account successfully activated.\"}\n end\n end",
"def activate\n unless user.activated?\n user.activated = true\n user.save!\n end\n end",
"def change_user_to_host\n self.host.update(host: true)\n end",
"def activate_invited\n # users who have logged in aren't asked to activate their account again\n # so we'll pretend \n if params[:user] and user = current_user\n user.sign_up\n user.attributes = params[:user]\n\n if user.remember_me\n current_user_session.remember_me = true \n user_session = current_user_session\n user_session.send :save_cookie\n end\n user.save and flash[:notice] = \"Welcome aboard, #{user}.\"\n Notifications.deliver_welcome user\n end\n if order_id = params[:order_id]\n redirect_to order_path(order_id)\n else\n redirect_to root_path\n end\n end",
"def logon_block_fast_user_switching=(value)\n @logon_block_fast_user_switching = value\n end",
"def acceptPingOnUser(ping)\r\n @user = User.find(ping.pingable_id)\r\n if current_user == @user\r\n if ping.update_attributes('status' => 2, 'accepted_at' => Time.now)\r\n ping.owner.follow(@user)\r\n flash[:notice] = t(\"flash.pings.accept.notice\")\r\n end\r\n else\r\n flash[:error] = t(\"flash.pings.accept.error.notAllowed\")\r\n end\r\n end",
"def user_connect(name, ip)\n return unless @operator_local\n if @device.connection_status != Device::CONNECTED\n dputs(2) { 'Going to connect' }\n $MobileControl and $MobileControl.connect(true)\n end\n\n # Free users have different auto-disconnect time than non-free users\n Captive.user_connect name, ip, (self.free(name) ? 'yes' : 'no')\n end",
"def activate\n active = @user.active\n @user.update_attribute(:active, !active)\n\n redirect_to user_url(:id => params[:id])\n end",
"def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end",
"def switch_user\n if @current_user == @players[0]\n @current_user = @players[1]\n elsif @current_user == @players[1]\n @current_user = @players[0]\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Define breakfast, lunch and dinner methods that return the meal choice passed into them. If nothing is passed in, it shoud default to the foods on the readme (frosted flake, grilled cheese, salmon)
|
def meal(breakfast = "frosted flakes", lunch = "grilled cheese", dinner = "salmon")
puts "Morning is the best time for #{breakfast}!"
puts "Noon is the best time for #{lunch}!"
puts "Evening is the best time for #{dinner}!"
end
|
[
"def meal_choice(breakfast=\"frosted flakes\",lunch=\"grilled cheese\",dinner=\"salmon\")\n puts \"Morning is the best time for #{breakfast}!\"\n puts \"Lunch time is a good time to eat #{lunch}.\"\n puts \"At dinner time, we eat #{dinner}.\"\n\nend",
"def myfood(food)\r\n case food\r\n when \"Steak\"\r\n \"Pass the Steak sauce! That's delicious\"\r\n when \"Sushi\"\r\n \"Thats raw. I don't eat raw food\"\r\n when \"Tacos\", \"Burrito\", \"Quesadillas\"\r\n \"The perfect Combination!\"\r\n when \"Tofu\", \"Brussel Sprouts\"\r\n puts \"No Thanks\"\r\n else\r\n \"I don't know that food\"\r\n end\r\nend",
"def rate_my_food(food)\n case food\n when \"Steak\"\n puts \"I love steaks! Pass the sauce!\"\n when \"sushi\"\n puts \"It's my favourite!\"\n when \"Lasagne\"\n puts \"That's sth for me!\"\n when \"spaghetti\", \"pizza\", \"tiramisu\"\n puts \"I don't like it!\"\n else\n \"I don't know about that food\"\n end\nend",
"def get_food(hunger_level)\n case\n when hunger_level >= 9\n return \"Steak\"\n when hunger_level >= 7\n return \"Chicken\"\n when hunger_level >= 4\n return \"Soup\"\n else\n return \"Salad\"\n end\nend",
"def pick_meal(menu)\n puts \"1.#{menu[1][:name]} $#{menu[1][:price]}\"\n puts \"2.#{menu[2][:name]} $#{menu[2][:price]}\"\n puts \"3.#{menu[3][:name]} $#{menu[3][:price]}\"\n puts \"4.See Descriptions\"\n puts \"5.Clear order OR '0' to quit\"\n print \"> \"\n @menu_pick = gets.to_i\n\n case @menu_pick\n when 0\n puts \"Goodbye\"\n exit(0)\n when 4\n description(menu)\n when 5\n clear_order\n else\n order_meal(menu)\n end\n end",
"def eat(food) \r\n\t\tcase food \r\n\t\twhen 'butter'\r\n\t\t\t@@intake += 740\r\n\t\twhen 'beef'\r\n\t\t\t@@intake += 521\r\n\t\twhen 'chips'\r\n\t\t\t@@intake += 570\r\n\t\twhen 'pork', 'cheese'\r\n\t\t\t@@intake += 340\r\n\t\twhen 'beer', 'puddings'\r\n\t\t\t@@intake += 200\r\n\t\twhen 'rice', 'soup'\r\n\t\t\t@@intake += 150\r\n\t\twhen 'salad', 'egg'\r\n\t\t\t@@intake += 100\r\n\t\twhen 'fruit', 'milk'\r\n\t\t\t@@intake += 60\r\n\t\twhen 'tea', 'coffee', 'soda'\r\n\t\t\t@@intake += 10\r\n\t\tend\r\n\tend",
"def cats_favorite_food\n prompt = TTY::Prompt.new\n choices = {\n \" 1 - See which type of food you'll to put out to attract a specific cat\" => 1,\n \" 2 - View all of the cats that prefer wet food\" => 2,\n \" 3 - View all of the cats that prefer dry food\" => 3,\n \" 4 - Return to the Main Menu\" => 4 }\n choice = prompt.select(\"\\nIf you're lonely and want a cat, here's the info you'll need to attract one!\\n\", choices, per_page: 4)\n case (choice.to_i)\n when 1\n puts \"\\nWhich cat would you like to attract?\"\n cat_food_name = gets.chomp\n cat_fav_food = Cat.find_by(name: cat_food_name).favorite_food\n puts \"\\n#{cat_food_name} prefers #{cat_fav_food} food.\"\n when 2\n puts \"\\nCats that prefer wet food:\"\n Cat.where(:favorite_food => \"wet\").select {|cat| puts cat.name}\n when 3\n puts \"\\nCats that prefer dry food:\"\n Cat.where(:favorite_food => \"dry\").select {|cat| puts cat.name}\n when 4\n main_menu\n end\n end",
"def pizza_options\n puts <<-END\nWhat would you like to do?\n (R)etreat inward to a zen like state and meditate.\n (G)et frustrated. \\\"I need my wine now!\\\"\"\n (A)muse yourself watching clumsy tourists and remind yourself that\n you are lucky to be in beautiful Venice.\nEnter the letter corresponding with your choice.\n END\n case gets.chomp.downcase\n when \"r\"\n puts <<-END\n The waiter is afraid to disturb you from your zen state and\n you pass out from hunger! Fortunately, the fall from your chair did\n not do much damage.\n END\n conclude_day_venice {}\n\n when \"g\"\n puts <<-END\n The waiter finally approaches but trips and spills an entire\n pitcher of water all over your lap! Karma!\n END\n conclude_day_venice {}\n\n when \"a\"\n puts <<-END\n The manager himself approaches, apologizes and insists\n that you accept a complementary glass of wine.\n END\n conclude_day_venice {}\n\n else\n puts <<-END\n You seem to be a tad bit challenged when it comes\n to reading instructions.\n END\n pizza_options\n end\nend",
"def foster_options(f_id)\n puts Rainbow(\"Hello #{Foster.find(f_id).name}.\").white.background(0).bright\n puts Rainbow('How may we help you?').white.background(0).bright\n puts \"\\n\\t1 - Select an animal to foster.\"\n puts \"\\t2 - Review your current pets.\"\n puts \"\\t3 - Remove yourself from the database.\\n\"\n puts Rainbow(\"\\n\\t0 - Exit\").red\n choice = gets.chomp.downcase\n case choice\n when '1'\n foster_select_pet(f_id)\n when '2'\n foster_show_list_of_animals_by_shelter(f_id)\n when '3'\n foster_remove(f_id)\n when '0'\n puts 'Goodbye'\n else\n foster_options(f_id)\n end\n end",
"def description (pre_made, items)\n if pre_made == \"y\" || pre_made == \"Y\"\n # List of desriptives\n describe = %W[Lemon Fresh Putrid Crimson Fermented Spiced Creamy Translucent Sugar Pine]\n # List of cooking styles\n cook_style = %W[roasted pan-fried jellied deep-fried poached raw seared blackened steamed broilled]\n # List of foods\n foods = %W[duck grapeleaf romano-cheese salmon green-pepper fig toast crab squab ginger]\n menu_descriptors = [describe, cook_style, foods]\n elsif pre_made != \"y\" && pre_made != \"Y\"\n puts \"\\nEnter food descriptors ie hot, cold, spiced.\"\n puts \"Please separate each item by a comma and space.\\n\"\n describe = gets.chomp.split(\", \")\n if (describe.length) != items\n item_amount_confirm(describe, items)\n end\n puts \"\\nEnter methods of cooking ie fried, steamed, poached.\"\n puts \"Please separate each item by a comma and space.\\n\"\n cook_style = gets.chomp.split(\", \")\n if (cook_style.length) != items\n item_amount_confirm(cook_style, items)\n end\n puts \"\\nEnter food types ie salad, brownie, chicken.\"\n puts \"Please separate each item by a comma and space.\\n\"\n foods = gets.chomp.split(\", \")\n if (foods.length) != items\n item_amount_confirm(foods, items)\n end\n menu_descriptors = [describe, cook_style, foods]\n end\n return menu_descriptors\nend",
"def generate_strategy(strategy_string)\n define_method(strategy_string) do |choices, available, reveal|\n strategy = strategy_string.split('_')\n action = strategy[reveal - 1]\n case action\n when 'stay'\n return always_stay(choices, available, reveal)\n when 'switch'\n return random_switch(choices, available, reveal)\n end\n end\nend",
"def lunch (meal)\n\tputs \"#{@name} had #{meal} for lunch\"\nend",
"def grab_food(food)\n puts \"grabbing some #{food}\"\nend",
"def initialize(name, preferred_food, meal_time)\n @name = name\n @preferred_food = preferred_food\n @meal_time = meal_time\n end",
"def pizza_party(topping=\"cheese\")\n puts topping\n return topping\nend",
"def show_meal_actions(backend, meal, menu_only)\n allowed_input = ['m']\n if backend.favorites[meal.id].nil?\n unless menu_only\n puts 'Enter `f` to add to favorites and go back'\n allowed_input << 'f'\n end\n puts 'Enter `fm` to add to favorites and go to menu'\n allowed_input << 'fm'\n else\n unless menu_only\n puts 'Enter `r` to remove from favorites and go back'\n allowed_input << 'r'\n end\n puts 'Enter `rm` to remove from favorites and go to menu'\n allowed_input << 'rm'\n end\n unless menu_only\n puts 'Enter `b` to go back'\n allowed_input << 'b'\n end\n if meal.youtube\n puts 'Enter `v` to open meal video'\n allowed_input << 'v'\n end\n puts 'Enter `m` to go menu'\n choice = Frontend.user_input(0, *allowed_input)\n # Action\n if choice == 'v'\n puts \"Launching #{meal.youtube}\"\n suppress_output { Launchy.open(meal.youtube) }\n allowed_input.pop # remove v\n puts 'Select another option:'\n choice = Frontend.user_input(0, *allowed_input)\n end\n if %w[f fm].include?(choice)\n puts 'Adding to favorites'\n backend.add_to_favorites(meal)\n choice == 'f' ? (return true) : (return false)\n elsif %w[r rm].include?(choice)\n puts 'Removing favorite'\n backend.favorites.delete(meal.id)\n choice == 'r' ? (return true) : (return false)\n end\n return true if choice == 'b'\n return false if choice == 'm'\n\n raise \"Unknown choice: #{choice}\"\n end",
"def find_random_meal\n Meal.new(@api.random_meal)\n end",
"def feeling\n if (@mealCount == 1)\n @mealCount = 0\n return \"Good!\"\n else\n return \"Sad...\"\n end\n end",
"def test_meal\n @tester.meal(date: \"06-05\", cost: 40, tip_percent: 15, attendees: [\"Jim\", \"Tom\"], restaurant: \"Sudz\")\n assert(@tester.members == {\"Jim\" => 23.0, \"Tom\" => 23.0})\n assert(@tester.meal_list == {\"06-05\" => {\"Sudz\" => [\"Jim\", \"Tom\"]}})\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
=begin dada una palabra clave(llave) construlle una tabla tipo vigenere polialfabetica. =end
|
def crea_tabla(llave)
renglon = Array.new
tam = llave.length
tam.times do |i|
tmp = "" << llave[i]
if ALFABETO.include? tmp
renglon.push(tmp)
ALFABETO.delete! tmp
end
end
ALFABETO.chars{|c| renglon.push(c)}
tabla = Array.new
tabla.push(renglon.to_s)
for i in (1...26)
aux = recorre(renglon.to_s, i)
tabla.push(aux)
end#for
return tabla
end
|
[
"def tabla_pasos(contador,array_anterior)\n aux=0\n tabla = Terminal::Table.new do |a|\n a.title= \"ELEMENTOS A ORDENAR: #{array_anterior}\"\n a.headings = [{value:'DATO', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n for i in 0..contador-1\n a.add_row([\n aux+=1,\n @pasoL[i]\n ])\nend\n end\n return tabla\n end",
"def colocar_ficha_en_el_tablero(fila, columna) \n\t if @tablero[fila][columna] == CASILLA_VACIA and @jugador_actual == JUGADOR_X\n\t @tablero[fila][columna] = CASILLA_CON_VALOR_X\n\t\t@jugador_actual = JUGADOR_0 \n\t \n\t elsif @tablero[fila][columna] == CASILLA_VACIA and @jugador_actual == JUGADOR_0\n @tablero[fila][columna] = CASILLA_CON_VALOR_0\n @jugador_actual = JUGADOR_X\n \t end\n\tend",
"def tabla_pasos(contador,array_anterior)\n aux=0\n tabla = Terminal::Table.new do |a|\n a.title= \"ELEMENTOS A ORDENAR #{array_anterior} \"\n a.headings = [{value:'DATO', alignment: :center},{value:'ESTRUCTURA', alignment: :center}]\n for i in 0..contador-1\n a.add_row([\n aux+=1,\n @paso[i]\n ])\nend\n end\n return tabla\n end",
"def inicializar_tablero(mazo)\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Huerta Los Patos\", 100, 0.27, 300, 300, 300)))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Calle Rodahuevo\", 200, 0.53, 300, 300, 300)))\r\n @tablero.añade_casilla(Casilla_sorpresa.new(mazo, \"Suerte!\"))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Calle Recogidas\", 400, 0.51, 600, 600, 600)))\r\n # carcel, ya añadida\r\n @tablero.añade_casilla(Casilla_calle.new(Propiedad_ecologica.new(0.05,\"Avenida de la Constitución\", 500, 0.11, 700, 700, 700)))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Huerta Jorobado\", 600, 0.6, 800, 800, 800)))\r\n @tablero.añade_casilla(Casilla_sorpresa.new(mazo, \"Suerte!\"))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Calle Hierbabuena\", 800, 0.08, 1000, 1000, 1000)))\r\n @tablero.añade_casilla(Casilla.new(\"Parking Gratuito\"))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Estación de Autobuses\", 1000, 0.75, 1200, 1200, 1200)))\r\n @tablero.añade_casilla(Casilla_sorpresa.new(mazo, \"Suerte!\"))\r\n @tablero.añade_casilla(Casilla_calle.new(Propiedad_ecologica.new(0.05,\"Calle Periodista Daniel Saucedo Aranda\", 1100, 0.59, 1300, 1300, 1300)))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Calle Periodista Rafael Gómez\", 1200, 0.9, 1400, 1400, 1400)))\r\n @tablero.añade_juez\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Calle Real de la Alhambra\", 1300, 0.18, 1500, 1500, 1500)))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Calle Pedro Antonio de Alarcón\", 1340, 0.77, 1540, 1540, 1540)))\r\n @tablero.añade_casilla(Casilla_impuesto.new(1000, \"Impuesto\"))\r\n @tablero.añade_casilla(Casilla_calle.new(Titulo_propiedad.new(\"Calle Marqués de Larios\", 1800, 0.64, 2000, 2000, 2000)))\r\n end",
"def cargar(tablero)\n for i in 0..8\n for j in 0..8\n v=tablero[i][j]\n if (v != 0)\n k = fccuadro(i,j) \n filas[i].quitar(v)\n columnas[j].quitar(v)\n cuadros[k].quitar(v) \n filas[i].celdas[j].valor=v\n end\n end\n end\n end",
"def reconstruir_palabras\n palabras = []\n @trie.reconstruir_palabras_nodo('', palabras)\n palabras\n end",
"def colocar_piezas\n self.vaciar.tap do |tablero|\n (1..8).each do |columna|\n Peon.new(Blancas, columna, 2, tablero)\n Peon.new(Negras, columna, 7, tablero)\n end\n\n Torre.new(Blancas, 1, 1, tablero)\n Caballo.new(Blancas, 2, 1, tablero)\n Alfil.new(Blancas, 3, 1, tablero)\n Dama.new(Blancas, 4, 1, tablero)\n Rey.new(Blancas, 5, 1, tablero)\n Alfil.new(Blancas, 6, 1, tablero)\n Caballo.new(Blancas, 7, 1, tablero)\n Torre.new(Blancas, 8, 1, tablero)\n Torre.new(Negras, 1, 8, tablero)\n Caballo.new(Negras, 2, 8, tablero)\n Alfil.new(Negras, 3, 8, tablero)\n Dama.new(Negras, 4, 8, tablero)\n Rey.new(Negras, 5, 8, tablero)\n Alfil.new(Negras, 6, 8, tablero)\n Caballo.new(Negras, 7, 8, tablero)\n Torre.new(Negras, 8, 8, tablero)\n end\n end",
"def to_tabla\n\t\t\t\"#{@nombre}#{' ' * (15-@nombre.size)} #{@proteinas.round(1)} #{@glucidos.round(1)} #{@lipidos.round(1)} #{valor_energetico.round(2)}\"\n\t\tend",
"def tablero_ajedrez\n\n tablero_new =\n [ [\"T\", \"C\", \"A\", \"K\", \"Q\", \"A\", \"C\", \"T\" ],\n [\"P\"] ]\n\n for fila in 0..16 \n for columna in 0..7\n if fila == 1 \n print \"|\\t\" + tablero_new[fila-1][columna] + \"N\\t|\"\n elsif fila % 2 == 0\n print \"----------------\"\n elsif fila == 3 \n print \"|\\t\" + tablero_new[1][0] + \"N\\t|\"\n elsif fila == 13\n print \"|\\t\" + tablero_new[1][0] + \"B\\t|\"\n elsif fila == 15 \n print \"|\\t\" + tablero_new[fila-15][columna] + \"B\\t|\"\n else\n print \"|\\t\\t|\"\n end\n end\n puts \"\"\n end\n\nend",
"def preenche_parcelas_recorrencia\n return unless recorrencia\n \n if recorrencia.tipo == 'por'\n recorrencia.data_inicial = data\n recorrencia.parcelas = recorrencia.descobre_parcelas\n else\n recorrencia.parcelas = nil\n end\n end",
"def creerPlateau\n\n\t\ttailleGrille = @grille.largeur\n\t\tespacementCases = 2\n\n\t\t@table = Gtk::Table.new(tailleGrille+2, tailleGrille+2, false) # On rajoute 2 pour insérer les infos et les fleches\n\t\t@mat = Array.new(tailleGrille) {Array.new(tailleGrille)}\n\t\t@matFleche = Array.new(2) {Array.new(tailleGrille)}\n\n\t\t\n\t\t# Création de la grille\n\t\t0.upto(tailleGrille-1){|x|\n\t\t\t0.upto(tailleGrille-1){|y|\n\t\t\t\tcaseTemp = CaseVue.new(\"blanc\", tailleGrille, @grille, x, y)\n\t\t\t\t@table.attach(caseTemp, y+2, y+3, x+2, x+3)\n\t\t\t\t@mat[x][y] = caseTemp\n\t\t\t}\n\t\t}\n\t\t# Définition de l'espacement des cases toutes les 5 cases\n\t\t6.step(tailleGrille, 5){|i|\n\t\t\t@table.set_row_spacing(i, espacementCases)\n\t\t\t@table.set_column_spacing(i, espacementCases)\n\t\t}\n\n\t\treturn @table\n\tend",
"def test_set_binary\n @lp = LPSolve::make_lp(0, 1)\n assert_nothing_raised do\n LPSolve::set_binary(@lp, 1, 1) #Define the column to be binary\n end\n end",
"def build_tabula_recta\n table = []\n row = alphabet\n\n alphabet.each { |letter| table << row.rotate(row.index(letter)) }\n\n table\n end",
"def to_table=(_); end",
"def tabla_legacy\n @equivalencia_tablas[@nombre_tabla]\n end",
"def cicloLlena\n #Es un ciclo de transicion, si la maquina estaba en estado \"llena\" debe\n #comenzar a procesar en el siguiente ciclo.\n @estado = \"Procesando\"\n end",
"def vaciar_tablero\n\t for fila_actual in (0..2)\n\t\tfor columna_actual in (0..2)\n\t\t @tablero[fila_actual][columna_actual] = 0\n\t\tend\n\t end\n\tend",
"def from_table=(_); end",
"def initTableaux\n @meilleursJoueursScore = [[],[],[]]\n for i in 1..4\n @meilleursJoueursScore.push([])\n for j in 0..4\n @meilleursJoueursScore[i][j]=0\n end\n end\n @meilleursJoueursPseudo = [[],[],[]]\n for i in 1..4\n @meilleursJoueursPseudo.push([])\n for j in 0..4\n @meilleursJoueursPseudo[i][j]=\"---\"\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Helper method to generate the proper url for Mailgun unsubscribe API calls
|
def unsubscribe_url(address=nil)
"#{@mailgun.base_url}/#{@domain}/unsubscribes#{'/' + address if address}"
end
|
[
"def unsubscribe_url\n nil\n end",
"def unsubscribe_url(id:, email:)\n token =\n Base64.encode64(\"#{id}:#{email}\")\n\n \"#{connection.url_prefix}unsubscribe?token=#{token}\"\n end",
"def campaign_unsubscribes_url(domain, campaign_id=nil)\n \"#{@mailgun.base_url}/#{domain}/campaigns#{'/' + campaign_id if campaign_id}/unsubscribes\"\n end",
"def un_subscribe #unsubscribe is a reserved ruby word do not change\n\n # An unsubscribe email address is of the form <unsubscribe_token>@unsubscribe.zangzing.com\n # we use Mail::Address to parse the addresses and the domain\n # If the to or from addresses are invalid emails, an exception will be raised\n to = Mail::Address.new( params[:to].to_slug.to_ascii.to_s )\n from = Mail::Address.new( params[:from].to_slug.to_ascii.to_s )\n unsub_token = to.local\n\n if unsub_token == 'unsubscribe'\n #unsubscribe from address\n @subs = Subscriptions.find_by_email( from.address )\n else\n #unsubscribe using token\n @subs = Subscriptions.find_by_unsubscribe_token( unsub_token )\n end\n\n if @subs\n @subs.unsubscribe\n zza.track_event(\"email.unsubscribe.received\", {:email => @subs.email, :to => params[:to], :from => params[:from] })\n Rails.logger.info \"MAIL UNSUBSCRIBE: #{@subs.email} unsubscribed by email\"\n end\n render :nothing => true, :status=> :ok\n end",
"def unsubscribe_to_email_subscription_url_for(subscription, params = {})\n options = params.dup\n options.delete(:devise_default_routes) ?\n send(\"unsubscribe_to_email_#{routing_scope(options)}subscription_url\", subscription, options) :\n send(\"unsubscribe_to_email_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url\", subscription.target, subscription, options)\n end",
"def unsubscribe_subscription_url_for(subscription, params = {})\n options = params.dup\n options.delete(:devise_default_routes) ?\n send(\"unsubscribe_#{routing_scope(options)}subscription_url\", subscription, options) :\n send(\"unsubscribe_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_url\", subscription.target, subscription, options)\n end",
"def subscribe_url\n nil\n end",
"def unsubscribe destination_name, message_headers={}\r\n end",
"def unsubscribe_to_email\n @subscription.unsubscribe_to_email\n return_back_or_ajax\n end",
"def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end",
"def unsubscribe\n email = Base64.decode64(params[:token])\n Subscription.where(email: email).destroy_all\n end",
"def unsubscribe_to_email_subscription_path_for(subscription, params = {})\n options = params.dup\n options.delete(:devise_default_routes) ?\n send(\"unsubscribe_to_email_#{routing_scope(options)}subscription_path\", subscription, options) :\n send(\"unsubscribe_to_email_#{routing_scope(options)}#{subscription.target.to_resource_name}_subscription_path\", subscription.target, subscription, options)\n end",
"def unsubscribe destination_name, message_headers={}\n end",
"def unsubscribe(info)\n\t\tend",
"def unsubscribe(url, id = nil, opts = {}, &blk)\n endpoint = opts[:hub] || @@superfeedr_endpoint\n request = prep_request(url, id, endpoint, opts)\n\n request['hub.mode'] = 'unsubscribe'\n\n response = http_post(endpoint, request)\n\n r = response.body, opts[:async] && Integer(response.code) == 202 || Integer(response.code) == 204, response\n if blk\n blk.call(r) \n end\n r\n end",
"def unsubscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.unsubscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :delete_member => true, # this is NOT the default value\n :send_notify => true,\n :send_goodbye => true\n })\n Rails.logger.info(\"Unsubscribed #{self.email} from MailChimp\") if result\n end",
"def create_unsubscribes(data)\n # `data` should be a list of hashes, with each hash containing *at least* an `address` key.\n split_return = []\n if data.length >= 1000 then\n resp, resp_l = create_unsubscribes data[999..-1]\n split_return.push(resp)\n split_return.concat(resp_l)\n data = data[0..998]\n elsif data.length == 0 then\n return nil, []\n end\n\n valid = []\n # Validate the unsubscribes given\n while not data.empty? do\n unsubscribe = data.pop\n # unsubscribes MUST contain a `address` key.\n if not unsubscribe.include? :address then\n raise Mailgun::ParameterError.new \"Unsubscribe MUST include a :address key: #{unsubscribe}\"\n end\n\n unsubscribe.each do |k, v|\n # Hash values MUST be strings.\n # However, unsubscribes contain an array of tags\n if v.is_a? Array\n unsubscribe[k] = v.map(&:to_s)\n elsif !v.is_a? String\n unsubscribe[k] = v.to_s\n end\n end\n\n valid.push unsubscribe\n end\n\n response = @client.post(\"#{@domain}/unsubscribes\", valid.to_json, { \"Content-Type\" => \"application/json\" })\n return response, split_return\n end",
"def make_subscription_url(opts)\n validate_subscription_type opts[:type]\n path = if opts[:type] == :all\n \"\"\n else\n \"/\"+opts[:type].to_s\n end\n url = \"/user/#{@user_id}#{path}/apiSubscriptions\"\n if opts[:use_subscription_id]\n unless opts[:subscription_id]\n raise Fitgem::InvalidArgumentError, \"Must include options[:subscription_id]\"\n end\n url += \"/#{opts[:subscription_id]}\"\n end\n url += \".json\"\n end",
"def base_url\n \"#{Mailgun.protocol}://api:#{Mailgun.api_key}@#{Mailgun.mailgun_host}/#{Mailgun.api_version}\"\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list whose elements may also be integers or other lists. Example 1: Given the list [[1,1],2,[1,1]], return 10. (four 1's at depth 2, one 2 at depth 1)
|
def sum_depth ( x, weight = 1 )
sum = 0
x = [ x ] if x.is_a? Integer
x.each do | n |
if n.is_a? Array
sum += sum_depth( n, weight + 1 )
else
sum += n * weight
end
end
return sum
end
|
[
"def sum_nested(lst)\n sum = 0\n\n lst.each do |element|\n if element.is_a?(Array)\n sum += sum_nested(element)\n else\n sum += element\n end\n end\n\n sum\nend",
"def sum_nested_collection\n nested_numbers = [[1,2,3], [5,6,7,5], [9,10,13,6], [1]]\nend",
"def deep_count_x(arr)\n arr.map {|e| e.is_a?(Array) ? deep_count_x(e) + 1 : 1}.sum\nend",
"def sum_of_all_elements_DFS(root)\n return 0 if !root\n return root.value + sum_of_all_elements_DFS(root.left_child) + sum_of_all_elements_DFS(root.right_child)\nend",
"def sum(list)\n\tif list.empty?\n\t\treturn 0\n\telsif (list.first.class == Array) == true\n\t\tfirst, *rest = list\n\t\treturn sum(first) + sum(rest)\n\telse\n\t\tfirst, *rest = list\n\t\treturn first + sum(rest)\n\tend\nend",
"def deep_count(a)\r\n a.map{|x|x.is_a?(Array) ? 1+deep_count(x) : 1}.inject 0,:+\r\nend",
"def total_in_tree(hash)\n hash.reduce(0) do |acc, (_k, v)|\n acc + case v\n when Array, Hash\n total_in_tree v\n else\n v.is_a?(Integer) ? v : 0\n end\n end\nend",
"def depth (a)\n return 0 unless a.is_a?(Array)\n return 1 + depth(a[0])\nend",
"def multi_dimensional_sum(array)\n array.flatten.sum\nend",
"def ways_to_sum(n, list)\n return 1 if n == 0\n return 0 if list.empty?\n count = 0\n (0..(n / list[0])).each do |i|\n count += ways_to_sum(n - list[0] * i, list[1, list.length])\n end\n return count\nend",
"def SumSquares(arr)\n #first flatten the array inside\n results = 0\n arr.each do |el|\n if el.is_a?(Array)\n results += SumSquares(el)\n else\n results += el**2\n end\n end\n\n results\nend",
"def sum_numbers(root)\n return 0 if root.nil?\n\n numbers = []\n stack = [[root, '']]\n\n until stack.empty?\n root, path_str = stack.pop\n path_str += root.val.to_s\n if root.right || root.left\n stack.push([root.right, path_str]) if root.right\n stack.push([root.left, path_str]) if root.left\n else\n numbers.push(path_str)\n end\n end\n\n numbers.map(&:to_i).reduce(:+)\nend",
"def deep_count(arr)\n count = 0\n arr.each do |el|\n if el.class != Array\n count += 1\n else\n count += 1 + deep_count(el)\n end\n end\n count\nend",
"def largestParentSum( node, depth )\n depth -= 1\n\n if node != nil \n sum = node.to_int\n else\n return 0\n end\n\n if depth <= 0\n return sum\n end\n \n if node.parents.size == 1\n sum + largestParentSum( node.parents.first, depth )\n else\n sum + [ largestParentSum( node.parents.first, depth ), largestParentSum( node.parents.last, depth ) ].max\n end\nend",
"def two_d_sum(arr)\n\tsum = 0\n arr.each do |subArray|\n subArray.each do |i|\n sum += i\n end\n end\n return sum\nend",
"def sum_numbers(root, accumulator = 0)\n return 0 if root.nil?\n\n accumulator = accumulator * 10 + root.val\n\n if root.left.nil? && root.right.nil? # if a leaf node has been hit, return the cumulative value\n return accumulator\n end\n\n sum_numbers(root.left, accumulator) + sum_numbers(root.right, accumulator)\nend",
"def depth(a)\n\treturn 0 unless a.is_a?(Array)\n\treturn 1 + depth(a[0])\nend",
"def two_d_sum(arr)\n\tsum = 0\n arr.each do |elem|\n elem.each do |num|\n sum +=num\n end\n end\n return sum\nend",
"def get_depth(factor)\n if !(factor.is_a?(Array))\n return 0\n else\n return 1 + get_depth(factor[0])\n end\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Checks if the user is the author of a reply
|
def reply_author(reply)
logged_in? && current_user.id == reply.user_id
end
|
[
"def reply_author(reply)\n user_signed_in? && current_user.id == reply.user_id\n end",
"def answered_by?(user)\n replies.exists?(:user_id => user)\n end",
"def author?(user)\n self.user == user\n end",
"def author?(user)\n authors.member?(user)\n end",
"def already_replied? client, user\n client.user_timeline(\"crustasianwill\").any?{|my_tweet|\n my_tweet.in_reply_to_user_id == user.id\n }\nend",
"def current_user_is_author?\n current_user && current_user.is_author\n end",
"def verify_user_is_author\n unless current_user == @comment.author\n flash[:danger] = \"Can not modify someone else's post!\"\n redirect_to root_path\n end\n end",
"def reply?\n !self.in_reply_to.nil?\n end",
"def author_cant_respond\r\n author_id = self.respondent.id\r\n question_author_id = question.poll.author.id\r\n return author_id == question_author_id\r\n end",
"def is_reply?\n @is_reply\n end",
"def has_reply?\n @has_reply\n end",
"def respondent_is_not_author_poll?\n #\n # respondend.id == author.id\n\n if question.poll.author.id == user.id\n errors[:user_id] << 'author should not answer to his/her poll'\n end\n end",
"def is_author?\n true if current_user.level == author_level\n end",
"def invitable_to?(user)\n return false unless pending?\n return false if authors.include?(user)\n end",
"def deleted_by_author?\n @deleted_by_author = (\n system_post? and header_as_plain == \"This posting has been deleted by its author.\"\n ) if @deleted_by_author.nil?\n \n @deleted_by_author\n end",
"def can_reply?(user)\n return false if user.nil?\n category = determine_category\n\n args = [:categories, category.id.to_s, :reply_to]\n\n key = 'cached:' + user.id.to_s + ':' + self.class.name + ':can_reply:' + args.to_json\n cached = $redis.get(key)\n return string_to_bool(cached) unless cached.nil?\n\n visible = user.has_permission?(args + [:normal, 'all'])\n\n if !visible && self.user == user\n visible = user.has_permission?(args + [:normal, 'own'])\n end\n\n if visible && self.archived?\n visible = user.has_permission?(args + [:archived, 'all'])\n visible = visible || (self.user == user && user.has_permission?(args + [:archived, 'own']))\n end\n\n if visible && self.locked?\n visible = user.has_permission?(args + [:locked, 'all'])\n visible = visible || (self.user == user && user.has_permission?(args + [:locked, 'own']))\n end\n\n $redis.set(key, visible)\n\n return visible\n end",
"def author?\n !author.nil? && !author.empty?\n end",
"def author\n if @message.user_id > 0\n unless (current_user.sk == @message.user || (current_user.sk.admin && !@message.user.admin) || current_user.sk.root)\n render 'errors/access_refused' and return\n end\n else # Automatic message\n unless current_user.sk.root\n render 'errors/access_refused' and return\n end\n end\n end",
"def can_be_replied_by?(attempting_user)\n if attempting_user\n published? && (is_public? || is_protected? || member?(attempting_user) || attempting_user.is_admin? ||\n (is_subscription_only? && attempting_user.is_paid_subscriber?))\n else\n false # must be logged in to make a reply\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /tipo_venta POST /tipo_venta.json
|
def create
@tipo_ventum = TipoVentum.new(tipo_ventum_params)
respond_to do |format|
if @tipo_ventum.save
format.html { redirect_to @tipo_ventum, notice: 'Tipo ventum was successfully created.' }
format.json { render :show, status: :created, location: @tipo_ventum }
else
format.html { render :new }
format.json { render json: @tipo_ventum.errors, status: :unprocessable_entity }
end
end
end
|
[
"def create\n @tipo_evento = TipoEvento.new(tipo_evento_params)\n\n respond_to do |format|\n if @tipo_evento.save\n format.html { redirect_to :eventos, notice: 'Tipo evento was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_evento }\n else\n format.html { render :new }\n format.json { render json: @tipo_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @servico_evento = Servico::Evento.new(servico_evento_params)\n\n respond_to do |format|\n if @servico_evento.save\n format.html { redirect_to @servico_evento, notice: 'Evento was successfully created.' }\n format.json { render action: 'show', status: :created, location: @servico_evento }\n else\n format.html { render action: 'new' }\n format.json { render json: @servico_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_venda = TipoVenda.new(tipo_venda_params)\n\n respond_to do |format|\n if @tipo_venda.save\n format.html { redirect_to @tipo_venda, notice: 'Tipo venda was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_venda }\n else\n format.html { render :new }\n format.json { render json: @tipo_venda.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venta = Venta.new(params[:venta])\n\n respond_to do |format|\n if @venta.save\n format.html { redirect_to @venta, notice: 'Venta was successfully created.' }\n format.json { render json: @venta, status: :created, location: @venta }\n else\n format.html { render action: \"new\" }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @core_tipo_evento = Core::TipoEvento.new(params[:core_tipo_evento])\n\n respond_to do |format|\n if @core_tipo_evento.save\n format.html { redirect_to @core_tipo_evento, notice: 'Tipo evento was successfully created.' }\n format.json { render json: @core_tipo_evento, status: :created, location: @core_tipo_evento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @core_tipo_evento.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_servico = TipoServico.new(tipo_servico_params)\n\n respond_to do |format|\n if @tipo_servico.save\n format.html { redirect_to @tipo_servico, notice: 'Tipo servico criado com sucesso!' }\n format.json { render :show, status: :created, location: @tipo_servico }\n else\n format.html { render :new }\n format.json { render json: @tipo_servico.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_de_servicio = TipoDeServicio.new(tipo_de_servicio_params)\n\n respond_to do |format|\n if @tipo_de_servicio.save\n format.html { redirect_to @tipo_de_servicio, notice: 'Tipo de servicio was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_de_servicio }\n else\n format.html { render :new }\n format.json { render json: @tipo_de_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @venta = Venta.new(venta_params)\n\n respond_to do |format|\n if @venta.save\n format.html { redirect_to @venta, notice: 'Venta was successfully created.' }\n format.json { render :show, status: :created, location: @venta }\n else\n format.html { render :new }\n format.json { render json: @venta.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_seguro = TipoSeguro.new(params[:tipo_seguro])\n\n respond_to do |format|\n if @tipo_seguro.save\n format.html { redirect_to @tipo_seguro, notice: 'Tipo seguro was successfully created.' }\n format.json { render json: @tipo_seguro, status: :created, location: @tipo_seguro }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_seguro.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @dia_evento = DiaEvento.new(dia_evento_params)\n\n if @dia_evento.save\n render json: @dia_evento, status: :created, location: @dia_evento\n else\n render json: @dia_evento.errors, status: :unprocessable_entity\n end\n end",
"def create\n @tipoaviso = Tipoaviso.new(tipoaviso_params)\n\n respond_to do |format|\n if @tipoaviso.save\n format.html { redirect_to @tipoaviso, notice: 'Tipoaviso was successfully created.' }\n format.json { render :show, status: :created, location: @tipoaviso }\n else\n format.html { render :new }\n format.json { render json: @tipoaviso.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_veiculo = TipoVeiculo.new(tipo_veiculo_params)\n\n respond_to do |format|\n if @tipo_veiculo.save\n format.html { redirect_to @tipo_veiculo, notice: 'Tipo veiculo was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_veiculo }\n else\n format.html { render :new }\n format.json { render json: @tipo_veiculo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_servicio = TipoServicio.new(tipo_servicio_params)\n\n respond_to do |format|\n if @tipo_servicio.save\n format.html { redirect_to @tipo_servicio, notice: 'Tipo servicio was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_servicio }\n else\n format.html { render :new }\n format.json { render json: @tipo_servicio.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_apuestum = TipoApuestum.new(params[:tipo_apuestum])\n\n respond_to do |format|\n if @tipo_apuestum.save\n format.html { redirect_to @tipo_apuestum, notice: 'Tipo apuestum was successfully created.' }\n format.json { render json: @tipo_apuestum, status: :created, location: @tipo_apuestum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_apuestum.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoestado = Tipoestado.new(tipoestado_params)\n\n respond_to do |format|\n if @tipoestado.save\n format.html { redirect_to @tipoestado, notice: 'Tipoestado was successfully created.' }\n format.json { render :show, status: :created, location: @tipoestado }\n else\n format.html { render :new }\n format.json { render json: @tipoestado.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipoapreensao = Tipoapreensao.new(tipoapreensao_params)\n\n respond_to do |format|\n if @tipoapreensao.save\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @tipoapreensao }\n else\n format.html { render action: 'new' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @eventodepo = Eventodepo.new(params[:eventodepo])\n\n respond_to do |format|\n if @eventodepo.save\n format.html { redirect_to @eventodepo, notice: 'Eventodepo was successfully created.' }\n format.json { render json: @eventodepo, status: :created, location: @eventodepo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @eventodepo.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tiporeserva = Tiporeserva.new(tiporeserva_params)\n\n respond_to do |format|\n if @tiporeserva.save\n format.html { redirect_to @tiporeserva, notice: 'Registro incluído com suecesso!.' }\n format.json { render :show, status: :created, location: @tiporeserva }\n else\n format.html { render :new }\n format.json { render json: @tiporeserva.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @tipo_atendimento = TipoAtendimento.new(params[:tipo_atendimento])\n\n respond_to do |format|\n if @tipo_atendimento.save\n format.html { redirect_to @tipo_atendimento, notice: \"Tipo de atendimento: #{@tipo_atendimento.descricao}, foi criado com sucesso,\" }\n format.json { render json: @tipo_atendimento, status: :created, location: @tipo_atendimento }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tipo_atendimento.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /tipo_venta/1 DELETE /tipo_venta/1.json
|
def destroy
@tipo_ventum.destroy
respond_to do |format|
format.html { redirect_to tipo_venta_url, notice: 'Tipo ventum was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @tipo_evento = TipoEvento.find(params[:id])\n @tipo_evento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipi_evento_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_evento = TipoEvento.find(params[:id])\n @tipo_evento.destroy\n\n respond_to do |format|\n format.html { redirect_to tipos_eventos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_tipo_evento = Core::TipoEvento.find(params[:id])\n @core_tipo_evento.destroy\n\n respond_to do |format|\n format.html { redirect_to core_tipo_eventos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\r\n @sivic_tipo_evento.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_tipo_eventos_url }\r\n format.json { head :no_content }\r\n end\r\n end",
"def destroy\n @ventum.destroy\n respond_to do |format|\n format.html { redirect_to venta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_servico.destroy\n respond_to do |format|\n format.html { redirect_to tipo_servicos_url, notice: 'Tipo servico apagado com sucesso!.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_estado.destroy\n respond_to do |format|\n format.html { redirect_to tipo_estados_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @venta = Venta.find(params[:id])\n @venta.destroy\n\n respond_to do |format|\n format.html { redirect_to ventas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_analise.destroy\n respond_to do |format|\n format.html { redirect_to tipo_analises_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoapreensao.destroy\n respond_to do |format|\n format.html { redirect_to tipoapreensoes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @servico_evento.destroy\n respond_to do |format|\n format.html { redirect_to servico_eventos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_apuestum = TipoApuestum.find(params[:id])\n @tipo_apuestum.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_apuesta_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_tarifa.destroy\n respond_to do |format|\n format.html { redirect_to tipo_tarifas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_vehiculo = TipoVehiculo.find(params[:id])\n @tipo_vehiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_vehiculos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_seguro = TipoSeguro.find(params[:id])\n @tipo_seguro.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_seguros_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @estatuto = Estatuto.find(params[:id])\n @estatuto.destroy\n\n respond_to do |format|\n format.html { redirect_to estatutos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_egreso = TipoEgreso.find(params[:id])\n @tipo_egreso.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_egresos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipoenvolvido.destroy\n respond_to do |format|\n format.html { redirect_to tipoenvolvidos_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @tipo_acidente.destroy\n respond_to do |format|\n format.html { redirect_to tipo_acidentes_url }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Checks if other period is inside this period. This means that both starts_at and ends_at of other period have to be included in this period.
|
def include?(other_period)
inside?(other_period.starts_at) && inside?(other_period.ends_at)
end
|
[
"def overlaps_with_reservation?(other)\n other.overlaps?(begins_at, ends_at)\n end",
"def overlaps\n other_orders.overlaps start_date, end_date\n end",
"def overlaps(other_date_range)\n if contains(other_date_range.start_date) || contains(other_date_range.end_date)\n true\n elsif other_date_range.contains(@start_date) && other_date_range.contains(@end_date)\n true\n else\n false\n end\n end",
"def contained_inside?(other_time_span)\n starts_on_or_after?(other_time_span) && ends_on_or_before?(other_time_span)\n end",
"def overlapping_with?(other)\n (self.start_time <= other.start_time && self.end_time >= other.start_time) ||\n (other.start_time <= self.start_time && other.end_time >= self.start_time)\n end",
"def ends_before_other_starts?(other_time_span)\n ends < other_time_span.starts\n end",
"def contained_fully_inside?(other_time_span)\n starts_after?(other_time_span) && ends_before?(other_time_span)\n end",
"def starts_before_or_with?(other_time_span)\n starts <= other_time_span.starts\n end",
"def starts_as_other_ends?(other_time_span)\n starts == other_time_span.ends\n end",
"def check_overlap_with(time_period)\n if time_period.start <= @finish && time_period.finish >= @start\n @overlappings << time_period\n end\n end",
"def meeting_conflict?(other)\n return false if self.start_time.nil? or other.start_time.nil?\n section_days = other.days.split(\"\")\n section_days.each do |day|\n if( self.days.include?(day) )\n if (self.start_time.to_i >= other.start_time.to_i and self.start_time.to_i <= other.end_time.to_i) or \n (other.start_time.to_i >= self.start_time.to_i and other.start_time.to_i <= self.end_time.to_i)\n return true\n end \n end\n end\n return false\n end",
"def ends_as_other_starts?(other_time_span)\n ends == other_time_span.starts\n end",
"def include?(period)\n if period.is_a?(Date)\n start_date <= period && period <= end_date\n elsif period.is_a?(String)\n date = Date.parse(period.to_s)\n start_date <= date && date <= end_date\n elsif period.is_a?(Period)\n start_date <= period.start_date && period.end_date <= end_date\n else\n false\n end\n end",
"def contains_fully?(other_time_span)\n starts_before?(other_time_span) && ends_after?(other_time_span)\n end",
"def between?(first_day, last_day)\n ((self.ends_at.to_date >= first_day) && (self.ends_at.to_date <= last_day)) || ((self.starts_at.to_date >= first_day) && (self.starts_at.to_date <= last_day))\n end",
"def proper_include?(other_timeframe)\n raise ArgumentError, 'Proper inclusion only makes sense when testing other Timeframes' unless other_timeframe.is_a? Timeframe\n (start_date < other_timeframe.start_date) and (end_date > other_timeframe.end_date)\n end",
"def ends_on_or_before?(other_time_span)\n ends <= other_time_span.ends\n end",
"def starts_after?(other_time_span)\n starts > other_time_span.starts\n end",
"def overlap(dates)\n (out_date <= dates.in_date || in_date >= dates.out_date)\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
We can't serialize the explainer, so clear it before we transmit
|
def prepare_to_send
statement.explainer = nil
end
|
[
"def prepare_to_send\n statement.explainer = nil\n end",
"def clear_generated_description; end",
"def clear\n @recorded = ''\n end",
"def clear\n @answers = Hash.new\n @title = \"\"\n @version = 1.1\n end",
"def clear_description\n @description = Mongo::Server::Description.new(address, {})\n end",
"def cleanup\n redis.del(desc_key)\n cleanup_dump\n end",
"def clear; @output.clear ; end",
"def clear_data!\n @data = ''\n end",
"def clear\n self.request = nil\n end",
"def clear_reset_key\n self.reset_key_hash = nil\n self.reset_sent_at = nil\n end",
"def discard_doc!\n links # force parsing of page links before we trash the document\n @doc = body = nil\n self.save\n end",
"def clearHash()\n\t\t\t@csdl = '' unless !@csdl.nil?\n\t\t\t@hash = false\n\t\t\t@total_dpu = false\n\t\t\t@created_at = false\n\t\tend",
"def clear\n @data = nil\n end",
"def clear\n @topics.clear\n @consumer_groups.clear\n @data.clear\n end",
"def clear_builder\n TransactionState.get.transaction_sample_builder = nil\n end",
"def reset\n\t\tsuper\n\n\t\t@mediatype_callbacks.clear\n\t\t@language_callbacks.clear\n\t\t@encoding_callbacks.clear\n\n\t\t# Not clearing the Vary: header for now, as it's useful in a 406 to\n\t\t# determine what accept-* headers can be modified to get an acceptable\n\t\t# response\n\t\t# @vary_fields.clear\n\tend",
"def clear\n @server.clear_data\n end",
"def clear\n render({})\n end",
"def suppress; @write = false end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
`Paginatedlast_page(count)` Compute the maximum page number which could be meaningfully displayed.
|
def last_page(count)
(count / PER_PAGE.to_f).ceil
end
|
[
"def last_page\n (@count / @per_page.to_f).ceil\n end",
"def last_page\n page(page_count)\n end",
"def last_page_number\n number_of_pages\n end",
"def bound_last(last, count)\n if last > last_page(count) then last_page(count) else last end\n end",
"def last_page\n (max_matches.to_f / per_page).ceil\n end",
"def last_page\n self[page_count] \n end",
"def max_page(per_page = 10)\n count_hint / per_page + (count_hint % per_page == 0 ? 0 : 1)\n end",
"def last_page_index\n num_pages() - 1\n end",
"def get_last_page(s)\n tot = s.messages.count\n return [0,((tot-1)/10).floor].max + 1\n end",
"def last_page\n posts.page.total_pages\n end",
"def find_last_page(inital_count)\n last_page = self.github_client.last_response.headers[\"link\"]\n \n if last_page.present?\n last_page = last_page.split(\";\")[1].split(\",\")[1].split(\"page=\").last.gsub(\">\", \"\")\n\n return last_page if last_page.to_i.to_s.size == last_page.size\n end\n\n return 1 if self.github_client.last_response.headers[\"link\"].blank?\n\n # For example in case of slack commands we can use `page-X` flag\n # If there are in total 5 pages and we use `page-2` flag\n # The above calculation for last page won't work\n # Thus we need to calculate it using the following code\n if (last_page.to_i.to_s.size != last_page.size) && slack_command?\n array_of_links = self.github_client.last_response.headers[\"link\"].split(';')\n array_of_links.each_with_index do |str, index|\n next if str.exclude?('last')\n last_page = array_of_links[index-1].split('page=')[1].to_i\n end\n \n # In case we do last `page-5` the last page\n # Then again the avobe code won't work\n if last_page.to_i.to_s.size != last_page.size\n last_page = self.github_client.last_response.headers[\"link\"].split(';')[0].split('page=')[1].to_i + 1\n end\n \n return last_page\n else\n return inital_count.to_s\n end\n end",
"def max_page\n (Post.count(@tag).to_f / Post.page_size.to_f).ceil\n end",
"def count_items_on_last_page\n\t\tc = count_items % items_per_page\n\t\tif c.eql?(0)\n\t\t\treturn items_per_page\n\t\telse\n\t\t\treturn c\n\t\tend\n\tend",
"def last_page\n detect { |link| link.rel == Link::Rel::LAST }\n end",
"def last_item_number\n if next?\n @offset + @pager.per_page\n else\n @pager.count\n end\n end",
"def get_last_page\n query = URI.parse(request.referrer).query\n @last_page = query.nil? ? 0 : CGI.parse(query)[\"page\"].first.to_i\n end",
"def last_page?\n current_page == page_count\n end",
"def last_page(url = onliner_url)\n JSON(Net::HTTP.get(URI(url)))['page']['last']\n #Net::HTTP.get(URI(url)).scan(/\\\"last\\\"\\:\\d{1,}/).to_s.scan(/\\d+/).first.to_i\n end",
"def max_pages() 1 end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
`Paginatedpage(req)` Retrieve the current page out of the `req` instance.
|
def page(req)
req.params.fetch('page', default='1').to_i
end
|
[
"def pagination_page\n page = params[:page].to_i\n page = 1 if page == 0\n page\n end",
"def page\n\t\t\t@page ||= request.headers[\"page\"] || 1\n\t\tend",
"def paginate(request)\n pkey = httpize(PuppetHerald::Models::Pagination::KEYS[:page])\n lkey = httpize(PuppetHerald::Models::Pagination::KEYS[:limit])\n page = request.env[pkey] ? request.env[pkey] : PuppetHerald::Models::Pagination::DEFAULT.page\n limit = request.env[lkey] ? request.env[lkey] : PuppetHerald::Models::Pagination::DEFAULT.limit\n PuppetHerald::Models::Pagination.new(page, limit)\n end",
"def page\n (params[:page] || 0).to_i\n end",
"def paginate\n paginated?? self : page(1)\n end",
"def page_param\n params&.dig(:page)\n end",
"def current_page\n params[:page] && params[:page].match(/\\d+/) ? params[:page].to_i : 1\n end",
"def current_page\r\n return 1 if start < 1\r\n per_page_normalized = per_page < 1 ? 1 : per_page\r\n @current_page ||= (start / per_page_normalized).ceil + 1\r\n end",
"def current_page\n return 1 if start < 1\n per_page_normalized = per_page < 1 ? 1 : per_page\n @current_page ||= (start / per_page_normalized).ceil + 1\n end",
"def current_page\n return 1 unless self.paginated?\n return 1 if @conditions[:page].to_i < 1\n return @conditions[:page].to_i\n end",
"def page_number\n (params[:page] || 1).to_i\n end",
"def page\n return 1 if !params[page_param] || params[page_param].empty?\n params[page_param].to_i\n end",
"def paginate(opts)\n resource\n end",
"def paginate page, per_page, path, opts = nil\n opts ||= {}\n opts[:params] ||= {}\n raise \"'rows' or 'start' params should not be set when using +paginate+\" if [\"start\", \"rows\"].include?(opts[:params].keys)\n execute build_paginated_request(page, per_page, path, opts)\n end",
"def set_current_page\n @current_page = params[:page] || 1\n end",
"def paginated_collection\n collection_paginator.new(collection, params).call\n end",
"def paginate opts = {}\n @paginator = true\n page = (opts[:page] || 1).to_i\n per_page = (opts[:per_page] || 20).to_i\n page = 1 if page < 1\n limit( per_page, ( page - 1 ) * per_page )\n end",
"def page\n page = @page.to_i\n page > 1 ? page : 1\n end",
"def current_page\n @current_page ||= self.class.starting_page\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
`Paginatedpage_nums(req, count)` Compute the range of page numbers to display based on the current `req` and the total `count` of items contained in the paginated collection.
|
def page_nums(req, count)
first = page(req) - SPREAD
last = bound_first(first) + (SPREAD * 2)
first = bound_last(last, count) - (SPREAD * 2) if bound_last(last, count) == last_page(count)
bound_first(first)..bound_last(last, count)
end
|
[
"def calc_pages(count, page_size)\n ( (count.to_i-1) / page_size.to_i ).to_i + 1\n end",
"def page_count=(num)\n @page_count = num\n end",
"def xdes_page_numbers\n (0..(@pages / pages_per_xdes_page)).map { |n| n * pages_per_xdes_page }\n end",
"def pagination_numbers(pages, args={})\n result = safe_empty\n if pages && pages.num_pages > 1\n params = args[:params] ||= {}\n if pages.letter_arg && pages.letter\n params[pages.letter_arg] = pages.letter\n end\n\n num = pages.num_pages\n arg = pages.number_arg\n this = pages.number\n this = 1 if this < 1\n this = num if this > num\n size = args[:window_size] || 5\n from = this - size\n to = this + size\n\n result = []\n pstr = \"« #{:PREV.t}\"\n nstr = \"#{:NEXT.t} »\"\n result << pagination_link(pstr, this-1, arg, args) if this > 1\n result << '|' if this > 1\n result << pagination_link(1, 1, arg, args) if from > 1\n result << '...' if from > 2\n for n in from..to\n if n == this\n result << n\n elsif n > 0 && n <= num\n result << pagination_link(n, n, arg, args)\n end\n end\n result << '...' if to < num - 1\n result << pagination_link(num, num, arg, args) if to < num\n result << '|' if this < num\n result << pagination_link(nstr, this+1, arg, args) if this < num\n\n result = content_tag(:div, result.safe_join(' '), :class => \"pagination\")\n end\n result\n end",
"def num_pages\n\t\t\t\t(num_results.to_f / batch_size).ceil\n\t\t\tend",
"def paginator(page_no, count, options = {})\n options = options.reverse_merge :per_page => self.pagination_options[:per_page]\n Paginator.new(page_no, options[:per_page], count, options)\n end",
"def page_numbers\n start = current_page - @link_range\n finish = current_page + @link_range\n\n if start < 1\n finish = [finish + 1 - start, page_count].min\n start = 1\n elsif finish > page_count\n start = [start + page_count - finish, 1].max\n finish = page_count\n end\n\n (start..finish).to_a\n end",
"def pagination_number_list \n (0...page_button_count).to_a.map do |n|\n link_number = n + page_number_offset\n number_span(link_number)\n end.join(' ')\n end",
"def page_count\n @total_pages\n end",
"def number_of_reviews_pages (reviews_count)\n\tif reviews_count <= 10\n\t\tpages_count = 1\n\telse \n\t\tnumber_of_review_last_page = reviews_count % 10\n\t\tpages_count = (reviews_count-number_of_review_last_page)/10\n\t\tif number_of_review_last_page > 0\n\t\t\tpages_count = pages_count +1\n\t\telse\n\t\t\tpages_count = pages_count +0\n\t\tend\n\tend\nend",
"def page_visits_counter\n number_of_visits = visits_per_page.map { |page, visits| [page, visits.count] }\n number_of_visits.sort_by { |h| -h.last }\n end",
"def page_count\r\n @total_pages\r\n end",
"def show_total_pages\n pages = show_total_hits / show_results_per_page\n return pages + 1\n end",
"def page_count=(value)\n @page_count = value\n end",
"def paginator_numbers(total_pages, display_range=3, aParams=params)\n current_page = aParams[:page] ? aParams[:page].to_i : 1\n total_pages = total_pages.to_i\n html = \"\"\n # weed out the first and last page, they'll be handled separately\n prior_pages = (current_page-display_range..current_page-1).reject { |x| x <= 1 }\n next_pages = (current_page+1..current_page+display_range).reject { |x| x >= total_pages }\n\n # add the first page if you're not on it and add dots if it is far from the other pages\n if current_page != 1\n html += \"<li>\"\n html += link_to \"1\", to_page(\"1\", aParams)\n html += \"</li>\"\n html += \"<li class='disabled'><span>...</span></li>\" if prior_pages.min != display_range-1 && current_page != display_range-1\n end\n\n # prior pages, current page, and next pages\n html += add_paginator_options(prior_pages, aParams)\n html += \"<li class='active'>\"\n html += link_to current_page.to_s, to_page(current_page, aParams)\n html += \"</li>\"\n html += add_paginator_options(next_pages, aParams)\n\n # add the last page if you're not on it and add dots if it is far from the other pages\n if current_page != total_pages\n html += \"<li class='disabled'><span>...</span></li>\" if next_pages.max != total_pages-1 && current_page != total_pages-1\n html += \"<li>\"\n html += link_to total_pages.to_s, to_page(total_pages, aParams)\n html += \"</li>\"\n end\n\n return html.html_safe\n end",
"def page_range\n 1..page_count\n end",
"def show_total_pages\r\n pages = show_total_hits / show_results_per_page\r\n return pages + 1\r\n end",
"def pages(posts, per_page)\n (posts.count.to_f/per_page.to_f).ceil\n end",
"def number_of_reviews_pages (reviews_count)\n if reviews_count <= 10\n pages_count = 1\n else \n number_of_review_last_page = reviews_count % 10\n pages_count = (reviews_count-number_of_review_last_page)/10\n if number_of_review_last_page > 0\n pages_count = pages_count +1\n else\n pages_count = pages_count +0\n end\n end\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
`Paginatedbound_first(first)` Private method to calculate the first page based on the current value of `first` to display taking into account the lower display bound or minimum page number (1).
|
def bound_first(first)
if first < 1 then 1 else first end
end
|
[
"def first_page\n return nil if total_pages < 1\n return 1\n end",
"def first_page\n page(1)\n end",
"def lower_bound\n (pagenum - 1) * pagesize\n end",
"def first_page_number\n 1\n end",
"def first_page\n previous_page? ? resource_class.where(original_params.merge(from: from, page: { number: 1 })) : self\n end",
"def first_page\n self.visible_pages.first if self.visible_pages != nil\n end",
"def first!\n @page = 1\n end",
"def first_page!\n self.page = first_page\n all\n end",
"def first_page\n detect { |link| link.rel == Link::Rel::FIRST }\n end",
"def first_page!\n first_page.tap { |page| update_self(page) }\n end",
"def page_links_first\n @page_links_first\n end",
"def paginate_first_page_via_gitaly(finder)\n finder.execute(gitaly_pagination: true).tap do |records|\n total = finder.total\n per_page = params[:per_page].presence || Kaminari.config.default_per_page\n\n Gitlab::Pagination::OffsetHeaderBuilder.new(\n request_context: request_context, per_page: per_page, page: 1, next_page: 2,\n total: total, total_pages: total / per_page + 1\n ).execute\n end\n end",
"def first_page?\n page == 1\n end",
"def first_item_index\n items_per_page * page\n end",
"def first(&success_callback)\n async_wrap_if_realtime(success_callback) do\n return nil unless supports_pagination?\n PaginatedResult.new(client.get(pagination_url('first')), base_url, client, pagination_options, &each_block)\n end\n end",
"def starting_page\n @starting_page ||= 0\n end",
"def page\n (((@start || 0) / num_results_requested) + 1) rescue 1\n end",
"def first_page?\n current_page == pages.begin\n end",
"def fetch_first_page query\n if query then\n search query\n else\n random\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
`Paginatedbound_last(last, count)` Private method to calculate the last page number to display accounting for the maximum page number display bound represented by `last_page`. Returns a value less than or equal to `last_page` based on the current value of `last` and the total `count` of items in the collection.
|
def bound_last(last, count)
if last > last_page(count) then last_page(count) else last end
end
|
[
"def last_page\n (@count / @per_page.to_f).ceil\n end",
"def last_page(count)\n (count / PER_PAGE.to_f).ceil\n end",
"def last_page\n page(page_count)\n end",
"def last_page\n self[page_count] \n end",
"def last_page_number\n number_of_pages\n end",
"def last_page\n (max_matches.to_f / per_page).ceil\n end",
"def count_items_on_last_page\n\t\tc = count_items % items_per_page\n\t\tif c.eql?(0)\n\t\t\treturn items_per_page\n\t\telse\n\t\t\treturn c\n\t\tend\n\tend",
"def last_page_index\n num_pages() - 1\n end",
"def last_page\n posts.page.total_pages\n end",
"def last_item\n if @paginator.items_per_page.kind_of?(Array) \n [offset + (@number <= @paginator.items_per_page.size ? @paginator.items_per_page[@number-1] : @paginator.items_per_page.last),@paginator.item_count].min\n else\n [@paginator.items_per_page * @number, @paginator.item_count].min\n end\n end",
"def last_item_number\n if next?\n @offset + @pager.per_page\n else\n @pager.count\n end\n end",
"def upper_bound\n upperbound = pagenum * pagesize\n if total < upperbound\n upperbound = total\n end\n upperbound\n end",
"def max_page(per_page = 10)\n count_hint / per_page + (count_hint % per_page == 0 ? 0 : 1)\n end",
"def get_last_page(s)\n tot = s.messages.count\n return [0,((tot-1)/10).floor].max + 1\n end",
"def last_item_index\n [(items_per_page * (page+1)) - 1, total_item_count - 1].min\n end",
"def last(*args)\n last_arg = args.last\n\n limit = args.first if args.first.kind_of?(Integer)\n with_query = last_arg.respond_to?(:merge) && !last_arg.blank?\n\n query = with_query ? last_arg : {}\n query = scoped_query(query.merge(:limit => limit || 1)).reverse\n\n # tell the Query to prepend each result from the adapter\n query.update(:add_reversed => !query.add_reversed?)\n\n if !with_query && (loaded? || lazy_possible?(tail, limit || 1))\n if limit\n new_collection(query, super(limit))\n else\n super()\n end\n else\n if limit\n all(query)\n else\n relate_resource(query.repository.read_one(query))\n end\n end\n end",
"def last\n @curr = pages - 1\n curr\n end",
"def last_page\n !last_page? ? updated_collection(last_page_params.merge(from: from)) : self\n end",
"def last(*args)\n last_arg = args.last\n\n limit = args.first if args.first.kind_of?(Integer)\n with_query = last_arg.respond_to?(:merge) && !last_arg.blank?\n\n query = with_query ? last_arg : {}\n query = self.query.slice(0, limit || 1).update(query).reverse!\n\n # tell the Query to prepend each result from the adapter\n query.update(:add_reversed => !query.add_reversed?)\n\n # TODO: when a query provided, and there are enough elements in tail to\n # satisfy the query.limit, filter the tail with the query, and make\n # sure it matches the limit exactly. if so, use that result instead\n # of calling all()\n\n collection = if !with_query && (loaded? || lazy_possible?(tail, query.limit))\n new_collection(query, super(query.limit))\n else\n all(query)\n end\n\n if limit\n collection\n else\n collection.to_a.last\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Approve a particular Store in the database
|
def approve_store_app(uid)
Store.unlock.where(uid: uid)
end
|
[
"def approve!\n self.update_attribute(:status, APPROVED)\n self.stock_entries.update_all(status: StockEntry::ACTIVE)\n true\n end",
"def approve\n @expense = Expense.find(params[:id])\n @expense.approve!\n\n if @expense.save\n flash[:notice] = \"La nota de venta fue aprobada.\"\n else\n flash[:error] = \"Existio un problema con la aprobación.\"\n end\n\n redirect_to expense_path(@expense)\n end",
"def approve\n\t\tlocation = Location.find(params[:id])\n\t\tlocation.update_attribute(:verified, true)\n\t\tlocation.save!\n\n\t\tredirect_to admins_path\n\tend",
"def approve_bill\n @bill = Bill.find(params[:id])\n @bill.status = 'approved'\n @bill.save\n redirect_to admins_url\n end",
"def approve\n res = submission_details.approve(self)\n update_attribute(:approved, res)\n res\n end",
"def approve\n approve_item(@item)\n RefreshOpensearchJob.perform_later\n toast!(title: \"Item approved\",\n message: \"This item has been approved.\")\n redirect_back fallback_location: item_path(@item)\n end",
"def approve\n @order=Order.find(params[:id])\n if @order.order_status == OrderStatus.find_by_value(Order::OPENED) \n if this_user.contact.manager_of?(@order.requestor.contact.id)\n @order.approve(this_user.contact.full_name)\n if @order.save\n Notifier.deliver_order_approved(@order.order_type.processor.contact, @order)\n flash[:info]=\"Order Approved\"\n end\n return redirect_to :back\n else\n flash[:warning]=\"Only the requestor's managers can approve this order!\"\n return redirect_to :back\n end\n else\n flash[:error]=\"Order is not able to be approved\"\n return redirect_to :back\n end\n end",
"def approve\n if @ad.mark_as_approved!\n render_success_message 'AD successfully approved!'\n else\n render_error_model @ad\n end\n end",
"def approve\n associate_or_create_identity\n self.update!(approval_state: ApprovalState::APPROVED)\n send_approval_email\n end",
"def auto_approve!\n update_attribute(:approved_at,DateTime.now)\n update_attribute(:approved_by, User.APPLICATION)\n write_key!\n end",
"def approve\n @company = Company.find(params[:id])\n if @company.approve!\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end",
"def approve!\n self.approved_at = Time.now\n registration.approve\n save!\n end",
"def confirm_sales_order\n @sales_order = SalesOrder.find_by_id params[:sales_order_id]\n # add some defensive programming.. current user has role admin, and current_user is indeed belongs to the company \n @sales_order.confirm( current_user ) \n end",
"def approve\n @organization.status = 'active'\n @organization.save\n redirect_to admin_organizations_path\n end",
"def admin_approve_user\n @user.update(approved: true)\n redirect_to admin_path, notice: \"User Approved\"\n end",
"def accept\n # Creating offer and saving new status\n @offer = Offer.find(params[:offer])\n @offer.status = \"Accepted\"\n @offer.save\n\n # Updating status of application to complete\n @course_application = @offer.course_application\n @course_application.status = \"Completed\"\n @course_application.save\n\n # Updating course spaces\n @course = @course_application.course\n @course.decrease_spaces\n @course.save\n\n # Updating user status having accepted an offer\n @user = @offer.course_application.application.user\n @user.has_accepted_offer = true\n @user.save\n end",
"def approve\n redirect_to(@income, alert: 'El Ingreso ya esta aprovado') and return unless @income.is_draft?\n\n @income.approve!\n if @income.save\n flash[:notice] = \"El Ingreso fue aprobado.\"\n else\n flash[:error] = \"Existio un problema con la aprobación.\"\n end\n\n redirect_to income_path(@income)\n end",
"def approve\n @asset_transfer = AssetTransfer.accessible_by(current_ability, :approve).find(params[:id])\n if @asset_transfer.approve!(current_user)\n respond_to do |format|\n format.html { redirect_to asset_transfers_url, notice: I18n.t('controllers.approve_success', name: @asset_transfer.class.model_name.human) } \n format.json { head :no_content }\n format.xml { head :no_content }\n end\n else\n respond_to do |format|\n format.html { redirect_to asset_transfers_url, flash: {error: @asset_transfer.errors} }\n format.json { head :no_content }\n format.xml { head :no_content }\n end\n end\n end",
"def approve\n course_user = create_course_user\n if course_user.persisted?\n Course::Mailer.user_added_email(course_user).deliver_later\n approve_success\n else\n approve_failure(course_user)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Reject a particular Store in the database
|
def reject_store_app(uid)
Store.lock.where(uid: uid)
end
|
[
"def remove_store\n @admin_market = Market.find(params[:id])\n store = Store.find(params[:store_id])\n \n @admin_market.stores.delete(store) if @admin_market.stores.include? store\n unless @admin_market.stores.include? store\n flash[:success] = 'Success add store to market'\n end\n end",
"def reject\n handle_action('reject')\n end",
"def reject\n @assignment.active_offer.rejected!\n render_success @assignment.active_offer\n end",
"def reject(id)\n end",
"def reject!\n return false if self.approved == true\n self.destroy\n end",
"def approve_store_app(uid)\n Store.unlock.where(uid: uid)\n end",
"def reject\n General::ChangeStatusService.new(self, StatusLancer::REJECTED).change\n if self.save\n MemberMailerWorker.perform_async(recruitment_id: self.id.to_s, perform: :send_recruitment_rejection)\n return true\n end\n return false\n end",
"def reject\n @company = Company.find(params[:id])\n if @company.reject!\n respond_with @company\n else\n respond_with @company, status: :unprocessable_entity\n end\n end",
"def reject!\n self.status = 'Rejected'\n self.save\n GameInviteResponseEvent.new(self).enqueue\n end",
"def reject!\n self.update_attribute(:state, 'rejected')\n end",
"def reject\n reject_item(@item)\n RefreshOpensearchJob.perform_later\n toast!(title: \"Item rejected\",\n message: \"This item has been rejected.\")\n redirect_back fallback_location: item_path(@item)\n end",
"def reject\n @userService = UserService.find_by_id(params[:id])\n @service = Service.find_by_id(@userService.service_id)\n @service.purchased = false\n @service.save\n @message = Message.new(receiver_id: @userService.buyer_id, user_id: current_user.id, content: current_user.firstName+\" \"+current_user.lastName+\" has declined your request for \"+@service.name)\n @message.save\n @userService.destroy\n end",
"def reject\n email = Email.find(params[:id])\n email.state = \"Rejected\"\n email.reject_reason = params[:reject_reason]\n if email.save!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end",
"def reject\n self.update_attribute(:state, REJECTED)\n end",
"def reject\n @document.reject!\n\n respond_to do |format|\n format.html { redirect_to @document, notice: t('view.documents.rejected') }\n format.json { head :no_content }\n end\n end",
"def reject!\n self.destroy\n end",
"def reject\n @application.update_attributes(status: 'rejected')\n redirect_to admin_event_path(@application.event_id),\n flash: { info: \"#{ @application.name}'s application has been rejected\" }\n end",
"def reject\n transition_to :rejected\n end",
"def reject\n register_change\n PristinePermission.delete(id) unless id.nil?\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Edit a particular Store in the database
|
def edit_store(edited_store)
store = Store.find(edited_store.uid)
store.attributes = edited_store.attributes
store.save!
end
|
[
"def edit\n @store = Store.find(params[:id])\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to(stores_path, :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:admin_store])\n format.html { redirect_to([:admin,@store], :notice => 'Store was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n @store = Store.find(params[:id])\n\n respond_to do |format|\n if @store.update_attributes(params[:store])\n format.html { redirect_to api_v1_store_path(@store.id), notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def edit\n @store = Store.find(params[:store_id])\n @beer = Beer.find(params[:id])\n end",
"def update\n @ins_store = InsStore.find(params[:id])\n\n respond_to do |format|\n if @ins_store.update_attributes(params[:ins_store])\n flash[:notice] = 'InsStore was successfully updated.'\n format.html { redirect_to(@ins_store) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ins_store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @store.update(store_params)\n format.html { redirect_to [:phone, @store], notice: 'Store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n\t\t@store_item = StoreItem.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tif @store_item.update_attributes(params[:store_item])\n\t\t\t\tformat.html { redirect_to store_items_url, flash: { info: 'StoreItem was successfully updated.' } }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: \"edit\" }\n\t\t\t\tformat.json { render json: @store_item.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend",
"def update\n authorize @store_detail, :update?\n respond_to do |format|\n if @store_detail.update(store_detail_params)\n format.html { redirect_to @store_detail, notice: 'Store detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @store_detail }\n else\n format.html { render :edit }\n format.json { render json: @store_detail.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @user_store = UserStore.find(params[:id])\n\n respond_to do |format|\n if @user_store.update_attributes(params[:user_store])\n format.html { redirect_to api_v1_user_store_path(@user_store), notice: 'User store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @store_type = StoreType.find(params[:id])\n\n respond_to do |format|\n if @store_type.update_attributes(params[:store_type])\n format.html { redirect_to @store_type, notice: 'Store type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render \"edit\" }\n format.json { render json: @store_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @bookstore = Bookstore.find(params[:id])\n\n respond_to do |format|\n if @bookstore.update_attributes(params[:bookstore])\n format.html { redirect_to @bookstore, notice: 'Bookstore was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookstore.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n if @store.update(store_params)\n render json: @store\n else\n render json: @store.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @order_store.update(order_store_params)\n format.html { redirect_to @order_store, notice: 'Order store was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_store }\n else\n format.html { render :edit }\n format.json { render json: @order_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @online_store = OnlineStore.find(params[:id])\n\n respond_to do |format|\n if @online_store.update_attributes(online_store_params)\n format.html { redirect_to @online_store, notice: 'Online store was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @online_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @products_store = ProductsStore.find(params[:id])\n\n respond_to do |format|\n if @products_store.update_attributes(params[:products_store])\n format.html { redirect_to @products_store, :notice => 'Products store was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @products_store.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @has_store.update(has_store_params)\n format.html { redirect_to @has_store, notice: \"Has store was successfully updated.\" }\n format.json { render :show, status: :ok, location: @has_store }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @has_store.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @item = Item.find(params[:id])\n @store = Store.find(params[:store_id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(store_item_path(@store,@item), :notice => 'Post was successfully updated.') }\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 @storeorder = Storeorder.find(params[:id])\n\t\n\n\n respond_to do |format|\n if @storeorder.update_attributes(params[:storeorder])\n format.html { redirect_to @storeorder, notice: 'Storeorder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @storeorder.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Delete a particular Store in the database
|
def delete_store(uid)
store = Store.find(uid)
store.delete!
end
|
[
"def destroy\n store_id = params[:id]\n Store.find(store_id).destroy\n render plain: \"Deleted store with id #{store_id}\"\n end",
"def remove_store\n @admin_market = Market.find(params[:id])\n store = Store.find(params[:store_id])\n \n @admin_market.stores.delete(store) if @admin_market.stores.include? store\n unless @admin_market.stores.include? store\n flash[:success] = 'Success add store to market'\n end\n end",
"def destroy\n @admin_store = Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @admin_store = Admin::Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to(stores_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @admin_store = Store.find(params[:id])\n @admin_store.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store_class.destroy\n\n head :no_content\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @store = Store.find(params[:id])\n @store.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_v1_store.destroy\n\n head :no_content\n end",
"def delete\n self.store -= self\n end",
"def destroy\n @store.destroy\n respond_to do |format|\n format.html { redirect_to phone_stores_url, notice: 'Store was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @user_store = UserStore.find(params[:id])\n @user_store.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_user_stores_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @product_store = ProductStore.find(params[:id])\n @product_store.destroy\n\n respond_to do |format|\n format.html { redirect_to product_stores_url }\n format.json { head :ok }\n end\n end",
"def remove\n @confirmation = true\n @myStore = Store.find(params[:id])\n @isItMystore = Store.find_if_my_store(session[:user_id],@myStore.id)\n @mySharedStore = Share.find_shared_store_for_delete(session[:user_id],@myStore.id)\n if @isItMystore.empty?\n @confirmation = false\n flash[:alert]=\"This is a store which has been shared with you. Thus cannot be deleted\"\n else\n @myStore.destroy\n @mySharedStore.delete(1)\n @confirmation = true\n flash[:notice]=\"Store deleted.\"\n end\n\n respond_to do |format|\n format.html { redirect_to stores_url }\n format.json { head :no_content }\n end\n end",
"def delete(uri)\n store\n\n @store.delete(uri)\n end",
"def destroy\n @keyword_store = KeywordStore.find(params[:id])\n @keyword_store.destroy\n\n respond_to do |format|\n format.html { redirect_to(keyword_stores_url) }\n format.xml { head :ok }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
vai pegar os componentes e as quantidade de cada produto/componente
|
def iterando_nos_componente_enviados
quantidade = params[:produto_quantidade]
i = 1
for i in quantidade.to_i do
@componentesenviados << Produto.all(params[:exibeformcomponente_id])
end
end
|
[
"def n_itens\n n = 0\n self.produtos_quantidades.each { |c| n += c.qtd }\n return n\n end",
"def get_price_by_product_price_definition_set_by_component(quantity,components,dimension_x,dimension_y,options={})\n accumalte_total_price = 0\n success = false\n components.each do |elements|\n result = get_price_by_product_price_definition_set_elements(quantity, elements, dimension_x, dimension_y, options)\n success = result[\"success\"]\n accumalte_total_price += result[\"total_price\"].to_f if success\n end\n {\"total_price\" => accumalte_total_price,\"success\" => success}\n end",
"def sum_produits_assoc\n # TODO URGENT facture 46 la valeur renvoyee est fausse\n sum = 0\n # logger.error \"facture : #{self.id}\"\n self.protofactures.each do |p| \n # logger.error \"produit #{p.produit.name}\"\n # logger.error \"\\tquantite: #{p.quantite}\"\n # logger.error \"\\tused: #{p.get_used}\"\n # logger.error \"\\tstock: #{p.quantite - p.get_used}\"\n sum += p.prix_unit * p.quantite\n end\n # logger.error \"\\tsum_produits_assoc : #{sum}\"\n sum\n end",
"def get_prix_unitaire\n sum_cout = 0\n sum_quantite = 0\n prix_unitaire = 0\n unless self.ventoproduits.count == 0 \n self.ventoproduits.each do |ventopro| \n sum_cout -= ventopro.value\n end\n end\n unless self.protofactures.count == 0 \n self.protofactures.each do |protofac| \n sum_cout += protofac.prix_unit * protofac.quantite\n sum_quantite += protofac.quantite\n end\n prix_unitaire = sum_cout / sum_quantite \n end\n return prix_unitaire\n end",
"def get_cout_ha_produits\n\t sum = 0\n\t self.putoparcelles.each do |putoparcelle|\n \t\tputoparcelle.pulve.putoproduits.each do |putoproduit|\n \t\t\tsum += putoproduit.get_cout_ha_parcelle(self)\n end\n end\n sum\n end",
"def sum_produits_stock\n sum = 0\n self.protofactures.each { |p| sum += p.prix_unit * p.stock }\n sum\n end",
"def n_linhas_nota_fiscal\n n = 0\n self.produtos_quantidades.each do |pq|\n if pq.produto.class == ProdutoCombo\n n += pq.produto.produtos.size\n else\n n += 1\n end\n end\n return n \n end",
"def paid_quantity\n components.reject {|c| c.kind == 'bonus'}.map(&:quantity).sum\n end",
"def quantity_of(product_or_supply_item)\n quantity = 0\n lines.each do |l|\n if l.product.componentized?\n l.product.product_sets.each do |ps|\n quantity = ps.quantity if ps.component == product_or_supply_item\n end\n else\n quantity = l.quantity if l.product == product_or_supply_item\n end\n end\n\n return quantity\n end",
"def calculate_component_pricing\n purchase_price = BigDecimal.new(\"0\")\n price = BigDecimal.new(\"0\")\n margin = BigDecimal.new(\"0\")\n # Safeguard to prevent calculation on straightforward simple products\n if componentized? \n self.product_sets.each do |ps|\n # Components can disappear if their supply items disappear.\n # This is handled more elegantly by disabling these components from outside\n # when this occurs, but let's check for this here just to be safe.\n unless ps.component.nil?\n purchase_price += ps.purchase_price # Convenience method that does ps.quantity * ps.component.purchase_price\n end\n end\n\n margin = (purchase_price / BigDecimal.new(\"100.0\")) * self.applicable_margin_percentage_for_price(purchase_price) # Must not call through self.margin_percentage, because otherwise an infinite loop occurs\n gross_price = purchase_price + margin\n margin = BigDecimal.new(margin.to_s)\n gross_price = BigDecimal.new(gross_price.to_s)\n end\n @component_pricing ||= [gross_price, margin, purchase_price]\n return @component_pricing\n end",
"def total_nutrientes\n\t\ti = 0\n\t\tproteinas = carbohidratos = lipidos = 0.0\n\t\twhile i < @lista_alimentos.size do\n\t\t\tproteinas += (@lista_alimentos[i].proteinas)*(@lista_cantidades[i])\n\t\t\tcarbohidratos += (@lista_alimentos[i].carbohidratos)*(@lista_cantidades[i])\n\t\t\tlipidos += (@lista_alimentos[i].lipidos)*(@lista_cantidades[i])\n\t\t i+= 1\n\t\tend\n\t\treturn proteinas + lipidos + carbohidratos\n\tend",
"def quantidade_blocos\n UnidadeSocioeducativaBloco.select('id').where(\"unidade_socioeducativa_id = ?\", self.id).count\n end",
"def quantiteProduitVente\n \tproduitEnLigne = ProduitVenteLibre.where(:stock_id => self.id)\n \tquantite = 0\n \t\n \tif produitEnLigne.count > 0\n \t\tproduitEnLigne.each do |produit|\n\t \t\tquantite += produit.quantiteTotal\n\t \tend\n\tend\n\n\treturn quantite\n end",
"def unit_count\n # Assuming items are available if in cart -- check is made at that time\n # Assuming that a format has only 1 processing unit\n # Assuming that an assembly has same amount of titles no matter what format\n items = self.line_items.includes(:product_format => [:format, :product])\n items.inject(0) {|sum, item| sum + item.quantity * item.product_format.format.units}\n end",
"def trocar_por_produto_combo(produto_id)\n produto = ProdutoCombo.find(produto_id)\n if produto and @pedido.produtos_quantidades and not @pedido.produtos_quantidades.empty?\n esvazia_carrinho #@pedido.produtos_quantidades.each { |c| retirar_produto(c.produto_id) }\n incluir_produto(produto.id)\n end\n end",
"def calculate_produit_by_cat_for_parcelle(parcelle)\n # init\n sum = Hash.new\n sum[:total] = Hash.new\n sum[:ha] = Hash.new\n sum[:total][:total] = 0\n sum[:ha][:total] = 0\n Category.produits_cats.each do |cat|\n \t cat.subtree.each do |sub_cat|\n \t sum[:ha][\"#{sub_cat.code.to_sym}\"] = 0\n \t sum[:total][\"#{sub_cat.code.to_sym}\"] = 0\n end\n end\n # calcul\n Category.produits_cats.each do |cat|\n \tsum = calculate_produit_by_cat_for_parcelle_recurs(sum, cat, parcelle)\n end\n # calcul du total\n sum = calculate_produit_by_cat_for_parcelle_total(sum, parcelle)\n return sum\n end",
"def proteinasCalculo()\n\n proteinas = 0\n index = 0\n sumaTotalGramos = 0\n @listaGramos.each { | gr | sumaTotalGramos += gr }\n @listaAlimentos.each do | x |\n index += 1\n y = @listaGramos.pos( index )\n proteinas += ( ( x.proteinas / 100 ) * y )\n end\n (proteinas * 100 / sumaTotalGramos).round()\n end",
"def possible_makes\n n = 100000000000000\n self.product_parts.each do |pp|\n stock_to_needed = (pp.part.qty / pp.qty).to_i()\n if (stock_to_needed < n)\n n = stock_to_needed\n end\n end\n self.product_assemblies.each do |pa|\n stock_to_needed = (pa.assembly.qty / pa.qty).to_i()\n if (stock_to_needed < n)\n n = stock_to_needed\n end\n end\n if (n == 100000000000000)\n return 0\n else\n return n\n end\n end",
"def calcular_stock(estados = [1,2])\n items = self.solicitud_detalles.map{|v| v.item_id}\n suma = sumar_items(items, estados)\n stocks = Stock.sum(:cantidad, :conditions => {:item_id => items}, :group => :item_id)\n\n self.solicitud_detalles.each do |v|\n # Requerido transformar a String por el tipo de query que se realiza en sumar_items\n v.cantidad_suma = suma[v.item_id.to_s] \n v.stock = stocks[v.item_id].to_f + 0\n v.stock_disponible = v.stock.to_f - (v.cantidad.to_f + v.cantidad_suma.to_f)\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
GET /backend/conf_activities GET /backend/conf_activities.json
|
def index
@backend_conf_activities = Conf::Activity.all
end
|
[
"def all_activities\n get('activities.json')\n end",
"def activity(activity_id)\n get(\"activities/#{activity_id}.json\")\n end",
"def frequent_activities\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def frequent_activities()\n get(\"/user/#{@user_id}/activities/frequent.json\")\n end",
"def index\n @status_activities = StatusActivity.all\n render json: @status_activities\n end",
"def activities_path\n File.join(Activr.config.app_path, \"activities\")\n end",
"def recent_activities\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def recent_activities()\n get(\"/user/#{@user_id}/activities/recent.json\")\n end",
"def create\n @backend_conf_activity = Conf::Activity.new(backend_conf_activity_params)\n\n respond_to do |format|\n if @backend_conf_activity.save\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' }\n format.json { render :show, status: :created, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :new }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def activities=(value)\n @activities = value\n end",
"def activities(filter = nil)\n workspace_path = Workspace_path\n filter_by_date = nil\n if filter\n then\n filter_by_date = filter[:filter_by_date]\n end\n \n if filter && filter[:type] == \"task\"\n then\n t = task(filter[:id])\n workspace_id = t['shared_tags'][0]['id']\n workspace_path = \"/shared_tags/#{workspace_id}\"\n end\n\n url = @base_url + workspace_path + '/activity_streams.json'\n \n if filter && filter[:type] == \"user\"\n then\n url = @base_url + \"/users/#{filter[:id]}/activity_streams.json\"\n end\n\n \n ps = {:accept => :json, :params => {:filter_by_date => filter_by_date}}\n\n ret = get url, ps\n ret = JSON.parse(ret)\n\n if filter && filter[:type]\n then\n ret.select! {|x| x[\"description_with_meta\"][\"meta\"][filter[:type]][\"id\"].to_s == filter[:id] }\n end\n\n ret.each_index {|i| generate_link!(ret[i])}\n \n ret\n \n end",
"def activity_statistics\n get(\"/user/#{@user_id}/activities.json\")\n end",
"def fetch_activities(token, params)\n params.to_options!\n\n # Setup params.\n setup_params_logic = lambda do |last_request, params|\n if !last_request.blank?\n params[:occurred_since_date] = last_request\n end\n end\n\n # Parse the response.\n response_parse_logic = lambda do |response|\n content_keys = {}\n doc = Nokogiri::XML(response.body)\n\n doc.xpath(\"/activities//activity\").each do |act|\n id = act.search('id').first.inner_html\n content_keys[id] = act.to_s\n end\n content_keys\n end\n\n url = format_project_url(get_api_url('activities'), params[:project_id])\n fetch(::PivotalTracker::Activity, token, url,\n response_parse_logic, setup_params_logic, true)\n end",
"def frequent_activities\n get(\"user/#{user_id}/activities/frequent.json\")\n end",
"def activities=(value)\n @activities = value\n end",
"def index\n @activities = current_user.attending_activities\n render :index\n end",
"def goals\n get(\"/user/#{@user_id}/activities/goals/daily.json\")\n end",
"def favorite_activities\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end",
"def favorite_activities()\n get(\"/user/#{@user_id}/activities/favorite.json\")\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
POST /backend/conf_activities POST /backend/conf_activities.json
|
def create
@backend_conf_activity = Conf::Activity.new(backend_conf_activity_params)
respond_to do |format|
if @backend_conf_activity.save
format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' }
format.json { render :show, status: :created, location: backend_conf_activity_path(@backend_conf_activity) }
else
format.html { render :new }
format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }
end
end
end
|
[
"def index\n @backend_conf_activities = Conf::Activity.all\n end",
"def activities=(value)\n @activities = value\n end",
"def create\n raise Request::NoRequiredFields unless params[:activities]\n Request.add( params[:org_id], current_user, \"activity\", \"add\", { :new_record => params[:activities][0..4] } )\n respond_success \"Спасибо, Ваш запрос отправлен\", requests_path\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotSaved => e\n respond_error\n rescue Request::NoRequiredFields => e\n respond_error e.message\n end",
"def activities=(value)\n @activities = value\n end",
"def create\n @activity = Activity.create activity_params\n status = @activity.new_record? ? 400 : 201\n if @activity.recurrence\n render json: @activity.activity_factory.activities.as_json, status:status\n else\n respond_with @activity, status:status\n end\n end",
"def create\n @app = App.find(params[:app_id])\n @activity = @app.activities.build(params[:activity])\n @activity.state = Activity::STATE_DEVELOPMENT\n\n respond_to do |format|\n if @activity.save\n flash[:notice] = 'Activity was successfully created.'\n format.html do\n if request.xhr?\n render :partial => 'shared/activity_row', :collection => @app.activities, :as => 'activity'\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { render :xml => @activity, :status => :created, :location => @activity }\n else\n format.html do\n @base_versions = ['1_1_0']\n \n if request.xhr?\n render :partial => 'new', :locals => {:activity => @activity, :app => @app}, :status => :unprocessable_entity\n else\n render :action => \"new\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def create\n @dev_activity = current_user.dev_activities.create(dev_activity_params)\n\n respond_to do |format|\n if @dev_activity.save\n format.html { redirect_to user_dev_activities_path(current_user), notice: 'The Development Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @dev_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = @user.activities.create(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to @activity, notice: 'Exercise event was successfully created.' }\n format.json { render :show, status: :created, location: @activity }\n else\n format.html { render :new }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def track_activity(trackable, action = params[:action])\n if (params[:application_id]).present?\n current_user.activities.create! action: action, trackable: trackable, application_id: params[:application_id], company: current_company, job_id: params[:job_id] \n elsif (params[:applicant_ids]).present?\n applicant_ids = params[:applicant_ids].split(',')\n applicant_ids.each do |id| \n current_user.activities.create! action: action, trackable: trackable, application_id: id, company: current_company, job_id: @job.id\n end\n else\n current_user.activities.create! action: action, trackable: trackable, company: current_company\n end\n end",
"def create\n for activity_id in params[:activities]\n @activity_log = ActivityLog.new(params[:activity_log])\n @activity_log.activity_id = activity_id\n @activity_log.date = @activity_log.lesson.date\n @activity_log.save\n end\n respond_to do |format|\n if @activity_log.save\n flash[:notice] = 'logging activity successfully completed'\n format.html { redirect_to lesson_path(@activity_log.course_id, @activity_log.lesson) }\n format.xml { head :created, :location => activity_log_url(@activity_log) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @activity_log.errors.to_xml }\n end\n end\n end",
"def create\n @tactivity = @task.tactivities.build(tactivity_params)\n \n respond_to do |format|\n if @tactivity.save\n flash[:success]= 'Tactivity was successfully created.' \n format.html { redirect_to task_tactivities_path(@task)}\n format.json { render :show, status: :created, location: @tactivity }\n else\n format.html { render :new }\n format.json { render json: @tactivity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @event = Event.find(params[:event_id])\n @program = Program.find(params[:program_id])\n @activity = @program.activities.build(params[:activity])\n\n respond_to do |format|\n if @activity.save\n format.html {\n redirect_to @event, notice: 'Activity was successfully created.'\n }\n format.json {\n render json: @activity,\n status: :created,\n location: @activity\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @activity.errors, status: :unprocessable_entity\n }\n end\n end\n end",
"def create\n @status_activity = StatusActivity.new(status_activity_params)\n if @status_activity.save\n render json: @status_activity, status: :created #, location: @status_activity\n else\n render json: @status_activity.errors, status: :unprocessable_entity\n end\n end",
"def activity_type\n config_hash['activity_type']\n end",
"def add_activity(activity)\n act = activity.as_json\n write_feed.add_activity(act)\n end",
"def create\n @challenge = Challenge.find(challenge_activity_params[:challenge_id])\n @challenge_activity = ChallengeActivity.new(challenge_activity_params)\n\n @activities = Activity.all\n\n respond_to do |format|\n if @challenge_activity.save\n format.html { redirect_to list_challenge_activities_url(@challenge), notice: 'Challenge activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @challenge_activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @challenge_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @activity = @user.activities.new(activity_params)\n\n respond_to do |format|\n if @activity.save\n format.html { redirect_to activity_url(@user,@activity), notice: 'Activity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @activity }\n else\n format.html { render action: 'new' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def create\n @logic_activity = LogicActivity.new(logic_activity_params)\n\n respond_to do |format|\n if @logic_activity.save\n format.html { redirect_to @logic_activity, notice: 'Logic activity was successfully created.' }\n format.json { render :show, status: :created, location: @logic_activity }\n else\n format.html { render :new }\n format.json { render json: @logic_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @backend_conf_activity.update(backend_conf_activity_params)\n format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' }\n format.json { render :show, status: :ok, location: backend_conf_activity_path(@backend_conf_activity) }\n else\n format.html { render :edit }\n format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
PATCH/PUT /backend/conf_activities/1 PATCH/PUT /backend/conf_activities/1.json
|
def update
respond_to do |format|
if @backend_conf_activity.update(backend_conf_activity_params)
format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' }
format.json { render :show, status: :ok, location: backend_conf_activity_path(@backend_conf_activity) }
else
format.html { render :edit }
format.json { render json: @backend_conf_activity.errors, status: :unprocessable_entity }
end
end
end
|
[
"def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_activities(company, team, code, params)\n @client.put '/otask/v1/tasks/companies/' + company + '/teams/' + team + '/tasks/' + code, params\n end",
"def update\n @app = App.find(params[:app_id])\n @activity = @app.activities.find(params[:id])\n\n if params[:cancel_edit_activity_button]\n respond_to do |format|\n format.html do\n if request.xhr? \n render :partial => 'shared/activity', :locals => { :activity => @activity }\n else\n redirect_to apps_url\n end\n end\n \n format.xml { head :ok }\n end\n \n return\n end\n\n @vscm = Brazil::AppSchemaVersionControl.new(:vc_type => Brazil::AppSchemaVersionControl::TYPE_SUBVERSION, :vc_path => @app.vc_path, :vc_uri => ::AppConfig.vc_uri) \n @base_versions = @vscm.find_versions(params[:arg])\n @base_versions << Activity::NO_BASE_VERSION if @base_versions.count == 0\n\n respond_to do |format|\n if @activity.update_attributes(params[:activity])\n flash[:notice] = 'Activity was successfully updated.'\n format.html do\n if request.xhr?\n render :partial => \"shared/activity\", :locals => {:activity => @activity}\n else\n redirect_to app_activity_path(@app, @activity)\n end\n end\n format.xml { head :ok }\n else\n format.html do\n if request.xhr?\n render :action => \"edit\", :layout => false, :status => :unprocessable_entity\n else\n render :action => \"edit\"\n end\n end\n format.xml { render :xml => @activity.errors, :status => :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity_pending.update(activity_pending_params)\n format.html { redirect_to @activity_pending, notice: 'Activity pending was successfully updated.' }\n format.json { render :show, status: :ok, location: @activity_pending }\n else\n format.html { render :edit }\n format.json { render json: @activity_pending.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n json_update(factType,factType_params, FactType)\n end",
"def update\n cancel = params[:commit] == \"Cancel\"\n @external_activity = ExternalActivity.find(params[:id])\n authorize @external_activity\n\n if params[:update_material_properties]\n # set the material_properties tags\n @external_activity.material_property_list = (params[:material_properties] || [])\n @external_activity.save\n end\n\n if params[:update_cohorts]\n # set the cohort tags\n @external_activity.set_cohorts_by_id(params[:cohort_ids] || [])\n @external_activity.save\n end\n\n if params[:update_grade_levels]\n # set the grade_level tags\n @external_activity.grade_level_list = (params[:grade_levels] || [])\n @external_activity.save\n end\n\n if params[:update_subject_areas]\n # set the subject_area tags\n @external_activity.subject_area_list = (params[:subject_areas] || [])\n @external_activity.save\n end\n\n if params[:update_sensors]\n # set the sensor tags\n @external_activity.sensor_list = (params[:sensors] || [])\n @external_activity.save\n end\n\n if request.xhr?\n if cancel || @external_activity.update_attributes(params[:external_activity])\n render :partial => 'shared/external_activity_header', :locals => { :external_activity => @external_activity }\n else\n render :xml => @external_activity.errors, :status => :unprocessable_entity\n end\n else\n respond_to do |format|\n if @external_activity.update_attributes(params[:external_activity])\n flash[:notice] = 'ExternalActivity was successfully updated.'\n # redirect to browse path instead of show page since the show page is deprecated\n format.html { redirect_to(browse_external_activity_path(@external_activity)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @external_activity.errors, :status => :unprocessable_entity }\n end\n end\n end\n end",
"def update\n respond_to do |format|\n if @activity_track.update(activity_track_params)\n format.html { redirect_to @activity_track, notice: 'Activity track was successfully updated.' }\n format.json { head :no_content }\n else\n @activities = Activity.all\n format.html { render action: 'edit' }\n format.json { render json: @activity_track.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update_appointment_status\n\t\tid = params[:id]\n\t\t#user_token = params[:user_token]\n\t\tappointment_status = params[:appointment_status]\n\n\t\turl = \"https://sdpm-appointment-service.herokuapp.com/appointment/#{id}?appointment_status=#{appointment_status}\"\n\n\t\tresponse = RestClient::Request.execute(\n \t\tmethod: :put, \n \t\t\turl: url\n\t\t)\n\n\t\trender :json => response\n\tend",
"def update\n if @status_activity.update(status_activity_params)\n render json: @status_activity, status: :ok#, location: @status_activity\n else\n render json: @status_activity.errors, status: :unprocessable_entity\n end\n end",
"def update\n @qa_activity = QaActivity.find(params[:id])\n\n respond_to do |format|\n if @qa_activity.update_attributes(params[:qa_activity])\n format.html { redirect_to @qa_activity, notice: 'Qa activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @qa_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @dev_activity.update(dev_activity_params)\n format.html { redirect_to @dev_activity, notice: 'The Development Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @dev_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @companyactivity.update(activity_params)\n format.html { redirect_to @companyactivity, notice: 'CompanyActivity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @companyactivity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update(activity)\n client.update_activity(activity.as_json)\n end",
"def update\n respond_to do |format|\n if @activities_type.update(activities_type_params)\n format.html { redirect_to @activities_type, notice: 'Activities type was successfully updated.' }\n format.json { render :show, status: :ok, location: @activities_type }\n else\n format.html { render :edit }\n format.json { render json: @activities_type.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @primary_activity = PrimaryActivity.find(params[:id])\n\n respond_to do |format|\n if @primary_activity.update_attributes(params[:primary_activity])\n format.html { redirect_to @primary_activity, notice: 'Primary activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @primary_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n @api_wmall_activity = Wmall::Activity.find(params[:id])\n\n respond_to do |format|\n if @api_wmall_activity.update_attributes(params[:api_wmall_activity])\n format.html { redirect_to @api_wmall_activity, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @api_wmall_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @google_account_activity.update(google_account_activity_params)\n format.html { redirect_to google_account_activities_path }\n response = {status: 200}\n format.json { render json: response, status: response[:status] }\n else\n format.html { render action: 'edit' }\n format.json { render json: @google_account_activity.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @api_v1_pending.update(api_v1_pending_params)\n format.html { redirect_to @api_v1_pending, notice: 'Pending was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_pending }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_pending.errors, status: :unprocessable_entity }\n end\n end\n end",
"def update\n respond_to do |format|\n if @logic_activity.update(logic_activity_params)\n format.html { redirect_to @logic_activity, notice: 'Logic activity was successfully updated.' }\n format.json { render :show, status: :ok, location: @logic_activity }\n else\n format.html { render :edit }\n format.json { render json: @logic_activity.errors, status: :unprocessable_entity }\n end\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
DELETE /backend/conf_activities/1 DELETE /backend/conf_activities/1.json
|
def destroy
@backend_conf_activity.destroy
respond_to do |format|
format.html { redirect_to backend_conf_activities_url, notice: 'Conf activity was successfully destroyed.' }
format.json { head :no_content }
end
end
|
[
"def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end",
"def delete_object_activity(id)\n @client.raw('delete', \"/helpers/object-activities/#{id}\")\n end",
"def delete\n @activity = current_user.activities.find(params[:id])\n @activity.destroy\n\n respond_to do |format|\n format.html { redirect_to manage_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @conf = Conf.find(params[:id])\n @conf.destroy\n\n respond_to do |format|\n format.html { redirect_to confs_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @activity_award_cfg.destroy\n respond_to do |format|\n format.html { redirect_to admin_activity_award_cfgs_url, notice: 'Activity award cfg was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n Activity.delete_hack(params[:id])\n\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @activity.destroy\n respond_to do |format|\n format.html { redirect_to activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @qa_activity = QaActivity.find(params[:id])\n @qa_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to qa_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n conf.delete 'dashboard'\n end",
"def destroy\n conf.delete 'api'\n end",
"def destroy\n @key_activity.destroy\n respond_to do |format|\n format.html { redirect_to @business_model_canvase }\n format.json { head :no_content }\n end\n end",
"def destroy\n @cont_activity.destroy\n respond_to do |format|\n format.html { redirect_to cont_activities_url, notice: 'Cont activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @step_activity = StepActivity.find(params[:id])\n @step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to step_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @api_wmall_activity = Wmall::Activity.find(params[:id])\n @api_wmall_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to api_wmall_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @asset_activity.destroy\n respond_to do |format|\n format.html { redirect_to asset_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @primary_activity = PrimaryActivity.find(params[:id])\n @primary_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to primary_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @run_step_activity = RunStepActivity.find(params[:id])\n @run_step_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to run_step_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @my_activity = MyActivity.find(params[:id])\n @my_activity.destroy\n\n respond_to do |format|\n format.html { redirect_to my_activities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @logic_activity.destroy\n respond_to do |format|\n format.html { redirect_to logic_activities_url, notice: 'Logic activity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Returns a flat array containing all the possible child terms for this given ontology term
|
def all_child_terms
get_all_child_lists
return @all_child_terms
end
|
[
"def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_term\n from\n term_relationship tr\n join term as subject_term on tr.subject_term_pk = subject_term.term_pk\n join term as predicate_term on tr.predicate_term_pk = predicate_term.term_pk\n join term as object_term on tr.object_term_pk = object_term.term_pk\n where\n predicate_term.term_name in ('part_of','is_a','develops_from')\n and object_term.identifier = ?\n SQL\n \n OLS_DB[sql,node.term].each do |row|\n child = OntologyTerm.new( row[:child_identifier], row[:child_term] )\n node << child\n end\n end",
"def all_child_ids\n all_children.map(&:term_id)\n end",
"def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n @all_child_names.push( child.term_name )\n @all_child_names.push( child.all_child_names )\n end\n \n @all_child_terms = @all_child_terms.flatten.uniq\n @all_child_names = @all_child_names.flatten.uniq\n end\n end",
"def children_ids\n children.map(&:term_id)\n end",
"def child_terms\n h = {}\n\n # collect the sub-terms of the terms applicable to this node\n terms.each do |term|\n term.terms.each do |k1, v1|\n h[k1] = v1\n end\n end\n\n # and mix in any global terms of this node's ancestors\n self.ancestors.each do |a|\n a.term_accessors.each { |k,t| h[k] ||= t if t.options[:global] }\n end\n\n h\n end",
"def all_child_names\n all_children.map(&:term_name)\n end",
"def children_names\n children.map(&:term_name)\n end",
"def terms\n to_quad.map {|t| t.respond_to?(:terms) ? t.terms : t}.flatten.compact\n end",
"def root_terms(ontology)\n root_terms = []\n\n if @cached_ontologies.keys.include? ontology\n root_terms = @cached_ontologies[ontology][:root_terms].map { |term_id| self.find_by_id(term_id) }\n end\n\n root_terms\n end",
"def root_terms(ontology)\n root_terms = []\n root_terms = @cache.root_terms(ontology) if using_cache?\n\n if root_terms.empty?\n response = request(:get_root_terms) { soap.body = { :ontologyName => ontology } }\n\n if response[:item].is_a? Array\n response[:item].each do |term|\n root_terms.push( OLS::Term.new(term[:key],term[:value]) )\n end\n else\n term = response[:item]\n root_terms.push( OLS::Term.new(term[:key],term[:value]) )\n end\n end\n\n root_terms\n end",
"def children\n (0...@node.children.length).map {|i| get_subnode(i) }\n end",
"def terms\n @data.map(&:uniq).flatten\n end",
"def term_list\n terms = Array.new\n\n self.notes.each do |note|\n note.scrubbed_notes.each do |word|\n term_index = terms.index(word)\n if term_index.nil?\n terms.push(word)\n end\n end\n end\n terms\n end",
"def descendents\r\n @children.map { |child| [child, child.descendents] }.flatten\r\n end",
"def terms\n return @terms\n end",
"def terms\n @locations.map(&:term).uniq\n end",
"def get_terms(tag)\n terms = tag.terms\n\n parent_tag = tag.parent_tag\n until parent_tag.nil?\n terms.concat(parent_tag.terms)\n parent_tag = parent_tag.parent_tag\n end\n\n # sort the terms as they come out\n result = terms.uniq\n if !@sort_alphabetical\n result = result.sort { |x, y| x.row <=> y.row }\n else\n result = result.sort { |x, y| x.name <=> y.name }\n end\n\n result\n end",
"def root_terms\n terms.values.select {|term| term.is_root_term? }\n end",
"def terms\n @data.flatten.uniq\n end"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Helper function to query the OLS database and grab the full details of the ontology term.
|
def get_term_details
# This query ensures we look at the most recent fully loaded ontologies
sql = <<-SQL
select term.*
from term
join ontology on ontology.ontology_id = term.ontology_id
where term.identifier = ?
order by ontology.fully_loaded desc, ontology.load_date asc
SQL
term_set = OLS_DB[ sql, @name ].all()
if term_set.size == 0
get_term_from_synonym
else
subject = term_set.first
@content = subject[:term_name]
@term_pk = subject[:term_pk]
@ontology_id = subject[:ontology_id]
end
end
|
[
"def get_term_from_synonym\n sql = <<-SQL\n select term.*\n from term\n join ontology on ontology.ontology_id = term.ontology_id\n join term_synonym on term.term_pk = term_synonym.term_pk\n where term_synonym.synonym_value = ?\n order by ontology.fully_loaded desc, ontology.load_date asc\n SQL\n \n term_set = OLS_DB[ sql, @name ].all()\n \n raise OntologyTermNotFoundError, \"Unable to find the term '#{@name}' in the OLS database.\" \\\n if term_set.size == 0\n \n subject = term_set.first\n @name = subject[:identifier]\n @content = subject[:term_name]\n @term_pk = subject[:term_pk]\n @ontology_id = subject[:ontology_id]\n end",
"def ontology; ontologies.first; end",
"def get_term_metadata\n unless @already_fetched_metadata\n meta = [ OLS.request(:get_term_metadata) { soap.body = { :termId => self.term_id } }[:item] ].flatten\n meta.each do |meta_item|\n case meta_item[:key]\n when 'definition'\n @definition = meta_item[:value]\n when /synonym/\n syn_match = /^(.+)_synonym/.match( meta_item[:key] )\n @synonyms ||= {}\n @synonyms[ syn_match[1].to_sym ] ||= []\n @synonyms[ syn_match[1].to_sym ] << meta_item[:value]\n end\n end\n\n @already_fetched_metadata = true\n end\n end",
"def ontology\n load_ontology if @ontology.nil?\n @ontology\n end",
"def glossary_term_show(account_id, glossary_id, id)\n path = sprintf(\"/api/v2/accounts/%s/glossaries/%s/terms/%s\", account_id, glossary_id, id)\n data_hash = {}\n post_body = nil\n \n reqHelper = PhraseApp::ParamsHelpers::BodyTypeHelper.new(data_hash, post_body)\n rc, err = PhraseApp.send_request(@credentials, \"GET\", path, reqHelper.ctype, reqHelper.body, 200)\n if err != nil\n return nil, err\n end\n \n return PhraseApp::ResponseObjects::GlossaryTerm.new(JSON.load(rc.body)), err\n end",
"def sparql_vocab()\n q = Dev::Query.new()\n q.select(\"?term ?id\")\n q.where(\"?id skos:prefLabel ?term\")\n \n sparql = Dev::SparqlQuery.new(:uri=>\"http://bio2rdf.semanticscience.org:8026/sparql?\")\n sparql.prefix(:skos=>\"http://www.w3.org/2004/02/skos/core#\")\n return sparql.query(q,:graph=>\"cebs\",:format=>\"xml\")\n\n end",
"def fetch_ontology(uri)\n p_uri = URI.parse(uri)\n response = Net::HTTP.get_response(p_uri)\n\n if(response.code != \"200\")\n puts \"Unable to fetch #{uri}\"\n abort\n end\n\n response.body\nend",
"def docTerms(category, list, spec, doc='')\nnspre='foaf' # hardcoded for now\nlist.each do |t|\n term = Node.getResource(FOAF+t, spec)\n doc += \"<div class=\\\"specterm\\\" id=\\\"term_#{t}\\\">\\n<h3>#{category}: #{nspre}:#{t}</h3>\\n\"\n # almost vocab neutral. todo: 'foaf' shouldn't be hardcoded.\n l= term.rdfs_label.to_s\n c= term.rdfs_comment.to_s\n\n status= term.vs_term_status.to_s\n # MM: Listing the term name twice?\n doc += \"<em>#{l}</em> - #{c} <br />\"\n doc += \"<table style=\\\"th { float: top; }\\\">\\n\\t<tr><th>Status:</th>\\n\\t<td>#{status}</td></tr>\\n\"\n doc += owlInfo(term)\n doc += rdfsPropertyInfo(term) if category=='Property'\n doc += rdfsClassInfo(term) if category=='Class'\n doc += \"</table>\\n\"\n doc += htmlDocInfo(t)\n doc += \"<p style=\\\"float: right; font-size: small;\\\">[<a href=\\\"#glance\\\">back to top</a>]</p>\\n\\n\"\n\n doc += \"\\n<br/>\\n</div>\\n\\n\"\nend\nreturn doc\nend",
"def term\n return @term\n end",
"def so_term(feature)\n if hash = @data[feature]\n return hash[\"so_term\"]\n end\n end",
"def ontology_objects\n LinkedData::SampleData::Ontology.ontology_objects\n end",
"def index\n @cell_ontology_terms = CellOntologyTerm.all\n end",
"def find(term)\n\n\t raise NoWordnetConnection, \"There is presently no connection to wordnet. To attempt to reistablish a connection you should use the 'open!' command on the Wordnet object.\" unless connected?\n\t homographs = @wordnet_connection.homographs(term)\n\t Homographs.new(homographs, @wordnet_connection) unless homographs.nil?\n\n\tend",
"def find_term(uri)\n uri = RDF::URI(uri)\n return uri if uri.is_a?(Vocabulary::Term)\n if vocab = find(uri)\n if vocab.ontology == uri\n vocab.ontology\n else\n suffix = uri.to_s[vocab.to_uri.to_s.length..-1].to_s\n vocab[suffix]\n end\n end\n end",
"def term(code: nil, year: nil)\n params = { term: code, year: year }.compact\n\n fetch_and_parse('/termInfo', params)\n end",
"def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end",
"def lease_term\n self.dig_for_string(\"leaseTerm\")\n end",
"def details\n not_found if params[:conceptid].nil? || params[:conceptid].empty?\n\n if params[:ontology].to_i > 0\n orig_id = params[:ontology]\n params_cleanup_new_api()\n options = {stop_words: [\"controller\", \"action\", \"id\"]}\n redirect_to \"#{request.path.sub(orig_id, params[:ontology])}#{params_string_for_redirect(params, options)}\", :status => :moved_permanently\n return\n end\n\n @ontology = LinkedData::Client::Models::Ontology.find_by_acronym(params[:ontology]).first\n not_found if @ontology.nil?\n\n @concept = @ontology.explore.single_class({full: true}, CGI.unescape(params[:conceptid]))\n not_found if @concept.nil?\n\n if params[:styled].eql?(\"true\")\n render :partial => \"details\", :layout => \"partial\"\n else\n render :partial => \"details\"\n end\n end",
"def fetch_term(qid)\n (t = Wikisnakker::Item.find(qid)) || raise('No such item')\n name = t.label('en')\n data = {\n id: name[/^(\\d+)/, 1],\n name: name,\n start_date: %w[P580 P571].map { |p| t.send(p).to_s }.reject(&:empty?).first,\n end_date: %w[P582 P576].map { |p| t.send(p).to_s }.reject(&:empty?).first,\n wikidata: qid,\n }\n puts data.values.to_csv\n\n if prev = t.P155 || t.P1365\n fetch_term(prev.value.id)\n end\nend"
] |
{
"objective": {
"paired": [],
"self": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
}
|
Helper function to try to find an ontology term via a synonym.
|
def get_term_from_synonym
sql = <<-SQL
select term.*
from term
join ontology on ontology.ontology_id = term.ontology_id
join term_synonym on term.term_pk = term_synonym.term_pk
where term_synonym.synonym_value = ?
order by ontology.fully_loaded desc, ontology.load_date asc
SQL
term_set = OLS_DB[ sql, @name ].all()
raise OntologyTermNotFoundError, "Unable to find the term '#{@name}' in the OLS database." \
if term_set.size == 0
subject = term_set.first
@name = subject[:identifier]
@content = subject[:term_name]
@term_pk = subject[:term_pk]
@ontology_id = subject[:ontology_id]
end
|
[
"def find_synonyms(word)\r\n require 'open-uri'\r\n require 'timeout'\r\n timeout(5) do\r\n open(SYNONYM_LOOKUP_URI % word) do |stream|\r\n # Grab words linked to dictionary entries as possible synonyms\r\n data = stream.read.gsub(\" \", \" \").scan(/<a href=\"webwn.*?\">([\\w ]*?)<\\/a>/s).uniq\r\n end\r\n end\r\n rescue Exception\r\n return nil\r\n end",
"def find_term(uri)\n uri = RDF::URI(uri)\n return uri if uri.is_a?(Vocabulary::Term)\n if vocab = find(uri)\n if vocab.ontology == uri\n vocab.ontology\n else\n suffix = uri.to_s[vocab.to_uri.to_s.length..-1].to_s\n vocab[suffix]\n end\n end\n end",
"def suggest_synonym(synonym_name, keyword_id, is_formal)\n return Synonym.record_suggested_synonym(synonym_name, keyword_id, true, is_formal)\n end",
"def term_in_result_glossary(res_gloss, term_name)\n res_gloss = result_glossary(res_gloss) if res_gloss.is_a? String\n return nil if res_gloss.nil?\n\n res_gloss[:term].each { |t| return t if t[:name] == term_name }\n nil\nend",
"def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end",
"def get_institution_synonym(affi_string)\n print affi_string\n $institution_synonyms.keys.each do |inst_key|\n if affi_string.include?(inst_key.to_s)\n return inst_key.to_s\n end\n end\n return nil\nend",
"def get_synonym(word)\n results = Dinosaurus.synonyms_of(word)\n # count = redis.get(\"key\")\n\n # if next_day? || count == \"0\"\n # redis.set(\"key\", \"1\")\n # timer.set(\"t0\", Time.now)\n # else\n # count++\n # redis.incr(\"key\")\n # timer.set(\"t1\", Time.now)\n # end\n\n len = rand(results.length)\n len==0? word : word = results[len]\n end",
"def lookup(term, dict)\n (dict.key? term) ? dict[term] : term\n end",
"def find_term_from_id\n @term = GlossaryTerm.find(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end",
"def get_synonym(object_id, opts = {})\n @transporter.read(:GET, path_encode('/1/indexes/%s/synonyms/%s', @name, object_id), {}, opts)\n end",
"def find_by_term_name(name)\n if name =~ /\\A\\[/\n convert_ruby_term(eval(name))\n else\n term = @cyc.find_constant(transliterate(name))\n if term\n id = @cyc.compact_hl_external_id_string(term)\n @factory.new(term,id)\n end\n end\n end",
"def find(term)\n\n\t raise NoWordnetConnection, \"There is presently no connection to wordnet. To attempt to reistablish a connection you should use the 'open!' command on the Wordnet object.\" unless connected?\n\t homographs = @wordnet_connection.homographs(term)\n\t Homographs.new(homographs, @wordnet_connection) unless homographs.nil?\n\n\tend",
"def get_institution_synonym(affi_string)\n found_inst = nil\n $institution_synonyms.keys.each do |inst_key|\n if affi_string.include?(inst_key.to_s) then\n if found_inst == nil then\n found_inst = inst_key.to_s\n elsif found_inst.length < inst_key.to_s.length then\n found_inst = inst_key.to_s\n end\n end\n end\n return found_inst\nend",
"def find_definition(term)\n term.is_a?(TermDefinition) ? term : term_definitions[term.to_s]\n end",
"def find_stem_word(word, speller)\n stem = word.stem\n correct = stem #initializing correct to the stem word\n #checkiing the stem word's spelling for correctness\n while(!speller.check(correct)) do\n if(!speller.suggest(correct).first.nil?)\n correct = speller.suggest(correct).first\n else\n #break out of the loop, else it will continue infinitely\n break #break out of the loop if the first correction was nil\n end\n end\n return correct\n end",
"def get_synonym_for(word, country = nil, age_from = nil, age_to = nil,\n gender = nil, education = nil)\n keyword = Keyword.find_by_name(word)\n\n if keyword.blank?\n Keyword.add_keyword_to_database(word)\n return nil\n end\n\n if self.project.present?\n prefered_synonym = PreferedSynonym\n .where(keyword_id: keyword.id, project_id: self.project.id).first\n return prefered_synonym.synonym if prefered_synonym.present?\n\n country = self.project.country unless country.present?\n age_from = self.project.minAge unless age_from.present?\n age_to = self.project.maxAge unless age_to.present?\n gender = self.project.gender unless gender.present?\n education = self.project.education_level unless education.present?\n end\n\n synonym_list, votes_count =\n keyword.retrieve_synonyms(country, age_from, age_to, gender, education)\n synonym_list.first\n end",
"def []( word, *args )\n\t\tif word.is_a?( Integer )\n\t\t\t# :TODO: Assumes Synset IDs are all >= 100_000_000\n\t\t\tif word.to_s.length > 8\n\t\t\t\treturn WordNet::Synset[ word ]\n\t\t\telse\n\t\t\t\treturn WordNet::Word[ word ]\n\t\t\tend\n\t\telse\n\t\t\treturn self.lookup_synsets( word, 1, *args ).first\n\t\tend\n\tend",
"def find_stem_word(word, speller)\n stem = word.stem\n correct = stem #initializing correct to the stem word\n #checking the stem word's spelling for correctness\n while !speller.correct?(correct) do\n if !speller.suggestions(correct).first.nil?\n correct = speller.suggestions(correct).first\n else\n #break out of the loop, else it will continue infinitely\n break #break out of the loop if the first correction was nil\n end\n end\n correct\nend",
"def suggested_assay_type_ontology_uri\n uri = RDF::URI.new assay_type_uri\n if uri.valid?\n nil\n else\n SuggestedAssayType.where(:uri=> assay_type_uri).first.try(:ontology_uri)\n end\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.